:root {
    --felt: #1a6b3c;
    --felt-dark: #145a30;
    --felt-deeper: #0e4a24;
    --felt-center: #1e7a44;
    --wood: #5c3a1e;
    --wood-light: #8b5e3c;
    --gold: #d4a843;
    --gold-bright: #f0c75e;
    --gold-dim: #a08030;
    --cream: #faf3e0;
    --red-suit: #c0392b;
    --black-suit: #2c3e50;
    --card-bg: #fffef8;
    --score-p1: #5ba4e6;
    --score-p2: #e8944a;
    --bg-dark: #0a0a0a;
    --bg-card: #111;
    --border-subtle: #2a2a2a;
    /* panel surfaces */
    --panel-bg-1: #141414;
    --panel-bg-2: #1e1e1e;
    /* board / wood */
    --board-bg-1: #6b4226;
    --board-bg-2: #7a4f30;
    --board-border-color: #3e2215;
    /* card backs */
    --card-back-1: #1a3a6b;
    --card-back-2: #2a5a9b;
    --card-back-border: #4a7acc;
    /* ambient glows */
    --glow-felt: rgba(26, 107, 60, 0.06);
    --glow-accent: rgba(212, 168, 67, 0.04);
    /* elevation shadows */
    --shadow-1: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-2: 0 4px 16px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.25);
    --shadow-3: 0 8px 32px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
    --shadow-4: 0 32px 100px rgba(0,0,0,0.8), 0 8px 32px rgba(0,0,0,0.5);
    --shadow-gold: 0 0 0 1.5px rgba(212,168,67,0.25), 0 0 24px rgba(212,168,67,0.12);
    /* easing */
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-dark);
    color: var(--cream);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 55% at 50% -5%, rgba(26, 107, 60, 0.14) 0%, transparent 70%),
        radial-gradient(ellipse at 20% 50%, var(--glow-felt) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, var(--glow-accent) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ── LOBBY ── */
#lobby {
    margin-top: 10vh;
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2), var(--panel-bg-1));
    padding: 48px 44px;
    border-radius: 22px;
    text-align: center;
    border: 1px solid var(--border-subtle);
    box-shadow:
        0 40px 120px rgba(0, 0, 0, 0.85),
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 1px 0 rgba(212, 168, 67, 0.12) inset;
    max-width: 420px;
    width: 92%;
    position: relative;
    z-index: 1;
    animation: lobbyIn 0.65s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

@keyframes lobbyIn {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.96);
        filter: blur(2px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

#lobby::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.7;
}

#lobby::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: radial-gradient(ellipse at 50% 100%, rgba(212, 168, 67, 0.03) 0%, transparent 70%);
    border-radius: 0 0 22px 22px;
    pointer-events: none;
}

#lobby h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    font-weight: 900;
    background: linear-gradient(160deg, var(--gold-bright) 0%, var(--gold) 45%, var(--gold-dim) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
    letter-spacing: -0.5px;
}

#lobby .sub {
    font-family: 'Cormorant Garamond', serif;
    color: #5a5a5a;
    font-size: 1rem;
    font-style: italic;
    margin-bottom: 30px;
    letter-spacing: 1.5px;
}

.suit-decoration {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 26px;
    font-size: 0.88rem;
    letter-spacing: 2px;
}

.suit-decoration span {
    color: rgba(255, 255, 255, 0.14);
    animation: suitBreath 5s ease-in-out infinite;
}

.suit-decoration span:nth-child(2),
.suit-decoration span:nth-child(4) {
    color: rgba(170, 44, 36, 0.22);
}

.suit-decoration span:nth-child(1) { animation-delay: 0s; }
.suit-decoration span:nth-child(2) { animation-delay: 1.25s; }
.suit-decoration span:nth-child(3) { animation-delay: 2.5s; }
.suit-decoration span:nth-child(4) { animation-delay: 3.75s; }

@keyframes suitBreath {
    0%, 100% { opacity: 0.7; }
    50%       { opacity: 1.4; }
}

/* ── Lobby: home view ── */

#lobby input {
    width: 100%;
    padding: 13px 16px;
    border-radius: 11px;
    border: 1.5px solid #282828;
    background: rgba(0, 0, 0, 0.45);
    color: white;
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

#lobby input::placeholder {
    color: #4a4a4a;
}

#lobby input:focus {
    border-color: rgba(212, 168, 67, 0.45);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.07), 0 0 20px rgba(212, 168, 67, 0.04);
}

.lobby-role-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-host {
    padding: 15px 10px;
    background: linear-gradient(145deg, var(--felt), var(--felt-dark));
    color: rgba(255,255,255,0.95);
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.22s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
    letter-spacing: 0.3px;
    box-shadow: 0 4px 18px rgba(26, 107, 60, 0.35), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-host:hover {
    background: linear-gradient(145deg, var(--felt-dark), var(--felt-deeper));
    box-shadow: 0 7px 26px rgba(26, 107, 60, 0.45), inset 0 1px 0 rgba(255,255,255,0.08);
    transform: translateY(-2px);
}

.btn-host:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(26, 107, 60, 0.25), inset 0 1px 0 rgba(255,255,255,0.06);
}

.btn-join-mode {
    padding: 15px 10px;
    background: rgba(255,255,255,0.02);
    color: #999;
    border: 1.5px solid #2e2e2e;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.22s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
    letter-spacing: 0.3px;
}

.btn-join-mode:hover {
    border-color: #505050;
    color: var(--cream);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.btn-join-mode:active {
    transform: translateY(0) scale(0.98);
    box-shadow: none;
}

.lobby-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
}

.lobby-link {
    background: none;
    border: none;
    color: #4a4a4a;
    font-size: 0.78rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    padding: 4px 4px;
    transition: color 0.2s;
    letter-spacing: 0.4px;
}

.lobby-link:hover {
    color: #888;
}

.lobby-link-sep {
    color: #2e2e2e;
    font-size: 0.75rem;
    pointer-events: none;
}

/* ── Lobby: host view ── */

#lobby-host,
#lobby-join {
    animation: viewSlideIn 0.25s ease-out;
}

@keyframes viewSlideIn {
    from { opacity: 0; transform: translateX(16px) scale(0.99); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #555;
    font-size: 0.8rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    padding: 0;
    margin-bottom: 20px;
    transition: color 0.2s;
    letter-spacing: 0.3px;
}

.btn-back:hover {
    color: #999;
}

.lobby-step-label {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.92rem;
    color: #666;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

#lobby .id-display {
    background: rgba(0, 0, 0, 0.45);
    border: 1.5px solid #2a2a2a;
    border-radius: 12px;
    padding: 16px 16px 12px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    color: #888;
    word-break: break-all;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

#lobby .id-display:hover {
    border-color: rgba(212, 168, 67, 0.35);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 0 16px rgba(212,168,67,0.05);
}

#lobby .id-display strong {
    color: var(--gold-bright);
    font-size: 1rem;
    letter-spacing: 0.3px;
}

#lobby .id-display .hint {
    font-size: 0.68rem;
    color: #555;
    margin-top: 6px;
    transition: color 0.2s;
}

.lobby-waiting-hint {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

/* ── Code type toggle (UID vs Word Code) ── */

.code-type-toggle {
    display: flex;
    gap: 0;
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 18px;
}

.code-type-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    letter-spacing: 0.4px;
    transition: background 0.18s, color 0.18s;
}

.code-type-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.code-type-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: #888;
}

/* Word code display: larger text, spaced out */
#my-id-text.word-code strong {
    font-size: 1.2rem;
    letter-spacing: 1px;
    word-spacing: 4px;
}

/* Regenerate button */
.btn-regen {
    display: block;
    width: 100%;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #555;
    font-size: 0.75rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    padding: 7px 12px;
    margin-bottom: 14px;
    transition: color 0.2s, border-color 0.2s;
    letter-spacing: 0.3px;
}

