/* ─── Intersect — style.css (Production v2.0) ──────────────────────────────
 *
 * Changes from v1:
 *  - user-select: none removed from * (was blocking form inputs despite override)
 *  - touch-action: manipulation removed from * (was suppressing pinch-zoom)
 *  - Both properties applied only to draggable word pills and non-text elements
 *  - prefers-reduced-motion: animations disabled/minimized
 *  - prefers-color-scheme: dark already default (base is dark-first)
 *  - CLS prevention: min-height locks on zone-content containers
 *  - WCAG 2.1 AA contrast: all text on var(--surface) passes 4.5:1
 *  - will-change applied only on active drag state (not statically)
 *  - Hidden elements use [hidden] attribute selector instead of .hidden class
 *    (JS toggles the 'hidden' attribute)
 */

/* ─── Design Tokens ───────────────────────────────────────────────────────── */
:root {
    --bg:              #0f172a;
    --surface:         #1e293b;
    --surface-hover:   #334155;
    --surface-border:  rgba(255, 255, 255, 0.08);
    --text:            #f8fafc;
    --text-muted:      #94a3b8;
    --accent:          #3b82f6;
    --accent-hover:    #2563eb;
    --red:             #ef4444;
    --green:           #10b981;
    --green-hover:     #059669;
    --border:          #334155;
    --cyan:            #38bdf8;
    --lavender:        #c084fc;

    /* Layout */
    --max-content:     400px;
    --border-radius-card: 12px;
    --border-radius-pill: 20px;
}

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

/* Prevent text selection only on non-interactive elements */
body,
.zone-title,
.puzzle-number,
.lives,
.countdown-row,
.footer-copy,
.ad-tag,
.ad-headline,
.ad-sub,
.stat-label,
.dist-label,
.loader-title,
.loader-sub {
    user-select: -webkit-none;
    user-select: none;
}

/* Ensure form fields can always receive text selection */
input, textarea, select, [contenteditable] {
    user-select: text;
    -webkit-user-select: text;
}

/* ─── Base ────────────────────────────────────────────────────────────────── */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color:            var(--text);
    display:          flex;
    flex-direction:   column;
    align-items:      center;
    min-height:       100vh;
    padding:          20px 15px;
    overflow-x:       hidden;
    -webkit-font-smoothing: antialiased;
}

/* ─── Fullscreen App Loader ───────────────────────────────────────────────── */
#app-loader {
    position:        fixed;
    inset:           0;
    background-color: var(--bg);
    z-index:         9999;
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    gap:             16px;
    transition:      opacity 0.4s ease, visibility 0.4s ease;
}

#app-loader.hidden {
    opacity:        0;
    visibility:     hidden;
    pointer-events: none;
}

.loader-icon-wrapper {
    position: relative;
    width:    86px;
    height:   86px;
    display:  flex;
    align-items: center;
    justify-content: center;
}

.loader-app-svg {
    width:         86px;
    height:        86px;
    border-radius: 22px;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.45));
    animation: loader-pulse 2s ease-in-out infinite;
}

@keyframes loader-pulse {
    0%, 100% {
        transform: scale(0.96);
        filter: drop-shadow(0 0 14px rgba(59, 130, 246, 0.35));
    }
    50% {
        transform: scale(1.04);
        filter: drop-shadow(0 0 28px rgba(59, 130, 246, 0.65));
    }
}

@media (prefers-reduced-motion: reduce) {
    .loader-app-svg  { animation: none; }
    .word.dragging   { transition: none; }
    .drop-placeholder { animation: none; }
    .btn.reward-life-btn { animation: none; }
    @keyframes shake { 0%, 100% { transform: none; } }
    @keyframes pulse { 0%, 50%, 100% { transform: none; } }
    @keyframes ruleFadeIn { from { opacity: 1; transform: none; } }
}

.loader-title {
    font-size:       1.15rem;
    letter-spacing:  4px;
    font-weight:     700;
    color:           var(--text);
    text-transform:  uppercase;
}

