/* ===== FREE ARENA (mode card + join modal + FOMO lock) =====
   Uses the codex theme variables from legacy-ui.css so the free card
   is a visual sibling of the Elite card: sage accent, same fonts. */

/* --- Free card accents (match elite: sage) --- */
.free-mode-card .mode-icon.free-icon svg {
    fill: var(--acc, #ff7a22);
}

.mode-fee.free-fee {
    font: 500 13px/1 var(--mono, monospace);
    letter-spacing: 1.5px;
    color: var(--acc, #ff7a22);
    border: 1px solid var(--acc-line, rgba(255,122,34,0.30));
    background: var(--acc-soft, rgba(255,122,34,0.12));
    border-radius: 7px;
    padding: 4px 10px;
    white-space: nowrap;
}

/* --- FOMO locked state (any mode card given .locked) --- */
.game-mode-card.locked {
    opacity: 0.85;
    cursor: not-allowed;
}

.game-mode-card.locked:hover {
    transform: none;
}

/* Red = combat, consistent with the live-game status treatment */
.mode-locked-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 11px;
    padding: 9px 12px;
    border-radius: 7px;
    background: rgba(229, 72, 77, 0.07);
    border: 1px solid rgba(229, 72, 77, 0.28);
    color: #e5484d;
    font: 600 10px/1 var(--disp, sans-serif);
    letter-spacing: 1.8px;
    text-transform: uppercase;
    animation: lockedPulse 2.2s ease-in-out infinite;
}

@keyframes lockedPulse {
    0%, 100% { border-color: rgba(229, 72, 77, 0.28); }
    50% { border-color: rgba(229, 72, 77, 0.6); }
}

/* Full (queue maxed, no game yet) — amber */
.mode-locked-banner.full {
    background: rgba(245, 158, 11, 0.07);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
    animation: none;
}

/* --- Free join modal (codex-styled card) --- */
#free-join-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    align-items: center;
    justify-content: center;
    font-family: var(--body, sans-serif);
}

#free-join-overlay.active {
    display: flex;
}

#free-join-modal {
    background: var(--card, rgba(14,16,20,0.92));
    border: 1px solid var(--acc-line, rgba(255,122,34,0.30));
    border-radius: 14px;
    padding: 26px 30px;
    width: 420px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 40px var(--acc-glow, rgba(255,122,34,0.15));
}

#free-join-modal h2 {
    font: 600 15px/1 var(--disp, sans-serif);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--acc, #ff7a22);
    margin: 0 0 8px 0;
}

.free-join-sub {
    color: var(--t1, #c7afa4);
    font-size: 12.5px;
    margin: 0 0 16px 0;
    line-height: 1.55;
}

.free-join-label {
    display: block;
    font: 500 9px/1 var(--mono, monospace);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--t2, #8a756d);
    margin: 12px 0 6px 0;
}

#free-join-modal input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 13px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--hair, rgba(255,255,255,0.09));
    border-radius: 8px;
    color: var(--t0, #f6ede6);
    font-size: 13.5px;
    outline: none;
    font-family: var(--body, sans-serif);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#free-join-modal input:focus {
    border-color: var(--acc-line, rgba(255,122,34,0.30));
    box-shadow: 0 0 12px var(--acc-soft, rgba(255,122,34,0.12));
}

#free-join-modal input::placeholder {
    color: var(--t3, #5c4a46);
}

.free-join-optional {
    margin-top: 16px;
    padding: 13px 15px 15px 15px;
    border: 1px dashed var(--hair, rgba(255,255,255,0.12));
    border-radius: 10px;
}

.free-join-optional-title {
    font: 600 9.5px/1.4 var(--disp, sans-serif);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--acc-2, #ffb43c);
}

.free-join-note {
    margin-top: 11px;
    color: var(--t2, #8a756d);
    font-size: 11.5px;
    line-height: 1.55;
}

.free-join-error {
    display: none;
    margin-top: 13px;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(229, 72, 77, 0.08);
    border: 1px solid rgba(229, 72, 77, 0.3);
    color: #e5484d;
    font-size: 12px;
}

.free-join-error.active {
    display: block;
}

.free-join-buttons {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.free-join-buttons button {
    flex: 1;
    padding: 11px 0;
    border-radius: 8px;
    font: 600 11px/1 var(--disp, sans-serif);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
}

#free-join-cancel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--hair, rgba(255,255,255,0.09));
    color: var(--t1, #c7afa4);
}

#free-join-cancel:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--t0, #f6ede6);
}

#free-join-confirm {
    background: var(--acc-soft, rgba(255,122,34,0.12));
    border: 1px solid var(--acc-line, rgba(255,122,34,0.30));
    color: var(--acc, #ff7a22);
}

#free-join-confirm:hover {
    background: rgba(255, 122, 34, 0.22);
    box-shadow: 0 0 14px var(--acc-glow, rgba(255,122,34,0.25));
}

#free-join-confirm:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* ===== QUEUED PANEL — readability upgrade =====
   The default queue-status card was too dim (labels/timer in --t2 on a
   translucent card). This makes the queued state unmistakable. */

#queue-status {
    background: var(--acc-soft, rgba(255, 122, 34, 0.10));
    border: 1px solid var(--acc-line, rgba(255, 122, 34, 0.35));
    border-radius: 11px;
    padding: 14px 16px;
    box-shadow: 0 0 22px var(--acc-glow, rgba(255, 122, 34, 0.14)),
                inset 0 0 30px rgba(255, 122, 34, 0.04);
    animation: queuedBreathe 3s ease-in-out infinite;
}