.btn-regen:hover {
    color: #888;
    border-color: rgba(255, 255, 255, 0.16);
}

/* ── Lobby: join view ── */

#lobby .btn-connect {
    width: 100%;
    padding: 15px;
    background: linear-gradient(145deg, var(--felt), var(--felt-dark));
    color: rgba(255,255,255,0.95);
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.22s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
    letter-spacing: 0.3px;
    box-shadow: 0 4px 18px rgba(26, 107, 60, 0.35), inset 0 1px 0 rgba(255,255,255,0.1);
    margin-bottom: 0;
}

#lobby .btn-connect:hover {
    background: linear-gradient(145deg, var(--felt-dark), var(--felt-deeper));
    box-shadow: 0 7px 26px rgba(26, 107, 60, 0.45), inset 0 1px 0 rgba(255,255,255,0.08);
    transform: translateY(-2px);
}

#lobby .btn-connect:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(26, 107, 60, 0.25);
}

/* ── CUT FOR DEAL OVERLAY ── */
#cut-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 4, 4, 0.97);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cut-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--gold);
    margin-bottom: 6px;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cut-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.95rem;
    color: #777;
    margin-bottom: 36px;
    animation: slideDown 0.5s ease-out 0.1s both;
}

.cut-spread {
    display: flex;
    gap: 2px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 700px;
    padding: 0 16px;
    perspective: 800px;
}

.cut-card {
    width: 48px;
    height: 70px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    transform-style: preserve-3d;
    animation: dealIn 0.4s ease-out both;
}

.cut-card:nth-child(1) {
    animation-delay: 0.05s;
}

.cut-card:nth-child(2) {
    animation-delay: 0.08s;
}

.cut-card:nth-child(3) {
    animation-delay: 0.11s;
}

.cut-card:nth-child(4) {
    animation-delay: 0.14s;
}

.cut-card:nth-child(5) {
    animation-delay: 0.17s;
}

.cut-card:nth-child(6) {
    animation-delay: 0.20s;
}

.cut-card:nth-child(7) {
    animation-delay: 0.23s;
}

.cut-card:nth-child(8) {
    animation-delay: 0.26s;
}

.cut-card:nth-child(9) {
    animation-delay: 0.29s;
}

.cut-card:nth-child(10) {
    animation-delay: 0.32s;
}

.cut-card:nth-child(11) {
    animation-delay: 0.35s;
}

.cut-card:nth-child(12) {
    animation-delay: 0.38s;
}

.cut-card:nth-child(13) {
    animation-delay: 0.41s;
}

@keyframes dealIn {
    from {
        opacity: 0;
        transform: translateY(40px) rotateX(20deg) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translateY(0) rotateX(0) scale(1);
    }
}

.cut-card .cut-front,
.cut-card .cut-back {
    position: absolute;
    inset: 0;
    border-radius: 6px;
    backface-visibility: hidden;
}

.cut-card .cut-back {
    background: linear-gradient(135deg, var(--card-back-1), var(--card-back-2));
    border: 2px solid var(--card-back-border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cut-card .cut-back::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

.cut-card .cut-back::after {
    content: '✦';
    font-size: 16px;
    color: rgba(255, 255, 255, 0.18);
}

.cut-card .cut-front {
    background: var(--card-bg);
    border: 2px solid #ddd;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px 5px;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: 'DM Sans', sans-serif;
}

.cut-card .cut-front .cf-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
}

.cut-card .cut-front .cf-suit {
    font-size: 0.65rem;
}

.cut-card .cut-front .cf-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    opacity: 0.2;
}

.cut-card.red-card .cut-front {
    color: var(--red-suit);
}

.cut-card.black-card .cut-front {
    color: var(--black-suit);
}

.cut-card:hover:not(.picked):not(.disabled):not(.flipped) {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.cut-card.picked {
    transform: translateY(-14px) scale(1.08);
    z-index: 3;
}

.cut-card.picked .cut-back {
    border-color: var(--gold-bright);
    box-shadow: 0 0 20px rgba(212, 168, 67, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.cut-card.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.cut-card.flipped {
    transform: rotateY(180deg);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.cut-card.flipped.picked {
    transform: rotateY(180deg) translateY(-10px) scale(1.1);
}

.cut-card.winner-card {
    animation: winnerGlow 1.5s ease infinite;
}

@keyframes winnerGlow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(212, 168, 67, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(212, 168, 67, 0.6);
    }
}

.cut-result {
    margin-top: 32px;
    text-align: center;
    animation: resultIn 0.5s ease-out;
}

@keyframes resultIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cut-result .result-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--gold-bright);
    margin-bottom: 4px;
}

.cut-result .result-sub {
    font-size: 0.85rem;
    color: #888;
}

.cut-picks-status {
    margin-top: 20px;
    font-size: 0.85rem;
    color: #666;
    min-height: 24px;
}

.cut-picks-status .waiting-dot {
    display: inline-block;
    animation: pulse 1.2s infinite;
}

/* ── GAME BOARD ── */
#game-board {
    display: none;
    width: 100%;
    max-width: 800px;
    flex-direction: column;
    gap: 0;
    padding: 10px;
    padding-bottom: 82px; /* space for the fixed action bar */
    position: relative;
    z-index: 1;
    animation: boardIn 0.5s ease-out;
}

@keyframes boardIn {
    from {
        opacity: 0;
        transform: translateY(18px);
        filter: blur(1px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Score Bar */
.score-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2), var(--panel-bg-1));
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 14px 22px;
    margin-bottom: 10px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.03) inset;
    position: relative;
    overflow: hidden;
}

.score-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 100%, rgba(212, 168, 67, 0.02) 0%, transparent 70%);
    pointer-events: none;
}

.score-bar::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 67, 0.2), transparent);
}

.player-score {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 10px;
    border-radius: 9px;
    border: 1px solid transparent;
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.player-score.right {
    text-align: right;
}

.player-score .name {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #777;
    font-weight: 500;
}

.player-score .name .dealer-chip {
    display: inline-block;
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    color: #000;
    font-size: 0.58rem;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 5px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.player-score .pts {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    font-feature-settings: "tnum" 1;
    letter-spacing: -1px;
    transition: text-shadow 0.4s ease;
}

.player-score.active-turn {
    background: rgba(212, 168, 67, 0.06);
    border-color: rgba(212, 168, 67, 0.3);
    box-shadow: 0 0 18px rgba(212, 168, 67, 0.18);
    animation: activeTurnPulse 2.8s ease-in-out infinite;
}

.player-score.active-turn .pts {
    text-shadow: 0 0 20px rgba(255, 220, 100, 0.18);
}

@keyframes activeTurnPulse {

    0%,
    100% {
        box-shadow: 0 0 12px rgba(212, 168, 67, 0.14);
        border-color: rgba(212, 168, 67, 0.25);
    }

    50% {
        box-shadow: 0 0 24px rgba(212, 168, 67, 0.28);
        border-color: rgba(212, 168, 67, 0.4);
    }
}

/* Score progress bar */
.score-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
    margin-top: 5px;
}

.score-progress-fill {
    height: 100%;
    border-radius: 2px;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Score bar center column */
.score-center {
    text-align: center;
    padding: 0 16px;
}

/* Connection status dot */
.conn-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2a2a2a;
    margin: 6px auto 0;
    transition: background 0.4s, box-shadow 0.4s;
}

.conn-dot.connected {
    background: #27ae60;
    box-shadow: 0 0 6px rgba(39, 174, 96, 0.6);
}

.conn-dot.disconnected {
    background: #c0392b;
    box-shadow: 0 0 6px rgba(192, 57, 43, 0.5);
    animation: pulse 1.2s infinite;
}

.p1-color {
    color: var(--score-p1);
}

.p2-color {
    color: var(--score-p2);
}

.vs-badge {
    font-size: 0.68rem;
    color: #565656;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.vs-badge .count-num {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold);
    display: block;
    line-height: 1;
    font-feature-settings: "tnum" 1;
    text-shadow: 0 0 16px rgba(212, 168, 67, 0.18);
}

.score-divider-v {
    width: 1px;
    height: 44px;
    background: linear-gradient(180deg, transparent, #333, transparent);
    margin: 0 18px;
}

/* Status */
.status-bar {
    text-align: center;
    margin: 4px 0 6px;
    padding: 7px 18px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--gold);
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 100px;
    background: rgba(212, 168, 67, 0.04);
    border: 1px solid rgba(212, 168, 67, 0.1);
    letter-spacing: 0.2px;
}

.status-bar .turn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold-bright);
    animation: pulse 1.2s infinite;
    box-shadow: 0 0 8px rgba(240, 199, 94, 0.4);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* Felt Table Area */
