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

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Prevent callout / text selection on long-press */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Allow text selection inside form inputs */
input, textarea { user-select: text; -webkit-user-select: text; }

/* ── Score board ──────────────────────────────────────────────────────────── */
.score-board {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.8);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
    z-index: 10;
    pointer-events: auto;
    font-family: monospace;
    min-width: 80px;
    text-align: center;
}

/* ── Info text (top-left) ─────────────────────────────────────────────────── */
.info-text {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.6);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    z-index: 10;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Camera hint ──────────────────────────────────────────────────────────── */
.camera-hint {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.55);
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    padding: 5px 14px;
    border-radius: 20px;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 1s;
}
.camera-hint.hidden { opacity: 0; }

/* ── Panel toggle button ──────────────────────────────────────────────────── */
.panel-toggle {
    position: absolute;
    bottom: 80px;
    right: 12px;
    z-index: 20;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    /* always visible */
}

/* ── Controls panel ───────────────────────────────────────────────────────── */
.controls-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 15;
    pointer-events: auto;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,215,0,0.3);
    padding: 10px 14px;
    color: #fff;
    transition: transform 0.3s ease;
}

.controls-panel.panel-hidden {
    transform: translateY(100%);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-glow {
    background: linear-gradient(45deg, #ff6b6b, #ffd93d);
    border: none;
    color: #fff;
    font-weight: bold;
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 44px;   /* iOS tap target */
}

.btn-glow:hover, .btn-glow:active {
    transform: scale(1.04);
    box-shadow: 0 0 14px rgba(255,215,0,0.5);
    color: #fff;
}

/* ── Status ───────────────────────────────────────────────────────────────── */
.status-running {
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}

/* ── City / town labels (CSS2D on globe) ──────────────────────────────────── */
.city-label {
    pointer-events: none;
    white-space: nowrap;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 700;
    text-shadow: 0 1px 3px #000, 0 0 6px #000;
    letter-spacing: 0.5px;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(0,0,0,0.45);
}
.city-capital { color: #FFD700; font-size: 14px; }
.city-major   { color: #FFA040; font-size: 12px; }
.city-city    { color: #DDDDDD; font-size: 10px; }
.city-town    { color: #AAAAAA; font-size:  9px; }

/* ── CSS2D player username labels ─────────────────────────────────────────── */
.player-label {
    color: #fff;
    background: rgba(0,0,0,0.65);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid rgba(255,215,0,0.4);
    text-shadow: 0 1px 2px #000;
}

/* ── Bootstrap modal backdrop — semi-transparent so globe shows through ───── */
.modal-backdrop {
    background-color: rgba(5, 11, 26, 0.55) !important;
    opacity: 1 !important;
}

/* ── Auth modal ───────────────────────────────────────────────────────────── */
#authModal .nav-tabs { border-color: rgba(255,215,0,0.3); }
#authModal .nav-link { border-color: transparent; min-height: 44px; }
#authModal .nav-link.active {
    background: rgba(255,215,0,0.15);
    border-color: rgba(255,215,0,0.4) rgba(255,215,0,0.4) transparent;
    color: #ffd700 !important;
}
#authModal .form-control:focus {
    border-color: #ffd700;
    box-shadow: 0 0 0 0.2rem rgba(255,215,0,0.2);
}
/* Larger inputs on mobile for easy tapping */
#authModal .form-control {
    min-height: 44px;
    font-size: 16px;  /* prevents iOS auto-zoom on focus */
}

/* ── Mobile overrides ─────────────────────────────────────────────────────── */
@media (max-width: 575px) {
    .score-board { font-size: 15px; padding: 6px 12px; top: 8px; right: 8px; }
    .info-text   { font-size: 12px; padding: 6px 10px; top: 8px; left: 8px; }

    /* Full-screen modal on phones */
    #authModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }
    #authModal .modal-content {
        border-radius: 0;
        min-height: 100dvh;
    }

    .controls-panel { padding: 8px 10px; }
    .panel-toggle   { bottom: 70px; }

    /* Stack coordinate inputs vertically */
    .controls-panel .input-group {
        flex-wrap: wrap;
        gap: 4px;
    }
    .controls-panel .input-group .form-control { min-width: 0; flex: 1 1 80px; }
    .controls-panel .input-group .btn { width: 100%; margin-top: 4px; }
}

/* ── Tablet (sm–md) ───────────────────────────────────────────────────────── */
@media (min-width: 576px) and (max-width: 991px) {
    .score-board { font-size: 16px; }
    #authModal .modal-dialog { max-width: 480px; }
}

/* ── Intro overlay — floats above the auth modal ──────────────────────────── */
.intro-overlay {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    z-index: 1060;          /* above Bootstrap modal (1050) */
    transition: opacity 0.9s ease;
    width: 90%;
}
.intro-overlay.fading { opacity: 0; }

.intro-title {
    font-size: clamp(24px, 5vw, 56px);
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255,215,0,0.9), 0 2px 6px #000;
    letter-spacing: 2px;
    animation: introPulse 2s ease-in-out infinite;
}
.intro-sub {
    font-size: clamp(12px, 2vw, 20px);
    color: rgba(255,255,255,0.85);
    margin-top: 6px;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 1px 4px #000;
}

@keyframes introPulse {
    0%, 100% { text-shadow: 0 0 20px rgba(255,215,0,0.6), 0 2px 4px #000; }
    50%       { text-shadow: 0 0 60px rgba(255,215,0,1),   0 2px 4px #000; }
}

/* Hide intro overlay on small phones (modal is full-screen, no room) */
@media (max-width: 575px) and (max-height: 700px) {
    .intro-overlay { display: none !important; }
}

/* ── HUD avatar (top-left) ────────────────────────────────────────────────── */
.avatar-hud {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,215,0,0.6);
    cursor: pointer;
    flex-shrink: 0;
    background: #334;
    vertical-align: middle;
}
.avatar-hud img { width: 100%; height: 100%; object-fit: cover; }
.avatar-hud .avatar-initials {
    font-size: 13px; font-weight: 700; color: #fff;
    text-shadow: 0 1px 2px #000;
}

/* ── Profile avatar (large, in modal) ────────────────────────────────────── */
.avatar-large {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255,215,0,0.7);
    background: #334;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px #000;
}
.avatar-large img { width: 100%; height: 100%; object-fit: cover; }

/* ── Profile modal form controls ─────────────────────────────────────────── */
#profileModal .form-control[readonly] {
    opacity: 0.6;
    cursor: default;
}
#profileModal .form-control {
    min-height: 42px;
    font-size: 15px;
}
#profileModal hr { margin: 1.2rem 0; }