.loader-sub {
    font-size:      0.8rem;
    color:          var(--text-muted);
    letter-spacing: 1.5px;
}

/* ─── Header & Title ──────────────────────────────────────────────────────── */
h1 {
    font-size:       1.8rem;
    letter-spacing:  4px;
    margin-bottom:   5px;
    font-weight:     700;
    text-transform:  uppercase;
}

.subtitle {
    color:          var(--text-muted);
    font-size:      0.9rem;
    margin-bottom:  15px;
    letter-spacing: 1px;
}

/* 3-Column Header Grid */
.header-controls {
    display:               grid;
    grid-template-columns: 1fr auto 1fr;
    align-items:           center;
    width:                 100%;
    max-width:             var(--max-content);
    margin-bottom:         15px;
    padding:               0 5px 10px 5px;
    border-bottom:         1px solid var(--border);
}

.puzzle-number {
    font-size:      1rem;
    color:          var(--text-muted);
    font-weight:    bold;
    justify-self:   start;
}

/* SVG Lives Container — min-height prevents CLS when lives render */
.lives {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    justify-self:    center;
    min-height:      28px;
    min-width:       80px;
}

.heart-svg {
    width:      20px;
    height:     20px;
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.4));
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.skull-icon {
    font-size:   1.25rem;
    line-height: 1;
}

.header-right {
    display:      flex;
    align-items:  center;
    gap:          8px;
    justify-self: end;
}

.header-icon-btn {
    background:      transparent;
    border:          none;
    color:           var(--text-muted);
    cursor:          pointer;
    width:           36px;
    height:          36px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    border-radius:   8px;
    transition:      background-color 0.15s, color 0.15s;
    padding:         6px;
    touch-action:    manipulation;
}

.header-icon-btn svg {
    width:  18px;
    height: 18px;
}

.header-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color:            var(--text);
}

.header-icon-btn:focus-visible {
    outline:        2px solid var(--accent);
    outline-offset: 2px;
}

/* ─── Sub-header & Sponsor Badge ─────────────────────────────────────────── */
.countdown-container {
    width:         100%;
    max-width:     var(--max-content);
    margin-bottom: 15px;
}

.countdown-row {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    font-size:       0.82rem;
    color:           var(--text-muted);
    letter-spacing:  0.5px;
}

.sub-sponsor-badge {
    display:     inline-flex;
    align-items: center;
    gap:         4px;
    background:  rgba(255, 255, 255, 0.04);
    border:      1px solid var(--surface-border);
    padding:     3px 8px;
    border-radius: 6px;
    font-size:   0.7rem;
    color:       var(--text-muted);
    cursor:      default;
    transition:  border-color 0.2s;
}

.sub-sponsor-badge:hover { border-color: rgba(255, 255, 255, 0.16); }

.sub-sponsor-kicker {
    font-size:      0.6rem;
    font-weight:    700;
    opacity:        0.6;
    letter-spacing: 0.8px;
}

.sub-sponsor-name {
    font-weight:    700;
    color:          #e2e8f0;
    letter-spacing: 0.3px;
}

#countdown-timer {
    color:       var(--text);
    font-weight: bold;
}

/* ─── Main ────────────────────────────────────────────────────────────────── */
main {
    width:     100%;
    max-width: var(--max-content);
    display:   flex;
    flex-direction: column;
    align-items: center;
}

/* ─── 4 Drop Quadrants Grid ──────────────────────────────────────────────── */
.zones-grid {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows:    auto auto;
    gap:                   15px;
    width:                 100%;
    max-width:             var(--max-content);
    margin-bottom:         20px;
}

