/* ================================================
   HORLDLE — Vegas Felt Theme
   ================================================ */

:root {
    /* Felt palette */
    --felt-deep:   #09201a;
    --felt-dark:   #0e2d20;
    --felt-mid:    #14472d;
    --felt-light:  #1c5e3a;

    /* Gold palette */
    --gold-bright: #e8c84a;
    --gold-mid:    #c9a535;
    --gold-dim:    #8a6820;
    --gold-glow:   rgba(200, 165, 50, 0.25);

    /* Cards */
    --card-bg:    #fefaf0;
    --card-cream: #f5f0e0;
    --card-red:   #cc2200;
    --card-black: #1a1a2e;

    /* UI chrome */
    --panel-bg:      rgba(8, 24, 16, 0.75);
    --border-gold:   1px solid var(--gold-dim);
    --shadow-card:   0 10px 40px rgba(0,0,0,0.7), 0 2px 8px rgba(0,0,0,0.5);
    --shadow-gold:   0 0 24px var(--gold-glow);
    --text-cream:    #d4c99a;
    --text-dim:      #9d8b5b;
    --strike-red:    #8b0000;

    /* Typography */
    --font-display: 'Cinzel Decorative', serif;
    --font-heading: 'Cinzel', serif;
    --font-body:    'EB Garamond', serif;

    --radius-card:  13px;
}

/* ─────────────────────────────────────────────
   LANDSCAPE LOCK (mobile only)
───────────────────────────────────────────── */
#landscape-lock {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--felt-deep);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#landscape-lock .ls-inner {
    text-align: center;
}

#landscape-lock .ls-icon {
    font-size: 3rem;
    color: var(--gold-bright);
    animation: ls-spin 2s ease-in-out infinite;
    display: block;
    margin-bottom: 16px;
}

#landscape-lock p {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    color: var(--text-cream);
    line-height: 1.7;
}

@keyframes ls-spin {
    0%, 100% { transform: rotate(0deg); }
    50%       { transform: rotate(90deg); }
}

/* Show only on small landscape screens */
@media screen and (orientation: landscape) and (max-height: 500px) {
    #landscape-lock { display: flex; }
}
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

/* ── Felt background ────────────────────────── */
body {
    font-family: var(--font-body);
    background-color: var(--felt-deep);
    color: var(--text-cream);
    height: 100%;

    background-image:
        radial-gradient(ellipse 90% 55% at 50% 10%, rgba(28, 94, 58, 0.55) 0%, transparent 65%),
        radial-gradient(ellipse 70% 45% at 50% 95%, rgba(6, 18, 12, 0.7) 0%, transparent 70%);
}

/* Woven felt micro-texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Crect width='3' height='3' fill='rgba(255,255,255,0.013)'/%3E%3Crect x='3' y='3' width='3' height='3' fill='rgba(255,255,255,0.013)'/%3E%3C/svg%3E");
}

/* ── Body container ─────────────────────────── */
.body-container {
    position: relative;
    z-index: 1;
    max-width: 500px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 8px 0 0;
}

/* ─────────────────────────────────────────────
   TITLE BAR
───────────────────────────────────────────── */
.title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 10px;
    position: relative;
}

.title-lock {
    text-align: center;
    flex: 1;
}

.title-main {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 5vw, 1.65rem);
    font-weight: 700;
    color: var(--gold-bright);
    letter-spacing: 0.18em;
    text-shadow:
        0 0 28px rgba(232, 200, 74, 0.4),
        0 1px 0 rgba(0, 0, 0, 0.6);
}

.title-date {
    font-family: var(--font-heading);
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 0.25em;
    margin-top: 3px;
    text-transform: uppercase;
}

.title-spacer { width: 40px; flex-shrink: 0; }

/* Gold rule under header */
.divider-gold {
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--gold-dim) 15%,
        var(--gold-mid) 50%,
        var(--gold-dim) 85%,
        transparent 100%
    );
    margin: 0 14px 8px;
    box-shadow: 0 0 10px var(--gold-glow);
}

/* ─────────────────────────────────────────────
   HAMBURGER MENU
───────────────────────────────────────────── */
.menu-wrap {
    position: relative;
    width: 40px;
    flex-shrink: 0;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 36px;
}

.hamburger span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--text-cream);
    transition: background 0.2s;
}