/* ── Mobile lateral movement buttons ─────────────────────────────────────── */
#mobileControls {
    position: fixed;
    bottom: 100px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 50;
}

.mobile-move-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255,215,0,0.5);
    background: rgba(0,0,0,0.65);
    color: #ffd700;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background 0.1s;
}
.mobile-move-btn:active {
    background: rgba(255,215,0,0.3);
}

/* Mobile FP button — slightly different look */
.mobile-fp-btn { font-size: 22px; border-color: rgba(100,200,255,0.5); color: #aaddff; }

/* On desktop (non-touch), hide the mobile buttons */
@media (hover: hover) and (pointer: fine) {
    #mobileControls { display: none !important; }
}

/* ── Conquest charge bar (thin gold line at very top of viewport) ───────── */
#conquestBar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: rgba(255,255,255,0.12);
    z-index: 1100;
    pointer-events: none;
}
#conquestFill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffaa00, #ffd700, #fff8aa);
    transition: width 0.3s linear;
    box-shadow: 0 0 6px #ffd700;
}

/* ── Score history list rows ──────────────────────────────────────────────── */
.score-history-row { border-bottom: 1px solid rgba(255,255,255,0.06); }
.score-history-row:last-child { border-bottom: none; }

/* ── Lives HUD ────────────────────────────────────────────────────────────── */
.lives-hud {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 20, 0.65);
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 18px;
    pointer-events: none;
    z-index: 20;
    border: 1px solid rgba(255,255,255,0.18);
    white-space: nowrap;
    letter-spacing: 2px;
}

