@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Roboto+Condensed:wght@300;400;700&family=Roboto+Mono:wght@400;700&display=swap');

:root {
    --gta-red: #e21b1b;
    --gta-green: #2ecc71;
    --hud-bg: rgba(10, 10, 10, 0.75);
    --hud-border: rgba(255, 255, 255, 0.06);
    --text-dim: rgba(255, 255, 255, 0.3);
    --text-mid: rgba(255, 255, 255, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #000;
    color: #fff;
    font-family: 'Roboto Condensed', sans-serif;
    overflow: hidden;
    /* Use dvh (dynamic viewport height) so the body never extends under the browser bar */
    height: 100dvh;
    /* Fallback for older browsers */
    height: 100vh;
    height: 100dvh;
    -webkit-font-smoothing: antialiased;
    /* Extend background into safe areas but keep content clear of them */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.gta-font { font-family: 'Oswald', sans-serif; text-transform: uppercase; }
.mono { font-family: 'Roboto Mono', monospace; }

/* ===== GAME VIEWPORT ===== */
#game-viewport {
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* dynamic viewport height — shrinks when browser bar is visible */
    background: radial-gradient(ellipse at 50% 40%, #1a1a1a 0%, #0a0a0a 40%, #000 100%);
    position: relative;
    overflow: hidden;
}
#three-container { width: 100%; height: 100%; }

/* Scanlines */
#game-viewport::before {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
    pointer-events: none; z-index: 5;
}

.vignette {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.75) 100%);
    pointer-events: none; z-index: 4;
}