.hamburger:hover span { background: var(--gold-bright); }

/* Dropdown */
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 160px;
    background: linear-gradient(180deg, #1c3d28, #0e2018);
    border: 1px solid var(--gold-dim);
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.6),
        0 0 16px var(--gold-glow);
    z-index: 200;
}

.dropdown-menu.show { display: block; }

.menu-item {
    padding: 12px 18px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--text-cream);
    cursor: pointer;
    border-bottom: 1px solid rgba(200, 165, 50, 0.12);
    transition: background 0.15s, color 0.15s;
}

.menu-item:last-child { border-bottom: none; }

.menu-item:hover {
    background: rgba(200, 165, 50, 0.12);
    color: var(--gold-bright);
}

/* Pass the Deck — hidden until game ends, then revealed by JS */
.menu-pass-item {
    display: none;
    color: var(--gold-mid) !important;
    border-top: 1px solid rgba(200, 165, 50, 0.25) !important;
    letter-spacing: 0.08em;
}

.menu-pass-item:hover {
    color: var(--gold-bright) !important;
}

/* ─────────────────────────────────────────────
   MAIN LAYOUT
───────────────────────────────────────────── */
.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 0 10px 10px;
    gap: 10px;
    min-height: 0;
}

.main-container.lefty { flex-direction: row-reverse; }

.left-panel {
    flex: 0 0 44%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

/* ─────────────────────────────────────────────
   DECK GRID
───────────────────────────────────────────── */
.deck-label {
    font-family: var(--font-heading);
    font-size: 0.55rem;
    letter-spacing: 0.25em;
    color: var(--text-dim);
    text-align: center;
    text-transform: uppercase;
    padding-bottom: 2px;
}

.deck-grid {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-content: flex-start;
    overflow: visible;
}

/* Each small card in the grid */
.deck-card {
    width: calc(20% - 3px);
    aspect-ratio: 2 / 3;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;

    background:
        repeating-linear-gradient(
            45deg,
            rgba(160, 20, 20, 0.15) 0px, rgba(160, 20, 20, 0.15) 1px,
            transparent 1px, transparent 5px
        ),
        linear-gradient(145deg, #3d1515, #1f0808);
    border: 1px solid rgba(140, 20, 20, 0.5);
    box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Inset border on card back */
.deck-card::after {
    content: '';
    position: absolute;
    inset: 2px;
    border: 1px solid rgba(160, 40, 40, 0.25);
    border-radius: 2px;
    pointer-events: none;
}

/* Played card: dark, subtle */
.deck-card.dc-played {
    background: rgba(10, 25, 16, 0.6);
    border-color: rgba(14, 45, 32, 0.4);
    box-shadow: none;
    transform: none;
}

.deck-card.dc-played::after { display: none; }

/* Face-up played card */
.deck-card.dc-face {
    background: #fefaf0;
    border-color: rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.deck-card.dc-red   { color: var(--card-red); }
.deck-card.dc-black { color: var(--card-black); }

/* Suit in top-left corner of deck cell */
.dcf-suit {
    position: absolute;
    top: 1px;
    left: 1px;
    font-size: 18px;
    line-height: 1;
}

.dcf-suit-bot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    font-size: 18px;
    line-height: 1;
    transform: rotate(180deg);
}

/* Rank centred in the cell */
.dcf-rank {
    font-family: Libre Baskerville;
    font-size: 22px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
}

/* Correct guess tinge — slight green wash */
.deck-card.dc-correct {
    background: #d4edda;
    border-color: rgba(40, 140, 70, 0.35);
}

/* Wrong guess tinge — slight red wash */
.deck-card.dc-wrong {
    background: #f8d7da;
    border-color: rgba(160, 40, 40, 0.35);
}

/* Previous player's cards — neutral cream, no tinge */
.deck-card.dc-prev {
    background: #ede8db;
    border-color: rgba(0,0,0,0.12);
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════
   SCREEN FLASH — full-viewport guess feedback.
   To REMOVE: delete this entire CSS block AND the
   <div id="screen-flash"> in the HTML AND the 7-line
   "── SCREEN FLASH" block inside onGuessResult() in JS.
   ═══════════════════════════════════════════════ */
#screen-flash {
    position: fixed;
    inset: 0;
    z-index: 500;
    pointer-events: none;
    opacity: 0;
}

#screen-flash.flash-correct {
    animation: sf-green 0.35s ease-out forwards;
}

#screen-flash.flash-wrong {
    animation: sf-red 0.35s ease-out forwards;
}

@keyframes sf-green {
    0%   { background: rgba(40, 190, 80, 0.38); opacity: 1; }
    100% { background: rgba(40, 190, 80, 0);    opacity: 0; }
}

@keyframes sf-red {
    0%   { background: rgba(210, 40, 40, 0.38); opacity: 1; }
    100% { background: rgba(210, 40, 40, 0);    opacity: 0; }
}
/* ═══════════════════════════════════════════════
   END SCREEN FLASH
   ═══════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════
   END GAME MENU SHARE
   ═══════════════════════════════════════════════ */
#copy-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(10, 35, 20, 0.95);
    border: 1px solid var(--gold-dim);
    border-radius: 8px;
    padding: 10px 20px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--gold-bright);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 12px var(--gold-glow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 600;
}

#copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* Current card in grid: gold glow */
.deck-card.dc-current {
    background: linear-gradient(145deg, var(--gold-mid), var(--gold-dim));
    border-color: var(--gold-bright);
    box-shadow: 0 0 8px rgba(232, 200, 74, 0.6), 0 0 2px var(--gold-bright);
    transform: scale(1.12);
    z-index: 1;
}

.deck-card.dc-current::after { display: none; }

/* ─────────────────────────────────────────────
   STRIKES BAR
───────────────────────────────────────────── */
.strikes-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12%;
    padding: 2px 0;
}

.strike-icon {
    width: 26%;
    max-width: 50px;
    aspect-ratio: 1;
}

.strike-icon svg { width: 100%; height: 100%; overflow: visible; }

.s-circle {
    fill: rgba(8, 25, 15, 0.7);
    stroke: var(--gold-dim);
    stroke-width: 2;
    transition: fill 0.2s, stroke 0.2s, stroke-width 0.2s, filter 0.2s;
}

.s-line {
    stroke: transparent;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke 0.2s, stroke-width 0.2s;
}

/* Active strike — thick ring, bold X, red glow */
.strike-icon.struck .s-circle {
    fill: rgba(140, 0, 0, 0.9);
    stroke: #ff4444;
    stroke-width: 2;
    filter: drop-shadow(0 0 3px rgba(255, 60, 60, 0.75));
    animation: strike-pop 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.strike-icon.struck .s-line {
    stroke: #ff9999;
    stroke-width: 3.5;
}

@keyframes strike-pop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.48); }
    62%  { transform: scale(0.88); }
    100% { transform: scale(1); }
}

/* ─────────────────────────────────────────────
   SCORE PANEL
───────────────────────────────────────────── */
.score-panel {
    background: var(--panel-bg);
    border: var(--border-gold);
    border-radius: 8px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;

    box-shadow:
        inset 0 1px 0 rgba(200, 165, 50, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.4);
}

.score-row {
    display: flex;
    gap: 5px;
}

.score-cell {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 5px;
    border: 1px solid rgba(200, 165, 50, 0.08);
}

