/* ============ TOKENS ============ */
:root {
    --bg: #12082a;
    --bg-2: #2a0f4f;
    --surface: rgba(255, 255, 255, 0.07);
    --surface-2: rgba(255, 255, 255, 0.12);
    --border: rgba(255, 255, 255, 0.14);
    --text: #fbf7ff;
    --muted: #b9add6;
    --pink: #ff4f9a;
    --violet: #8b5cff;
    --red: #ff4646;
    --gold: #ffc83d;
    --green: #2fe39a;
    --blue: #3fa9ff;
    --teal: #22d3b6;
    --orange: #ff9a3d;
    --grad: linear-gradient(135deg, #8b5cff 0%, #c13cae 50%, #ff4f9a 100%);
    --radius: 20px;
    --shadow: 0 20px 50px rgba(5, 0, 20, 0.55);
    --font-display: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --tint: #8b5cff;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ============ BACKGROUND ============ */
.bg {
    position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
    background:
        radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--tint) 55%, transparent) 0%, transparent 60%),
        linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 70%);
    transition: background 0.8s ease;
}
.bg span { position: absolute; border-radius: 50%; }
.bg span:nth-child(1) { width: 520px; height: 520px; top: -220px; right: -240px; background: radial-gradient(circle, rgba(255, 79, 154, 0.38), transparent 65%); }
.bg span:nth-child(2) { width: 480px; height: 480px; bottom: -220px; left: -220px; background: radial-gradient(circle, rgba(139, 92, 255, 0.4), transparent 65%); }
.bg span:nth-child(3) { width: 360px; height: 360px; top: 40%; left: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--tint) 30%, transparent), transparent 65%); }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; width: 100%; height: 100%; }

/* ============ LAYOUT ============ */
.app {
    position: relative; z-index: 1;
    max-width: 560px;
    margin: 0 auto;
    min-height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}
.app.wide { max-width: 900px; }
.screen { display: none; flex-direction: column; flex: 1; gap: 16px; animation: screenIn 0.35s ease; }
.screen.active { display: flex; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.panel h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.panel h2 + .hint { margin-top: -6px; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; border-radius: 999px; cursor: pointer;
    padding: 13px 22px; font-weight: 700; font-size: 1rem;
    background: var(--surface-2); color: var(--text);
    transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s, background 0.2s;
    user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); box-shadow: 0 10px 30px rgba(255, 79, 154, 0.35); }