.felt-area {
    background: radial-gradient(ellipse at center, var(--felt-center) 0%, var(--felt) 45%, var(--felt-dark) 100%);
    border: 7px solid var(--wood);
    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, 0.35),
        inset 0 0 100px rgba(0, 0, 0, 0.12),
        inset 0 2px 0 rgba(255, 255, 255, 0.04),
        0 8px 28px rgba(0, 0, 0, 0.55),
        0 2px 6px rgba(0, 0, 0, 0.3);
    outline: 1px solid rgba(0, 0, 0, 0.5);
    outline-offset: -7px;
    border-radius: 80px;
    min-height: 218px;
    padding: 20px 24px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.felt-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    border-radius: 74px;
}

.felt-label {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 8px;
    font-weight: 600;
}

.card-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 104px;
    align-items: center;
}

.starter-area {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
}

.starter-divider {
    width: 2px;
    height: 60px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 1px;
}

/* Cards */
.card {
    width: 68px;
    height: 98px;
    background: var(--card-bg);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px 7px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: default;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.28),
        0 1px 3px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s, box-shadow 0.2s;
    user-select: none;
    position: relative;
    flex-shrink: 0;
}

.card .top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
}

.card .bot {
    position: absolute;
    bottom: 6px;
    right: 7px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1;
    transform: rotate(180deg);
}

.card .suit {
    font-size: 0.85rem;
}

.card .center-suit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.65rem;
    opacity: 0.18;
}

.card.red {
    color: var(--red-suit);
}

.card.black {
    color: var(--black-suit);
}

.card.clickable {
    cursor: pointer;
}

.card.clickable:hover:not(.selected) {
    transform: translateY(-7px);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.38),
        0 4px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.card.selected {
    border-color: var(--gold);
    transform: translateY(-14px);
    box-shadow:
        0 14px 36px rgba(212, 168, 67, 0.38),
        0 0 0 2px rgba(212, 168, 67, 0.5),
        0 0 0 4px rgba(212, 168, 67, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.card.selected:hover {
    transform: translateY(-14px);
}

.card.unplayable {
    opacity: 0.32;
    cursor: not-allowed !important;
    filter: saturate(0.6);
}

.card.unplayable:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.card.facedown {
    background: linear-gradient(145deg, var(--card-back-1), var(--card-back-2));
    border: 1.5px solid var(--card-back-border);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.35),
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.card.facedown::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.card.facedown::after {
    content: '✦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.card.facedown * {
    visibility: hidden;
}

.card.mini {
    width: 52px;
    height: 74px;
    font-size: 0.88rem;
    padding: 4px 5px;
}

.card.mini .suit {
    font-size: 0.68rem;
}

.card.mini .center-suit {
    font-size: 1rem;
}

.card.highlighted {
    border-color: var(--gold);
    background: #fff8e0;
}

.card.peg-p1 {
    box-shadow: 0 2px 8px rgba(91, 164, 230, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
}

.card.peg-p2 {
    box-shadow: 0 2px 8px rgba(232, 148, 74, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ── HAND DEAL ANIMATION ── */
@keyframes handDealIn {
    from {
        opacity: 0;
        transform: translateY(38px) scale(0.88);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── STARTER CARD REVEAL ── */
@keyframes starterReveal {
    from {
        opacity: 0;
        transform: rotateY(90deg) scale(0.85);
    }

    to {
        opacity: 1;
        transform: rotateY(0deg) scale(1);
    }
}

/* ── PEG CARD PLAY ANIMATION ── */
@keyframes pegCardPlay {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.88);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Hand Area */
.hand-section {
    text-align: center;
    margin-bottom: 0; /* fixed action bar + #game-board padding-bottom handles spacing */
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 16px;
    padding: 14px 16px 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2) inset;
}

.hand-label {
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888;
    margin-bottom: 10px;
    font-weight: 600;
}

.hand-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    min-height: 136px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* Larger cards for the player's own hand — more visual space now that
   the action bar is fixed and no utility bar sits below the hand */
.hand-row .card {
    width: 84px;
    height: 122px;
    font-size: 1.3rem;
    padding: 8px 9px;
    border-radius: 9px;
}

.hand-row .card .suit {
    font-size: 1.0rem;
}

.hand-row .card .center-suit {
    font-size: 2.1rem;
}

.hand-row .card.selected {
    transform: translateY(-18px);
    box-shadow:
        0 18px 42px rgba(212, 168, 67, 0.42),
        0 0 0 2px rgba(212, 168, 67, 0.6),
        0 0 0 5px rgba(212, 168, 67, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.hand-row .card.clickable:hover:not(.selected) {
    transform: translateY(-9px);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.42),
        0 4px 8px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

/* Opponent placeholder */
.opp-area {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
    min-height: 72px;
    align-items: center;
}

.opp-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #686868;
    text-align: center;
    margin-bottom: 4px;
    margin-top: 4px;
    font-weight: 600;
}

/* ── FIXED ACTION BAR ──────────────────────────────────────────────────────
   Pinned to the bottom of the viewport so action buttons never shift the
   game-board layout. The settings FAB sits in the right corner of the bar.
   -------------------------------------------------------------------------- */
#action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: none; /* shown (flex) once game board is active */
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 11px 20px calc(13px + env(safe-area-inset-bottom, 0px));
    min-height: calc(60px + env(safe-area-inset-bottom, 0px));
    background: rgba(12, 12, 12, 0.88);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5), 0 -1px 0 rgba(255, 255, 255, 0.04);
    z-index: 100;
}

/* Gear icon in the far-right corner of the action bar */
.settings-fab {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    background: var(--panel-bg-1);
    color: #666;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.settings-fab:hover {
    color: var(--gold);
    border-color: rgba(212, 168, 67, 0.5);
    box-shadow: 0 0 10px rgba(212, 168, 67, 0.18);
}

/* ── ADMIN FAB (in-game, just left of settings fab) ────────────────────── */
.admin-fab {
    position: absolute;
    right: 58px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 1px solid rgba(212, 168, 67, 0.35);
    border-radius: 50%;
    background: rgba(212, 168, 67, 0.08);
    color: var(--gold);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.admin-fab:hover {
    background: rgba(212, 168, 67, 0.18);
    border-color: rgba(212, 168, 67, 0.6);
    box-shadow: 0 0 10px rgba(212, 168, 67, 0.25);
}

/* ── CHAT FAB (left side of action bar) ────────────────────────────────── */
.chat-fab {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    background: var(--panel-bg-1);
    color: #666;
    font-size: 1rem;
    cursor: pointer;
    display: none; /* shown via JS for multiplayer games */
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.chat-fab:hover {
    color: var(--gold);
    border-color: rgba(212, 168, 67, 0.5);
    box-shadow: 0 0 10px rgba(212, 168, 67, 0.18);
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #e53935;
    color: #fff;
    font-size: 0.65rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
}

.chat-badge.hidden {
    display: none;
}

/* ── CHAT PANEL (slide-up bottom sheet) ────────────────────────────────── */
.chat-panel {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.chat-panel.hidden {
    display: none;
}

.chat-sheet {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2));
    border-top: 1px solid var(--border-subtle);
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    animation: settingsSheetUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.55);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
    max-height: 40vh;
}

.chat-msg-row {
    display: flex;
}

.chat-mine {
    justify-content: flex-end;
}

.chat-theirs {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 75%;
    padding: 7px 11px;
    border-radius: 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
}

.chat-mine .chat-bubble {
    background: var(--gold);
    color: #1a1000;
    border-bottom-right-radius: 4px;
}

.chat-theirs .chat-bubble {
    background: var(--panel-bg-1);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary, #e0e0e0);
    border-bottom-left-radius: 4px;
}

.chat-sender {
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 2px;
    opacity: 0.75;
}

.chat-text {
    line-height: 1.4;
    word-break: break-word;
}

.chat-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 16px 0;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background: var(--panel-bg-1);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 8px 14px;
    color: var(--text-primary, #e0e0e0);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--gold);
}

.chat-input::placeholder {
    color: #555;
}

.chat-send-btn {
    background: var(--gold);
    color: #1a1000;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    opacity: 0.85;
}

/* ── SETTINGS PANEL (slide-up bottom sheet) ────────────────────────────────
   A translucent backdrop + a sheet that animates up from below.
   -------------------------------------------------------------------------- */
.settings-panel {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.settings-panel.hidden {
    display: none;
}

.settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px) saturate(0.8);
    -webkit-backdrop-filter: blur(6px) saturate(0.8);
    animation: settingsFadeIn 0.22s ease;
}

@keyframes settingsFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.settings-sheet {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2));
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px 20px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: 72vh;
    overflow-y: auto;
    animation: settingsSheetUp 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -12px 50px rgba(0, 0, 0, 0.6), 0 -1px 0 rgba(255,255,255,0.05);
}

@keyframes settingsSheetUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0);    }
}

