:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

body {
    background: linear-gradient(135deg, #0f172a 0%, #1a1040 100%);
    min-height: 100vh;
}

/* ===== RESUME CARD ===== */
.resume-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
}
.resume-card h2 { color: white; -webkit-text-fill-color: white; background: none; }
.resume-card p { color: rgba(255,255,255,0.88); margin: 0 0 15px; }
.resume-card-btn { background: white !important; color: var(--primary-dark) !important; width: 100%; font-weight: 700; }

/* ===== ACTIONS ===== */
.actions { margin-top: 10px; margin-bottom: 30px; }

/* ===== LOBBY / PLAYER SELECT ===== */
.player-select-btn {
    padding: 14px 12px;
    font-size: 0.95rem;
    font-weight: 700;
    border: 3px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.player-select-btn:hover:not(:disabled) { border-color: var(--primary-color); }
.player-select-btn.solo-selected {
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(139,92,246,0.3));
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.player-select-btn:disabled { opacity: 0.55; cursor: default; }

/* ===== SCORE ROW / LEADERBOARD ===== */
.score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
    transition: background 0.2s;
    border: 1px solid transparent;
}
.score-row.current-player {
    background: rgba(99,102,241,0.12);
    border: 1px solid rgba(99,102,241,0.35);
}
.score-player-info { display: flex; align-items: center; gap: 6px; }
.score-rank { font-size: 1rem; min-width: 28px; }
.score-name { font-size: 1rem; font-weight: 600; }
.score-value, .score-total { font-size: 1.3rem; font-weight: 700; color: var(--primary-color); }

/* ===== BUDDY GAMEBAR: extra "player" badge (not just owner/viewer) ===== */
.buddy-gamebar-badge--player {
    background: rgba(59,130,246,0.18);
    color: #60a5fa;
    border: 1px solid rgba(59,130,246,0.4);
}

/* ===== TWENTY ONE SHEET ===== */
.t21-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}
.t21-row:last-child { border-bottom: none; }
.t21-row-locked { opacity: 0.45; }
.t21-row-cells {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}
.t21-cell {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1.05rem;
    border: 2px solid var(--cell-color);
    color: var(--cell-color);
    background: color-mix(in srgb, var(--cell-color) 14%, transparent);
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s;
}
.t21-cell:active { transform: scale(0.92); }
/* Open/still-available fields: dashed outline, no fill at all - reads as an
   empty die waiting to be filled. Deliberately as different as possible from
   the solid block below, so "open" vs. "chosen" is obvious at a glance even
   in dice-pip mode (hollow pips vs. solid pips, see below). */
.t21-cell-empty {
    opacity: 0.75;
    border-style: dashed;
    font-weight: 600;
    background: transparent;
}
/* Chosen fields: solid, opaque block fill - unmistakably "filled in" next to
   the dashed/transparent open fields. */
.t21-cell-filled {
    background: var(--cell-color);
    color: #0b0b12;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.t21-cell-hit {
    background: var(--cell-color);
    color: #0b0b12;
    box-shadow: 0 0 0 3px rgba(255,215,0,0.55);
}
.t21-cell-cross {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    border-color: var(--border-color);
    border-style: dotted;
}
.t21-cell-locked { cursor: default; }

/* ===== DICE PIPS (dice-face display mode) =====
   The cell itself already looks like a die face (colored square) - these are
   just the dots, sized to actually fill it, no separate die icon drawn. */
.t21-pips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 2.3em;
    height: 2.3em;
    margin: 0 auto;
}
.t21-pip {
    width: 68%;
    height: 68%;
    margin: auto;
    border-radius: 50%;
    background: currentColor;
    box-sizing: border-box;
}
/* Open fields show hollow (outlined) pips for the target - "not chosen yet".
   Filled/hit fields show solid pips - "this is what you picked". */
.t21-cell-empty .t21-pip {
    background: transparent;
    border: 0.14em solid currentColor;
}
.cell-picker-num .t21-pips { width: 2.6em; height: 2.6em; }
.row-score {
    display: block;
    text-align: right;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== CELL PICKER MODAL =====
   --picker-color is set inline (per tap) to the tapped field's colour, so the
   whole popup stays visibly tinted while the player is still deciding. */
#cellPickerModal .modal {
    border-top: 6px solid var(--picker-color, var(--primary-color));
}
#cellPickerTitle {
    color: var(--picker-color, var(--primary-color));
}
.cell-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.cell-picker-num {
    padding: 16px 0;
    font-size: 1.3rem;
    font-weight: 800;
    border-radius: 10px;
    border: 2px solid var(--picker-color, var(--border-color));
    background: color-mix(in srgb, var(--picker-color, var(--bg-color)) 16%, var(--bg-color));
    color: var(--picker-color, var(--text-color));
    cursor: pointer;
}
.cell-picker-num:hover { filter: brightness(1.15); }
.cell-picker-hit {
    border-color: #eab308;
    color: #eab308;
    background: color-mix(in srgb, #eab308 18%, var(--bg-color));
}

/* ===== CONFETTI ===== */
.confetti-container { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2000; }
.confetti-piece { position: absolute; top: -10vh; width: 10px; height: 18px; opacity: 0.9; animation: confetti-fall linear forwards; }
@keyframes confetti-fall {
  0% { transform: translate3d(0,0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(0,120vh,0) rotate(540deg); opacity: 0; }
}