/* ── Level HUD ────────────────────────────────────────────────────────────── */
.level-hud {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    z-index: 20;
    min-width: 120px;
}
.level-badge {
    background: #ffd700;
    color: #000;
    font-size: 10px;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 1px;
}
.xp-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}
.xp-bar-fill {
    height: 100%;
    background: #ffd700;
    width: 0%;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 5px rgba(255,215,0,0.5);
}

/* ── Lightning flash overlays ─────────────────────────────────────────────── */
.lightning-flash,
.lightning-hit {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.15s ease-out;
}
.lightning-flash { background: #ffffff; }
.lightning-hit   { background: #cc0000; transition: opacity 0.6s ease-out; }

/* ── Weather HUD ──────────────────────────────────────────────────────────── */
.weather-hud {
    position: fixed;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 20, 0.65);
    color: #fff;
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 14px;
    pointer-events: none;
    z-index: 20;
    border: 1px solid rgba(255,255,255,0.18);
    white-space: nowrap;
    transition: background 1s;
}

/* ── Pause / Quit HUD buttons ─────────────────────────────────────────────── */
.game-controls-hud {
    position: fixed;
    top: 12px;
    right: 120px;          /* sits left of the score board */
    display: flex;
    gap: 6px;
    z-index: 20;
}
.hud-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(255,215,0,0.4);
    background: rgba(0,0,0,0.75);
    color: #ffd700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.hud-btn:hover  { background: rgba(255,215,0,0.2); }
.hud-btn-quit   { border-color: rgba(255,80,80,0.5); color: #ff8888; }
.hud-btn-quit:hover { background: rgba(255,60,60,0.25); }
.hud-speed-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    font-size: 12px;
    font-weight: 700;
    color: #ffd700;
    letter-spacing: 0.02em;
    user-select: none;
}

/* ── Pause overlay ────────────────────────────────────────────────────────── */
.pause-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,10,0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    backdrop-filter: blur(4px);
}
.pause-box {
    background: rgba(5,11,26,0.95);
    border: 1px solid rgba(255,215,0,0.4);
    border-radius: 16px;
    padding: 32px 40px;
    text-align: center;
    min-width: 240px;
}
.pause-title {
    font-size: 28px;
    font-weight: 900;
    color: #ffd700;
    letter-spacing: 4px;
    margin-bottom: 24px;
    text-shadow: 0 0 20px rgba(255,215,0,0.5);
}

/* ── Language feedback popup ──────────────────────────────────────────────── */
.lang-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 300;
    font-size: clamp(20px, 4vw, 36px);
    font-weight: 900;
    letter-spacing: 1px;
    text-align: center;
    white-space: nowrap;
    padding: 10px 24px;
    border-radius: 16px;
    opacity: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}
.lang-feedback.show {
    animation: langFade 2.2s ease forwards;
}
.lang-feedback.tier-super {
    color: #fff700;
    background: rgba(255, 200, 0, 0.25);
    border: 2px solid rgba(255, 215, 0, 0.7);
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 80px rgba(255, 215, 0, 0.4);
    font-size: clamp(24px, 5vw, 42px);
}
.lang-feedback.tier-gold {
    color: #ffd700;
    background: rgba(255, 180, 0, 0.2);
    border: 2px solid rgba(255, 180, 0, 0.5);
    box-shadow: 0 0 20px rgba(255, 180, 0, 0.5);
}
.lang-feedback.tier-silver {
    color: #dce8ff;
    background: rgba(180, 200, 255, 0.15);
    border: 1px solid rgba(180, 200, 255, 0.3);
}
.lang-feedback.tier-bronze {
    color: rgba(255,255,255,0.6);
    background: transparent;
    border: none;
    font-size: 16px;
    top: 42%;
}
.lang-feedback.tier-penalty {
    color: #ffaa44;
    background: rgba(255, 100, 0, 0.2);
    border: 2px solid rgba(255, 100, 0, 0.4);
    box-shadow: 0 0 16px rgba(255, 100, 0, 0.4);
}
.lang-feedback.tier-heavy_penalty {
    color: #ff4444;
    background: rgba(200, 0, 0, 0.25);
    border: 2px solid rgba(200, 0, 0, 0.5);
    box-shadow: 0 0 30px rgba(200, 0, 0, 0.6);
}