/* Drag handle hint */
.settings-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    margin: 12px auto 0;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
    border-bottom: 1px solid #1a1a1a;
}

.settings-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.4px;
}

.settings-close {
    width: 28px;
    height: 28px;
    border: 1px solid #2a2a2a;
    border-radius: 50%;
    background: var(--panel-bg-1);
    color: #666;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s, border-color 0.2s;
}

.settings-close:hover {
    color: #aaa;
    border-color: #444;
}

.settings-section {
    padding: 10px 20px;
}

.settings-section-center {
    text-align: center;
    padding: 12px 20px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
}

.settings-row-label {
    font-size: 0.83rem;
    color: #888;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.2px;
}

.settings-divider {
    height: 1px;
    background: #1a1a1a;
    margin: 0 20px;
}

.settings-theme-chips {
    display: flex;
    gap: 7px;
    align-items: center;
}

.settings-log-header {
    font-size: 0.73rem;
    color: #565656;
    cursor: pointer;
    padding: 4px 0 8px;
    user-select: none;
    transition: color 0.2s;
    letter-spacing: 0.5px;
}

.settings-log-header:hover {
    color: #888;
}

.btn {
    padding: 13px 30px;
    border: none;
    border-radius: 11px;
    font-weight: 700;
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(145deg, var(--felt), var(--felt-dark));
    color: rgba(255,255,255,0.95);
    box-shadow: 0 3px 14px rgba(26, 107, 60, 0.32), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(145deg, var(--felt-dark), var(--felt-deeper));
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(26, 107, 60, 0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 6px rgba(26, 107, 60, 0.22), inset 0 1px 0 rgba(255,255,255,0.08);
}

.btn-go {
    background: linear-gradient(145deg, #c0392b, #a93226);
    color: rgba(255,255,255,0.95);
    box-shadow: 0 3px 14px rgba(192, 57, 43, 0.32), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-go:hover:not(:disabled) {
    background: linear-gradient(145deg, #a93226, #922b21);
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(192, 57, 43, 0.4), inset 0 1px 0 rgba(255,255,255,0.08);
}

.btn-go:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 6px rgba(192, 57, 43, 0.22);
}

.btn-deal {
    background: linear-gradient(145deg, var(--gold), var(--gold-dim));
    color: #111;
    box-shadow: 0 3px 14px rgba(212, 168, 67, 0.32), inset 0 1px 0 rgba(255,255,255,0.28);
}

.btn-deal:hover:not(:disabled) {
    background: linear-gradient(145deg, var(--gold-bright), var(--gold));
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(212, 168, 67, 0.44), inset 0 1px 0 rgba(255,255,255,0.25);
}

.btn-deal:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(212, 168, 67, 0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Shimmer sweep on the Deal/confirm button — subtle, deluxe */
.btn-deal::after {
    content: '';
    position: absolute;
    top: -60%;
    left: -80%;
    width: 45%;
    height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    transform: skewX(-18deg);
    animation: btnDealShimmer 3.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes btnDealShimmer {
    0%      { left: -80%; opacity: 0; }
    10%     { opacity: 1; }
    35%, 100% { left: 130%; opacity: 0; }
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Cribbage Board */
.board-container {
    background: linear-gradient(170deg, var(--board-bg-1) 0%, var(--board-bg-2) 25%, var(--board-bg-1) 50%, var(--board-bg-2) 75%, var(--board-bg-1) 100%);
    border: 3px solid var(--board-border-color);
    border-radius: 50px;
    padding: 4px;
    margin-bottom: 10px;
    box-shadow:
        inset 0 2px 10px rgba(0, 0, 0, 0.4),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04),
        0 8px 24px rgba(0, 0, 0, 0.55),
        0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.board-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg,
            transparent 0px,
            rgba(0, 0, 0, 0.025) 1px,
            transparent 2px,
            transparent 6px),
        linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.05) 100%);
    pointer-events: none;
    border-radius: 47px;
}

.board-svg {
    display: block;
    width: 100%;
    height: auto;
}

.board-svg .peg {
    transition: cx 0.6s cubic-bezier(0.4, 0, 0.2, 1), cy 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Score flash */
.score-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--gold-bright);
    text-shadow:
        0 0 40px rgba(240, 199, 94, 0.55),
        0 2px 8px rgba(0,0,0,0.4);
    pointer-events: none;
    z-index: 50;
    animation: flashUp 1.4s ease-out forwards;
    white-space: nowrap;
    text-align: center;
    line-height: 1.1;
    background: rgba(0,0,0,0.35);
    padding: 8px 20px 10px;
    border-radius: 100px;
    border: 1px solid rgba(212,168,67,0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.score-flash .sf-reason {
    display: block;
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    color: rgba(240, 199, 94, 0.75);
    letter-spacing: 0.5px;
    margin-top: 2px;
}

@keyframes flashUp {
    0% {
        opacity: 0;
        transform: translate(-50%, -30%) scale(0.6);
    }

    12% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.08);
    }

    25% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -80%) scale(0.95);
    }
}

.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.73rem;
    font-weight: 500;
    color: #484848;
    cursor: pointer;
    user-select: none;
    padding: 6px 12px 6px 10px;
    border: 1.5px solid #222;
    border-radius: 100px;
    background: rgba(0, 0, 0, 0.3);
    transition: all 0.22s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
    letter-spacing: 0.4px;
}

.toggle-btn:hover {
    border-color: #383838;
    color: #666;
}

.toggle-btn .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #333;
    flex-shrink: 0;
    transition: all 0.25s var(--ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
}

.toggle-btn.active {
    border-color: rgba(212, 168, 67, 0.35);
    color: var(--gold);
    background: rgba(212, 168, 67, 0.07);
}

.toggle-btn.active:hover {
    border-color: rgba(212, 168, 67, 0.55);
    background: rgba(212, 168, 67, 0.1);
}

.toggle-btn.active .dot {
    background: var(--gold);
    box-shadow: 0 0 8px rgba(212, 168, 67, 0.5);
    transform: scale(1.15);
}

/* Game Log (lives inside the settings sheet) */
.log-box {
    max-height: 180px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 6px;
    font-size: 0.78rem;
    line-height: 1.7;
    color: #888;
}