@keyframes queuedBreathe {
    0%, 100% { border-color: var(--acc-line, rgba(255, 122, 34, 0.35)); }
    50%      { border-color: rgba(255, 122, 34, 0.65); }
}

#queue-status .queued-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--acc-line, rgba(255, 122, 34, 0.25));
}

#queue-status .queued-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--acc-soft, rgba(255, 122, 34, 0.15));
    border: 1px solid var(--acc, #ff7a22);
    color: var(--acc, #ff7a22);
    font-size: 15px;
    font-weight: 700;
    animation: queuedIconPulse 2s ease-in-out infinite;
}

@keyframes queuedIconPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 122, 34, 0.45); }
    70%      { box-shadow: 0 0 0 9px rgba(255, 122, 34, 0); }
}

#queue-status .queued-title {
    font: 700 13px/1 var(--disp, sans-serif);
    letter-spacing: 3px;
    color: var(--acc, #ff7a22);
    text-transform: uppercase;
}

#queue-status .queued-mode {
    font-size: 12px;
    color: var(--t0, #f6ede6) !important;
    margin-top: 3px;
    font-weight: 500;
}

/* Detail rows: brighter labels, bigger values */
#queue-status .queue-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
}

#queue-status .queue-detail-item + .queue-detail-item {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

#queue-status .queue-label {
    font: 600 9.5px/1 var(--mono, monospace) !important;
    letter-spacing: 1.5px !important;
    color: var(--t1, #c7afa4) !important;
}

#queue-status .queue-value {
    font: 600 15px/1 var(--mono, monospace) !important;
    color: var(--t0, #f6ede6) !important;
}

#queue-status .queue-value.timer {
    color: var(--acc, #ff7a22) !important;
}

#queue-status .queue-value.gold {
    color: var(--acc, #ff7a22) !important;
}

/* Leave-queue ✕ (visible for FREE queue only) */
#leave-queue-btn {
    width: 28px;
    height: 28px;
    margin-left: auto;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    background: rgba(229, 72, 77, 0.08);
    border: 1px solid rgba(229, 72, 77, 0.35);
    border-radius: 7px;
    color: #e5484d;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

#leave-queue-btn:hover {
    background: rgba(229, 72, 77, 0.18);
    border-color: #e5484d;
    box-shadow: 0 0 10px rgba(229, 72, 77, 0.25);
}

/* ===== IN-GAME: hide lobby chrome ===== */
/* The welcome banner and codex launcher belong to the sanctuary only.
   main.js sets body[data-in-game="1"] for the duration of a match. */

body[data-in-game="1"] #cg-welcome {
    display: none !important;
}

body[data-in-game="1"] #cg-launcher {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ===== FREE PRIZE DISCLAIMER (victory/draw modals) ===== */