/* ===== INTRO SCREEN ===== */
#intro-screen {
    position: absolute; inset: 0; z-index: 300;
    background: #000;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.6s ease;
}
.intro-content { text-align: center; }
.intro-logo {
    font-family: 'Oswald', sans-serif; font-weight: 700; font-style: italic;
    font-size: 80px; letter-spacing: -2px; color: #fff; margin-bottom: 4px;
}
.intro-logo span:first-child { color: var(--gta-red); }
.tubelight {
    animation: flicker 8s infinite;
    margin-left: 14px;
    font-style: normal;
}
@keyframes flicker {
    0%, 9.9%, 11.1%, 39.9%, 41.1%, 41.9%, 43.1%, 69.9%, 71.1%, 71.4%, 72.6%, 72.9%, 75.1%, 100% {
        color: #444444;
    }
    10%, 11%, 40%, 41%, 42%, 43%, 70%, 71%, 71.5%, 72.5%, 73%, 75% {
        color: #ffffff;
    }
}
.intro-tagline {
    font-family: 'Roboto Mono', monospace; font-size: 10px;
    letter-spacing: 8px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 20px;
}
.intro-divider {
    width: 60px; height: 2px; background: var(--gta-red);
    margin: 0 auto 16px;
}
.intro-desc {
    font-family: 'Roboto Mono', monospace; font-size: 11px;
    letter-spacing: 4px; color: var(--text-mid); margin-bottom: 40px;
}
.intro-start {
    font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 15px;
    letter-spacing: 4px; text-transform: uppercase;
    background: transparent; border: 1px solid rgba(255,255,255,0.15);
    color: #fff; padding: 14px 50px; cursor: pointer;
    transition: all 0.3s ease;
    clip-path: polygon(4% 0, 100% 0, 96% 100%, 0% 100%);
}
.intro-start:hover { background: var(--gta-red); border-color: var(--gta-red); }
.intro-blink { animation: blink 1.5s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ===== MODE SELECT SCREEN ===== */
#mode-screen {
    position: absolute; inset: 0; z-index: 280;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(20px);
}
.mode-content { text-align: left; max-width: 320px; width: 100%; padding: 0; }
.mode-header { background: var(--gta-red); padding: 15px; color: #fff; text-align: left; margin-bottom: 0; }
.mode-title {
    font-size: 24px; font-weight: 700; letter-spacing: 2px; margin-bottom: 4px;
}
.mode-subtitle {
    font-family: 'Roboto Mono', monospace; font-size: 9px;
    letter-spacing: 2px; color: rgba(255,255,255,0.8); margin-top: 0;
}
.mode-list {
    display: flex; flex-direction: column;
    background: rgba(0,0,0,0.85);
}
.mode-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 15px; cursor: pointer; transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-bottom: 1px solid rgba(255,255,255,0.1); color: #fff;
}
.mode-item:hover { background: rgba(255,255,255,0.15); padding-left: 20px; padding-right: 10px; }
.mode-item:active { background: rgba(255,255,255,0.3); }
.mode-item.selected { background: #fff; color: #000; border-bottom: none; }
.mi-name { font-size: 13px; font-weight: 700; letter-spacing: 1px; }
.mi-bet { font-family: 'Oswald', sans-serif; font-size: 14px; font-weight: 700; }
.mode-item.selected .mi-name, .mode-item.selected .mi-bet { color: #000; }
.btn-start-match { margin-top: 10px; width: 100%; text-align: center; border-radius: 0; }

/* ===== COUNTDOWN OVERLAY ===== */
#countdown-overlay {
    position: absolute; inset: 0; z-index: 290;
    background: rgba(0,0,0,0.9);
    display: flex; align-items: center; justify-content: center;
}
.cd-content { text-align: center; }
.cd-found {
    font-size: 22px; font-weight: 600; letter-spacing: 6px;
    color: var(--gta-green);
    animation: cdPulse 1s ease-in-out infinite;
}
.cd-number {
    font-size: 120px; font-weight: 700; line-height: 1;
    color: #fff; margin: 10px 0;
    text-shadow: 0 0 40px rgba(255,255,255,0.3);
}
.cd-mode {
    font-family: 'Roboto Mono', monospace; font-size: 9px;
    letter-spacing: 4px; color: var(--text-dim);
}
@keyframes cdPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ===== SIDE PANEL ACTION BUTTONS ===== */
.side-panel-left { left: 14px; padding: 0; border: none; background: transparent; backdrop-filter: none; width: 220px; }
.sp-header-gta {
    background: #000; padding: 12px 15px; margin-bottom: 0;
    border-top: 4px solid var(--gta-red);
}
.sp-header-gta .sp-title { color: #fff; font-size: 14px; }
.sp-actions { display: flex; flex-direction: column; background: rgba(0,0,0,0.85); }
.sp-btn {
    display: flex; align-items: center; justify-content: flex-start;
    background: transparent;
    border: none; border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 12px 15px; cursor: pointer;
    transition: all 0.1s ease;
    color: rgba(255,255,255,0.8);
    width: 100%; text-align: left;
    pointer-events: auto;
}
.sp-btn:hover { background: #fff; color: #000; border-bottom: none; }
.sp-btn-text {
    font-family: 'Oswald', sans-serif; font-size: 12px;
    font-weight: 600; letter-spacing: 1px;
}

/* ===== TEKKEN-STYLE TOP HUD ===== */
.tekken-hud {
    position: absolute; top: 0; left: 0; right: 0;
    z-index: 50; pointer-events: none;
    display: flex; align-items: flex-start;
    padding: 20px 24px 0;
    gap: 0;
}

.tk-player {
    flex: 1;
    transition: opacity 0.4s ease;
}

/* Name rows */
.tk-name-row {
    display: flex; align-items: baseline; gap: 8px;
    margin-bottom: 6px;
}
.tk-p2 .tk-name-row { justify-content: flex-end; }

.tk-name {
    font-family: 'Oswald', sans-serif; font-size: 22px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px; line-height: 1;
}
.tk-p1 .tk-name { color: var(--gta-green); }
.tk-p2 .tk-name { color: var(--gta-red); }

.tk-tag {
    font-family: 'Roboto Mono', monospace; font-size: 8px;
    letter-spacing: 2px; color: var(--text-dim);
    background: rgba(255,255,255,0.05); padding: 2px 6px;
}

/* Health bar wrappers */
.tk-bar-wrapper {
    position: relative; height: 18px;
}

.tk-bar-bg {
    height: 100%;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
    position: relative;
}

/* Skewed bar shapes */
.tk-bar-left .tk-bar-bg {
    clip-path: polygon(0 0, 97% 0, 100% 100%, 0 100%);
}
.tk-bar-right .tk-bar-bg {
    clip-path: polygon(3% 0, 100% 0, 100% 100%, 0 100%);
}

.tk-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
    position: relative;
}

.tk-fill-green {
    background: linear-gradient(90deg, #1a6b3a 0%, #2ecc71 60%, #5dff9e 100%);
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.tk-fill-red {
    background: linear-gradient(270deg, #6b1a1a 0%, #e21b1b 60%, #ff5e5e 100%);
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
    margin-left: auto;
}

/* Accent line under bar */
.tk-bar-accent {
    height: 2px; margin-top: 2px;
}
.tk-accent-left {
    background: linear-gradient(90deg, var(--gta-green), transparent);
}
.tk-accent-right {
    background: linear-gradient(270deg, var(--gta-red), transparent);
}

/* Shot counters */
.tk-shots {
    display: flex; align-items: baseline; gap: 4px;
    margin-top: 5px;
}
.tk-shots-right { justify-content: flex-end; }
.tk-shots-val {
    font-family: 'Oswald', sans-serif; font-size: 16px; font-weight: 600;
}
.tk-shots-sep, .tk-shots-total {
    font-family: 'Roboto Mono', monospace; font-size: 11px; color: var(--text-dim);
}
.tk-shots-lbl {
    font-family: 'Roboto Mono', monospace; font-size: 7px;
    letter-spacing: 2px; color: var(--text-dim); margin-left: 6px;
}
.tk-shots-right .tk-shots-lbl { margin-left: 0; margin-right: 6px; }

/* Balance display */
.tk-balance {
    display: flex; align-items: baseline; gap: 6px;
    margin-top: 3px;
}
.tk-balance-right { justify-content: flex-end; }
.tk-bal-lbl {
    font-family: 'Roboto Mono', monospace; font-size: 7px;
    letter-spacing: 2px; color: var(--text-dim);
}
.tk-bal-val {
    font-family: 'Oswald', sans-serif; font-size: 18px; font-weight: 700;
    color: #ffd700;
    text-shadow: 0 0 6px rgba(255,215,0,0.2);
    transition: all 0.3s ease;
}
.tk-bal-val.bal-up {
    animation: balPulseUp 0.8s ease forwards;
}
.tk-bal-val.bal-down {
    animation: balPulseDown 0.8s ease forwards;
}
@keyframes balPulseUp {
    0% { transform: scale(1); color: #ffd700; }
    20% { transform: scale(1.4); color: #2ecc71; text-shadow: 0 0 12px rgba(46,204,113,0.5); }
    60% { transform: scale(1.1); color: #2ecc71; }
    100% { transform: scale(1); color: #ffd700; text-shadow: 0 0 6px rgba(255,215,0,0.2); }
}
@keyframes balPulseDown {
    0% { transform: scale(1); color: #ffd700; }
    20% { transform: scale(1.4); color: #e21b1b; text-shadow: 0 0 12px rgba(226,27,27,0.5); }
    60% { transform: scale(1.1); color: #e21b1b; }
    100% { transform: scale(1); color: #ffd700; text-shadow: 0 0 6px rgba(255,215,0,0.2); }
}

/* Center round badge */
.tk-center {
    display: flex; flex-direction: column; align-items: center;
    min-width: 60px; padding-top: 2px;
}
.tk-round-badge {
    width: 44px; height: 44px;
    background: rgba(0,0,0,0.8);
    border: 2px solid rgba(255,255,255,0.12);
    transform: rotate(45deg);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 8px;
}
.tk-round-num {
    transform: rotate(-45deg);
    font-size: 22px; font-weight: 700; line-height: 1;
}

/* Win dots */
.tk-round-dots {
    display: flex; gap: 4px;
    margin-top: 10px;
}
.tk-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}
.tk-dot.active { background: #fff; box-shadow: 0 0 6px rgba(255,255,255,0.8); }
.tk-dot.won { background: var(--gta-green); box-shadow: 0 0 4px var(--gta-green); }
.tk-dot.lost { background: var(--gta-red); box-shadow: 0 0 4px var(--gta-red); }

/* Audio toggle */
.audio-toggle-btn {
    position: absolute; top: 16px; right: 24px; z-index: 60;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-mid); padding: 6px 10px;
    font-size: 14px; cursor: pointer;
    transition: all 0.2s ease; line-height: 1;
}
.audio-toggle-btn:hover {
    background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2);
}

/* ===== TURN INDICATOR ===== */
.turn-indicator {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -140%);
    z-index: 50; text-align: center;
    pointer-events: none; opacity: 0;
    transition: opacity 0.4s ease;
}
.turn-indicator.visible { opacity: 1; }
.turn-who {
    font-family: 'Roboto Mono', monospace; font-size: 9px;
    letter-spacing: 5px; color: var(--text-dim); margin-bottom: 4px;
}
.turn-name {
    font-family: 'Oswald', sans-serif; font-size: 28px;
    font-weight: 700; text-transform: uppercase;
}
.turn-name.p1-color { color: var(--gta-green); }
.turn-name.p2-color { color: var(--gta-red); }

/* ===== BOTTOM HUD ===== */
.hud-bottom {
    position: absolute; bottom: 0; left: 0; right: 0;
    z-index: 50; pointer-events: none;
    display: flex; flex-direction: column; align-items: center;
    /* Pushes content above the home indicator / browser bar on iOS */
    padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
    gap: 8px;
}
.hud-bottom > * { pointer-events: auto; }

/* Chamber row */
.chamber-row {
    display: flex; align-items: center; gap: 10px;
}
.chamber-label {
    font-family: 'Roboto Mono', monospace; font-size: 7px;
    letter-spacing: 3px; color: var(--text-dim);
}
.chamber-slots { display: flex; gap: 6px; }

.chamber-slot {
    width: 28px; height: 28px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Roboto Mono', monospace; font-size: 9px;
    color: var(--text-dim); transition: all 0.3s ease;
    position: relative;
}
.chamber-slot.active {
    border-color: rgba(255,255,255,0.5); color: #fff;
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 8px rgba(255,255,255,0.08);
}
.chamber-slot.fired-empty {
    border-color: rgba(255,255,255,0.1); color: transparent;
}
.chamber-slot.fired-empty::after {
    content: '✓'; position: absolute; color: var(--gta-green); font-size: 12px;
}
.chamber-slot.fired-bang {
    border-color: var(--gta-red); background: rgba(226,27,27,0.15); color: transparent;
}
.chamber-slot.fired-bang::after {
    content: '✕'; position: absolute; color: var(--gta-red); font-size: 13px; font-weight: 700;
}

/* Bet Pot */
.bet-pot {
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    margin: 4px 0;
}
.bet-pot.visible { opacity: 1; }
.pot-label {
    font-family: 'Roboto Mono', monospace; font-size: 7px;
    letter-spacing: 3px; color: var(--text-dim);
}
.pot-amount {
    font-size: 28px; font-weight: 700; color: #ffd700;
    text-shadow: 0 0 12px rgba(255,215,0,0.4);
    line-height: 1;
}

/* Flying bet chips */
.bet-chip {
    position: fixed;
    font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 18px;
    color: #ffd700;
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(255,215,0,0.3);
    padding: 6px 14px;
    pointer-events: none; z-index: 100;
    opacity: 0;
    text-shadow: 0 0 8px rgba(255,215,0,0.3);
    transition: none;
}
.bet-chip-left { left: 40px; }
.bet-chip-right { right: 40px; }

.bet-chip.flying {
    opacity: 1;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.bet-chip.arrived {
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Status */
.status-line {
    font-family: 'Roboto Mono', monospace; font-size: 9px;
    letter-spacing: 3px; text-transform: uppercase;
    color: var(--text-dim); pointer-events: none;
}

/* Controls */
.bottom-controls {
    display: flex; gap: 8px; align-items: center;
}

.btn-gta {
    font-family: 'Oswald', sans-serif; font-weight: 600;
    font-size: 13px; text-transform: uppercase; letter-spacing: 2px;
    padding: 12px 36px; border: none; cursor: pointer;
    transition: all 0.15s ease; position: relative; overflow: hidden;
}
.btn-gta::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 50%);
    pointer-events: none;
}
.btn-primary { background: #fff; color: #000; }
.btn-primary:hover { background: var(--gta-red); color: #fff; transform: scale(1.03); }
.btn-secondary {
    background: rgba(255,255,255,0.08); color: var(--text-mid);
    backdrop-filter: blur(4px);
}
.btn-secondary:hover { background: rgba(255,255,255,0.15); color: #fff; }
.btn-gta:disabled { opacity: 0.25; cursor: not-allowed; transform: none !important; }

#timer-val {
    display: inline-block;
    width: 32px;
    margin-left: 8px;
    opacity: 0.6;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9em;
    font-weight: 400;
    text-align: left;
    transition: all 0.1s ease;
}

#timer-val.urgent {
    color: var(--gta-red);
    font-weight: 700;
    opacity: 1;
}

/* When button is hovered (turns red), make urgent timer black */
#btn-trigger:hover #timer-val.urgent {
    color: #000 !important;
}
#btn-trigger:hover #timer-val {
    opacity: 0.9;
}

/* ===== OVERLAYS ===== */
.muzzle-flash-overlay {
    position: absolute; inset: 0; z-index: 100;
    pointer-events: none; opacity: 0;
    background: radial-gradient(circle at 50% 45%, rgba(255,200,50,0.4) 0%, rgba(255,100,0,0.1) 40%, transparent 70%);
    transition: opacity 0.1s;
}

.mission-overlay {
    position: absolute; top: 45%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200; text-align: center;
    pointer-events: none; opacity: 0;
    transition: opacity 0.3s;
}
.mission-main {
    font-family: 'Oswald', sans-serif; font-weight: 700; font-style: italic;
    font-size: 90px; text-transform: uppercase; letter-spacing: -3px; line-height: 1;
    text-shadow: 0 0 60px rgba(0,0,0,0.8), 0 4px 0 rgba(0,0,0,0.5);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.mission-sub {
    font-family: 'Roboto Mono', monospace; font-size: 11px;
    letter-spacing: 5px; text-transform: uppercase; margin-top: 10px; color: var(--text-mid);
}
.mission-wasted .mission-main { color: var(--gta-red); }
.mission-survived .mission-main { color: var(--gta-green); }

/* ===== SCREEN FX ===== */
.screen-shake { animation: shake 0.3s ease-out; }
@keyframes shake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-8px, 4px); }
    20% { transform: translate(6px, -6px); }
    30% { transform: translate(-4px, 2px); }
    40% { transform: translate(4px, -2px); }
}
.red-flash { animation: redFlash 0.4s ease-out; }
@keyframes redFlash {
    0% { box-shadow: inset 0 0 200px rgba(226,27,27,0.5); }
    100% { box-shadow: inset 0 0 0 transparent; }
}
.grayscale-death {
    filter: grayscale(0.8) contrast(1.1) brightness(0.7);
    transition: filter 0.8s ease;
}

/* Smoke */
.smoke-particle {
    position: absolute; border-radius: 50%;
    background: radial-gradient(circle, rgba(180,180,180,0.3) 0%, transparent 70%);
    pointer-events: none; z-index: 90;
}

/* Corner deco */
.corner-deco {
    position: absolute; z-index: 10; pointer-events: none;
    font-family: 'Roboto Mono', monospace; font-size: 7px;
    color: rgba(255,255,255,0.06); letter-spacing: 1px;
}
.corner-deco.bl { bottom: max(18px, env(safe-area-inset-bottom, 18px)); left: 24px; }
.corner-deco.br { bottom: max(18px, env(safe-area-inset-bottom, 18px)); right: 24px; text-align: right; }

/* ===== SIDE PANELS ===== */
.side-panel {
    position: absolute; z-index: 15;
    bottom: max(14px, env(safe-area-inset-bottom, 14px)); top: auto; transform: none;
    width: 220px;
    padding: 0; border: none; background: transparent; backdrop-filter: none;
    pointer-events: none;
}
.side-panel-left { left: 14px; }
.side-panel-right { right: 14px; }

.sp-header { margin-bottom: 10px; }
.sp-title {
    font-family: 'Oswald', sans-serif; font-size: 10px;
    font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
    color: rgba(255,255,255,0.5);
}
.sp-badge {
    font-family: 'Roboto Mono', monospace; font-size: 7px;
    background: rgba(255,215,0,0.15); color: #ffd700;
    padding: 1px 5px; letter-spacing: 1px; margin-left: 4px;
    vertical-align: middle;
}
.sp-line {
    height: 1px; margin-top: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.1), transparent);
}
.side-panel-right .sp-line {
    background: linear-gradient(270deg, rgba(255,255,255,0.1), transparent);
}

.sp-list { display: flex; flex-direction: column; gap: 4px; }

.sp-empty {
    font-family: 'Roboto Mono', monospace; font-size: 8px;
    color: rgba(255,255,255,0.15); letter-spacing: 1px;
    padding: 8px 0;
}

/* History rows */
.hist-row {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-family: 'Roboto Condensed', sans-serif; font-size: 11px;
}
.hist-round {
    font-family: 'Roboto Mono', monospace; font-size: 8px;
    color: var(--text-dim); min-width: 18px;
}
.hist-result {
    font-family: 'Oswald', sans-serif; font-weight: 600;
    font-size: 10px; letter-spacing: 1px;
    flex: 1;
}
.hist-result.win { color: var(--gta-green); }
.hist-result.loss { color: var(--gta-red); }
.hist-amt {
    font-family: 'Roboto Mono', monospace; font-size: 9px;
}
.hist-amt.win { color: var(--gta-green); }
.hist-amt.loss { color: var(--gta-red); }

/* Leaderboard rows - Game UI Style */
.lb-list { display: flex; flex-direction: column; background: rgba(0,0,0,0.85); pointer-events: auto; }
.lb-row {
    display: flex; align-items: center; justify-content: flex-start; gap: 10px;
    background: transparent;
    border: none; border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 12px 15px; cursor: pointer;
    transition: all 0.1s ease;
    color: rgba(255,255,255,0.8);
}
.lb-row:hover { background: rgba(255,255,255,0.1); color: #fff; }

.lb-rank-wrap { display: none; } /* Hide the old diamond shape */

.lb-rank {
    font-family: 'Oswald', sans-serif; font-size: 14px; font-weight: 700;
    color: rgba(255,255,255,0.5); width: 20px; text-align: left;
}

.lb-info { flex: 1; display: flex; flex-direction: column; gap: 0px; }
.lb-name {
    font-family: 'Oswald', sans-serif; font-size: 12px; font-weight: 600;
    color: inherit; letter-spacing: 1px;
}
.lb-wins {
    font-family: 'Roboto Mono', monospace; font-size: 8px;
    color: rgba(255,255,255,0.5); letter-spacing: 1px;
}
.lb-amount {
    font-family: 'Oswald', sans-serif; font-size: 13px; font-weight: 700;
    color: inherit;
}

/* Rank tiers - Override specific colors to match GTA clean look */
.lb-gold, .lb-silver, .lb-bronze { border-color: rgba(255,255,255,0.1); background: transparent; }
.lb-gold .lb-rank { color: #ffd700; }
.lb-silver .lb-rank { color: #c0c0c0; }
.lb-bronze .lb-rank { color: #cd7f32; }

/* Your row */
.lb-you {
    background: #fff; color: #000; border-bottom: none;
}
.lb-you:hover { background: #fff; color: #000; }
.lb-you .lb-rank { color: #000; }
.lb-you .lb-wins { color: rgba(0,0,0,0.6); }
.lb-you-tag {
    font-family: 'Roboto Mono', monospace; font-size: 8px;
    background: #000; color: #fff;
    padding: 2px 5px; letter-spacing: 1px; margin-left: 6px;
    vertical-align: middle;
}

/* ===== MONEY RESULT ANIMATION ===== */
.money-result {
    position: absolute;
    top: 65%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 210; pointer-events: none;
    opacity: 0;
    text-align: center;
}

.money-result.show-win {
    animation: moneyWin 2s ease-out forwards;
}
.money-result.show-lose {
    animation: moneyLose 2s ease-out forwards;
}

.money-result-amount {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 60px;
    line-height: 1;
    text-shadow: 0 0 30px currentColor, 0 2px 0 rgba(0,0,0,0.5);
}

.money-result.show-win .money-result-amount {
    color: #2ecc71;
}
.money-result.show-lose .money-result-amount {
    color: var(--gta-red);
}

@keyframes moneyWin {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    30% { transform: translate(-50%, -50%) scale(1); }
    70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(0.9); }
}

@keyframes moneyLose {
    0% { opacity: 0; transform: translate(-50%, -70%) scale(0.5); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    30% { transform: translate(-50%, -50%) scale(1); }
    70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -30%) scale(0.9); }
}

#mobile-menu-toggle, #mobile-lb-toggle {
    position: absolute;
    bottom: 20px;
    /* Respect safe area so toggles aren't hidden behind home indicator */
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    z-index: 250;
    display: none;
    padding: 10px 16px;
    font-size: 12px;
}
#mobile-menu-toggle { left: 0; }
#mobile-lb-toggle { right: 0; }

.mobile-top-logo {
    display: none;
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
    .mobile-top-logo {
        display: block;
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 260;
        font-family: 'Oswald', sans-serif;
        font-weight: 700;
        font-style: italic;
        font-size: 15px;
        letter-spacing: -0.5px;
        color: #fff;
        pointer-events: none;
    }
    .mobile-top-logo span:first-child { color: var(--gta-red); }
    .mobile-top-logo .tubelight { margin-left: 3px; font-style: normal; }
    .intro-logo { font-size: 60px; }
    .intro-start { padding: 12px 30px; font-size: 13px; }
    
    .tekken-hud { top: 50px; padding: 0 10px; }
    .tk-name { font-size: 18px; }
    .tk-bal-val { font-size: 16px; }
    .tk-round-badge { width: 40px; height: 40px; }
    .tk-round-num { font-size: 18px; }
    .audio-toggle-btn { top: 10px; right: auto; left: 50%; transform: translateX(-50%); padding: 4px 8px; font-size: 13px; }

    /* Safe area padding is already applied globally via env(safe-area-inset-bottom)
       and 100dvh — no hardcoded 10vh hack needed */

    #mobile-menu-toggle, #mobile-lb-toggle { display: block; bottom: auto; top: 0; }
    .side-panel {
        width: 190px;
        z-index: 240;
        pointer-events: all;
    }
    .side-panel-left { 
        display: none; 
        top: 44px;
        bottom: auto; 
        left: 0; 
    }
    .side-panel-left.mobile-open { display: block; }
    
    .side-panel-right { 
        display: none; 
        top: 44px;
        bottom: auto; 
        right: 0; 
    }
    .side-panel-right.mobile-open { display: block; }

    /* Side panel content */
    .sp-title { font-size: 16px !important; }
    .sp-line { font-size: 13px !important; }
    .lb-row { padding: 10px 12px; }
    .lb-name { font-size: 13px; }
    .lb-amount { font-size: 13px; }
    .sp-mode-btn { font-size: 14px !important; padding: 10px 14px !important; }
    .bet-chip { font-size: 14px !important; }

    /* Bottom HUD: let safe-area-inset handle clearance; add extra 60px so it sits above mobile toggles */
    .hud-bottom { bottom: 44px; padding-bottom: max(0px, env(safe-area-inset-bottom, 0px)); gap: 8px; }
    .chamber-slot { width: 26px; height: 26px; }
    .pot-amount { font-size: 28px; }
    .btn-gta { padding: 10px 24px; font-size: 14px; }
    #btn-trigger { padding: 18px 44px; font-size: 18px; font-weight: 700; transform: scale(1.1); margin-top: 16px; }
    #btn-restart { padding: 18px 44px; font-size: 18px; font-weight: 700; transform: scale(1.1); margin-top: 16px; }
    
    .mission-main { font-size: 60px; }
    .cd-number { font-size: 80px; }
    .money-result-amount { font-size: 40px; }
    
    .bet-chip-left { left: 10px; }
    .bet-chip-right { right: 10px; }

    .tk-bar-left .tk-bar-bg { clip-path: polygon(0 0, 90% 0, 100% 100%, 0 100%); }
    .tk-bar-right .tk-bar-bg { clip-path: polygon(10% 0, 100% 0, 100% 100%, 0 100%); }
}

@media (max-width: 480px) {
    .intro-logo { font-size: 50px; }
    .intro-desc { font-size: 10px; letter-spacing: 2px; }
    
    .tekken-hud { top: 42px; padding: 0 5px; }
    .tk-name { font-size: 15px; }
    .tk-bal-val { font-size: 13px; }
    .tk-shots-val { font-size: 13px; }
    .tk-tag { font-size: 8px; padding: 2px 5px; }
    .audio-toggle-btn { top: 5px; }
    
    #mobile-menu-toggle, #mobile-lb-toggle { bottom: auto; top: 0; padding: 9px 14px; font-size: 12px; }
    .side-panel {
        transform: none;
        width: 180px;
        z-index: 240;
        pointer-events: all;
    }
    .side-panel-left { display: none; top: 40px; bottom: auto; left: 0; transform-origin: top left; }
    .side-panel-left.mobile-open { display: block; }
    
    .side-panel-right { display: none; top: 40px; bottom: auto; right: 0; transform-origin: top right; }
    .side-panel-right.mobile-open { display: block; }

    /* Side panel content */
    .sp-title { font-size: 14px !important; }
    .sp-line { font-size: 12px !important; }
    .lb-name { font-size: 12px; }
    .lb-amount { font-size: 12px; }
    .sp-mode-btn { font-size: 13px !important; }
    .bet-chip { font-size: 13px !important; }

    .hud-bottom { bottom: 34px; padding-bottom: max(0px, env(safe-area-inset-bottom, 0px)); }
    .chamber-slot { width: 22px; height: 22px; font-size: 9px; }
    .pot-amount { font-size: 22px; }
    .btn-gta { padding: 9px 18px; font-size: 13px; }
    #btn-trigger { padding: 16px 34px; font-size: 16px; transform: scale(1.1); margin-top: 12px; }
    #btn-restart { padding: 16px 34px; font-size: 16px; transform: scale(1.1); margin-top: 12px; }
    
    .mission-main { font-size: 40px; }
    .mission-sub { font-size: 10px; letter-spacing: 3px; }
    .cd-number { font-size: 60px; }
    .money-result-amount { font-size: 30px; }
}