.log-box::-webkit-scrollbar {
    width: 4px;
}

.log-box::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

.log-entry {
    padding: 1px 0;
}

.log-entry.score {
    color: var(--gold);
}

.log-entry.phase {
    color: #555;
    font-style: italic;
}

.log-entry.go {
    color: #c0392b;
}

/* Show Phase Breakdown */
.show-panel {
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2));
    border: 1px solid rgba(212, 168, 67, 0.12);
    border-radius: 14px;
    padding: 18px;
    margin: 8px 0;
    text-align: center;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(212, 168, 67, 0.04) inset;
    animation: panelIn 0.32s ease-out both;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.show-panel h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 12px;
}

.show-cards-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.show-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 10px;
    font-size: 0.85rem;
}

.show-line .desc {
    color: #999;
}

.show-line .val {
    color: var(--gold);
    font-weight: 700;
}

.show-total {
    border-top: 1px solid var(--border-subtle);
    margin-top: 8px;
    padding-top: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold-bright);
}

/* Winner Overlay */
.winner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px) saturate(0.7);
    -webkit-backdrop-filter: blur(8px) saturate(0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.4s ease;
}

.winner-box {
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2), var(--panel-bg-1));
    border: 1.5px solid rgba(212, 168, 67, 0.4);
    border-radius: 22px;
    padding: 52px 48px;
    text-align: center;
    box-shadow:
        0 0 140px rgba(212, 168, 67, 0.22),
        0 0 60px rgba(212, 168, 67, 0.1),
        0 32px 80px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255,255,255,0.04) inset;
    animation: winnerIn 0.55s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
    position: relative;
    overflow: hidden;
}

.winner-box::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 140px;
    background: radial-gradient(ellipse at 50% 100%, rgba(212, 168, 67, 0.06) 0%, transparent 70%);
    border-radius: 0 0 22px 22px;
    pointer-events: none;
}

@keyframes winnerIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(24px);
        filter: blur(1px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

.winner-box::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.winner-box .trophy {
    font-size: 3.2rem;
    margin-bottom: 14px;
    filter: drop-shadow(0 0 20px rgba(212, 168, 67, 0.35));
    display: block;
}

.winner-box h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(160deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-dim) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.winner-box .final-score {
    font-size: 1.15rem;
    color: #888;
    margin-bottom: 24px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
}

.hidden {
    display: none !important;
}

/* Round badge */
.round-badge {
    font-size: 0.76rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    padding: 4px 0 6px;
    font-weight: 500;
}

/* ── ACTIVE MODIFIER BAR ── */
.mod-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 14px 6px;
    margin-bottom: 2px;
}

.mod-bar:empty {
    display: none;
}

.mod-bar-label {
    font-size: 0.56rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(212, 168, 67, 0.38);
    font-weight: 600;
    margin-right: 3px;
}

.mod-pill {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.63rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 9px;
    border-radius: 100px;
    border: 1px solid rgba(212, 168, 67, 0.30);
    color: rgba(212, 168, 67, 0.65);
    background: rgba(212, 168, 67, 0.07);
    animation: fadeIn 0.3s ease both;
}

/* ── CUT RESULT CARD DISPLAY ── */
.cut-result-cards {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.cut-result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cut-result-card-face {
    width: 54px;
    height: 78px;
    background: var(--card-bg);
    border-radius: 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: 'DM Sans', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    border: 2px solid transparent;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.cut-result-card.winner .cut-result-card-face {
    border-color: var(--gold);
    box-shadow: 0 0 22px rgba(212, 168, 67, 0.45), 0 4px 14px rgba(0, 0, 0, 0.45);
}

.cut-result-card-suit {
    font-size: 0.85em;
    line-height: 1;
}

.cut-result-card-name {
    font-size: 0.73rem;
    color: #666;
    text-align: center;
    font-family: 'DM Sans', sans-serif;
    line-height: 1.4;
}

.cut-result-card.winner .cut-result-card-name {
    color: var(--gold);
}

.cut-deal-tag {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold-bright);
    display: block;
}

.cut-result-vs {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 10px;
}

@media (max-width: 500px) {
    .card {
        width: 58px;
        height: 84px;
        font-size: 0.92rem;
        padding: 4px 5px;
    }

    .card .suit {
        font-size: 0.72rem;
    }

    .card .center-suit {
        font-size: 1.3rem;
    }

    .card.mini {
        width: 44px;
        height: 64px;
        font-size: 0.76rem;
    }

    .felt-area {
        padding: 14px 12px;
        border-radius: 40px;
        min-height: 176px;
    }

    /* Hand cards stay larger than base cards even on small screens */
    .hand-row .card {
        width: 72px;
        height: 104px;
        font-size: 1.1rem;
        padding: 6px 7px;
    }

    .hand-row .card .suit {
        font-size: 0.88rem;
    }

    .hand-row .card .center-suit {
        font-size: 1.7rem;
    }

    .hand-row {
        gap: 8px;
        min-height: 116px;
    }

    .score-bar {
        padding: 10px 14px;
    }

    .player-score .pts {
        font-size: 1.7rem;
    }

    .cut-card {
        width: 40px;
        height: 58px;
    }

    .cut-card .cut-front {
        font-size: 0.72rem;
        padding: 3px 4px;
    }

    .cut-card .cut-front .cf-suit {
        font-size: 0.55rem;
    }

    .cut-card .cut-front .cf-center {
        font-size: 1rem;
    }

    .cut-title {
        font-size: 1.3rem;
    }

    .winner-box {
        padding: 36px 28px;
    }

    .winner-box h2 {
        font-size: 1.8rem;
    }
}

/* ── STATISTICS BUTTON ── */
.btn-stats {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 12px 28px;
    background: rgba(212, 168, 67, 0.04);
    border: 1.5px solid rgba(212, 168, 67, 0.3);
    color: var(--gold);
    border-radius: 11px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.22s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.btn-stats:hover {
    border-color: rgba(212, 168, 67, 0.55);
    color: var(--gold-bright);
    background: rgba(212, 168, 67, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(212, 168, 67, 0.08);
}

.btn-stats:active {
    transform: translateY(0) scale(0.98);
}

/* ── STATISTICS MODAL ── */
.stats-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px) saturate(0.8);
    -webkit-backdrop-filter: blur(8px) saturate(0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.3s ease;
    padding: 16px;
}

.stats-box {
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2), var(--panel-bg-1));
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255,255,255,0.03) inset;
    animation: winnerIn 0.38s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}

.stats-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold-bright);
    margin: 0;
}

.stats-close {
    background: none;
    border: none;
    color: #555;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

.stats-close:hover {
    color: var(--cream);
    background: rgba(255, 255, 255, 0.07);
}

.stats-content {
    overflow-y: auto;
    padding: 20px 24px;
    flex: 1;
}

.stats-section {
    margin-bottom: 24px;
}

.stats-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #555;
    margin-bottom: 12px;
    font-family: 'DM Sans', sans-serif;
}

/* Final score summary */
.stats-final {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 16px 0 8px;
}

.stats-player-col {
    text-align: center;
}

.stats-player-name {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
}

.stats-big-num {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
}

.stats-sub {
    font-size: 0.72rem;
    color: #555;
    margin-top: 2px;
    font-family: 'DM Sans', sans-serif;
}

.stats-vs {
    font-size: 0.85rem;
    color: #444;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    align-self: center;
}

.stats-meta {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #555;
    margin-top: 8px;
    flex-wrap: wrap;
    font-family: 'DM Sans', sans-serif;
}

/* Score graph */
.stats-canvas {
    width: 100%;
    height: 180px;
    display: block;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

/* Points breakdown table */
.stats-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2px 16px;
    font-family: 'DM Sans', sans-serif;
}

.breakdown-header {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #555;
    padding-bottom: 6px;
    border-bottom: 1px solid #222;
    margin-bottom: 4px;
    font-weight: 600;
}

