/* ─── Reset & Base ─────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    width: 100vw; height: 100vh;
    max-width: 100vw;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    touch-action: pan-y;
}

/* ─── Screens ─────────────────────────────────────────────────────────── */
.screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 1;
}
.screen.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}
.screen-content {
    width: 100vw; height: 100vh;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
}
.center-content {
    justify-content: center;
    align-items: center;
}

/* ─── Language Screen ─────────────────────────────────────────────────── */
.logo-title {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #f0a030;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 60px;
}
.lang-buttons { display: flex; gap: 20px; }
.lang-btn {
    width: 100px; height: 100px;
    border-radius: 16px;
    border: 3px solid #f0a030;
    background: transparent;
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s;
}
.lang-btn:active { background: #f0a030; color: #000; }

/* ─── Theme Screen ────────────────────────────────────────────────────── */
.section-title {
    font-size: 28px;
    font-weight: 900;
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: 2px;
}
.themes-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 400px;
}
.theme-btn {
    padding: 20px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #f0a030, #e08020);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    transition: transform 0.15s;
}
.theme-btn:active { transform: scale(0.97); }
.theme-btn .theme-desc {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 6px;
}

/* ─── Lobby ───────────────────────────────────────────────────────────── */
.player-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}
.player-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
}
.player-hearts {
    display: flex;
    gap: 2px;
}
.mini-heart {
    width: 12px; height: 12px;
    background: #f0a030;
    clip-path: path('M6 1.5C4.5 0 2 0 1 1.5S0 4.5 6 9c6-4.5 5.5-6 5-7S7.5 0 6 1.5z');
}
.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 30px;
}
.name-input {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 18px;
    outline: none;
}
.name-input:focus { border-color: #f0a030; }
.action-btn {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: none;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 1px;
    transition: transform 0.15s;
}
.action-btn:active { transform: scale(0.97); }
.green-btn { background: #2d8a1e; color: #fff; }
.orange-btn { background: #f0a030; color: #000; }

/* ─── Game Card ───────────────────────────────────────────────────────── */
.card-close {
    position: absolute;
    top: 16px; left: 16px;
    font-size: 24px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    z-index: 20;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
}
.card-title {
    font-size: 42px;
    font-weight: 900;
    text-align: center;
    margin-top: 25%;
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 1.1;
}
.card-body {
    font-size: 22px;
    text-align: center;
    margin-top: 30px;
    padding: 0 10px;
    line-height: 1.5;
    opacity: 0.92;
    flex: 1;
}
.card-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 10px 40px;
}

/* ─── Card Colors (matching Bottle Royale app exactly) ────────────────── */
.bg-DUEL, .bg-PRECISION            { background: rgb(200, 55, 45) !important; }
.bg-INSTINCT_SURVIE, .bg-RENCONTRE, .bg-DECOUVERTE
                                   { background: rgb(25, 100, 10) !important; }
.bg-STRATEGIE, .bg-MAILLON_FAIBLE  { background: rgb(130, 120, 25) !important; }
.bg-TIR_DE_PLANQUE, .bg-KAMIKAZE   { background: rgb(240, 160, 30) !important; }
.bg-BOUCLIER, .bg-REDUCTION_ZONE   { background: rgb(50, 60, 75) !important; }
.bg-PROLOGUE, .bg-CHECKPOINT, .bg-SENTENCE, .bg-FIN
                                   { background: rgb(10, 10, 10) !important; }

/* ─── Choice Buttons (on the card, like app) ──────────────────────────── */
.choice-btn {
    width: 100%;
    padding: 18px 20px;
    border-radius: 10px;
    border: none;
    background: rgba(60, 120, 50, 0.65);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, transform 0.12s;
}
.choice-btn:active {
    background: rgba(60, 120, 50, 0.9);
    transform: scale(0.97);
}

/* ─── Reveal/Next Buttons ─────────────────────────────────────────────── */
.reveal-btn {
    padding: 16px 30px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.reveal-btn:active { background: rgba(255,255,255,0.3); }

.next-btn-container {
    padding: 20px 20px 60px;
    display: flex;
    justify-content: center;
}
.next-btn {
    padding: 18px 50px;
    border-radius: 12px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 1px;
    -webkit-tap-highlight-color: rgba(255,255,255,0.3);
}
.next-btn:active { background: rgba(255,255,255,0.4); transform: scale(0.97); }

/* ─── Target Buttons ─────────────────────────────────────────────────── */
.target-btn {
    width: 100%;
    padding: 16px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.target-btn:active { background: rgba(255,255,255,0.2); }

/* ─── Hit Buttons (strategy) ─────────────────────────────────────────── */
.hits-row {
    display: flex;
    gap: 16px;
    justify-content: center;
}
.hit-btn {
    width: 70px; height: 70px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    cursor: pointer;
}
.hit-btn:active { background: rgba(255,255,255,0.25); }

/* ─── Scoreboard ─────────────────────────────────────────────────────── */
.scoreboard-title {
    font-size: 36px;
    font-weight: 900;
    text-align: center;
    margin: 50px 0 30px;
    letter-spacing: 2px;
}
.scoreboard-players {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px;
}
.score-player {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.score-name {
    font-size: 20px;
    font-weight: 700;
}
.score-name.dead {
    color: #666;
    text-decoration: line-through;
}
.hearts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.heart {
    width: 32px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    line-height: 1;
}
.heart-full::after { content: ""; display: block; width: 26px; height: 24px; background: #f0a030; clip-path: path('M13 2C10 -1 5 -1 2.5 2S0 8 13 19C26 8 25 5 23.5 2S16 -1 13 2z'); }
.heart-lost::after { content: ""; display: block; width: 26px; height: 24px; background: #5a4614; clip-path: path('M13 2C10 -1 5 -1 2.5 2S0 8 13 19C26 8 25 5 23.5 2S16 -1 13 2z'); }
.heart-shield { color: #4a8cdc; font-size: 20px; }

/* Heart cells for in-card grid */
.heart-cell { width: 30px; height: 28px; display: flex; align-items: center; justify-content: center; }
.heart-shape {
    width: 26px; height: 24px;
    clip-path: path('M13 2C10 -1 5 -1 2.5 2S0 8 13 19C26 8 25 5 23.5 2S16 -1 13 2z');
    transition: background 0.4s ease;
    position: relative;
}
.heart-shape.lost {
    background: #5a4614 !important;
}
.heart-shape.lost::after {
    content: '';
    position: absolute;
    top: 45%; left: 5%; width: 90%; height: 3px;
    background: #3a2a0a;
    border-radius: 2px;
    transform: rotate(-5deg);
}

/* ─── Result overlay ─────────────────────────────────────────────────── */
.result-text {
    font-size: 22px;
    text-align: center;
    margin-top: 20px;
    line-height: 1.5;
}
.drink-line {
    font-size: 20px;
    color: #ffd060;
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
}

/* ─── Victory ─────────────────────────────────────────────────────────── */
.victory-name {
    font-size: 48px;
    font-weight: 900;
    color: #ffd700;
    text-align: center;
    margin-bottom: 40px;
}
.victory-end {
    font-size: 100px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 10px;
}

/* ─── Transitions ─────────────────────────────────────────────────────── */
.card-transition {
    animation: cardIn 0.35s ease forwards;
}
@keyframes cardIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* ─── Telegram safe area ────────────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .screen-content { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
    .next-btn-container { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
    .card-actions { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
}

/* ─── Scrollbar hide ─────────────────────────────────────────────────── */
::-webkit-scrollbar { display: none; }