.free-prize-note {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 7px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #f59e0b;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

/* ===== DEATH POPUP — codex redesign =====
   Replaces the old full-screen red wash + giant pulsing emoji with a
   codex-styled card: dimmed backdrop, ringed glyph, disciplined type. */

#death-replay-overlay {
    background: rgba(6, 8, 10, 0.72) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.death-replay-content {
    background: var(--card, rgba(14, 16, 20, 0.92));
    border: 1px solid rgba(229, 72, 77, 0.35);
    border-radius: 14px;
    padding: 34px 44px 30px;
    max-width: 440px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 44px rgba(229, 72, 77, 0.12);
    animation: deathCardIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

@keyframes deathCardIn {
    0%   { transform: translateY(-16px) scale(0.97); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Ringed glyph badge (matches the victory crown treatment) */
.death-replay-icon {
    font-size: 26px !important;
    width: 62px;
    height: 62px;
    margin: 0 auto 18px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(229, 72, 77, 0.07);
    border: 1px solid rgba(229, 72, 77, 0.4);
    box-shadow: 0 0 22px rgba(229, 72, 77, 0.18);
    animation: none !important;
}

.death-replay-title {
    font: 700 24px/1.15 var(--disp, sans-serif) !important;
    letter-spacing: 5px !important;
    color: #e5484d !important;
    text-shadow: 0 0 24px rgba(229, 72, 77, 0.35) !important;
    margin-bottom: 14px !important;
    text-transform: uppercase;
}

.death-replay-cause {
    font: 400 13.5px/1.55 var(--body, sans-serif) !important;
    color: var(--t1, #c7afa4) !important;
    margin-bottom: 10px !important;
    max-width: none !important;
}

.death-replay-cause .highlight {
    color: #e5484d !important;
    font-weight: 600;
}

.death-replay-position {
    font: 500 11px/1 var(--mono, monospace) !important;
    letter-spacing: 1px;
    color: var(--t2, #8a756d) !important;
    margin-bottom: 4px !important;
}

.death-replay-hint {
    font: 400 11.5px/1.55 var(--body, sans-serif) !important;
    font-style: normal !important;
    color: var(--t2, #8a756d) !important;
    margin-top: 16px !important;
    padding-top: 14px !important;
    border-top: 1px solid var(--hair, rgba(255, 255, 255, 0.09)) !important;
    max-width: none !important;
}

/* ===== IN-GAME HUD (relocated #game-controls) =====
   The Season Timers panel now lives OUTSIDE #codex-shell so it stays
   visible during a match (the shell is opacity:0 while minimized).
   The old '#side-panel #game-controls' pointer rule no longer matches,
   so re-enable interaction and keep it above the world. */

#game-controls.panel-section {
    z-index: 1005;
    pointer-events: auto;

    /* Codex card wrapper — the HUD previously floated transparent on the
       bright sky, washing out the title, status pill and buttons. */
    background: linear-gradient(180deg, rgba(18, 23, 32, 0.88), rgba(10, 14, 20, 0.92));
    backdrop-filter: var(--card-blur, blur(22px) saturate(1.15));
    -webkit-backdrop-filter: var(--card-blur, blur(22px) saturate(1.15));
    border: 1px solid var(--acc-line, rgba(255, 122, 34, 0.30));
    border-radius: 14px;
    padding: 16px 16px 14px;
    gap: 10px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45),
                0 0 30px var(--acc-glow, rgba(255, 122, 34, 0.14)),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#game-controls.panel-section * {
    pointer-events: auto;
}

/* Title — display face, sage, soft glow */
#game-controls .section-title {
    font: 600 11px/1 var(--disp, serif);
    letter-spacing: 3px;
    color: var(--acc, #ff7a22);
    text-shadow: 0 0 18px var(--acc-glow, rgba(255, 122, 34, 0.35));
    margin-bottom: 2px;
}

#game-controls .section-title::before {
    background: linear-gradient(90deg, transparent, var(--acc-line, rgba(255, 122, 34, 0.30)));
}

#game-controls .section-title::after {
    background: linear-gradient(90deg, var(--acc-line, rgba(255, 122, 34, 0.30)), transparent);
}

/* Timer tiles — nested on the dark card, no double blur */
#game-controls .timer-item {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--hair, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    padding: 11px 13px;
    gap: 6px;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#game-controls .timer-label {
    font: 600 9.5px/1 var(--mono, monospace);
    letter-spacing: 1.5px;
    color: var(--t1, #c7afa4);
}

#game-controls .timer-value {
    font: 600 20px/1 var(--mono, monospace);
    color: var(--t0, #f6ede6);
}

/* Re-assert state colors (the #id selector above outranks .timer-value.warning) */
#game-controls .timer-value.warning { color: #fb923c; }
#game-controls .timer-value.critical { color: #e5484d; }

/* Movement status pill — stronger borders + glow so states pop */
#game-controls .movement-status {
    margin-top: 2px;
    border-radius: 10px;
    padding: 12px 14px;
}

#game-controls .movement-status.needs-move {
    background: rgba(229, 72, 77, 0.12);
    border: 1px solid rgba(229, 72, 77, 0.55);
    box-shadow: 0 0 16px rgba(229, 72, 77, 0.18);
}

#game-controls .movement-status.has-moved {
    background: rgba(111, 168, 74, 0.10);
    border: 1px solid rgba(111, 168, 74, 0.50);
    box-shadow: 0 0 16px rgba(111, 168, 74, 0.14);
}

#game-controls .movement-status-text {
    font-weight: 700;
    letter-spacing: 1.5px;
}

/* Buttons — visible tiles, codex uppercase, sage hover */
#game-controls .secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--hair, rgba(255, 255, 255, 0.09));
    border-radius: 9px;
    padding: 11px 14px;
    color: var(--t1, #c7afa4);
    font: 600 11px/1 var(--disp, sans-serif);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: all 0.16s ease;
}

#game-controls .secondary:hover {
    color: var(--acc, #ff7a22);
    border-color: var(--acc-line, rgba(255, 122, 34, 0.30));
    background: var(--acc-soft, rgba(255, 122, 34, 0.12));
    box-shadow: 0 0 12px var(--acc-glow, rgba(255, 122, 34, 0.20));
}

#game-controls .secondary svg {
    flex-shrink: 0;
}

/* ===== IN-GAME: kill codex blur + rail =====
   If the countdown ends while the codex is open, the game must not start
   behind the dim/blur layer or the codex rail. JS also force-closes the
   codex on game start; this is the CSS backstop. */

body[data-in-game="1"] #cg-dim,
body[data-in-game="1"] .codex-rail,
body[data-in-game="1"] #codex-shell {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ===== ATMOSPHERE: soft vignette =====
   Pure CSS overlay — zero GPU scene cost. Gently frames the world and
   pulls the eye to the island. Sits above the canvas, below all UI. */

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(ellipse 120% 90% at 50% 42%,
        transparent 55%,
        rgba(8, 12, 14, 0.16) 80%,
        rgba(8, 12, 14, 0.34) 100%);
}