.breakdown-label {
    font-size: 0.88rem;
    color: #888;
    padding: 5px 0;
    border-bottom: 1px solid #1a1a1a;
}

.breakdown-val {
    font-size: 0.95rem;
    color: var(--cream);
    padding: 5px 0;
    border-bottom: 1px solid #1a1a1a;
    font-variant-numeric: tabular-nums;
}

.breakdown-label.total-row,
.breakdown-val.total-row {
    color: var(--gold);
    font-weight: 600;
    border-bottom: none;
    padding-top: 8px;
}

/* Biggest hand */
.stats-biggest-hand {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(212, 168, 67, 0.05);
    border: 1px solid rgba(212, 168, 67, 0.12);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
}

.stats-bh-pts {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--gold-bright);
    line-height: 1;
}

.stats-bh-pts-label {
    font-size: 0.78rem;
    color: #666;
    margin-right: 4px;
}

.stats-bh-info {
    font-size: 0.88rem;
    color: #888;
}

.p1-color { color: var(--score-p1) !important; }
.p2-color { color: var(--score-p2) !important; }

/* Legend row for graph */
.stats-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 8px;
    font-size: 0.78rem;
    font-family: 'DM Sans', sans-serif;
    color: #888;
}

.stats-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

/* ── CREDITS BUTTON (settings row) ── */
.btn-credits-small {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: #555;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 400;
    cursor: pointer;
    padding: 4px 12px;
    letter-spacing: 0.5px;
    transition: border-color 0.2s, color 0.2s;
    align-self: center;
}

.btn-credits-small:hover {
    border-color: #444;
    color: #888;
}

/* ── CREDITS MODAL ── */
.credits-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px) saturate(0.8);
    -webkit-backdrop-filter: blur(8px) saturate(0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: fadeIn 0.3s ease;
    padding: 16px;
}

.credits-box {
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2), var(--panel-bg-1));
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255,255,255,0.03) inset;
    animation: winnerIn 0.38s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.credits-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #222;
}

.credits-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold-bright);
    margin: 0;
}

.credits-content {
    padding: 24px;
    text-align: center;
}

.credits-suit-row {
    font-size: 1.3rem;
    color: #333;
    letter-spacing: 8px;
    margin-bottom: 24px;
}

.credits-section {
    margin-bottom: 4px;
}

.credits-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #555;
    margin-bottom: 4px;
    font-family: 'DM Sans', sans-serif;
}

.credits-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold-bright);
    margin-bottom: 4px;
}

.credits-note {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 4px;
}

.credits-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #2a2a2a, transparent);
    margin: 18px 0;
}

.credits-footer-note {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    color: #444;
    line-height: 1.8;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.credits-version {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: #333;
}

/* ── TUTORIAL MODAL ── */
.tutorial-overlay, .options-overlay {
    backdrop-filter: blur(8px) saturate(0.8);
    -webkit-backdrop-filter: blur(8px) saturate(0.8);
}

.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: fadeIn 0.3s ease;
    padding: 16px;
}

.tutorial-box {
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2), var(--panel-bg-1));
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255,255,255,0.03) inset;
    animation: winnerIn 0.38s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
    display: flex;
    flex-direction: column;
}

.tutorial-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}

.tutorial-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold-bright);
    margin: 0;
}

.tutorial-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px 0;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.tutorial-tabs::-webkit-scrollbar {
    display: none;
}

.tutorial-tab {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: #555;
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    padding: 7px 16px;
    letter-spacing: 0.4px;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    white-space: nowrap;
    margin-bottom: -1px;
    position: relative;
}

.tutorial-tab:hover {
    color: #888;
    border-color: #333;
}

.tutorial-tab.active {
    color: var(--gold-bright);
    border-color: #2a2a2a;
    background: var(--panel-bg-2);
    border-bottom: 1px solid var(--panel-bg-2);
}

.tutorial-panel {
    overflow-y: auto;
    flex: 1;
    padding: 20px 24px;
    scrollbar-width: thin;
    scrollbar-color: #2a2a2a transparent;
}

.tutorial-panel::-webkit-scrollbar {
    width: 4px;
}

.tutorial-panel::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 4px;
}

.tutorial-section {
    margin-bottom: 20px;
}

.tutorial-section:last-child {
    margin-bottom: 0;
}

.tutorial-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #555;
    font-family: 'DM Sans', sans-serif;
    margin-bottom: 8px;
}

.tutorial-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.65;
    margin: 0 0 8px;
}

.tutorial-text strong {
    color: #ccc;
}

.tutorial-text em {
    font-style: italic;
    color: #999;
}

.tutorial-tip {
    background: rgba(212, 168, 67, 0.06);
    border-left: 2px solid var(--gold-dim);
    border-radius: 0 6px 6px 0;
    padding: 10px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    color: #888;
    line-height: 1.6;
    margin-top: 8px;
}

.tutorial-tip strong {
    color: var(--gold);
}

.tutorial-pts-badge {
    display: inline-block;
    background: rgba(212, 168, 67, 0.15);
    border: 1px solid var(--gold-dim);
    border-radius: 4px;
    padding: 1px 7px;
    font-size: 0.78rem;
    color: var(--gold);
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
}

.tutorial-list {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.8;
    margin: 0;
    padding-left: 20px;
}

.tutorial-card-values {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tutorial-cv-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #1e1e1e;
    border-radius: 8px;
}

.tutorial-cv-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: #aaa;
}

.tutorial-cv-pts {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gold);
}

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

.tutorial-score-row {
    display: grid;
    grid-template-columns: 130px 56px 1fr;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #1e1e1e;
    border-radius: 8px;
}

.tutorial-score-name {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: #ccc;
}

.tutorial-score-pts {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gold);
    text-align: center;
}

.tutorial-score-desc {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    color: #666;
    line-height: 1.4;
}

.tutorial-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid #222;
    flex-shrink: 0;
}

.tutorial-nav-btn {
    background: transparent;
    border: 1.5px solid #2a2a2a;
    color: #666;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 7px 18px;
    transition: border-color 0.2s, color 0.2s;
}

.tutorial-nav-btn:hover:not(:disabled) {
    border-color: var(--gold-dim);
    color: var(--gold);
}

.tutorial-nav-btn:disabled {
    opacity: 0.2;
    cursor: default;
}

.tutorial-page-indicator {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    color: #444;
    letter-spacing: 1px;
}

@media (max-width: 480px) {
    .tutorial-score-row {
        grid-template-columns: 100px 48px 1fr;
        gap: 6px;
        padding: 7px 10px;
    }

    .tutorial-score-name {
        font-size: 0.78rem;
    }

    .tutorial-score-desc {
        font-size: 0.72rem;
    }
}

/* ── WAITING ROOM ── */
.waiting-room {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    padding: 24px;
    animation: fadeIn 0.45s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.waiting-box {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.waiting-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--gold-bright);
    margin-bottom: 28px;
}

.waiting-players {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.waiting-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.waiting-player-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #555;
    font-family: 'DM Sans', sans-serif;
    margin-bottom: 3px;
}

.waiting-player-name {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--cream);
    font-weight: 500;
}

.waiting-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 9px;
    border-radius: 20px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    flex-shrink: 0;
}

.host-badge {
    background: rgba(212, 168, 67, 0.1);
    border: 1px solid rgba(212, 168, 67, 0.3);
    color: var(--gold);
}

.waiting-joined-tag {
    font-size: 0.73rem;
    color: #44cc66;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    flex-shrink: 0;
    background: rgba(68, 204, 102, 0.08);
    border: 1px solid rgba(68, 204, 102, 0.25);
    border-radius: 20px;
    padding: 2px 9px;
}

.waiting-options-summary {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 18px;
    min-height: 18px;
    letter-spacing: 0.3px;
}

.waiting-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Guest connected panel ── */

