/* ==========================================================================
   The Leisure Suit Chronicles - Stylesheet
   Design direction: a boozy, neon-lit lounge aesthetic. Deep navy base,
   brass/gold accents, a warm coral highlight for interactive moments.
   Display type: Playfair Display (has real character, feels like a
   nightclub marquee). UI type: Space Grotesk (clean, slightly technical,
   keeps the chrome legible against the moodier display type).
   ========================================================================== */

:root {
    --navy-950: #0c1220;
    --navy-900: #121a2b;
    --navy-800: #1a2438;
    --navy-700: #24304a;
    --navy-600: #34405c;
    --brass-400: #d4af6a;
    --brass-300: #e6c88a;
    --brass-200: #f2ddb3;
    --coral-500: #e8674f;
    --coral-400: #f0836b;
    --cream-100: #f7f1e6;
    --cream-050: #fbf8f1;
    --ink-muted: #a8b2c7;
    --ink-faint: #6b7690;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-ui: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;

    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 999px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-ui);
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212, 175, 106, 0.08), transparent),
        linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 100%);
    color: var(--cream-100);
    min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------------------------------- Auth ---------------------------------- */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(160deg, var(--navy-800), var(--navy-900));
    border: 1px solid var(--navy-600);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
}

.auth-eyebrow {
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brass-400);
    font-weight: 600;
    margin-bottom: 14px;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 34px;
    line-height: 1.15;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--cream-050);
}

.auth-title em {
    color: var(--brass-300);
    font-style: italic;
}

.auth-tagline {
    color: var(--ink-muted);
    font-size: 14.5px;
    margin: 0 0 28px;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 13px;
    color: var(--ink-muted);
    font-weight: 500;
}

.field-hint {
    font-size: 12px;
    color: var(--ink-faint);
    margin-top: 2px;
}

input[type="text"],
input[type="password"],
input[type="number"] {
    background: var(--navy-950);
    border: 1px solid var(--navy-600);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--cream-100);
    font-family: var(--font-ui);
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    border-color: var(--brass-400);
}

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.5;
    cursor: pointer;
}

.checkbox-field input {
    margin-top: 3px;
    accent-color: var(--brass-400);
}

.btn {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 14.5px;
    padding: 13px 22px;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--brass-300), var(--brass-400));
    color: var(--navy-950);
    box-shadow: 0 8px 20px -6px rgba(212, 175, 106, 0.5);
}

.btn-primary:hover { transform: translateY(-1px); }

.btn-secondary {
    background: var(--navy-700);
    color: var(--cream-100);
    border: 1px solid var(--navy-600);
}

.btn-ghost {
    background: transparent;
    color: var(--brass-300);
    border: 1px solid var(--navy-600);
}

.btn-block { width: 100%; }

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.auth-switch {
    text-align: center;
    font-size: 13.5px;
    color: var(--ink-muted);
    margin-top: 22px;
}

.auth-switch a {
    color: var(--brass-300);
    text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

.auth-footnote {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--navy-700);
    font-size: 11.5px;
    color: var(--ink-faint);
    line-height: 1.6;
    text-align: center;
}

/* ---------------------------------- Flash ---------------------------------- */

.flash-stack {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 480px;
}

.flash {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    text-align: center;
    background: var(--navy-800);
    border: 1px solid var(--navy-600);
    color: var(--cream-100);
}

.flash-error {
    border-color: var(--coral-500);
    color: var(--coral-400);
}

.flash-success, .flash-info {
    border-color: var(--brass-400);
}

/* ---------------------------------- Game Header ---------------------------------- */

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--navy-700);
    background: rgba(12, 18, 32, 0.7);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.game-header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.brand-mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    color: var(--brass-300);
    font-size: 18px;
    letter-spacing: 0.02em;
}

.world-name {
    font-size: 13px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.game-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.player-name {
    font-size: 13.5px;
    color: var(--ink-muted);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--navy-600);
    color: var(--ink-muted);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
    border-color: var(--brass-400);
    color: var(--brass-300);
}

/* ---------------------------------- Progress ---------------------------------- */

.progress-rail {
    height: 3px;
    background: var(--navy-800);
    width: 100%;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--coral-500), var(--brass-400));
    transition: width 0.4s ease;
}

/* ---------------------------------- Scene ---------------------------------- */

.game-stage {
    display: flex;
    justify-content: center;
    padding: 40px 20px 80px;
}

.scene-card {
    width: 100%;
    max-width: 640px;
    animation: sceneIn 0.5s ease;
}

@keyframes sceneIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.scene-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.scene-title {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    color: var(--cream-050);
    text-shadow: 0 0 24px rgba(230, 200, 138, 0.18);
}

.narrate-btn {
    flex-shrink: 0;
    background: var(--navy-800);
    border: 1px solid var(--navy-600);
    color: var(--brass-300);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.narrate-btn.speaking {
    border-color: var(--coral-500);
    color: var(--coral-400);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232, 103, 79, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(232, 103, 79, 0); }
}