/* Gold screen flash for scripture */
.scripture-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 250;
    background: rgba(255, 215, 0, 0.18);
    opacity: 0;
}
.scripture-flash.show {
    animation: flashFade 1.2s ease forwards;
}

@keyframes langFade {
    0%   { opacity: 0;   transform: translate(-50%, -40%); }
    15%  { opacity: 1;   transform: translate(-50%, -50%); }
    70%  { opacity: 1;   transform: translate(-50%, -50%); }
    100% { opacity: 0;   transform: translate(-50%, -60%); }
}
@keyframes flashFade {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Rest area sign label ─────────────────────────────────────────────────── */
.rest-area-label {
    color: #e8f5e8;
    background: rgba(20, 60, 20, 0.85);
    border: 1.5px solid rgba(100, 200, 100, 0.6);
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 0 6px rgba(80, 200, 80, 0.5);
}

/* ── Speech bubble (CSS2D label above player head) ───────────────────────── */
.speech-bubble {
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.3);
    text-shadow: 0 1px 3px #000;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.5s;
}
.speech-bubble.tier-super {
    color: #fff700;
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
    background: rgba(80, 60, 0, 0.85);
}
.speech-bubble.tier-gold {
    color: #ffd700;
    border-color: rgba(255, 180, 0, 0.6);
    background: rgba(60, 40, 0, 0.85);
}
.speech-bubble.tier-penalty,
.speech-bubble.tier-heavy_penalty {
    color: #ff6666;
    border-color: rgba(200, 0, 0, 0.5);
    background: rgba(60, 0, 0, 0.85);
}

/* ── Cup of Iniquity — sin gauge ─────────────────────────────────────────── */
.sin-gauge-wrap {
    position: fixed;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    z-index: 900;
    pointer-events: none;
    user-select: none;
}

.sin-cup-label {
    color: rgba(255, 200, 200, 0.75);
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 5px;
}

/* Main tube body */
.sin-tube {
    width: 22px;
    height: 140px;
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    background: rgba(10, 0, 0, 0.22);
    overflow: visible;          /* lets overflow drip show above */
    position: relative;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Glass shine highlight */
.sin-tube::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 3px;
    width: 4px;
    bottom: 4px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 2px;
    pointer-events: none;
}

/* Rounded bottom cap */
.sin-tube-base {
    width: 22px;
    height: 13px;
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    border-top: none;
    border-radius: 0 0 13px 13px;
    background: rgba(10, 0, 0, 0.22);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow: hidden;
    position: relative;
}

/* Liquid fill (height driven by JS) */
.sin-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    overflow: hidden;
    transition: height 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Two counter-rotating ellipses create a sloshing wave on the liquid surface */
.sin-liquid::before,
.sin-liquid::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -110%;
    left: -50%;
    background: rgba(195, 8, 8, 0.72);
    border-radius: 45%;
    animation: sinWave 3.2s linear infinite;
}
.sin-liquid::after {
    border-radius: 43%;
    background: rgba(155, 0, 0, 0.55);
    animation-duration: 4.7s;
    animation-direction: reverse;
}