.waiting-guest-connected {
    padding: 16px 0 8px;
}

.waiting-guest-icon {
    font-size: 2.2rem;
    color: #44cc66;
    margin-bottom: 10px;
    line-height: 1;
}

.waiting-guest-msg {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cream);
    margin-bottom: 10px;
}

.waiting-info-text {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: #666;
    font-size: 1rem;
    margin-bottom: 0;
}

.btn-secondary {
    background: rgba(255,255,255,0.025);
    border: 1px solid #282828;
    color: #777;
    padding: 10px 20px;
    border-radius: 11px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: #484848;
    color: #aaa;
    background: rgba(255,255,255,0.04);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0) scale(0.98);
}

/* ── GAME OPTIONS MODAL ── */
.options-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    animation: fadeIn 0.3s ease;
    padding: 16px;
}

.options-box {
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2), var(--panel-bg-1));
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255,255,255,0.03) inset;
    animation: winnerIn 0.38s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.options-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}

.options-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold-bright);
    margin: 0;
}

.options-content {
    overflow-y: auto;
    padding: 4px 24px 20px;
    flex: 1;
}

.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 0;
    border-bottom: 1px solid #1a1a1a;
}

.option-row-last {
    border-bottom: none;
}

.option-info {
    flex: 1;
    min-width: 0;
}

.option-name {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    color: var(--cream);
    font-weight: 500;
    margin-bottom: 3px;
}

.option-desc {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.74rem;
    color: #555;
    line-height: 1.4;
}

.option-stepper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.stepper-btn {
    background: transparent;
    border: 1px solid #333;
    color: #888;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stepper-btn:hover {
    color: var(--gold);
    border-color: var(--gold);
}

#decks-value {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold-bright);
    min-width: 24px;
    text-align: center;
}

.option-btn-group {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.option-pill {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: #555;
    padding: 5px 13px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.option-pill.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(212, 168, 67, 0.08);
}

.option-pill:hover:not(.active) {
    border-color: #444;
    color: #888;
}

/* ═══════════════════════════════════════════════════════════
   THEME PICKER
   ═══════════════════════════════════════════════════════════ */

.theme-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 4px 0 6px;
}

.theme-row-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #555;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    margin-right: 2px;
}

.theme-chip {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.22s var(--ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1)), box-shadow 0.2s, border-color 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.theme-chip:hover {
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.theme-chip.active {
    transform: scale(1.2);
    border-color: rgba(255,255,255,0.7);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.12), 0 4px 12px rgba(0,0,0,0.4);
}

.theme-chip[data-theme="default"] { background: #1a6b3c; }
.theme-chip[data-theme="royal"]   { background: #1a3d6b; }
.theme-chip[data-theme="crimson"] { background: #6b1a24; }
.theme-chip[data-theme="amethyst"]{ background: #3a1a6b; }
.theme-chip[data-theme="obsidian"]{ background: #2a2c30; border-color: #484848; }
.theme-chip[data-theme="obsidian"].active { border-color: #aaa; }

/* ── Lobby theme row is inside the lobby card ── */
#lobby .theme-row {
    margin-top: 12px;
    padding-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════
   THEMES
   ═══════════════════════════════════════════════════════════ */

/* ── Royal (Deep Navy) ── */
[data-theme="royal"] {
    --felt: #1a3d6b;
    --felt-dark: #122e52;
    --felt-deeper: #0c2040;
    --felt-center: #1e4882;
    --wood: #1a1e3a;
    --wood-light: #303666;
    --gold: #d4a843;
    --gold-bright: #f0c75e;
    --gold-dim: #a08030;
    --score-p1: #70c8f8;
    --score-p2: #f8c860;
    --bg-dark: #060810;
    --border-subtle: #1e2848;
    --panel-bg-1: #0c1020;
    --panel-bg-2: #14182c;
    --board-bg-1: #1a1e3a;
    --board-bg-2: #242848;
    --board-border-color: #0e122a;
    --card-back-1: #6b1a20;
    --card-back-2: #9b2830;
    --card-back-border: #c04050;
    --glow-felt: rgba(26, 61, 107, 0.10);
    --glow-accent: rgba(212, 168, 67, 0.04);
}

/* ── Crimson (Deep Red) ── */
[data-theme="crimson"] {
    --felt: #6b1a24;
    --felt-dark: #581418;
    --felt-deeper: #420e12;
    --felt-center: #7e202e;
    --wood: #3a1008;
    --wood-light: #6a2014;
    --gold: #d4a843;
    --gold-bright: #f0c75e;
    --gold-dim: #a08030;
    --score-p1: #70b8ff;
    --score-p2: #ffb870;
    --bg-dark: #0d0506;
    --border-subtle: #2a1a1c;
    --panel-bg-1: #130808;
    --panel-bg-2: #1e0e10;
    --board-bg-1: #4a1808;
    --board-bg-2: #6a2a14;
    --board-border-color: #280c06;
    --card-back-1: #1a2a5a;
    --card-back-2: #2a408a;
    --card-back-border: #4466aa;
    --glow-felt: rgba(107, 26, 36, 0.12);
    --glow-accent: rgba(212, 168, 67, 0.04);
}

/* ── Amethyst (Purple) ── */
[data-theme="amethyst"] {
    --felt: #3a1a6b;
    --felt-dark: #2e1454;
    --felt-deeper: #220e40;
    --felt-center: #4e2080;
    --wood: #1e0a30;
    --wood-light: #3a1858;
    --gold: #c090e8;
    --gold-bright: #e0b8ff;
    --gold-dim: #9060c0;
    --score-p1: #80c8f8;
    --score-p2: #f888c8;
    --bg-dark: #080510;
    --border-subtle: #2a1e40;
    --panel-bg-1: #0e0a1a;
    --panel-bg-2: #160e28;
    --board-bg-1: #280a40;
    --board-bg-2: #3a1258;
    --board-border-color: #1a0828;
    --card-back-1: #0a2e30;
    --card-back-2: #1a4e50;
    --card-back-border: #306870;
    --glow-felt: rgba(58, 26, 107, 0.12);
    --glow-accent: rgba(192, 144, 232, 0.06);
}

/* ── Obsidian (Monochrome) ── */
[data-theme="obsidian"] {
    --felt: #242628;
    --felt-dark: #1c1e20;
    --felt-deeper: #141618;
    --felt-center: #303436;
    --wood: #282828;
    --wood-light: #3c3c3c;
    --gold: #c8c8b8;
    --gold-bright: #e8e8d8;
    --gold-dim: #909080;
    --score-p1: #90c8e8;
    --score-p2: #e8a870;
    --bg-dark: #000000;
    --border-subtle: #242424;
    --panel-bg-1: #0e0e0e;
    --panel-bg-2: #181818;
    --board-bg-1: #222428;
    --board-bg-2: #2c2e34;
    --board-border-color: #141414;
    --card-back-1: #1e1808;
    --card-back-2: #322810;
    --card-back-border: #4e3e18;
    --glow-felt: rgba(36, 38, 40, 0.0);
    --glow-accent: rgba(200, 200, 184, 0.04);
}

/* ═══════════════════════════════════════════════════════════
   SOLO MODE BUTTON
   ═══════════════════════════════════════════════════════════ */

.btn-solo {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 12px 0;
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.06), rgba(212, 168, 67, 0.02));
    border: 1.5px solid rgba(212, 168, 67, 0.28);
    border-radius: 12px;
    color: rgba(212, 168, 67, 0.75);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.22s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}
.btn-solo:hover {
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.1), rgba(212, 168, 67, 0.05));
    border-color: rgba(212, 168, 67, 0.55);
    color: var(--gold-bright);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(212, 168, 67, 0.08);
}
.btn-solo:active {
    transform: translateY(0) scale(0.98);
    box-shadow: none;
}

/* AI thinking indicator */
.ai-thinking-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(212, 168, 67, 0.7);
    margin-left: 6px;
    animation: aiPulse 1s ease-in-out infinite;
    vertical-align: middle;
}
@keyframes aiPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%       { opacity: 1;   transform: scale(1.2); }
}