.btn-primary:not(:disabled):hover { box-shadow: 0 14px 36px rgba(255, 79, 154, 0.5); }
.btn-success { background: linear-gradient(135deg, #22c983, #12a06a); box-shadow: 0 10px 26px rgba(34, 201, 131, 0.3); }
.btn-danger { background: linear-gradient(135deg, #ff5a5a, #d6264a); box-shadow: 0 10px 26px rgba(255, 70, 70, 0.3); }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn-xl { font-family: var(--font-display); font-size: 1.3rem; padding: 16px 28px; width: 100%; letter-spacing: 0.5px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn-row .btn { flex: 1 1 140px; }

.icon-btn {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 14px; border: 1px solid var(--border);
    background: var(--surface); cursor: pointer;
    display: grid; place-items: center; font-size: 1.15rem;
    transition: background 0.2s, transform 0.12s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.off { opacity: 0.5; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ============ TOPBAR ============ */
.topbar { display: flex; align-items: center; gap: 10px; }
.topbar h2 {
    flex: 1; text-align: center;
    font-family: var(--font-display); font-size: 1.35rem; font-weight: 800;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .spacer { width: 44px; }

/* ============ LOBBY ============ */
.brand { text-align: center; padding: 8px 0 4px; }
.brand-logo {
    width: 96px; height: 96px; border-radius: 26px;
    box-shadow: 0 16px 40px rgba(193, 60, 174, 0.5);
    animation: pop 0.6s cubic-bezier(0.18, 0.9, 0.3, 1.3); transform: rotate(-4deg);
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
.brand h1 {
    font-family: var(--font-display); font-weight: 800;
    font-size: clamp(2.4rem, 11vw, 3.4rem); line-height: 1; margin-top: 10px;
    letter-spacing: -0.5px;
}
.brand h1 em {
    font-style: normal;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand p { color: var(--muted); margin-top: 6px; }

.add-player { display: flex; gap: 10px; }
.add-player input {
    flex: 1; min-width: 0;
    background: rgba(0, 0, 0, 0.25); color: var(--text);
    border: 1px solid var(--border); border-radius: 14px;
    padding: 13px 16px; font-size: 1rem; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.add-player input::placeholder { color: #8c80ad; }
.add-player input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 79, 154, 0.25); }
.add-player .btn { padding: 0 20px; font-size: 1.4rem; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chips:empty { display: none; }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 6px 5px 5px; border-radius: 999px;
    background: var(--surface-2); font-weight: 600;
    animation: pop 0.3s cubic-bezier(0.18, 0.9, 0.3, 1.3);
}
.chip button {
    border: none; background: rgba(255, 255, 255, 0.12); width: 26px; height: 26px; border-radius: 50%;
    cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.chip button:hover { background: var(--red); }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    font-weight: 800; font-size: 0.85rem; color: #1a0b33;
    background: var(--c, var(--gold));
}

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: rgba(0, 0, 0, 0.25); padding: 5px; border-radius: 16px; }
.segmented button {
    border: none; background: transparent; border-radius: 12px; padding: 10px 6px; cursor: pointer;
    font-weight: 700; font-size: 0.92rem; color: var(--muted); transition: background 0.2s, color 0.2s;
}
.segmented .se { display: block; font-size: 1.25rem; line-height: 1.2; }
.segmented button small { display: block; font-weight: 500; font-size: 0.72rem; opacity: 0.8; margin-top: 2px; }
.segmented button.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(193, 60, 174, 0.35); }
.setting + .setting { margin-top: 16px; }
.setting-label { font-weight: 700; font-size: 0.9rem; margin-bottom: 8px; display: block; }

.games-picker summary {
    cursor: pointer; font-weight: 700; font-size: 0.9rem; list-style: none;
    display: flex; justify-content: space-between; align-items: center;
}
.games-picker summary::-webkit-details-marker { display: none; }
.games-picker summary::after { content: '▾'; transition: transform 0.2s; }
.games-picker[open] summary::after { transform: rotate(180deg); }
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.toggle {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; border-radius: 12px; cursor: pointer;
    background: rgba(0, 0, 0, 0.2); border: 1px solid var(--border);
    font-size: 0.88rem; font-weight: 600; text-align: left;
    transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}
.toggle.on { border-color: var(--pink); background: rgba(255, 79, 154, 0.12); }
.toggle:not(.on) { opacity: 0.55; }

.lobby-footer { text-align: center; color: var(--muted); font-size: 0.82rem; line-height: 1.7; margin-top: auto; padding-top: 8px; }
.link { background: none; border: none; color: var(--text); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ============ HUB ============ */
.progress { flex: 1; position: relative; height: 44px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--grad); opacity: 0.55; transition: width 0.5s ease; }
.progress span { position: relative; display: grid; place-items: center; height: 100%; font-weight: 700; font-size: 0.88rem; }

.turn { display: flex; align-items: center; gap: 14px; padding: 4px 4px 0; }
.turn .avatar { width: 54px; height: 54px; font-size: 1.4rem; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1); }
.turn-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.turn-name { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; line-height: 1.05; word-break: break-word; }
.turn-next { color: var(--muted); font-size: 0.82rem; }
.turn.bump { animation: bump 0.45s ease; }
@keyframes bump { 0% { transform: translateX(-12px); opacity: 0; } 100% { transform: none; opacity: 1; } }

.deck-area { flex: 1; display: grid; place-items: center; padding: 6px 0; perspective: 1400px; }
.flip-card {
    position: relative;
    width: min(320px, 82vw, calc(56dvh * 5 / 7)); min-width: 220px; aspect-ratio: 5 / 7;
    cursor: pointer; outline: none;
}
.flip-card::before, .flip-card::after {
    content: ''; position: absolute; inset: 0; border-radius: 26px;
    background: #2a1452; border: 1px solid var(--border); transition: opacity 0.3s;
}
.flip-card::before { transform: translate(8px, 8px) rotate(3deg); opacity: 0.6; }
.flip-card::after { transform: translate(-6px, 10px) rotate(-3deg); opacity: 0.35; }
.flip-card.last::before, .flip-card.last::after { opacity: 0; }
.flip-inner {
    position: absolute; inset: 0; z-index: 1;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-card.dealing .flip-inner { animation: deal 0.45s ease; }
@keyframes deal { from { transform: translateY(-30px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.card-face {
    position: absolute; inset: 0; border-radius: 26px;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    overflow: hidden; box-shadow: var(--shadow);
}
.card-back {
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 12px),
        var(--grad);
    border: 6px solid rgba(255, 255, 255, 0.9);
}
.card-back-inner {
    width: 78%; height: 82%; border: 2px dashed rgba(255, 255, 255, 0.5); border-radius: 18px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.card-back img { width: 46%; border-radius: 22%; box-shadow: 0 10px 30px rgba(0,0,0,0.3); animation: bob 4s ease-in-out infinite; }
.card-back strong { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; text-shadow: 0 2px 10px rgba(0,0,0,0.25); }
.card-back small { font-weight: 700; letter-spacing: 2px; font-size: 0.72rem; opacity: 0.9; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.card-front {
    transform: rotateY(180deg);
    background: #fffaf3; color: #1d1030;
    border: 6px solid var(--cat, var(--violet));
    padding: 52px 22px 22px; text-align: center; justify-content: center;
}
.card-front::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 46%;
    background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--cat, var(--violet)) 28%, transparent), transparent 70%);
    pointer-events: none;
}
.card-cat {
    position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
    background: var(--cat, var(--violet)); color: #fff;
    padding: 5px 14px; border-radius: 999px; white-space: nowrap;
    font-weight: 800; font-size: 0.72rem; letter-spacing: 1.5px; text-transform: uppercase;
}
.card-emoji { font-size: clamp(3.2rem, 15vw, 4.6rem); line-height: 1; margin: 6px 0 10px; position: relative; filter: drop-shadow(0 8px 10px rgba(0,0,0,0.15)); }
.card-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.4rem, 6vw, 1.8rem); line-height: 1.05; margin-bottom: 10px; position: relative; }
.card-text { font-size: clamp(0.95rem, 4vw, 1.08rem); line-height: 1.45; color: #4a3d63; position: relative; overflow-wrap: anywhere; }
.card-text b { color: #1d1030; }
.card-text .sips { display: inline-block; background: color-mix(in srgb, var(--cat, var(--violet)) 16%, white); color: #1d1030; padding: 0 7px; border-radius: 8px; font-weight: 800; white-space: nowrap; }
.card-foot { position: absolute; left: 16px; right: 16px; bottom: 14px; font-size: 0.75rem; color: #8a7fa3; font-weight: 600; }

.card-actions { display: flex; flex-direction: column; gap: 10px; min-height: 52px; }
.card-actions .btn-row { animation: screenIn 0.3s ease; }
.rule-input {
    width: 100%; background: rgba(0, 0, 0, 0.25); color: var(--text);
    border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; font-size: 1rem; outline: none;
}
.rule-input:focus { border-color: var(--blue); }

.rules-strip { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rules-strip:empty { display: none; }
.rule-chip {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    padding: 6px 8px 6px 12px; border-radius: 12px;
    background: rgba(63, 169, 255, 0.14); border: 1px solid rgba(63, 169, 255, 0.4);
    font-size: 0.82rem; font-weight: 600; animation: pop 0.3s ease;
}
.rule-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-chip em { font-style: normal; opacity: 0.75; font-size: 0.75rem; white-space: nowrap; }
.rule-chip button { border: none; background: none; cursor: pointer; opacity: 0.6; padding: 0 4px; font-size: 1rem; }
.rule-chip button:hover { opacity: 1; }
.rule-chip.double { background: rgba(255, 200, 61, 0.15); border-color: rgba(255, 200, 61, 0.5); }

/* ============ MENU ============ */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.game-tile {
    position: relative; text-align: left; cursor: pointer; border: none;
    padding: 16px 14px; border-radius: var(--radius); min-height: 150px;
    background: var(--g); color: #fff; overflow: hidden;
    display: flex; flex-direction: column; gap: 6px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.game-tile:hover { transform: translateY(-4px) rotate(-0.5deg); box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4); }
.game-tile:active { transform: scale(0.97); }
.game-tile .ge { font-size: 2.4rem; line-height: 1; }
.game-tile h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; line-height: 1.1; margin-top: 4px; }
.game-tile p { font-size: 0.8rem; opacity: 0.9; line-height: 1.35; }
.game-tile .tag {
    position: absolute; top: 12px; right: 12px; background: rgba(0, 0, 0, 0.35);
    padding: 4px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
}
.game-tile::after {
    content: ''; position: absolute; width: 140px; height: 140px; border-radius: 50%;
    right: -40px; bottom: -60px; background: rgba(255, 255, 255, 0.12);
}

/* ============ GAME SCREEN ============ */
.game-intro { text-align: center; }
.game-intro .big-emoji { font-size: 4.5rem; line-height: 1; margin: 6px 0 10px; animation: bob 3s ease-in-out infinite; }
.rules-list { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 10px; margin: 12px 0 18px; counter-reset: r; }
.rules-list li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.45; font-size: 0.97rem; }
.rules-list li::before {
    counter-increment: r; content: counter(r);
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 800; font-size: 0.85rem;
    background: var(--tint); color: #fff;
}
.game-body { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.game-body:empty { display: none; }

.status {
    text-align: center; padding: 14px 16px; border-radius: 16px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 1.05rem; font-weight: 600; line-height: 1.4;
}
.status .avatar { display: inline-grid; vertical-align: middle; margin-right: 6px; }
.status strong { font-family: var(--font-display); font-size: 1.3rem; color: var(--gold); }
.status.alert { background: rgba(255, 70, 70, 0.15); border-color: rgba(255, 70, 70, 0.5); }
.status.good { background: rgba(47, 227, 154, 0.12); border-color: rgba(47, 227, 154, 0.45); }

.grid-tiles { display: grid; gap: 12px; grid-template-columns: repeat(var(--cols, 3), 1fr); }
.tile {
    position: relative; aspect-ratio: 1; border-radius: 18px; border: 2px solid rgba(255, 255, 255, 0.2);
    background: var(--tb, var(--surface-2)); cursor: pointer;
    display: grid; place-items: center; font-size: clamp(1.8rem, 8vw, 2.6rem);
    transition: transform 0.15s ease, background 0.3s, border-color 0.3s;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}
.tile:not(:disabled):hover { transform: translateY(-3px); }
.tile:disabled { cursor: default; }
.tile.safe { background: linear-gradient(135deg, #22c983, #0f8a5a); border-color: #6ff5c0; }
.tile.boom { background: linear-gradient(135deg, #ff5a5a, #a3142f); border-color: #ffb3b3; animation: shake 0.5s ease; }
.tile.gold { background: linear-gradient(135deg, #ffd34d, #e89a0c); border-color: #fff0b3; }
.tile.picked { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 200, 61, 0.35); }
.tile.flip { animation: tileflip 0.5s ease; }
.tile .badges { position: absolute; bottom: 6px; left: 6px; right: 6px; display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.tile .badges .avatar { width: 22px; height: 22px; font-size: 0.65rem; }
@keyframes tileflip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px) rotate(-4deg); } 40% { transform: translateX(8px) rotate(4deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }

.balloon {
    border-radius: 50% 50% 46% 46%; aspect-ratio: 0.82; border: none;
    background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.6), transparent 22%), var(--tb);
    animation: float 3s ease-in-out infinite; animation-delay: var(--d, 0s);
}
.balloon.popped { animation: popout 0.35s ease forwards; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes popout { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(0.85); } }

.player-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pick {
    display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; cursor: pointer;
    background: var(--surface); border: 2px solid var(--border); font-weight: 700; text-align: left;
    transition: border-color 0.2s, background 0.2s, transform 0.12s;
}
.pick:active { transform: scale(0.96); }
.pick.on { border-color: var(--pink); background: rgba(255, 79, 154, 0.16); }
.pick span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.big-number { font-family: var(--font-display); font-weight: 800; text-align: center; font-size: clamp(4rem, 22vw, 7rem); line-height: 1; color: var(--gold); text-shadow: 0 6px 30px rgba(255, 200, 61, 0.4); }
.big-number.pulse { animation: numpulse 1s ease; }
@keyframes numpulse { 0% { transform: scale(1.5); opacity: 0; } 30% { transform: scale(1); opacity: 1; } }

/* F1 */
.f1-board {
    background: #0c0c12; border-radius: 22px; padding: 22px 14px; border: 2px solid #2a2a38;
    display: flex; justify-content: center; gap: clamp(6px, 3vw, 16px); cursor: pointer; user-select: none; touch-action: manipulation;
}
.f1-light { display: flex; flex-direction: column; gap: 8px; background: #1b1b26; padding: 8px; border-radius: 14px; }
.f1-light i { display: block; width: clamp(30px, 11vw, 48px); aspect-ratio: 1; border-radius: 50%; background: #2c0a0a; transition: background 0.05s, box-shadow 0.05s; }
.f1-light.on i { background: #ff2a2a; box-shadow: 0 0 22px #ff2a2a, inset 0 -4px 8px rgba(0,0,0,0.3); }
.f1-board.go { border-color: var(--green); box-shadow: 0 0 40px rgba(47, 227, 154, 0.35); }

/* Leaderboard */
.board { display: flex; flex-direction: column; gap: 8px; }
.board-row {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--border); font-weight: 600;
}
.board-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .val { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.board-row.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 200, 61, 0.25); }
.board-row.loser { border-color: rgba(255, 70, 70, 0.6); background: rgba(255, 70, 70, 0.12); }
.board-row .bar { height: 6px; border-radius: 3px; background: var(--grad); margin-top: 4px; }
.board-row .grow { flex: 1; min-width: 0; }

/* Blackjack */
.felt { background: radial-gradient(circle at 50% 0%, #1b7a4c, #0b3d26); border-radius: 22px; padding: 12px; border: 6px solid #5b3a1a; box-shadow: inset 0 0 40px rgba(0,0,0,0.4); }
.felt h4 { text-align: center; font-size: 0.85rem; letter-spacing: 1px; text-transform: uppercase; opacity: 0.85; margin-bottom: 6px; }
.hand { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; min-height: 70px; }
.pcard {
    width: 46px; height: 66px; border-radius: 7px; background: #fff; color: #111;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.05rem; line-height: 1.05; box-shadow: 0 3px 8px rgba(0,0,0,0.4);
    animation: pop 0.3s ease;
}
.pcard.red { color: #e11d48; }
.pcard.hidden-card { background: repeating-linear-gradient(45deg, #8b5cff 0 4px, #c13cae 4px 8px); color: transparent; }
.pcard.big { width: 110px; height: 156px; font-size: 2.6rem; border-radius: 14px; }
.bj-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-top: 14px; }
.bj-seat { background: rgba(0, 0, 0, 0.25); border-radius: 14px; padding: 10px; text-align: center; border: 2px solid transparent; transition: border-color 0.2s; }
.bj-seat.active { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 200, 61, 0.3); }
.bj-seat .hand { min-height: 0; }
.bj-seat .pcard { width: 34px; height: 48px; font-size: 0.8rem; }
.bj-seat h5 { font-size: 0.95rem; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bj-score { font-size: 0.85rem; margin-top: 6px; opacity: 0.9; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; margin-top: 4px; }
.badge.win { background: var(--green); color: #052; }
.badge.lose { background: var(--red); }
.badge.draw { background: #64748b; }

/* Roulette */
.glasses { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.glass {
    padding: 14px 8px; border-radius: 18px; text-align: center; background: var(--surface); border: 2px solid var(--border);
    transition: background 0.1s, border-color 0.1s, transform 0.1s;
}
.glass div { font-size: 2.2rem; }
.glass span { display: block; font-weight: 700; font-size: 0.88rem; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.glass.lit { background: rgba(255, 70, 70, 0.3); border-color: var(--red); transform: scale(1.06); }
.glass.chosen { background: linear-gradient(135deg, #ff5a5a, #a3142f); border-color: #fff; transform: scale(1.1); animation: shake 0.5s ease; }

/* Wheel */
.wheel-wrap { position: relative; width: min(340px, 86vw); aspect-ratio: 1; margin: 0 auto; }
.wheel-pointer {
    position: absolute; top: -10px; left: 50%; transform: translateX(-50%); z-index: 2;
    width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 30px solid var(--gold);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
}
.wheel {
    position: absolute; inset: 0; border-radius: 50%; border: 8px solid #fff;
    box-shadow: 0 0 0 4px var(--gold), var(--shadow);
    transition: transform 4.5s cubic-bezier(0.12, 0.8, 0.15, 1);
}
.wheel-label {
    position: absolute; left: 50%; top: 50%; width: 50%; height: 26px; margin-top: -13px;
    transform-origin: 0 50%; display: flex; align-items: center; justify-content: flex-end;
    padding-right: 14px; font-weight: 800; font-size: clamp(0.66rem, 2.8vw, 0.86rem); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.wheel-hub { position: absolute; inset: 40%; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 1.8rem; box-shadow: 0 4px 12px rgba(0,0,0,0.35); z-index: 1; }

/* Bomb */
.bomb { font-size: clamp(6rem, 30vw, 9rem); text-align: center; line-height: 1; user-select: none; }
.bomb.ticking { animation: tick var(--speed, 1s) ease-in-out infinite; }
.bomb.exploded { animation: shake 0.5s ease; }
@keyframes tick { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12) rotate(-4deg); } }
.category-box { text-align: center; padding: 18px; border-radius: 18px; background: var(--surface-2); border: 1px dashed var(--border); }
.category-box small { color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; font-size: 0.72rem; }
.category-box div { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; line-height: 1.15; margin-top: 4px; }

/* Pirate */
.pirate-hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pirate-hud div { background: rgba(0,0,0,0.25); border: 1px solid rgba(255, 200, 61, 0.35); border-radius: 14px; padding: 10px; text-align: center; }
.pirate-hud b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--gold); line-height: 1.1; }
.pirate-hud small { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.sand { --tb: linear-gradient(135deg, #d9a35b, #a8692b); border-color: rgba(255, 230, 180, 0.5); }

/* Result */
.game-result { display: flex; flex-direction: column; gap: 14px; }
.game-result:empty { display: none; }
.result-card { text-align: center; padding: 22px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); animation: pop 0.4s cubic-bezier(0.18, 0.9, 0.3, 1.3); }
.result-card .re { font-size: 3.4rem; line-height: 1; }
.result-card h3 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; margin: 8px 0 4px; line-height: 1.1; }
.result-card p { color: var(--muted); }
.drinkers { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; text-align: left; }
.drinker { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 70, 70, 0.12); border: 1px solid rgba(255, 70, 70, 0.35); }
.drinker .name { flex: 1; font-weight: 700; }
.drinker .what { font-weight: 800; color: var(--gold); white-space: nowrap; }
.drinker.give { background: rgba(47, 227, 154, 0.1); border-color: rgba(47, 227, 154, 0.35); }

/* ============ MODAL & TOAST ============ */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(8, 2, 20, 0.7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card {
    width: 100%; max-width: 440px; max-height: 88dvh; overflow-y: auto;
    background: linear-gradient(180deg, #2b1356, #1a0b33); border: 1px solid var(--border); border-radius: 24px;
    padding: 22px 18px; box-shadow: var(--shadow); animation: pop 0.3s cubic-bezier(0.18, 0.9, 0.3, 1.3);
    display: flex; flex-direction: column; gap: 14px;
}
.modal-card h2 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; text-align: center; line-height: 1.1; }
.modal-card .sub { text-align: center; color: var(--muted); margin-top: -8px; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .btn { justify-content: flex-start; border-radius: 16px; padding: 14px 16px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: 6px 0; }
.podium div { flex: 1; max-width: 120px; text-align: center; }
.podium .step { border-radius: 14px 14px 4px 4px; background: var(--grad); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; }
.podium .p1 .step { height: 96px; }
.podium .p2 .step { height: 70px; opacity: 0.8; }
.podium .p3 .step { height: 52px; opacity: 0.65; }
.podium .pn { font-weight: 700; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .pe { font-size: 1.8rem; }
.awards { display: flex; flex-direction: column; gap: 8px; }
.award { display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: 14px; padding: 10px 12px; }
.award .ae { font-size: 1.6rem; }
.award b { display: block; }
.award small { color: var(--muted); }

.toast {
    position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 60;
    transform: translate(-50%, 140%); opacity: 0;
    background: #fff; color: #1d1030; font-weight: 700; padding: 12px 18px; border-radius: 999px;
    box-shadow: var(--shadow); transition: transform 0.35s cubic-bezier(0.2, 1.2, 0.4, 1), opacity 0.3s; width: max-content; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (min-width: 700px) {
    .app { padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============ AGE GATE ============ */
.age-gate { z-index: 80; background: rgba(8, 2, 20, 0.92); }
.age-gate .modal-card { text-align: center; align-items: stretch; }
.age-logo { width: 80px; height: 80px; border-radius: 22px; margin: 0 auto; box-shadow: 0 12px 30px rgba(193, 60, 174, 0.45); }
.age-gate .sub { margin-top: 0; line-height: 1.5; }
a.link { color: var(--text); }

/* ============ JEUX VIP ============ */
.vip-tag { background: linear-gradient(135deg, #ffd34d, #e89a0c) !important; color: #3b2300; }
.game-tile.disabled { opacity: 0.45; cursor: not-allowed; }
.game-tile.disabled:hover { transform: none; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.9rem; }

.handoff {
    text-align: center; padding: 28px 18px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.handoff h3 { font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.handoff p { color: var(--muted); }
.handoff .btn { margin-top: 12px; width: 100%; }

.secret { text-align: center; padding: 26px 18px; border-radius: var(--radius); background: #fffaf3; color: #1d1030; box-shadow: var(--shadow); animation: pop 0.3s ease; }
.secret small { text-transform: uppercase; letter-spacing: 1.5px; font-weight: 800; font-size: 0.72rem; color: #8a7fa3; }
.secret .hint { color: #6b5f85; }
.secret .hand { margin-top: 12px; }
.secret-word { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 9vw, 2.8rem); line-height: 1.1; margin: 6px 0; overflow-wrap: anywhere; }
.taboo-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.taboo-list li { background: #ffe4e6; color: #be123c; font-weight: 700; padding: 7px; border-radius: 10px; }

.timer-wrap { display: flex; align-items: center; gap: 12px; }
.timer { flex: 1; height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: var(--green); border-radius: 999px; transition: width 0.1s linear, background 0.3s; }
.timer.low .timer-fill { background: var(--red); }
.timer-num { font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; min-width: 2.2ch; text-align: right; }

.category-box .quiz-q { font-size: 1.25rem; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
    padding: 15px 16px; border-radius: 16px; background: var(--surface); border: 2px solid var(--border);
    font-weight: 700; font-size: 1rem; cursor: pointer; text-align: left; transition: background 0.2s, border-color 0.2s;
}
.quiz-opt:not(:disabled):hover { background: var(--surface-2); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { background: rgba(47, 227, 154, 0.2); border-color: var(--green); }
.quiz-opt.wrong { background: rgba(255, 70, 70, 0.2); border-color: var(--red); animation: shake 0.5s ease; }

.dilemma { display: grid; gap: 8px; text-align: center; }
.dilemma > div { padding: 16px; border-radius: 18px; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; line-height: 1.2; }
.dilemma small { display: block; font-family: var(--font-body); font-size: 0.7rem; letter-spacing: 1px; text-transform: uppercase; opacity: 0.85; margin-bottom: 4px; }
.dilemma > span { color: var(--muted); font-weight: 700; }
.opt-a { background: linear-gradient(135deg, #8b5cff, #5b3fd1); }
.opt-b { background: linear-gradient(135deg, #ff4f9a, #d6266a); }

.pyramid {
    display: flex; flex-direction: column; gap: 8px; align-items: center;
    padding: 16px 12px; border-radius: 22px;
    background: radial-gradient(circle at 50% 0%, #7c2d12, #2a0f08); border: 4px solid #92400e;
}
.pyr-row { display: flex; gap: 6px; align-items: center; }
.pyr-val { width: 40px; font-size: 0.75rem; font-weight: 800; color: var(--gold); white-space: nowrap; }
.pyr-row::after { content: ''; width: 40px; }

.bet-horses { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bet-horse {
    padding: 12px 4px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px; transition: border-color 0.2s, background 0.2s;
}
.bet-horse span { font-size: 1.7rem; }
.bet-horse b { color: var(--hc); font-size: 1.4rem; }
.bet-horse.on { border-color: var(--hc); background: color-mix(in srgb, var(--hc) 18%, transparent); }
.track { display: flex; flex-direction: column; gap: 8px; padding: 12px 10px; border-radius: 20px; background: linear-gradient(180deg, #3f6212, #1a2e05); border: 4px solid #a16207; }
.lane { display: flex; align-items: center; gap: 8px; }
.lane-suit { width: 20px; font-weight: 800; font-size: 1.3rem; color: var(--hc); text-align: center; }
.lane-run { flex: 1; position: relative; height: 40px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); border-right: 4px dashed rgba(255, 255, 255, 0.7); }
.horse { position: absolute; top: 50%; left: 0; transform: translateY(-50%) scaleX(-1); font-size: 1.75rem; line-height: 1; transition: left 0.45s ease; }
.lane-bettors { display: flex; flex-wrap: wrap; gap: 2px; width: 46px; }
.lane-bettors .avatar { width: 20px; height: 20px; font-size: 0.6rem; }
.side-cards { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.side-cards .pcard { width: 36px; height: 50px; font-size: 1.1rem; }
.menu-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; margin: 14px 4px 10px; }
.menu-title:first-child { margin-top: 0; }
.pyramid .pcard { animation: none; }
.pyramid .pcard.new { animation: pop 0.35s ease; }