.scene-narration {
    font-size: 17px;
    line-height: 1.75;
    color: var(--ink-muted);
    margin: 0 0 32px;
}

.choices-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--navy-800);
    border: 1px solid var(--navy-600);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.choice-btn:hover {
    border-color: var(--brass-400);
    background: var(--navy-700);
}

.choice-btn:active {
    transform: scale(0.99);
}

.choice-btn.chosen {
    border-color: var(--coral-500);
    background: var(--navy-700);
}

.choice-index {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    background: var(--navy-950);
    border: 1px solid var(--navy-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--brass-300);
    font-weight: 600;
}

.choice-text {
    font-size: 15px;
    color: var(--cream-100);
    line-height: 1.4;
}

.game-complete-banner {
    margin-top: 32px;
    padding: 24px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(212, 175, 106, 0.12), rgba(232, 103, 79, 0.08));
    border: 1px solid var(--brass-400);
    text-align: center;
}

.game-complete-banner p {
    font-family: var(--font-display);
    font-size: 19px;
    color: var(--brass-200);
    margin: 0 0 16px;
}

/* ---------------------------------- Settings Panel ---------------------------------- */

.settings-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 20, 0.6);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.settings-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 380px;
    height: 100vh;
    background: var(--navy-900);
    border-left: 1px solid var(--navy-600);
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.settings-panel.active {
    transform: translateX(0);
}

.settings-panel-inner {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-header h2 {
    font-family: var(--font-display);
    font-size: 20px;
    margin: 0;
    color: var(--cream-050);
}

.toggle-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: var(--cream-100);
    padding: 12px 16px;
    background: var(--navy-800);
    border-radius: var(--radius-md);
    border: 1px solid var(--navy-600);
}

.toggle-field input {
    accent-color: var(--brass-400);
    width: 18px;
    height: 18px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    background: var(--navy-800);
    border-radius: var(--radius-md);
    border: 1px solid var(--navy-700);
}

.settings-group h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brass-300);
    margin: 0 0 4px;
    font-weight: 600;
}

select {
    background: var(--navy-950);
    border: 1px solid var(--navy-600);
    color: var(--cream-100);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 14px;
}

input[type="range"] {
    accent-color: var(--brass-400);
    width: 100%;
}

.settings-note {
    font-size: 11.5px;
    color: var(--ink-faint);
    line-height: 1.6;
}

/* ---------------------------------- Minigames ---------------------------------- */

.minigame-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 20, 0.85);
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.minigame-overlay.active {
    display: flex;
}

.minigame-card {
    width: 100%;
    max-width: 520px;
    background: linear-gradient(160deg, var(--navy-800), var(--navy-900));
    border: 1px solid var(--brass-400);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.7);
}

.minigame-header {
    margin-bottom: 20px;
}

.minigame-eyebrow {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--coral-400);
    font-weight: 600;
}

.minigame-header h2 {
    font-family: var(--font-display);
    font-size: 21px;
    margin: 8px 0 0;
    color: var(--cream-050);
}

.trivia-question {
    font-size: 16px;
    color: var(--cream-100);
    margin-bottom: 18px;
    line-height: 1.5;
}

.trivia-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.trivia-option-btn {
    background: var(--navy-950);
    border: 1px solid var(--navy-600);
    color: var(--cream-100);
    padding: 13px 16px;
    border-radius: var(--radius-md);
    text-align: left;
    cursor: pointer;
    font-size: 14.5px;
    transition: border-color 0.15s ease;
}

.trivia-option-btn:hover { border-color: var(--brass-400); }

.trivia-option-btn.selected-correct {
    border-color: #7fbf7f;
    background: rgba(127, 191, 127, 0.1);
}

.trivia-option-btn.selected-wrong {
    border-color: var(--coral-500);
    background: rgba(232, 103, 79, 0.1);
}

.trivia-feedback {
    font-size: 13.5px;
    color: var(--brass-300);
    padding: 14px;
    background: var(--navy-950);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    line-height: 1.5;
}

.memory-stats {
    display: flex;
    gap: 20px;
    font-size: 13.5px;
    color: var(--ink-muted);
    margin-bottom: 18px;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.memory-tile {
    aspect-ratio: 1;
    background: var(--navy-950);
    border: 1px solid var(--navy-600);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.memory-tile:hover { border-color: var(--brass-400); }

.memory-tile.flipped {
    background: var(--navy-700);
    border-color: var(--brass-400);
}

.memory-tile.matched {
    background: rgba(127, 191, 127, 0.15);
    border-color: #7fbf7f;
    cursor: default;
}

/* ---------------------------------- Result Toast ---------------------------------- */

.result-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--navy-800);
    border: 1px solid var(--brass-400);
    color: var(--cream-100);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    z-index: 200;
    font-size: 14px;
    text-align: center;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6);
}

/* ---------------------------------- Responsive ---------------------------------- */

@media (max-width: 480px) {
    .scene-title { font-size: 24px; }
    .auth-card { padding: 30px 22px; }
    .memory-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .memory-tile { font-size: 20px; }
}