/* ═══════════════════════════════════════════════════════════
   DISCARD PREVIEW
   ═══════════════════════════════════════════════════════════ */

.discard-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 7px 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(212, 168, 67, 0.18);
    border-radius: 8px;
    font-size: 0.75rem;
    animation: dpFadeIn 0.2s ease-out both;
}
@keyframes dpFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.dp-label {
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.68rem;
}
.dp-score {
    font-weight: 700;
    font-size: 0.82rem;
}
.dp-hand  { color: #5ba4e6; }
.dp-crib  { color: #e8944a; }
.dp-sep   { color: rgba(255, 255, 255, 0.2); }
.dp-note  {
    color: rgba(255, 255, 255, 0.22);
    font-size: 0.65rem;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   RECONNECT BAR
   ═══════════════════════════════════════════════════════════ */

.reconnect-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 20px;
    background: rgba(160, 50, 30, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 100, 60, 0.3);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    color: rgba(255, 220, 200, 0.95);
    animation: reconnectSlideDown 0.3s ease-out both;
}
.reconnect-bar.hidden {
    display: none;
}
@keyframes reconnectSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
.reconnect-btn {
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.reconnect-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ═══════════════════════════════════════════════════════════
   REDUCED MOTION — respect user preferences
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.1ms !important;
    }

    .btn-deal::after {
        display: none;
    }

    .suit-decoration span {
        animation: none;
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════
   PEG ANIMATION — smooth slide along the board
   ═══════════════════════════════════════════════════════════ */
.peg {
    transition: cx 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
                cy 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════════════
   SHOW PHASE — card combination highlights
   ═══════════════════════════════════════════════════════════ */
.show-line-hl {
    cursor: default;
}
.show-line-hl:hover {
    background: rgba(212, 168, 67, 0.08);
    border-radius: 5px;
}
.show-cards-row .card.show-hl {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    transform: translateY(-3px) scale(1.06);
    transition: transform 0.15s, outline 0.15s;
    z-index: 2;
}
.show-cards-row .card.show-dimmed {
    opacity: 0.35;
    transition: opacity 0.15s;
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS — VOLUME SLIDER
   ═══════════════════════════════════════════════════════════ */
.settings-volume-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 110px;
    height: 4px;
    border-radius: 2px;
    background: #333;
    outline: none;
    cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    border: none;
}
.volume-pct {
    font-size: 0.78rem;
    color: #888;
    min-width: 32px;
    text-align: right;
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS — SPEED PILLS
   ═══════════════════════════════════════════════════════════ */
.speed-pill {
    padding: 4px 10px;
    border-radius: 6px;
    background: #1c1c1c;
    border: 1px solid #333;
    color: #888;
    font-size: 0.76rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.speed-pill.active,
.speed-pill:hover {
    background: rgba(212, 168, 67, 0.12);
    border-color: rgba(212, 168, 67, 0.4);
    color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS — CARD BACK CHIPS
   ═══════════════════════════════════════════════════════════ */
.cardback-chips {
    display: flex;
    gap: 8px;
}
.cardback-chip {
    width: 24px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 2px solid transparent;
}
.cardback-chip[data-back="classic"] { background: linear-gradient(135deg, #1a3a6b, #2a5a9b); }
.cardback-chip[data-back="crimson"] { background: linear-gradient(135deg, #6b1010, #9b2020); }
.cardback-chip[data-back="forest"]  { background: linear-gradient(135deg, #0f3b1a, #1a6b2a); }
.cardback-chip[data-back="ebony"]   { background: linear-gradient(135deg, #2a2010, #4e3e18); }
.cardback-chip.active,
.cardback-chip:hover {
    transform: scale(1.12);
    box-shadow: 0 0 0 2px var(--gold);
}

/* ═══════════════════════════════════════════════════════════
   CARD BACK OVERRIDES via data-cardback attribute on <html>
   ═══════════════════════════════════════════════════════════ */
[data-cardback="crimson"] {
    --card-back-1:      #6b1010;
    --card-back-2:      #9b2020;
    --card-back-border: #c04040;
}
[data-cardback="forest"] {
    --card-back-1:      #0f3b1a;
    --card-back-2:      #1a6b2a;
    --card-back-border: #2a9b3a;
}
[data-cardback="ebony"] {
    --card-back-1:      #1e1808;
    --card-back-2:      #3a2e14;
    --card-back-border: #6a5428;
}

/* ═══════════════════════════════════════════════════════════
   LOBBY — AI DIFFICULTY SELECTOR
   ═══════════════════════════════════════════════════════════ */
.lobby-diff-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 6px 0 18px;
}
.diff-label {
    font-size: 0.75rem;
    color: #666;
    letter-spacing: 0.5px;
}
.diff-pill {
    padding: 4px 12px;
    border-radius: 6px;
    background: #1c1c1c;
    border: 1px solid #333;
    color: #777;
    font-size: 0.76rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.diff-pill.active,
.diff-pill:hover {
    background: rgba(212, 168, 67, 0.12);
    border-color: rgba(212, 168, 67, 0.4);
    color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS LOG — DOWNLOAD BUTTON
   ═══════════════════════════════════════════════════════════ */
.settings-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.log-dl-btn {
    font-size: 0.72rem;
    padding: 3px 9px;
    border-radius: 5px;
    background: rgba(255,255,255,0.05);
    border: 1px solid #2a2a2a;
    color: #777;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.15s, color 0.15s;
}
.log-dl-btn:hover {
    background: rgba(212,168,67,0.1);
    color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════
   CHAT — CHARACTER COUNTER
   ═══════════════════════════════════════════════════════════ */
.chat-counter-row {
    padding: 3px 16px 8px;
    text-align: right;
}
.chat-counter {
    font-size: 0.72rem;
    color: #555;
    transition: color 0.2s;
}
.chat-counter.chat-counter-low {
    color: #c0604a;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   WINNER OVERLAY — MATCH / SERIES SCORE
   ═══════════════════════════════════════════════════════════ */
.match-score-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 22px;
    margin-bottom: 4px;
}
.match-label {
    font-size: 0.72rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.match-pts {
    font-size: 1.05rem;
    font-weight: 700;
}
.match-sep {
    color: #555;
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════
   LIFETIME STATS MODAL
   ═══════════════════════════════════════════════════════════ */
.lifetime-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 8px;
    padding: 12px 0 4px;
}
.lt-item {
    text-align: center;
}
.lt-val {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1.2;
}
.lt-label {
    font-size: 0.68rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   ADMIN PANEL MODAL
   ═══════════════════════════════════════════════════════════ */
.btn-admin {
    display: block;
    margin: 14px auto 0;
    padding: 6px 18px;
    background: rgba(212, 168, 67, 0.08);
    border: 1px solid rgba(212, 168, 67, 0.28);
    border-radius: 20px;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.btn-admin:hover {
    background: rgba(212, 168, 67, 0.15);
    border-color: rgba(212, 168, 67, 0.5);
}

.admin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px) saturate(0.8);
    -webkit-backdrop-filter: blur(8px) saturate(0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    padding: 16px;
}

.admin-box {
    background: linear-gradient(160deg, var(--panel-bg-1), var(--panel-bg-2), var(--panel-bg-1));
    border: 1px solid rgba(212, 168, 67, 0.18);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    padding: 24px;
    box-shadow: 0 0 0 1px rgba(212,168,67,0.08), var(--shadow-4);
    animation: winnerIn 0.32s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.admin-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--gold);
    font-weight: 700;
}

.admin-badge-row {
    margin-bottom: 20px;
}

.admin-badge {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(212, 168, 67, 0.1);
    border: 1px solid rgba(212, 168, 67, 0.22);
    border-radius: 10px;
    color: var(--gold);
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.admin-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}