@keyframes sinWave {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Danger glow when >= 70% full */
.sin-gauge-wrap.danger .sin-tube,
.sin-gauge-wrap.danger .sin-tube-base {
    border-color: rgba(255, 60, 60, 0.75);
    box-shadow: 0 0 10px rgba(220, 0, 0, 0.55),
                inset 0 0 6px rgba(200, 0, 0, 0.20);
}

/* Overflow drip — shown when gauge hits 100% */
.sin-overflow {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    background: rgba(210, 0, 0, 0.85);
    border-radius: 0 0 4px 4px;
    height: 0;
    opacity: 0;
    pointer-events: none;
}
.sin-gauge-wrap.overflowing .sin-overflow {
    animation: drip 0.55s ease-in infinite;
}
@keyframes drip {
    0%   { height: 0;    top: 0;    opacity: 0.9; }
    60%  { height: 16px; top: -16px; opacity: 0.8; }
    100% { height: 22px; top: -22px; opacity: 0; }
}

/* Strike indicator dots below the tube */
.sin-strikes {
    display: flex;
    gap: 3px;
    margin-top: 5px;
}
.sin-strike-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.20);
    border: 1px solid rgba(255,255,255,0.30);
    transition: background 0.3s;
}
.sin-strike-dot.active {
    background: rgba(220, 40, 40, 0.90);
    border-color: rgba(255,100,100,0.8);
    box-shadow: 0 0 4px rgba(255,0,0,0.6);
}

/* ── Character tier HUD label ─────────────────────────────────────────────── */
.hud-char-tier {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-left: 8px;
    vertical-align: middle;
    text-shadow: 0 0 6px currentColor;
    transition: color 0.6s ease;
}

/* ── "Who Are You?" identity confrontation overlay ────────────────────────── */
#whoAreYou {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    z-index: 2000;
    background: rgba(10, 5, 20, 0.92);
    border: 2px solid #ff4444;
    border-radius: 14px;
    padding: 24px 32px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 0 40px rgba(255, 40, 40, 0.5), inset 0 0 30px rgba(255, 0, 0, 0.06);
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
#whoAreYou.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.way-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}
.way-msg {
    font-size: 13px;
    color: #ccbbbb;
    margin-bottom: 12px;
    line-height: 1.5;
}
.way-tier {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}
.way-question {
    font-size: 13px;
    color: #ffbbbb;
    font-style: italic;
}

/* ── Wardrobe modal ───────────────────────────────────────────────────────── */
.modal-wardrobe { max-width: 640px; }

.wd-layout {
    display: grid;
    grid-template-columns: 1fr 204px 1fr;
    gap: 8px;
    align-items: start;
    min-height: 320px;
}

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

.wd-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wd-drag-hint {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.05em;
    user-select: none;
}

/* Individual slot */
.wd-slot {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,215,0,0.18);
    border-radius: 7px;
    padding: 5px 7px;
}

.wd-slot-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ffd700;
    margin-bottom: 3px;
}

