/* ── IMPORT SHARED PREMIUM CSS SYSTEM ── */
@import 'index.css';

:root {
    --caller-sidebar: 360px;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    height: 100dvh; 
    overflow-x: hidden;
    overflow-y: auto; 
}

body.caller-page {
    display: flex;
    flex-direction: column;
}

/* ── NAV OVERRIDES (Compact) ── */
.top-nav { flex-shrink: 0; }
.nav-link--active { color: var(--text) !important; font-weight: 800 !important; }

/* ── FULLSCREEN OPERATOR HUD ── */
.caller-main {
    flex: 1 1 auto;
    height: calc(100dvh - 74px); /* Account for nav height */
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    gap: 32px;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

/* ── SHARED PANELS ── */
.caller-panel {
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
}

/* ── LEFT CONTROLS ── */
.caller-left {
    width: var(--caller-sidebar);
    flex-shrink: 0;
    gap: 24px;
    justify-content: space-between;
}

/* Game Tabs */
.caller-tabs { background: var(--surface-solid); padding: 6px; border-radius: 99px; display: flex; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); border: 1px solid var(--border); }
.caller-tabs .gen-tab { flex: 1; background: transparent; border: none; color: var(--text-muted); font-family: "Space Grotesk", sans-serif; font-size: 0.95rem; font-weight: 700; padding: 12px 0; border-radius: 99px; cursor: pointer; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.05em; }
.caller-tabs .gen-tab:hover { color: var(--text); }
.caller-tabs .gen-tab.active { background: linear-gradient(135deg, var(--accent-purple), #7C3AED); color: #fff; box-shadow: 0 4px 15px rgba(91, 33, 182, 0.3); transform: scale(1.02); z-index: 2; }

/* ── THE DESKTOP STICKY WRAPPER ── */
.sticky-draw-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    justify-content: center;
}

/* Current Draw Box */
.current-draw-box { background: var(--surface-solid); text-align: center; padding: 32px 10px; display: flex; flex-direction: column; justify-content: center; flex: 1; transition: all 0.2s; }
.draw-label { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.15em; color: var(--accent-purple); margin-bottom: 15px; }
.draw-value { font-family: "Space Grotesk", sans-serif; font-size: 6rem; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.05em; }
.draw-value.scrambling { color: var(--accent-blue); filter: blur(2px); transform: scale(1.05); }

/* Recent Draws */
.recent-draws { background: var(--surface-solid); border-radius: var(--gen-radius-sm); padding: 20px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.recent-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.recent-list { display: flex; gap: 8px; flex-wrap: wrap; min-height: 38px; align-items: center; }
.recent-list span { background: var(--bg); color: var(--text); padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 1.1rem; font-family: "Space Grotesk", sans-serif; border: 1px solid var(--border); }
.recent-list .empty-recent { font-family: Inter, sans-serif; font-size: 0.9rem; font-weight: 500; color: var(--text-muted); background: transparent; border: none; padding: 0; }

/* Draw Button */
.draw-btn { background: linear-gradient(135deg, var(--accent-blue), #0284C7); border: none; border-radius: var(--gen-radius-sm); color: #fff; padding: 24px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 10px 20px rgba(2, 132, 199, 0.25); display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; touch-action: manipulation; }
.draw-btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 15px 30px rgba(2, 132, 199, 0.35); }
.draw-btn:active:not(:disabled) { transform: translateY(0); box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2); }
.draw-btn:disabled { opacity: 0.6; cursor: not-allowed; filter: grayscale(1); box-shadow: none; transform: none; }
.draw-btn-text { font-family: "Space Grotesk", sans-serif; font-size: 1.4rem; font-weight: 700; letter-spacing: 0.05em; }
.draw-btn-hint { font-size: 0.75rem; font-weight: 700; color: rgba(255,255,255,0.8); display: flex; align-items: center; gap: 6px; }
.draw-btn-hint kbd { background: rgba(0,0,0,0.15); padding: 4px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2); font-family: inherit; font-size: 0.75rem; letter-spacing: 0.05em; }

/* HUD Actions (Verify & Reset) */
.hud-actions { display: flex; gap: 12px; width: 100%; }
.hud-btn { position: relative; overflow: hidden; flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 10px; border-radius: 12px; font-family: Inter, sans-serif; font-size: 0.9rem; font-weight: 700; cursor: pointer; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text-muted); transition: all 0.2s; user-select: none; box-shadow: var(--shadow-sm); }
.hud-btn:hover { border-color: var(--accent-purple); color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Verify Toggle */
.hud-btn-verify.active { background: linear-gradient(135deg, var(--accent-gold), #D97706); border-color: transparent; color: #fff; box-shadow: 0 10px 20px rgba(180, 83, 9, 0.25); }

/* Hold to Reset Progress */
.btn-content { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.btn-progress { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: rgba(225, 29, 72, 0.15); z-index: 0; transition: width 0s linear; pointer-events: none; }
.hud-btn-reset.is-holding .btn-progress { width: 100%; transition: width 1.2s linear; }
.hud-btn-reset.is-holding { transform: scale(0.95); border-color: #E11D48; color: #E11D48; }

/* ── RIGHT FLASHBOARD ── */
.caller-flashboard { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 32px; }
.flashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.flashboard-header h2 { margin: 0; font-family: "Space Grotesk", sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.call-count { font-weight: 800; font-size: 1rem; padding: 8px 18px; border-radius: 999px; }

/* Grid Magic */
.flashboard-grid { flex: 1; display: grid; gap: clamp(6px, 1vmin, 12px); width: 100%; height: 100%; min-height: 0; transition: filter 0.3s; }
.grid-75 { grid-template-columns: repeat(15, 1fr); grid-template-rows: repeat(5, 1fr); }
.grid-90 { grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(9, 1fr); }

.board-cell { background: var(--surface-solid); border: 1px solid var(--border); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: clamp(1.2rem, 3vmin, 2.2rem); font-weight: 700; color: var(--text-muted); font-family: "Space Grotesk", sans-serif; transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); box-sizing: border-box; position: relative; box-shadow: inset 0 1px 2px rgba(0,0,0,0.02); }
.board-cell.called { background: linear-gradient(135deg, var(--accent-purple), #7C3AED); color: #fff; border-color: transparent; box-shadow: 0 10px 20px rgba(91, 33, 182, 0.3); transform: scale(1.1); z-index: 2; }

/* Verify/Highlight Mode Magic */
.flashboard-grid.highlight-active .board-cell:not(.called) { opacity: 0.2; filter: grayscale(1); }
.flashboard-grid.highlight-active .board-cell.called { transform: scale(1.15); box-shadow: 0 15px 30px rgba(180, 83, 9, 0.4); background: linear-gradient(135deg, var(--accent-gold), #D97706); z-index: 10; }

/* ── SEO & FOOTER ── */
.scroll-wrapper { width: 100%; position: relative; z-index: 5; background: var(--bg); }
.seo-grid { display: grid; grid-template-columns: 1fr 360px; gap: 50px; align-items: center; }
.seo-text h2 { font-family: "Space Grotesk", sans-serif; font-size: 2rem; font-weight: 700; color: var(--text); margin: 0 0 16px; letter-spacing: -0.03em; }
.seo-text h3 { color: var(--text); margin: 32px 0 12px; font-size: 1.3rem; font-weight: 700; }
.seo-text p { color: var(--text-muted); font-size: 1.1rem; line-height: 1.7; margin: 0; }

.caller-upsell-box { padding: 32px; display: flex; flex-direction: column; gap: 20px; text-decoration: none; color: var(--text); transition: transform 0.3s, box-shadow 0.3s; border-left: 4px solid var(--accent-gold); }
.caller-upsell-box:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.upsell-icon { color: var(--accent-gold); font-size: 2.5rem; }
.upsell-text strong { display: block; font-size: 1.25rem; font-weight: 700; font-family: "Space Grotesk", sans-serif; color: var(--text); margin-bottom: 6px; }
.upsell-text span { font-size: 1rem; color: var(--text-muted); line-height: 1.5; display: block; }
.upsell-badge { height: 46px; width: auto; margin-top: 10px; border-radius: 8px; border: 1px solid var(--border); transition: transform 0.2s; }
.caller-upsell-box:hover .upsell-badge { transform: translateY(-2px); }

/* TOAST */
.toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(100px); padding: 14px 28px; font-size: 0.95rem; font-weight: 700; z-index: 8000; opacity: 0; transition: transform 0.4s cubic-bezier(0.175,0.885,0.32,1.275), opacity 0.4s; pointer-events: none; background: var(--text); color: #fff; border-radius: 999px; box-shadow: var(--shadow-lg); border: none; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }


/* ═══════════════════════════════════════════════════════════════
   BREAKPOINTS (The "Mobile Stack" Fix)
═══════════════════════════════════════════════════════════════ */

/* ── TABLET / LAPTOP (≤ 1100px) ── */
@media (max-width: 1100px) {
    .caller-left { width: 300px; }
    .draw-value { font-size: 4.5rem; }
    .seo-grid { grid-template-columns: 1fr; }
}

/* ── MOBILE PHONES (≤ 900px) ── */
@media (max-width: 900px) {
    .nav-links { display: none !important; }

    /* Unlock page height to allow natural scrolling on mobile */
    html, body { height: auto; min-height: 100vh; overflow-y: auto; overflow-x: hidden; }
    
    .caller-main { 
        display: flex; 
        flex-direction: column; 
        padding: 16px; 
        gap: 20px; 
        width: 100%; 
        height: auto;
        padding-bottom: 140px; /* Prevent SEO hiding behind sticky bar */
        box-sizing: border-box; 
    }

    .caller-panel {
        display: flex;
        flex-direction: column;
        padding: 0;
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
    }
    .caller-panel::before { display: none; } /* Strip glass border */

    /* Restyle children inside the caller-left wrapper */
    .caller-tabs { margin-bottom: 10px; background: var(--surface); border: 1px solid var(--border-light); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-md); }
    .recent-draws { background: var(--surface); border: 1px solid var(--border-light); padding: 20px; border-radius: var(--gen-radius); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-md); }
    
    .hud-actions { 
        background: var(--surface); 
        border: 1px solid var(--border-light); 
        padding: 16px; 
        border-radius: var(--gen-radius); 
        margin-top: 10px;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: var(--shadow-md);
    }

    .caller-flashboard {
        padding: 20px;
        border-radius: var(--gen-radius);
        background: var(--surface);
        border: 1px solid var(--border-light);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: var(--shadow-lg);
    }
    
    .grid-75 { grid-template-columns: repeat(15, 1fr); gap: 4px; }
    .grid-90 { grid-template-columns: repeat(10, 1fr); gap: 4px; }
    .board-cell { font-size: clamp(0.75rem, 2.5vw, 1.1rem); padding: 8px 0; border-radius: 6px; }
    .board-cell.called { border-width: 1px; box-shadow: 0 4px 10px rgba(91, 33, 182, 0.4); transform: scale(1.05); }

    /* ── THE MAGIC STICKY BOTTOM BAR (Premium Mobile Frosted Glass) ── */
    .sticky-draw-controls {
        position: fixed;
        bottom: 0; 
        left: 0; 
        right: 0;
        display: flex;
        flex-direction: row;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-light);
        padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
        z-index: 9999;
        box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.1);
        gap: 16px;
        align-items: center;
        justify-content: space-between;
    }

    .current-draw-box {
        padding: 12px 24px;
        flex-direction: row;
        border-radius: 16px;
        flex: 0 0 auto;
        align-items: center;
        margin: 0;
        background: var(--surface-solid);
        border: 1px solid var(--border);
        box-shadow: var(--shadow-sm);
    }
    .current-draw-box::before { display: none; }
    
    .draw-label { display: none; } /* Hidden to save space on mobile */
    .draw-value { font-size: 2.5rem; color: var(--accent-purple); }
    .draw-value.scrambling { font-size: 2.6rem; }

    .draw-btn {
        flex: 1;
        padding: 18px;
        border-radius: 16px;
        height: 100%;
        margin: 0;
    }
    .draw-btn-text { font-size: 1.15rem; }
    .draw-btn-hint { display: none; } /* Hide keyboard hint on touch devices */

    /* Move toast above the sticky bar */
    .toast { bottom: 130px; }
}

@media (max-width: 380px) {
    .caller-flashboard { padding: 12px; }
    .current-draw-box { padding: 10px 16px; }
    .draw-value { font-size: 2rem; }
    .draw-btn { padding: 16px 12px; }
    .draw-btn-text { font-size: 1rem; }
    .board-cell { font-size: clamp(0.6rem, 2vw, 0.9rem); gap: 2px; }
}

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION & ACCESSIBILITY
═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration:  0.01ms !important; animation-iteration-count: 1 !important; }
    .board-cell.called { transform: none; }
    .draw-btn:hover:not(:disabled), .hud-btn:hover, .caller-upsell-box:hover { transform: none; box-shadow: none; }
}