.score-label {
    font-family: var(--font-heading);
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    color: var(--text-dim);
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.score-val {
    font-family: var(--font-heading);
    font-size: clamp(0.9rem, 3vw, 1.15rem);
    font-weight: 600;
    color: var(--gold-bright);
    display: block;
    line-height: 1;
    text-shadow: 0 0 10px rgba(232, 200, 74, 0.3);
}

/* ─────────────────────────────────────────────
   LEADERBOARD PANEL
───────────────────────────────────────────── */
.leaderboard-panel {
    background: var(--panel-bg);
    border: var(--border-gold);
    border-radius: 8px;
    padding: 6px 8px 7px;
    box-shadow:
        inset 0 1px 0 rgba(200, 165, 50, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

/* HEADER */
.lb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.lb-title {
    font-family: var(--font-heading);
    font-size: 0.52rem;
    letter-spacing: 0.22em;
    color: var(--text-dim);
    text-transform: uppercase;
}

.lb-badge {
    font-family: var(--font-heading);
    font-size: 0.44rem;
    letter-spacing: 0.08em;
    color: var(--gold-dim);
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s;
	font-weight: 600
}

.lb-badge:hover { color: var(--gold-mid); }

/* LIST */
.lb-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* ENTRY — GRID LAYOUT */
.lb-entry {
    display: grid;
    grid-template-columns:
        10px      /* rank/medal */
        1fr       /* name */
        50px      /* player count */
        50px;     /* score */
    align-items: center;
    padding: 5px 6px;
    gap: 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.lb-entry:hover {
    background: rgba(200, 165, 50, 0.05);
}


/* RANK / MEDAL */
.lb-rank {
    font-size: 0.62rem;
    text-align: center;
    line-height: 1;
}

/* NAME */
.lb-name {
    font-family: var(--font-heading);
    font-size: 0.56rem;
    color: var(--text-cream);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.04em;
}

/* PLAYER COUNT */
.lb-player {
    font-family: var(--font-heading);
    font-size: 0.55rem;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
	font-weight: 600;
}

.lb-player-label {
    font-size: 0.5rem;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* SCORE */
.lb-score {
    font-family: var(--font-heading);
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--gold-mid);
    text-align: left;
    white-space: nowrap;
	padding-left: 10px;
}

/* EMPTY / LOADING */
.lb-empty,
.lb-loading {
    font-family: var(--font-heading);
    font-size: 0.52rem;
    color: var(--text-dim);
    text-align: center;
    padding: 5px 0 3px;
    letter-spacing: 0.06em;
    font-style: italic;
}

/* SETUP NOTE */
.lb-setup-note {
    font-family: var(--font-heading);
    font-size: 0.48rem;
    color: var(--text-dim);
    text-align: center;
    padding: 4px 0 2px;
    letter-spacing: 0.04em;
    line-height: 1.6;
}

.lb-setup-note a {
    color: var(--gold-dim);
    text-decoration: none;
}

.lb-setup-note a:hover { color: var(--gold-mid); }


/* ─────────────────────────────────────────────
   CARD AREA
───────────────────────────────────────────── */
.card-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 0;
    position: relative;
}

.hint-label {
    font-family: var(--font-heading);
    font-size: .85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    user-select: none;
    pointer-events: none;
}

.hint-up, .hint-down   {     
	color: var(--gold-bright);
    letter-spacing: 0.18em;
    text-shadow:
        0 0 28px rgba(232, 200, 74, 0.4),
        0 1px 0 rgba(0, 0, 0, 0.6);
}

/* ─────────────────────────────────────────────
   PLAYING CARD
───────────────────────────────────────────── */
.playing-card {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(200, 190, 160, 0.3);
	
    width: min(90%, 165px);
    aspect-ratio: 2.5 / 3.5;

    position: relative;

    cursor: pointer;
    user-select: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;

    will-change: transform;
    transform-origin: center 60%;


    transition:
        transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease;
}

.playing-card:hover {
    box-shadow: var(--shadow-card), 0 0 24px rgba(200, 165, 50, 0.18);
}

/* Suit color variants */
.playing-card.red-card   { color: var(--card-red); }
.playing-card.black-card { color: var(--card-black); }

/* Disabled card (already played today) */
.playing-card.card-disabled {
    opacity: 0.55;
    pointer-events: none;
    cursor: default;
    filter: grayscale(0.35);
}

/* Card corners — pinned absolutely so they don't take up layout space */
.card-corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    padding: 5px 5px;
}

.card-corner.tl {
    top: 0;
    left: 0;
}

.card-corner.br {
    bottom: 0;
    right: 0;
    transform: rotate(180deg);
}

.cr-rank {
    font-family:  'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(25px, 3.8vw, 30px);
    line-height: 1;
}

.cr-suit {
    font-size: clamp(12px, 2.3vw, 17px);
    line-height: 1;
    margin-top: 1px;
}

/* Pip container — fills the full card face */
.card-mid-suit {
    position: absolute;
    inset: 0;
}

/* Single large suit for A / J / Q / K — centred in full card */
.pip-single {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(42px, 14vw, 68px);
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

/* Individual suit pip for 2–10 */
.pip {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: clamp(40px, 2.8vw, 50px);
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

/* Bottom-half pips face downward */
.pip.pip-r {
    transform: translate(-50%, -50%) rotate(180deg);
}


/* ─────────────────────────────────────────────
   SCORE CELL FEEDBACK ANIMATIONS
───────────────────────────────────────────── */

/* Correct guess — quick green glow on score + streak cells */
.score-cell.glow-green {
    animation: score-glow-green 0.55s ease forwards;
}

@keyframes score-glow-green {
    0%   { background: rgba(0, 0, 0, 0.25);        border-color: rgba(200, 165, 50, 0.08); }
    28%  { background: rgba(30, 150, 65, 0.32);    border-color: rgba(50, 210, 90, 0.65);
           box-shadow: 0 0 16px rgba(40, 190, 75, 0.5), inset 0 0 8px rgba(40, 200, 80, 0.2); }
    100% { background: rgba(0, 0, 0, 0.25);        border-color: rgba(200, 165, 50, 0.08); }
}

/* Wrong guess — streak cell clunks red, value briefly goes crimson */
.score-cell.clunk-red {
    animation: score-clunk-red 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

.score-cell.clunk-red .score-val {
    animation: streak-val-red 0.42s ease forwards;
}

@keyframes score-clunk-red {
    0%   { background: rgba(0,0,0,0.25);       border-color: rgba(200,165,50,0.08); transform: scale(1);    }
    20%  { background: rgba(150,15,15,0.55);   border-color: rgba(255,55,55,0.75);  transform: scale(1.07);
           box-shadow: 0 0 14px rgba(200,30,30,0.5), inset 0 0 6px rgba(220,40,40,0.25); }
    55%  { background: rgba(110,10,10,0.40);   border-color: rgba(200,40,40,0.45);  transform: scale(0.96); }
    100% { background: rgba(0,0,0,0.25);       border-color: rgba(200,165,50,0.08); transform: scale(1);    }
}

@keyframes streak-val-red {
    0%   { color: var(--gold-bright); }
    25%  { color: #ff6060; }
    100% { color: var(--gold-bright); }
}

/* ─────────────────────────────────────────────
   STREAK FIRE STATES
   Applied to both the score-cell and score-val
   for the streak box.
───────────────────────────────────────────── */

/* ── Hot Streak (5+) — steady golden glow ── */
.score-cell.streak-hot {
    border-color: rgba(232, 200, 74, 0.55) !important;
    box-shadow: 0 0 10px rgba(232, 200, 74, 0.3), inset 0 0 6px rgba(232, 200, 74, 0.08);
}
.score-val.streak-hot {
    color: var(--gold-bright);
    text-shadow:
        0 0 8px rgba(232, 200, 74, 0.9),
        0 0 20px rgba(232, 200, 74, 0.5);
    animation: hot-pulse 1.8s ease-in-out infinite;
}
@keyframes hot-pulse {
    0%, 100% { text-shadow: 0 0 8px rgba(232,200,74,0.8), 0 0 18px rgba(232,200,74,0.4); }
    50%       { text-shadow: 0 0 14px rgba(232,200,74,1),  0 0 30px rgba(232,200,74,0.7); }
}

/* Streak label glow when hot */
.score-cell.streak-hot .score-label {
    color: var(--gold-mid);
    text-shadow: 0 0 8px rgba(232, 200, 74, 0.4);
}

/* ── On Fire (10+) — pulsing fire colours ── */
.score-cell.streak-fire {
    border-color: rgba(255, 130, 30, 0.6) !important;
    box-shadow: 0 0 14px rgba(255, 100, 20, 0.35), inset 0 0 8px rgba(255, 80, 10, 0.12);
    animation: fire-cell 2s ease-in-out infinite;
}
@keyframes fire-cell {
    0%, 100% { box-shadow: 0 0 12px rgba(255,90,10,0.3),  inset 0 0 6px rgba(255,60,0,0.1); }
    33%       { box-shadow: 0 0 20px rgba(255,160,10,0.5), inset 0 0 10px rgba(255,130,0,0.2); }
    66%       { box-shadow: 0 0 16px rgba(200,30,10,0.45), inset 0 0 8px rgba(200,20,0,0.15); }
}
.score-val.streak-fire {
    animation: fire-val 1.4s ease-in-out infinite;
}
@keyframes fire-val {
    0%   { color: #ffe566; text-shadow: 0 0 10px rgba(255,220,50,0.9); }
    25%  { color: #ffaa22; text-shadow: 0 0 14px rgba(255,140,10,0.9); }
    50%  { color: #ff6010; text-shadow: 0 0 16px rgba(255,80,10,0.9);  }
    75%  { color: #ffaa22; text-shadow: 0 0 14px rgba(255,140,10,0.9); }
    100% { color: #ffe566; text-shadow: 0 0 10px rgba(255,220,50,0.9); }
}
.score-cell.streak-fire .score-label {
    animation: fire-label 1.4s ease-in-out infinite;
}
@keyframes fire-label {
    0%, 100% { color: #e8a030; }
    50%       { color: #ff5010; }
}

/* ── Max Streak (20+) — intense fire + gold ── */
.score-cell.streak-max {
    border-color: rgba(255, 210, 50, 0.75) !important;
    animation: max-cell 1s ease-in-out infinite;
}
@keyframes max-cell {
    0%, 100% { box-shadow: 0 0 18px rgba(255,200,30,0.5),  0 0 6px rgba(255,100,0,0.4),  inset 0 0 10px rgba(255,180,0,0.15); }
    33%       { box-shadow: 0 0 28px rgba(255,230,80,0.7),  0 0 12px rgba(255,160,10,0.55), inset 0 0 14px rgba(255,200,20,0.2); }
    66%       { box-shadow: 0 0 22px rgba(255,60,0,0.55),   0 0 8px rgba(200,20,0,0.5),   inset 0 0 12px rgba(200,30,0,0.18); }
}
.score-val.streak-max {
    animation: max-val 1s ease-in-out infinite;
}
@keyframes max-val {
    0%   { color: #fff07a; text-shadow: 0 0 12px #ffe566, 0 0 28px rgba(255,210,50,0.8); }
    25%  { color: #ffcc22; text-shadow: 0 0 16px #ffaa00, 0 0 36px rgba(255,160,0,0.8);  }
    50%  { color: #ff6010; text-shadow: 0 0 20px #ff4400, 0 0 40px rgba(255,50,0,0.7);   }
    75%  { color: #ffcc22; text-shadow: 0 0 16px #ffaa00, 0 0 36px rgba(255,160,0,0.8);  }
    100% { color: #fff07a; text-shadow: 0 0 12px #ffe566, 0 0 28px rgba(255,210,50,0.8); }
}
.score-cell.streak-max .score-label {
    animation: fire-label 1s ease-in-out infinite;
}

/* ─────────────────────────────────────────────
   OVERLAYS
───────────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 14, 9, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

.overlay-panel {
    width: 90%;
    max-width: 340px;
    background: linear-gradient(180deg, #1c3f2a 0%, #0f2419 100%);
    border: 1px solid var(--gold-dim);
    border-radius: 16px;
    padding: 28px 24px 24px;
    text-align: center;
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.8),
        0 0 40px var(--gold-glow);

    transform: translateY(12px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.overlay.active .overlay-panel {
    transform: translateY(0) scale(1);
}

/* Decorative suits at top of each panel */
.overlay-suits {
    font-size: 1.1rem;
    letter-spacing: 0.4em;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.overlay-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gold-bright);
    letter-spacing: 0.12em;
    margin-bottom: 18px;
    text-shadow: 0 0 20px rgba(232, 200, 74, 0.3);
}

/* Rules text */
.rules p, .overlay-panel p {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-cream);
    margin-bottom: 10px;
    line-height: 1.55;
}

.rules p strong, .overlay-panel p strong {
    color: var(--gold-bright);
    font-weight: 500;
}

.hint-box {
    font-family: var(--font-heading) !important;
    font-size: 0.72rem !important;
    color: var(--text-dim) !important;
    letter-spacing: 0.04em;
    border: 1px solid rgba(200, 165, 50, 0.2);
    border-radius: 6px;
    padding: 12px 14px !important;
    margin-top: 6px;
    line-height: 1.8 !important;
}

/* ── Already Played overlay ──────────────────── */
.played-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 6px 0 14px;
}

.played-stat {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(200, 165, 50, 0.15);
    border-radius: 7px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.played-stat span {
    font-family: var(--font-heading);
    font-size: 0.5rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.played-stat strong {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--gold-bright);
    line-height: 1;
}

.played-countdown {
    font-family: var(--font-heading) !important;
    font-size: 0.72rem !important;
    color: var(--text-dim) !important;
    letter-spacing: 0.08em;
    margin-top: 4px !important;
}

.played-countdown strong {
    color: var(--gold-mid) !important;
}

/* ── Buttons ──────────────────────────────────── */
.btn-gold {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    background: linear-gradient(180deg, var(--gold-mid) 0%, #9e7b18 100%);
    border: 1px solid var(--gold-bright);
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1a1408;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.btn-gold:hover {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold-mid) 100%);
    box-shadow: 0 4px 22px var(--gold-glow);
    transform: translateY(-1px);
}

.btn-gold:active {
    transform: translateY(0);
}

.btn-outline {
    display: block;
    width: 100%;
    padding: 11px;
    margin-top: 10px;
    background: transparent;
    border: 1px solid rgba(200, 165, 50, 0.3);
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: var(--gold-mid);
    color: var(--text-cream);
}

/* ── Game over result grid ───────────────────── */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 14px 0 4px;
}

.result-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(200, 165, 50, 0.15);
    border-radius: 7px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.result-item span {
    font-family: var(--font-heading);
    font-size: 0.5rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.result-item strong {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--gold-bright);
    line-height: 1;
}

.pass-text {
    font-family: var(--font-heading) !important;
    font-size: 0.72rem !important;
    color: var(--text-dim) !important;
    letter-spacing: 0.06em;
    margin-top: 6px !important;
    margin-bottom: 0 !important;
}

/* Player ranking line in game-over overlay */
.gameover-rank {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    color: var(--text-cream);
    letter-spacing: 0.06em;
    text-align: center;
    margin-top: 8px;
    min-height: 1.2em;
}

.gameover-rank strong {
    color: var(--gold-bright);
    font-weight: 600;
}

.gameover-rank sup {
    font-size: 0.6em;
    vertical-align: super;
}

.share-confirm {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: #60c060;
    min-height: 22px;
    margin-top: 8px;
}

/* ── Takeover overlay ────────────────────────── */
.takeover-msg p {
    font-size: 1rem;
    color: var(--text-cream);
    margin-bottom: 10px;
    line-height: 1.6;
}

.takeover-msg p strong { color: var(--gold-bright); }

/* ─────────────────────────────────────────────
   RESPONSIVE ADJUSTMENTS
───────────────────────────────────────────── */

/* Short screens — hide leaderboard & simplify */
@media (max-height: 600px) {
    .title-main        { font-size: 1rem; }
    .title-date        { display: none; }
    .score-val         { font-size: 0.85rem; }
    .score-label       { font-size: 0.44rem; }
    .strikes-bar       { padding: 0; }
    .strike-icon       { max-width: 36px; }
    .hint-label        { font-size: 0.45rem; }
    .card-area         { gap: 3px; }
    .deck-label        { display: none; }
    .leaderboard-panel { display: none; }
}

/* Mobile: tighter card corner sizes to prevent bleed */
@media (max-width: 430px) {
    .cr-rank { font-size: 28px; }
    .cr-suit { font-size: 8px; margin-top: 10px; }
    .pip     { font-size: clamp(18px, 7.5vw, 28px); }
    .pip-single { font-size: clamp(36px, 13vw, 56px); }
	.dcf-suit {font-size: 8px;}
	.dcf-suit-bot {font-size: 8px;}
}

/* Wide desktop */
@media (min-width: 520px) {
    .playing-card { width: 170px; }
}

/* ── LEADERBOARD RESPONSIVE FIXES ───────────────────────────── */

/* Make sure the entry container keeps elements in a clean row */
.lb-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 4px;
}

/* Protect the name! Allow it to grow, but truncate with '...' if it runs out of space */
.lb-name {
    flex: 1;             /* Takes up all available middle space */
    text-align: left;
    white-space: nowrap; /* Prevents the name from wrapping to a second line */
    overflow: hidden;
    text-overflow: ellipsis; 
}

/* Keep player and score structural elements neatly sized */
.lb-player, .lb-score {
    white-space: nowrap;
}

/* Shorten the label on small mobile screens */
@media screen and (max-width: 440px) {
    /* Hide the original "Players: " text */
    .lb-player-label {
        font-size: 0;
    }
    
    /* Inject "Plrs: " right before the number instead */
    .lb-player-label::before {
        content: "Plrs: ";
        font-size: 0.5rem; /* Restores standard text size for mobile */
    }
}

/* ─────────────────────────────────────────────
   COLORBLIND TOGGLE SLIDER (How-to-Play overlay)
───────────────────────────────────────────── */
.colorblind-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0 4px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(200, 165, 50, 0.2);
    border-radius: 8px;
    text-align: left;
}

.cb-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cb-toggle-label span:first-child {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--text-cream);
    letter-spacing: 0.05em;
}

.cb-sub {
    font-family: 'EB Garamond', serif;
    font-size: 0.78rem;
    color: var(--text-dim);
}

.cb-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    margin-left: 14px;
}

.cb-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cb-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--gold-dim);
    border-radius: 26px;
    transition: background 0.3s, border-color 0.3s;
}

.cb-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}

.cb-switch input:checked + .cb-slider {
    background: rgba(25, 90, 170, 0.55);
    border-color: #4a9ae0;
}

.cb-switch input:checked + .cb-slider::before {
    transform: translateX(22px);
    background: #70b8f8;
}

/* Active state highlight for menu item */
.menu-item.menu-item-active {
    color: #70b8f8 !important;
}

/* ─────────────────────────────────────────────
   COLORBLIND MODE  (body.colorblind)
   Blue = correct/green   Orange = wrong/red
───────────────────────────────────────────── */
body.colorblind {
    --card-red:   #c05800;
    --strike-red: #7a3200;
}

/* Deck grid card tints */
body.colorblind .deck-card.dc-correct {
    background: #cce1f5;
    border-color: rgba(30, 100, 190, 0.4);
}

body.colorblind .deck-card.dc-wrong {
    background: #fde8cc;
    border-color: rgba(200, 90, 0, 0.4);
}

/* Screen flash */
body.colorblind #screen-flash.flash-correct {
    animation: sf-blue 0.35s ease-out forwards;
}

body.colorblind #screen-flash.flash-wrong {
    animation: sf-orange 0.35s ease-out forwards;
}

@keyframes sf-blue {
    0%   { background: rgba(30, 120, 215, 0.38); opacity: 1; }
    100% { background: rgba(30, 120, 215, 0);    opacity: 0; }
}

@keyframes sf-orange {
    0%   { background: rgba(215, 105, 15, 0.38); opacity: 1; }
    100% { background: rgba(215, 105, 15, 0);    opacity: 0; }
}

/* Score cell glow — blue instead of green */
body.colorblind .score-cell.glow-green {
    animation: score-glow-blue 0.55s ease forwards;
}

@keyframes score-glow-blue {
    0%   { background: rgba(0, 0, 0, 0.25);       border-color: rgba(200, 165, 50, 0.08); }
    28%  { background: rgba(20, 85, 165, 0.32);   border-color: rgba(40, 145, 225, 0.65);
           box-shadow: 0 0 16px rgba(25, 115, 205, 0.5), inset 0 0 8px rgba(30, 125, 215, 0.2); }
    100% { background: rgba(0, 0, 0, 0.25);       border-color: rgba(200, 165, 50, 0.08); }
}

/* Score cell clunk — orange instead of red */
body.colorblind .score-cell.clunk-red {
    animation: score-clunk-orange 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

body.colorblind .score-cell.clunk-red .score-val {
    animation: streak-val-orange 0.42s ease forwards;
}

@keyframes score-clunk-orange {
    0%   { background: rgba(0,0,0,0.25);      border-color: rgba(200,165,50,0.08); transform: scale(1);    }
    20%  { background: rgba(185,80,0,0.55);   border-color: rgba(255,140,35,0.75); transform: scale(1.07);
           box-shadow: 0 0 14px rgba(210,95,10,0.5), inset 0 0 6px rgba(230,105,20,0.25); }
    55%  { background: rgba(140,60,0,0.40);   border-color: rgba(210,95,20,0.45);  transform: scale(0.96); }
    100% { background: rgba(0,0,0,0.25);      border-color: rgba(200,165,50,0.08); transform: scale(1);    }
}

@keyframes streak-val-orange {
    0%   { color: var(--gold-bright); }
    25%  { color: #ff9040; }
    100% { color: var(--gold-bright); }
}

/* Strikes — orange instead of red */
body.colorblind .strike-icon.struck .s-circle {
    fill: rgba(165, 72, 0, 0.9);
    stroke: #ff8c22;
    filter: drop-shadow(0 0 3px rgba(255, 142, 32, 0.75));
}

body.colorblind .strike-icon.struck .s-line {
    stroke: #ffcc88;
}