.wd-slot-picker {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wd-slot-name {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wd-arrow {
    background: rgba(255,215,0,0.12);
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 4px;
    color: #ffd700;
    font-size: 11px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
    flex-shrink: 0;
}
.wd-arrow:hover { background: rgba(255,215,0,0.28); }
.wd-arrow-disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

/* Colour swatches */
.wd-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 2px;
}

.wd-swatch {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    padding: 0;
    transition: transform 0.12s, border-color 0.12s;
}
.wd-swatch:hover { transform: scale(1.18); }
.wd-swatch-active {
    border: 2px solid #ffd700;
    transform: scale(1.12);
    box-shadow: 0 0 5px rgba(255,215,0,0.6);
}

/* Mobile: stack columns vertically */
@media (max-width: 500px) {
    .wd-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .wd-center { order: -1; }
    #wardrobeCanvas { width: 160px !important; height: 240px !important; }
}

/* ── Race HUD ─────────────────────────────────────────────────────────────── */
.race-hud {
    position: fixed;
    top: 128px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(5, 10, 25, 0.85);
    border: 1px solid rgba(255, 215, 0, 0.6);
    border-radius: 20px;
    padding: 4px 14px;
    z-index: 70;
    font-size: 0.82rem;
    color: #fff;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}
.race-dest { color: #ffd700; font-weight: 600; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-km   { color: #88ddff; font-weight: 700; min-width: 60px; text-align: right; }

/* ── Destination picker ───────────────────────────────────────────────────── */
.dest-city-list { max-height: 52vh; overflow-y: auto; }
.dest-region-header {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #ffd700;
    padding: 6px 8px 2px;
    border-bottom: 1px solid rgba(255,215,0,0.2);
    text-transform: uppercase;
    margin-top: 4px;
}
.dest-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.15s;
}
.dest-row:hover { background: rgba(255,215,0,0.06); }
.dest-city-name { flex: 1; font-size: 0.88rem; color: #e8eeff; }
.dest-tier-badge {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: #aaa;
}
.dest-tier-badge.capital { background: rgba(255,215,0,0.25); color: #ffd700; }
.dest-tier-badge.major   { background: rgba(255,140,0,0.22); color: #ffaa44; }
.dest-dist { font-size: 0.76rem; color: #88aacc; min-width: 56px; text-align: right; }
.dest-btn { font-size: 0.72rem; padding: 2px 8px; }

/* ── Stamina HUD ──────────────────────────────────────────────────────────── */
.stamina-hud {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 20;
    background: rgba(0, 0, 20, 0.65);
    padding: 3px 10px 3px 8px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    pointer-events: none;
    white-space: nowrap;
}
.stamina-icon { font-size: 14px; }
.stamina-bar-wrap {
    width: 90px;
    height: 7px;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    overflow: hidden;
}
.stamina-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 4px;
    transition: width 0.6s ease, background-color 0.4s;
}
.stamina-hud.stamina-tired .stamina-bar-fill {
    background: linear-gradient(90deg, #ff9800, #ffc107);
}
.stamina-hud.stamina-exhausted .stamina-bar-fill {
    background: linear-gradient(90deg, #f44336, #e53935);
    animation: stamina-pulse 0.7s ease-in-out infinite alternate;
}
@keyframes stamina-pulse {
    from { opacity: 0.6; }
    to   { opacity: 1.0; }
}
.stamina-pct {
    font-size: 10px;
    color: #aaa;
    font-variant-numeric: tabular-nums;
    min-width: 28px;
}
.stamina-hud.stamina-exhausted .stamina-pct { color: #f44336; font-weight: bold; }

/* ── Daily Missions Panel ─────────────────────────────────────────────────── */
.missions-panel {
    position: fixed;
    top: 60px;
    right: -310px;
    width: 290px;
    background: rgba(10, 12, 24, 0.92);
    border: 1px solid #ffd700;
    border-radius: 10px;
    padding: 10px 12px;
    z-index: 1200;
    transition: right 0.35s ease;
    backdrop-filter: blur(6px);
    max-height: 80vh;
    overflow-y: auto;
}
.missions-panel.mp-visible { right: 12px; }
.mp-header {
    color: #ffd700;
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,215,0,0.3);
    padding-bottom: 5px;
}
.mp-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mp-row:last-child { border-bottom: none; }
.mp-row.mp-done { opacity: 0.55; }
.mp-icon { font-size: 1.3em; flex-shrink: 0; margin-top: 1px; }
.mp-info { flex: 1; min-width: 0; }
.mp-label { font-size: 0.82em; color: #eee; font-weight: 600; }
.mp-bar-wrap {
    height: 5px;
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
    margin: 3px 0 2px;
    overflow: hidden;
}
.mp-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffaa00);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.mp-row.mp-done .mp-bar { background: #4caf50; }
.mp-sub { font-size: 0.73em; color: #aaa; }

/* ── Custom scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track  { background: #1a1a2e; }
::-webkit-scrollbar-thumb  { background: #ffd700; border-radius: 4px; }
