/* ============================================================
   ScriptBattle - Global Styles (Source: px → PostCSS → rem)
   Design base: 390×844 (iPhone 14/15)
   ============================================================ */

/* === CSS Variables (Colors & Theme) === */
:root {
    /* Primary palette */
    --bg-color: #0d0d11;
    --bg-black: #000000;
    --bg-surface: #1A1A1A;
    --surface-color: #2B2B2B;
    
    /* Accent colors */
    --primary-action: #99FF00;
    --alert-orange: #FF9500;
    --interact-pink: #FF0055;
    --error-color: #FF4D4D;
    
    /* Text colors */
    --text-primary: #FFFFFF;
    --text-dim: #6e6e73;
    --text-hint: #707070;
    
    /* Shadows */
    --neon-glow: 0 0 0.625rem rgba(153, 255, 0, 0.8), 0 0 0.3125rem rgba(153, 255, 0, 0.4);
    --error-glow: 0 0 0.625rem rgba(255, 77, 77, 0.8), 0 0 0.3125rem rgba(255, 77, 77, 0.4);
}

/* === Reset === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    /* font-size is dynamically set by auto-scale.js */
    -webkit-text-size-adjust: 100%;
    background-color: var(--bg-black);
}

body {
    font-family: 'Inter', 'Rajdhani', -apple-system, 'Helvetica Neue', sans-serif;
    background-color: var(--bg-black);
    color: var(--text-primary);
    overflow: hidden;
    overscroll-behavior-y: none;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === App Container (Phone Frame) === */
#phone-frame, .iphone-frame {
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-black);
    position: relative;
    border: none !important;
    box-shadow: none !important;
}

/* === Safe Area Utilities === */
.safe-area-top {
    padding-top: env(safe-area-inset-top, 1.25rem);
}

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* === Layout Utilities === */

/* Scrollable flex child - grows to fill space, scrolls internally */
.flex-grow-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fixed footer area - sticks to bottom */
.footer-fixed {
    flex-shrink: 0;
    margin-top: auto;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

/* === WeChat WebView Fixes === */

/* Prevent rubber banding on body while allowing internal scrolling */
.overflow-y-auto {
    -webkit-overflow-scrolling: touch !important;
    border: none !important;
}

/* WeChat Capsule Button Avoidance */
#top-interaction-area {
    top: calc(env(safe-area-inset-top, 1.25rem) + 0.75rem) !important;
}

/* Image Overflow & Polish */
.top-logo-area {
    overflow: hidden !important;
}
.top-logo-area img {
    max-width: 85% !important;
    max-height: 85% !important;
    object-fit: contain !important;
    margin: auto !important;
}

/* Flex fix for overflow children */
.flex-grow {
    min-height: 0;
}

/* Common input fixes */
input, button {
    font-family: inherit;
}

/* === Hide Scrollbar Utility === */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