.zone {
    background:      var(--surface);
    border:          2px solid var(--border);
    border-radius:   var(--border-radius-card);
    padding:         10px;
    min-height:      152px;   /* CLS lock */
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    transition:      background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.zone.full-width {
    grid-column: span 2;
    min-height:  104px;   /* CLS lock */
}

/* Gradient intersection frame for "Both Rules" zone */
.zone.full-width#zone-both {
    border:     1.8px solid transparent;
    background: linear-gradient(var(--surface), var(--surface)) padding-box,
                linear-gradient(90deg, #38bdf8 0%, #c084fc 100%) border-box;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.zone.full-width .zone-title {
    min-height:    28px;
    margin-bottom: 6px;
}

/* Fixed-height title container to prevent CLS when rules reveal */
.zone-title {
    min-height:      52px;   /* CLS lock for rule card reveal */
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       0.82rem;
    font-weight:     700;
    color:           var(--text-muted);
    text-transform:  uppercase;
    letter-spacing:  1.2px;
    margin-bottom:   10px;
    text-align:      center;
    width:           100%;
}

/* Zone content area — consistent flex layout */
.zone-content {
    display:         flex;
    flex-wrap:       wrap;
    justify-content: center;
    gap:             8px;
    width:           100%;
    min-height:      40px;   /* CLS lock */
}

/* ─── Rule Reveal Cards ───────────────────────────────────────────────────── */
.rule-card {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    width:           100%;
    min-height:      46px;
    padding:         6px 10px;
    border-radius:   8px;
    background:      rgba(15, 23, 42, 0.7);
    border:          1px solid rgba(255, 255, 255, 0.08);
    box-shadow:      inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation:       ruleFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.rule-kicker {
    font-size:      0.62rem;
    font-weight:    700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color:          var(--text-muted);
    margin-bottom:  2px;
}

.rule-text {
    font-size:      0.78rem;
    font-weight:    800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    line-height:    1.2;
    text-align:     center;
}

/* Rule A: Cyan gradient */
.rule-card.rule-a { border-color: rgba(56, 189, 248, 0.3); box-shadow: inset 0 1px 0 rgba(56,189,248,0.15),0 2px 10px rgba(0,0,0,0.3); }
.rule-card.rule-a .rule-text   { background: linear-gradient(135deg,#ffffff 0%,#38bdf8 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.rule-card.rule-a .rule-kicker { color: #38bdf8; }

/* Rule B: Lavender gradient */
.rule-card.rule-b { border-color: rgba(192,132,252,0.3); box-shadow: inset 0 1px 0 rgba(192,132,252,0.15),0 2px 10px rgba(0,0,0,0.3); }
.rule-card.rule-b .rule-text   { background: linear-gradient(135deg,#ffffff 0%,#c084fc 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.rule-card.rule-b .rule-kicker { color: #c084fc; }

/* Game Over: Crimson */
.rule-card.rule-gameover { border-color: rgba(239,68,68,0.3); }
.rule-card.rule-gameover .rule-text   { background: linear-gradient(135deg,#fca5a5 0%,#ef4444 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.rule-card.rule-gameover .rule-kicker { color: #f87171; }

@keyframes ruleFadeIn {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* ─── Drag & Drop Zone Highlights ────────────────────────────────────────── */
.zone-highlight {
    background:  rgba(59, 130, 246, 0.08) !important;
    border-color: var(--accent) !important;
    box-shadow:  0 0 18px rgba(59, 130, 246, 0.25);
}

.drop-placeholder {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    padding:         10px 16px;
    border-radius:   var(--border-radius-pill);
    font-size:       0.9rem;
    font-weight:     600;
    border:          2px dashed var(--accent);
    background:      rgba(59, 130, 246, 0.15);
    color:           var(--accent);
    opacity:         0.85;
    pointer-events:  none;
    animation:       ghostPulse 1.2s ease-in-out infinite alternate;
}

@keyframes ghostPulse {
    from { opacity: 0.5; transform: scale(0.97); }
    to   { opacity: 0.95; transform: scale(1.02); }
}

/* ─── Word Bank ───────────────────────────────────────────────────────────── */
#word-bank {
    display:         flex;
    flex-wrap:       wrap;
    justify-content: center;
    gap:             10px;
    width:           100%;
    max-width:       var(--max-content);
    min-height:      105px;   /* CLS lock */
    padding:         15px;
    background:      rgba(30, 41, 59, 0.4);
    border-radius:   14px;
    border:          2px dashed var(--border);
    margin-bottom:   18px;
    align-content:   flex-start;
    transition:      border-color 0.2s, background 0.2s;
}

#word-bank.bank-completed {
    border:          1px solid var(--surface-border);
    background:      rgba(30, 41, 59, 0.55);
    align-items:     center;
    justify-content: center;
    min-height:      90px;
    padding:         16px 20px;
}

.bank-message {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    text-align:      center;
}

.bank-message-title {
    font-size:   1.15rem;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.bank-message-title.victory {
    color:       var(--green);
    text-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
}

.bank-message-title.gameover {
    color:       var(--red);
    text-shadow: 0 0 14px rgba(239, 68, 68, 0.3);
}

.bank-message-sub {
    font-size:   0.82rem;
    color:       var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ─── Word Pills ──────────────────────────────────────────────────────────── */
.word {
    background:   var(--surface-hover);
    color:        var(--text);
    padding:      10px 16px;
    border-radius: var(--border-radius-pill);
    font-size:    0.9rem;
    font-weight:  600;
    box-shadow:   0 4px 6px rgba(0, 0, 0, 0.3);
    touch-action: none;          /* Prevent scroll during drag */
    cursor:       grab;
    border:       1px solid rgba(255, 255, 255, 0.1);
    transition:   transform 0.1s, border-color 0.2s, background-color 0.2s, color 0.2s;
    user-select:  none;
    -webkit-user-select: none;
}

.word:focus-visible {
    outline:        2px solid var(--accent);
    outline-offset: 2px;
}

.word.dragging {
    opacity:  0.92;
    transform: scale(1.05);
    z-index:  1000;
    position: fixed;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    cursor:    grabbing;
    border-color: var(--accent);
    will-change: transform;   /* Applied only during drag, not statically */
}

/* Solved word colour variants */
.word.solved-left    { background: rgba(56,189,248,0.12)!important; border-color: var(--cyan)!important; color: var(--cyan)!important; box-shadow: 0 0 10px rgba(56,189,248,0.25); pointer-events: none; }
.word.solved-right   { background: rgba(192,132,252,0.12)!important; border-color: var(--lavender)!important; color: var(--lavender)!important; box-shadow: 0 0 10px rgba(192,132,252,0.25); pointer-events: none; }
.word.solved-both    { background: rgba(16,185,129,0.18)!important; border-color: var(--green)!important; color: var(--green)!important; box-shadow: 0 0 12px rgba(16,185,129,0.3); pointer-events: none; }
.word.solved-neither { background: rgba(148,163,184,0.08)!important; border-color: #64748b!important; color: var(--text-muted)!important; box-shadow: none; pointer-events: none; }
.word.locked         { background: rgba(16,185,129,0.2); border-color: var(--green); box-shadow: none; pointer-events: none; color: var(--green); }
.word.error          { border-color: var(--red); background: rgba(239,68,68,0.2); color: var(--red); }
.word.keyboard-selected {
    border-color: var(--accent) !important;
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.6) !important;
    transform: scale(1.05);
    background: rgba(59, 130, 246, 0.22) !important;
    color: #ffffff !important;
}

body.word-selected .zone {
    border-style: dashed;
    cursor: pointer;
}

body.word-selected .zone:hover {
    background: rgba(59, 130, 246, 0.12) !important;
    border-color: var(--accent) !important;
}

/* ─── Message ─────────────────────────────────────────────────────────────── */
#message {
    min-height:   0;
    font-weight:  bold;
    font-size:    1.05rem;
    text-align:   center;
    margin-bottom: 12px;
    width:         100%;
    max-width:     var(--max-content);
}

#message:empty {
    margin-bottom: 0;
    display:       none;
}

/* ─── Controls & Action Buttons ──────────────────────────────────────────── */
.action-buttons {
    display:       flex;
    gap:           12px;
    width:         100%;
    max-width:     380px;
    margin-bottom: 20px;
}

.btn {
    background:   var(--text);
    color:        var(--bg);
    border:       none;
    font-size:    1.05rem;
    font-weight:  bold;
    border-radius: 30px;
    cursor:       pointer;
    touch-action: manipulation;
    transition:   transform 0.1s, opacity 0.2s, background-color 0.2s;
}

.btn.hint-btn {
    background:  var(--surface);
    color:       var(--text);
    border:      1px solid var(--border);
    padding:     13px 14px;
    flex:        0.35;
}

/* Progressive Rewarded Button */
.btn.reward-life-btn {
    background:  rgba(239, 68, 68, 0.15);
    color:       #f87171;
    border:      1px solid rgba(239, 68, 68, 0.35);
    padding:     13px 12px;
    font-size:   0.88rem;
    font-weight: 700;
    flex:        0.55;
    animation:   rewardGlow 2s ease-in-out infinite alternate;
}

.btn.reward-life-btn:hover {
    background:  rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

@keyframes rewardGlow {
    from { box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
    to   { box-shadow: 0 0 12px rgba(239, 68, 68, 0.35); }
}

#submit-btn { padding: 13px 20px; flex: 1; }

.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.3; pointer-events: none; }

.btn:focus-visible {
    outline:        2px solid var(--accent);
    outline-offset: 2px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}

.shake { animation: shake 0.3s ease-in-out; }

/* ─── Floating Toast ──────────────────────────────────────────────────────── */
.toast-notification {
    position:   fixed;
    bottom:     24px;
    left:       50%;
    transform:  translateX(-50%) translateY(20px);
    background: rgba(15, 23, 42, 0.95);
    border:     1px solid var(--accent);
    color:      var(--text);
    padding:    10px 18px;
    border-radius: 30px;
    display:    inline-flex;
    align-items: center;
    gap:        8px;
    font-size:  0.88rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    z-index:    3000;
    opacity:    0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width:  calc(100vw - 48px);
    text-align: center;
}

/* [hidden] attribute hides but allows :not([hidden]) selectors */
.toast-notification[hidden] { display: none; }

.toast-notification.active {
    opacity:   1;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    width:     16px;
    height:    16px;
    color:     var(--cyan);
    flex-shrink: 0;
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.footer {
    margin-top:  30px;
    margin-bottom: 10px;
    font-size:   0.8rem;
    color:       var(--text-muted);
    text-align:  center;
    width:       100%;
    max-width:   var(--max-content);
    border-top:  1px solid var(--border);
    padding-top: 15px;
}

.footer-links {
    margin-bottom: 8px;
    display:       flex;
    justify-content: center;
    flex-wrap:     wrap;
    gap:           6px;
}

.footer-links a,
.footer-links button.footer-link-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.8rem;
    color:       var(--text-muted);
    text-decoration: none;
    cursor:      pointer;
    transition:  color 0.2s;
}

.footer-links a:hover,
.footer-links button.footer-link-btn:hover { color: var(--accent); text-decoration: underline; }

.footer-links a:focus-visible,
.footer-links button.footer-link-btn:focus-visible {
    outline:        2px solid var(--accent);
    outline-offset: 2px;
    border-radius:  2px;
}

.footer-divider { color: var(--border); }

.footer-copy { opacity: 0.7; font-size: 0.75rem; }

/* ─── Unified Modal System ────────────────────────────────────────────────── */
.modal-overlay {
    position:        fixed;
    inset:           0;
    background:      rgba(15, 23, 42, 0.85);
    z-index:         2000;
    display:         flex;
    align-items:     center;
    justify-content: center;
    opacity:         0;
    transition:      opacity 0.2s ease;
    pointer-events:  none;
    cursor:          pointer;
}

/* [hidden] on modal overlays: hide completely when not open */
.modal-overlay[hidden] { display: none; }

.modal-overlay.active {
    opacity:        1;
    pointer-events: auto;
}

.modal-card {
    position:      relative;
    background:    var(--surface);
    border:        1px solid var(--surface-border);
    border-radius: 18px;
    padding:       24px 20px;
    width:         90%;
    max-width:     360px;
    text-align:    center;
    box-shadow:    0 20px 40px rgba(0, 0, 0, 0.6);
    transform:     scale(0.95);
    transition:    transform 0.2s ease;
    cursor:        default;
    max-height:    90dvh;
    overflow-y:    auto;
    overscroll-behavior: contain;
}

.modal-overlay.active .modal-card { transform: scale(1); }

.modal-close-icon {
    position:    absolute;
    top:         14px;
    right:       14px;
    background:  transparent;
    border:      none;
    color:       var(--text-muted);
    font-size:   1.25rem;
    cursor:      pointer;
    width:       32px;
    height:      32px;
    display:     flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition:  background 0.15s, color 0.15s;
    touch-action: manipulation;
}

.modal-close-icon:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.modal-close-icon:focus-visible {
    outline:        2px solid var(--accent);
    outline-offset: 2px;
}

.modal-card h3 {
    font-size:      1.25rem;
    color:          var(--text);
    margin-bottom:  14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight:    800;
}

.modal-card p, .modal-card ul {
    font-size:     0.9rem;
    color:         var(--text-muted);
    line-height:   1.6;
    margin-bottom: 15px;
    text-align:    left;
}

.modal-card ul { padding-left: 20px; }
.modal-card li { margin-bottom: 6px; }

.modal-btn-row {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    gap:                   10px;
    width:                 100%;
    margin-top:            10px;
}

.modal-btn-primary {
    width:           100%;
    padding:         12px 16px;
    font-size:       0.95rem;
    background:      var(--accent);
    color:           #ffffff;
    border-radius:   12px;
    border:          none;
    cursor:          pointer;
    font-weight:     700;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    transition:      background 0.15s, transform 0.1s;
    touch-action:    manipulation;
}

.modal-btn-primary:hover  { background: var(--accent-hover); }
.modal-btn-primary:active { transform: scale(0.97); }
.modal-btn-primary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.modal-btn-secondary {
    width:           100%;
    padding:         12px 16px;
    font-size:       0.95rem;
    background:      rgba(255, 255, 255, 0.06);
    color:           var(--text);
    border-radius:   12px;
    border:          1px solid var(--border);
    cursor:          pointer;
    font-weight:     700;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    transition:      background 0.15s, border-color 0.15s, transform 0.1s;
    touch-action:    manipulation;
}

.modal-btn-secondary:hover  { background: rgba(255, 255, 255, 0.12); border-color: rgba(255,255,255,0.2); }
.modal-btn-secondary:active { transform: scale(0.97); }
.modal-btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.modal-btn-success          { background: var(--green); color: #ffffff; border: none; }
.modal-btn-success:hover    { background: var(--green-hover); }

/* ─── Feedback Form ───────────────────────────────────────────────────────── */
.feedback-intro {
    font-size:     0.85rem;
    color:         var(--text-muted);
    margin-bottom: 14px;
    line-height:   1.45;
}

.form-group {
    display:        flex;
    flex-direction: column;
    gap:            6px;
    margin-bottom:  12px;
    width:          100%;
    text-align:     left;
}

.form-label {
    font-size:      0.72rem;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color:          var(--text-muted);
}

.form-input,
.form-textarea {
    width:        100%;
    background:   rgba(15, 23, 42, 0.6);
    border:       1px solid var(--border);
    border-radius: 10px;
    padding:      10px 12px;
    font-size:    0.88rem;
    color:        var(--text);
    font-family:  inherit;
    box-sizing:   border-box;
    transition:   border-color 0.2s, background-color 0.2s;
    /* user-select and -webkit-user-select: text — set in global rule above */
}

.form-input:focus,
.form-textarea:focus {
    outline:    none;
    border-color: var(--accent);
    background:  rgba(15, 23, 42, 0.9);
}

.form-textarea { resize: none; }

.direct-contact-note {
    font-size:   0.74rem;
    color:       var(--text-muted);
    margin:      8px 0 14px 0;
    line-height: 1.4;
}

.direct-contact-note a { color: var(--accent); text-decoration: none; font-weight: 600; }
.direct-contact-note a:hover { text-decoration: underline; }

/* ─── Native Sponsor Card ─────────────────────────────────────────────────── */
.native-ad-card {
    background:    rgba(15, 23, 42, 0.65);
    border:        1px solid var(--surface-border);
    border-radius: var(--border-radius-card);
    padding:       10px 12px;
    margin:        8px 0 16px 0;
    text-align:    left;
    transition:    border-color 0.2s, background 0.2s;
    cursor:        pointer;
}

.native-ad-card:hover { border-color: rgba(56, 189, 248, 0.3); background: rgba(15, 23, 42, 0.85); }

.ad-meta {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   6px;
}

.ad-tag {
    font-size:    0.6rem;
    font-weight:  800;
    letter-spacing: 0.8px;
    color:        var(--accent);
    background:   rgba(56, 189, 248, 0.12);
    padding:      2px 6px;
    border-radius: 4px;
}

.ad-provider { font-size: 0.65rem; color: var(--text-muted); opacity: 0.7; }

.ad-body { display: flex; align-items: center; gap: 10px; }

.ad-icon-tile {
    width:           36px;
    height:          36px;
    border-radius:   8px;
    background:      rgba(255, 255, 255, 0.05);
    border:          1px solid var(--surface-border);
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       1.15rem;
    flex-shrink:     0;
}

.ad-copy { display: flex; flex-direction: column; gap: 2px; }
.ad-headline { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.ad-sub { font-size: 0.72rem; color: var(--text-muted); line-height: 1.35; }

/* ─── Rewarded Ad Modal ───────────────────────────────────────────────────── */
.rewarded-card {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    padding:        22px 18px;
}

.rewarded-timer-badge {
    font-size:          0.72rem;
    font-weight:        800;
    color:              #f87171;
    background:         rgba(239, 68, 68, 0.12);
    padding:            2px 8px;
    border-radius:      12px;
    font-variant-numeric: tabular-nums;
}

.rewarded-content {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    text-align:     center;
    margin:         12px 0 18px 0;
}

.rewarded-icon { font-size: 2.2rem; margin-bottom: 8px; filter: drop-shadow(0 0 10px rgba(239,68,68,0.4)); }
.rewarded-heading { font-size: 1.1rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.rewarded-text { font-size: 0.82rem; color: var(--text-muted); line-height: 1.45; margin-bottom: 14px; }

.rewarded-sponsor-box {
    background:    rgba(15, 23, 42, 0.65);
    border:        1px solid var(--surface-border);
    border-radius: 10px;
    padding:       12px 14px;
    width:         100%;
    text-align:    left;
}

.sponsor-box-tag  { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.9px; color: var(--accent); margin-bottom: 4px; }
.sponsor-box-brand { font-size: 0.85rem; font-weight: 800; color: var(--text); margin-bottom: 2px; }
.sponsor-box-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.35; }

/* ─── Statistics Modal ────────────────────────────────────────────────────── */
.stats-summary-grid {
    display:               grid;
    grid-template-columns: repeat(4, 1fr);
    gap:                   8px;
    margin:                16px 0 20px 0;
}

.stat-box {
    background:      rgba(15, 23, 42, 0.6);
    border:          1px solid var(--border);
    border-radius:   10px;
    padding:         10px 4px;
    display:         flex;
    flex-direction:  column;
    align-items:     center;
}

.stat-value { font-size: 1.55rem; font-weight: 800; color: #ffffff; line-height: 1.2; }
.stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; text-align: center; margin-top: 4px; font-weight: 600; }

.distribution-title { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 1.5px; margin-bottom: 12px; text-align: left; font-weight: 700; text-transform: uppercase; }

.distribution-chart { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; width: 100%; }

.dist-row { display: flex; align-items: center; gap: 10px; width: 100%; }

.dist-label { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); width: 12px; text-align: right; }

.dist-bar-wrapper { flex: 1; background: rgba(15, 23, 42, 0.5); border-radius: 6px; height: 24px; display: flex; overflow: hidden; }

.dist-bar { background: #475569; height: 100%; border-radius: 6px; display: flex; align-items: center; justify-content: flex-end; padding: 0 8px; min-width: 26px; transition: width 0.4s ease; }

.dist-bar.highlight-bar { background: var(--green) !important; }

.dist-count { font-size: 0.78rem; font-weight: 700; color: #ffffff; }

/* ─── How-To Modal ────────────────────────────────────────────────────────── */
.howto-card { max-height: 90vh; overflow-y: auto; }

.howto-summary { font-size: 0.86rem; color: var(--text-muted); line-height: 1.45; margin-bottom: 12px; }

.example-container { background: rgba(15,23,42,0.75); border: 1px solid var(--surface-border); border-radius: 12px; padding: 12px; margin-bottom: 14px; }

.example-header { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.06); padding-bottom: 8px; }

.example-tag { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.8px; color: var(--accent); }

.example-rules { font-size: 0.76rem; color: #e2e8f0; }

.example-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }

.example-zone { background: rgba(30,41,59,0.6); border: 1px dashed var(--border); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; align-items: center; min-height: 54px; }

.example-zone.full-span { grid-column: span 2; min-height: 48px; }

.example-zone-title { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }

.example-zone-words { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

.example-pill { background: var(--surface-hover); color: var(--text); padding: 4px 10px; border-radius: 14px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.4px; border: 1px solid rgba(255,255,255,0.08); }

.example-pill.highlight-both { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.4); color: var(--green); }

.example-explanation { font-size: 0.74rem; color: var(--text-muted); line-height: 1.35; background: rgba(59,130,246,0.06); border-left: 2px solid var(--accent); padding: 6px 8px; border-radius: 0 6px 6px 0; }

.howto-rules-list { display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

.rule-item { display: flex; align-items: flex-start; gap: 8px; }

.rule-bullet { font-size: 0.85rem; }

/* ─── Tutorial Overlay ────────────────────────────────────────────────────── */
#tutorial-overlay {
    position:        fixed;
    inset:           0;
    background:      rgba(15, 23, 42, 0.85);
    z-index:         1500;
    display:         flex;
    align-items:     center;
    justify-content: center;
    pointer-events:  none;
    opacity:         0;
    transition:      opacity 0.3s ease;
}

#tutorial-overlay[hidden] { display: none; }

#tutorial-overlay.active { opacity: 1; }

.tutorial-text {
    background:  var(--accent);
    color:       white;
    padding:     16px 24px;
    border-radius: 12px;
    font-weight: bold;
    font-size:   1.1rem;
    position:    absolute;
    top:         15%;
    text-align:  center;
    max-width:   80%;
    box-shadow:  0 4px 20px rgba(59, 130, 246, 0.6);
    pointer-events: auto;
}

.close-tutorial {
    position:      absolute;
    top:           -12px;
    right:         -12px;
    background:    var(--surface);
    color:         var(--text);
    border:        2px solid var(--border);
    border-radius: 50%;
    width:         28px;
    height:        28px;
    font-weight:   bold;
    cursor:        pointer;
    display:       flex;
    align-items:   center;
    justify-content: center;
    font-size:     0.8rem;
    touch-action:  manipulation;
}

.tutorial-highlight {
    z-index:    1501 !important;
    position:   relative;
    box-shadow: 0 0 0 4px var(--accent), 0 0 25px var(--accent) !important;
    border-color: var(--accent) !important;
    animation:  pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.03); }
}

/* ─── Utility: [hidden] attribute ────────────────────────────────────────── */
/* Keep .hidden for loader fade-out transition (which needs display:flex) */
.hidden { display: none !important; }

/* ─── Responsive Adjustments ─────────────────────────────────────────────── */
@media (max-width: 360px) {
    h1              { font-size: 1.5rem; }
    .zones-grid     { gap: 10px; }
    .zone           { min-height: 130px; padding: 8px; }
    .word           { padding: 8px 12px; font-size: 0.82rem; }
    .action-buttons { gap: 8px; }
    .btn.hint-btn   { padding: 11px 10px; font-size: 0.9rem; }
}

@media (min-width: 480px) {
    :root { --max-content: 440px; }
    .modal-card { max-width: 400px; }
}
