*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0d1117;
    --panel:     #161b22;
    --border:    #30363d;
    --text:      #e6edf3;
    --muted:     #8b949e;
    --accent:    #1f6feb;
    --accent-h:  #388bfd;
    --danger:    #da3633;
    --success:   #3fb950;
    --card-w:    120px;
    --card-h:    168px;
}

body {
    background: var(--bg);
    color: var(--text);
    /* Updated to use the custom game font with standard fallbacks */
    font-family: var(--game-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    height: 100vh;        /* fallback for browsers without dvh */
    height: 100dvh;       /* dynamic viewport — excludes mobile nav bars */
   /* overflow: hidden; */
}

/* Apply custom heading font globally to the game screen UI */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--game-heading-font, inherit);
}

/* ── Screens ──────────────────────────────────────────────────────────────── */
.screen { display: none; width: 100vw; height: 100vh; height: 100dvh; }
.screen.active { display: flex; align-items: center; justify-content: center; }

/* ── Loading ──────────────────────────────────────────────────────────────── */
.loader-box { text-align: center; }
.loader-box h1 { font-size: 2.5rem; margin-bottom: 1rem; color: var(--accent); }
.loader-box p  { color: var(--muted); margin-bottom: 1rem; }
.progress-bar  { width: 300px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto; }
#progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }

/* ── Picker ───────────────────────────────────────────────────────────────── */
.picker-box { text-align: center; padding: 3rem; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.picker-box h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.picker-box p  { color: var(--muted); margin-bottom: 2rem; }

/* ── Lobby ────────────────────────────────────────────────────────────────── */
.lobby-box { width: 860px; max-width: 95vw; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; }
.lobby-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.lobby-header h2 { font-size: 1.5rem; }
.lobby-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 1.5rem; }
.lobby-col h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.75rem; }
.lobby-col input { width: 100%; padding: 0.6rem 0.8rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 0.95rem; margin-bottom: 0.75rem; font-family: inherit; }
#lobby-code { font-size: 1.8rem; font-weight: bold; letter-spacing: 0.15em; color: var(--accent); margin-top: 0.5rem; }
.lobby-list-wrap h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.5rem; }
#lobby-list { min-height: 60px; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem; margin-bottom: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.lobby-empty { color: var(--muted); padding: 0.6rem; font-size: 0.85rem; text-align: center; }
.lobby-entry {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.6rem 0.75rem; border-radius: 8px;
    background: var(--bg); border: 1px solid var(--border);
}
.lobby-entry:hover { border-color: var(--accent); }
.lobby-entry-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.lobby-entry-host { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
.lobby-entry-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: var(--muted); }
.lobby-seat { padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.lobby-seat.open { background: rgba(46,160,67,0.18); color: #3fb950; }
.lobby-seat.full { background: rgba(248,81,73,0.15); color: #f85149; }
.btn-play {
    flex: none; padding: 0.45rem 1.1rem; border-radius: 8px; border: none;
    background: var(--accent); color: #fff; font-weight: 600; font-size: 0.85rem;
    cursor: pointer; transition: filter .12s, transform .12s; font-family: inherit;
}
.btn-play:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.btn-play:disabled { background: #2d333b; color: var(--muted); cursor: default; }
#lobby-status { margin-top: 1rem; color: var(--muted); font-size: 0.9rem; text-align: center; }

/* ── Game screen ──────────────────────────────────────────────────────────── */
/* ── Game screen — full viewport ──────────────────────────────────────────── */
#screen-game { display: none; position: relative; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; }
#screen-game.active { display: block; }

#battlefield-canvas {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; display: block;
}

/* ── Fan hands ────────────────────────────────────────────────────────────── */
#player-hand-area, #opponent-hand-area {
    position: fixed; left: 0; right: 0;
    display: flex; justify-content: center; align-items: flex-end;
    pointer-events: none; z-index: 12;
    overflow: visible;
}
/* Pin the player's hand flush to the bottom; pad up by the safe-area so it clears
   the home indicator without floating in the middle of the screen. */
#player-hand-area   {
    bottom: 0; height: 120px; overflow: visible;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: content-box;
}
#opponent-hand-area { top: 0;    top: env(safe-area-inset-top, 0px);       height: 90px; align-items: flex-start; }

.hand-card {
    position: absolute;
    transform-origin: bottom center;
    transition: transform 0.15s;
    cursor: pointer; pointer-events: all;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.7);
}
.hand-card:hover { z-index: 200 !important; }
/* Hover highlight colour: battlefield presentation.hover_color (engine/main.js sets the variable). */
body:not(.eg-no-hover-glow) .hand-card:hover { filter: drop-shadow(0 0 6px var(--eg-hover-color, #ffd54f)) drop-shadow(0 0 2px var(--eg-hover-color, #ffd54f)); }
/* Foil prints in the hand (card.foil, from the deck's owned foil count): a slow
   rainbow edge glow and shimmer. On the field the renderer draws a sheen. */
.hand-card.eg-foil-card { animation: egFoilGlow 3.2s linear infinite; }
@keyframes egFoilGlow {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(255,90,90,.85)) brightness(1.04); }
    25%      { filter: drop-shadow(0 0 6px rgba(255,215,90,.9)) brightness(1.1); }
    50%      { filter: drop-shadow(0 0 5px rgba(90,255,180,.85)) brightness(1.04); }
    75%      { filter: drop-shadow(0 0 6px rgba(90,160,255,.9)) brightness(1.1); }
}
@media (prefers-reduced-motion: reduce) {
    .hand-card.eg-foil-card { animation: none; filter: drop-shadow(0 0 5px rgba(255,215,120,.85)); }
}

/* ── Floating action panel — vertical centre, left ─────────────────────────── */
#action-panel {
    position: fixed; top: 50%; left: 20px; transform: translateY(-50%); z-index: 15;
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
/* ── Targeting / combat prompt ─────────────────────────────────────────────
   Lives inside #action-panel in the DOM but is positioned OUT of it, on the
   centre line of the board.

   It used to be an unstyled div in that fixed, left-hand flex column, so a long
   prompt - "Select one of your minions for <a long card name> (Esc to cancel)"
   - stretched the panel clear across the battlefield. The panel sits at
   z-index 15 above the canvas, so that invisible box swallowed every click
   aimed at the minions the prompt was asking you to pick.

   pointer-events:none is the important half: a message that tells you to click
   something must never be the thing intercepting the click. user-select:none
   stops it highlighting blue when a click-drag lands on it. */
#combat-prompt {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 16;
    pointer-events: none;
    user-select: none;
    max-width: min(70vw, 720px);
    text-align: center;
    background: rgba(13,17,23,0.92);
    border: 1px solid rgba(197,160,89,0.55);
    border-radius: 10px;
    padding: 8px 16px;
    color: #e8e0d0;
    font-size: 0.9rem;
    line-height: 1.35;
    box-shadow: 0 6px 22px rgba(0,0,0,0.55);
}
/* No box when there is nothing to say. */
#combat-prompt:empty { display: none; }

#phase-display {
    background: rgba(13,17,23,0.85);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px; padding: 4px 14px;
    font-size: 0.75rem; color: rgba(255,255,255,0.55);
    width: 130px; text-align: center;
}
#resource-display {
    background: rgba(13,17,23,0.85);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px; padding: 6px 10px;
    display: flex; flex-direction: column; gap: 5px;
    min-width: 110px;
}
.resource-row {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: rgba(255,255,255,0.85);
}
.resource-row img {
    width: 18px; height: 18px; object-fit: contain;
}
.resource-row .res-count { color: #3fb950; font-weight: bold; margin-left: auto; }
.resource-row .res-name  { color: rgba(255,255,255,0.7); }
.btn-action {
    padding: 0.5rem 1.2rem;
    background: rgba(31,111,235,0.85);
    border: 1px solid rgba(56,139,253,0.5);
    border-radius: 8px; color: white; cursor: pointer;
    font-size: 0.85rem; font-weight: 600;
    backdrop-filter: blur(4px);
    transition: background 0.15s;
    width: 110px; font-family: inherit;
}
.btn-action:hover { background: rgba(56,139,253,0.95); }
.btn-end-turn {
    background: rgba(63,185,80,0.85);
    border-color: rgba(63,185,80,0.5);
    padding: 0.7rem 1.2rem; font-size: 0.9rem;
}
.btn-end-turn:hover { background: rgba(63,185,80,0.95); }

/* ── Card tooltip ─────────────────────────────────────────────────────────── */
#card-tooltip {
    position: fixed; z-index: 9999;
    background: rgba(13,17,23,0.97);
    border: 1px solid #30363d; border-radius: 8px;
    padding: 10px 12px; width: 200px;
    color: #e6edf3; font-size: 12px;
    pointer-events: none; display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.8);
}
#tt-name     { font-weight: 700; font-size: 13px; margin-bottom: 3px; font-family: var(--game-heading-font, inherit); }
#tt-type     { color: #8b949e; font-size: 11px; margin-bottom: 5px; }
#tt-stats    { color: #3fb950; font-size: 11px; margin-bottom: 4px; }
#tt-keywords { color: #e3b341; font-size: 11px; margin-bottom: 4px; }
#tt-counters { font-size: 11px; margin-bottom: 4px; }
#tt-ability  { color: #c9d1d9; font-size: 11px; line-height: 1.4; }
/* One block per ability on a multi-ability card, so they read as separate rules
   rather than one run-on paragraph. A single-ability card renders one entry and
   looks exactly as it did before. */
.tt-ability-entry { margin-top: 5px; }
.tt-ability-entry:first-child { margin-top: 0; }

/* ── Log panel ────────────────────────────────────────────────────────────── */
#log-toggle {
    position: fixed; right: 0; top: 50%; transform: translateY(-50%);
    z-index: 21; background: rgba(22,27,34,0.9);
    border: 1px solid var(--border); border-right: none;
    color: var(--muted); cursor: pointer; padding: 0.75rem 0.3rem;
    border-radius: 6px 0 0 6px; font-size: 0.85rem;
}
#log-toggle:hover { color: var(--text); }
#log-panel {
    position: fixed; right: -240px; top: 0; bottom: 0;
    width: 220px; z-index: 20;
    background: rgba(22,27,34,0.95);
    backdrop-filter: blur(6px);
    border-left: 1px solid var(--border);
    overflow-y: auto; font-size: 0.75rem; padding: 0.5rem;
    transition: right 0.25s ease;
}
#log-panel.open { right: 0; }
#log-entries div { padding: 0.2rem 0; border-bottom: 1px solid var(--border); color: var(--muted); }

/* Unfinished games hint */
.hint { color: var(--muted); font-size: 0.8rem; margin: 0 0 0.5rem; }

/* Leave match button (game.html) */
/* ── Options button + menu ───────────────────────────────────────────────── */
#btn-options {
    position: fixed; top: 12px; right: 12px; z-index: 30;
    width: 34px; height: 34px; border-radius: 8px;
    background: rgba(13,17,23,0.8); border: 1px solid var(--border);
    color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1;
}
#btn-options:hover { color: var(--text); border-color: var(--muted); }
#options-menu {
    position: fixed; top: 52px; right: 12px; z-index: 31;
    background: rgba(13,17,23,0.97); border: 1px solid var(--border);
    border-radius: 10px; padding: 6px; min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
#options-menu .options-title {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--muted); padding: 4px 8px 6px; font-family: var(--game-heading-font, inherit);
}
#options-menu .options-item {
    display: block; width: 100%; text-align: left;
    padding: 10px 12px; border: none; border-radius: 6px;
    background: transparent; color: var(--text); cursor: pointer; font-size: 0.95rem; font-family: inherit;
}
#options-menu .options-item:hover { background: rgba(255,255,255,0.06); }
#options-menu #opt-concede { color: #f85149; }
#options-menu .options-cancel { color: var(--muted); }

/* ── Concede confirm overlay ─────────────────────────────────────────────── */
#concede-overlay {
    position: fixed; inset: 0; z-index: 600;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.6);
}
.concede-box {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 1.6rem 1.8rem; max-width: 380px; text-align: center;
}
.concede-box h2 { font-size: 1.3rem; margin-bottom: 0.6rem; }
.concede-box p  { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.4rem; line-height: 1.5; }
.concede-actions { display: flex; gap: 0.8rem; justify-content: center; }
.concede-actions .btn-action { min-width: 120px; }
.concede-actions .concede-confirm { background: #da3633; }
.concede-actions .concede-confirm:hover { background: #f85149; }
.concede-actions .options-cancel { background: #2d333b; }
.concede-actions .options-cancel:hover { background: #444c56; }

.resource-empty { color: rgba(255,255,255,0.4); font-size: 0.75rem; font-style: italic; }

/* Deck picker in lobby */
.lobby-deck-pick { margin-bottom: 1rem; }
.lobby-deck-pick h3 { margin-bottom: 0.4rem; }
#select-deck {
    width: 100%; padding: 0.6rem 0.8rem; font-family: inherit;
    background: var(--panel, #161b22); color: var(--text, #e6edf3);
    border: 1px solid var(--border, #30363d); border-radius: 8px;
    font-size: 0.95rem; cursor: pointer;
}
#select-deck:focus { outline: none; border-color: #388bfd; }

/* Remove unfinished game button */
.btn-remove {
    background: rgba(218,54,51,0.15); border: 1px solid #da3633;
    color: #f85149; border-radius: 6px; cursor: pointer; margin-left: 0.4rem; font-family: inherit;
}
.btn-remove:hover { background: rgba(218,54,51,0.3); }
.btn-remove:disabled { opacity: 0.5; cursor: default; }

/* Mulligan overlay */
#mulligan-overlay {
    position: fixed; inset: 0; z-index: 500;
    display: flex; align-items: center; justify-content: center;
    background: rgba(5,8,12,0.72); backdrop-filter: blur(3px);
}
.mulligan-card {
    background: #161b22; border: 1px solid #30363d; border-radius: 14px;
    padding: 1.6rem 2rem; text-align: center;
    max-width: min(92vw, 760px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.mulligan-card h2 { margin-bottom: 0.5rem; font-size: 1.4rem; }
.mulligan-card p  { color: #8b949e; margin-bottom: 1.2rem; }
#mulligan-hand {
    display: grid;
    grid-template-columns: repeat(auto-fit, 132px);
    grid-auto-rows: min-content;
    gap: 0.6rem; justify-content: center;
    margin: 0.6rem 0 1.1rem;
    max-width: calc(5 * 132px + 4 * 0.6rem);   /* 5 cards per row */
    max-height: 64vh; overflow-y: auto; overflow-x: hidden;
    padding: 0.3rem;
}
#mulligan-hand::-webkit-scrollbar { width: 8px; }
#mulligan-hand::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
.mulligan-card-mini {
    display: block; width: 132px; height: auto;
    border-radius: 6px; transition: transform 0.12s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4); cursor: default;
}
.mulligan-card-mini:hover { transform: translateY(-8px) scale(1.06); z-index: 2; }
.mulligan-actions { display: flex; gap: 0.8rem; justify-content: center; }
.mulligan-actions .btn-action { min-width: 120px; }
.mulligan-actions .btn-keep { background: #2ea043; }
.mulligan-actions .btn-keep:hover { background: #3fb950; }
#mulligan-wait { color: #8b949e; font-style: italic; margin-top: 0.5rem; }

/* ── Stack display ───────────────────────────────────────────────────────── */
#stack-display {
    margin: 0.5rem 0; padding: 0.5rem 0.7rem;
    background: rgba(69,90,100,0.25); border: 1px solid rgba(160,160,200,0.5);
    border-radius: 8px; max-width: 220px;
}
#stack-display .stack-title {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: #b0b8c8; margin-bottom: 0.35rem; font-family: var(--game-heading-font, inherit);
}
#stack-display .stack-item {
    font-size: 0.85rem; color: #e6edf3; white-space: pre; line-height: 1.4;
}
#btn-pass-priority { background: #6e7681; }
#btn-pass-priority:hover { background: #848d97; }

/* ── Larger tap/hit targets on small screens ─────────────────────────────── */
@media (max-width: 820px) {
    .btn-action { min-height: 44px; font-size: 1rem; }
    #btn-options { width: 40px; height: 40px; font-size: 1.2rem; }
    .options-item { padding: 12px 14px; }
}

/* ── Game over ───────────────────────────────────────────────────────────── */
#gameover-overlay {
    position: fixed; inset: 0; z-index: 650;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.72); backdrop-filter: blur(4px);
}
.gameover-box {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 16px; padding: 2rem 2.4rem; max-width: 400px; text-align: center;
    box-shadow: 0 24px 70px rgba(0,0,0,0.6);
}
.gameover-box h2 { font-size: 1.9rem; margin-bottom: 0.5rem; color: var(--accent); }
.gameover-box p  { color: var(--muted); margin-bottom: 1.6rem; }
.gameover-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.gameover-actions .btn-action { min-width: 140px; }
.gameover-exit { background: #1f6feb; }
.gameover-exit:hover { background: #388bfd; }

/* Persistent review banner */
#gameover-banner {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 640;
    display: flex; align-items: center; gap: 1rem;
    background: rgba(13,17,23,0.92); border: 1px solid var(--border);
    border-radius: 999px; padding: 8px 8px 8px 18px;
}
#gameover-banner-text { color: var(--muted); font-size: 0.9rem; }
#gameover-banner .btn-action { min-height: 36px; padding: 6px 16px; }

/* ── End-of-turn discard step ────────────────────────────────────────────── */
#discard-overlay {
    position: fixed; inset: 0; z-index: 520;
    display: flex; align-items: center; justify-content: center;
    background: rgba(5,8,12,0.78); backdrop-filter: blur(3px);
}
.discard-box {
    background: #161b22; border: 1px solid #30363d; border-radius: 14px;
    padding: 1.4rem 1.8rem; text-align: center; max-width: min(94vw, 820px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.discard-box h2 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.discard-box p  { color: #8b949e; margin-bottom: 1rem; }
#discard-hand {
    display: grid; grid-template-columns: repeat(auto-fit, 92px);
    gap: 10px; justify-content: center; max-height: 60vh; overflow-y: auto;
}
.discard-card-mini {
    cursor: pointer; border-radius: 8px; transition: transform .12s, box-shadow .12s;
}
.discard-card-mini:hover {
    transform: translateY(-6px) scale(1.06);
    box-shadow: 0 8px 20px rgba(248,81,73,0.5);   /* red glow — about to discard */
}

/* ── Registered games picker list ───────────────────────────────────────── */
.picker-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
#game-list {
    display: flex; flex-direction: column; gap: 0.4rem;
    max-height: 260px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem;
}
.game-empty { color: var(--muted); padding: 0.7rem; font-size: 0.85rem; text-align: center; }
.game-entry {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.6rem 0.75rem; border-radius: 8px;
    background: var(--bg); border: 1px solid var(--border);
}
.game-entry:hover { border-color: var(--accent); }
.game-entry-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.game-entry-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 13rem; }
.game-entry-ver  { font-size: 0.75rem; color: var(--muted); }

/* ── Stack panel (HTML popup anchored at the stack zone) ─────────────────── */
#stack-panel {
    position: fixed; z-index: 480;
    background: rgba(13,17,23,0.94); border: 1px solid var(--accent, #1f6feb);
    border-radius: 12px; padding: 10px 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 18px rgba(31,111,235,0.35);
    transform: translate(-50%, -50%);   /* JS positions the center */
    pointer-events: auto;
}
.stack-panel-title {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--muted, #8b949e); text-align: center; margin-bottom: 6px; font-family: var(--game-heading-font, inherit);
}
#stack-panel-cards { display: flex; gap: 8px; align-items: flex-end; }
.stack-panel-card {
    position: relative; border-radius: 8px; cursor: pointer;
    transition: transform .12s; flex: none;
}
.stack-panel-card:hover { transform: translateY(-6px); }
.stack-panel-card.top   { box-shadow: 0 0 0 2px var(--accent, #1f6feb); }
.stack-panel-card.countered { filter: grayscale(0.7) brightness(0.6); }
.stack-panel-card.countered::after {
    content: '✕'; position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center;
    color: #f85149; font-size: 1.8rem; font-weight: bold;
}
.stack-panel-caret {
    position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
    color: #fff; font-size: 0.7rem;
}

/* ── Compact mobile centered tooltip ────────────────────────────────────── */
#card-tooltip.compact-bottom-sheet {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: calc(100% - 32px) !important;
    max-width: 440px !important;
    box-sizing: border-box !important;
    z-index: 10000 !important;
    background: rgba(18, 22, 30, 0.96) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85) !important;
    padding: 14px 18px !important;
    /* Keep the overlay from intercepting taps intended for cards in hand. */
    pointer-events: none !important;
    touch-action: none !important;
}/* Moved clear of the card it describes (main.js placeCompactTooltip) - the
   centred sheet above would otherwise sit on top of a card near the middle. */
#card-tooltip.compact-bottom-sheet.compact-beside {
    top: var(--tt-top) !important;
    left: var(--tt-left) !important;
    transform: none !important;
    width: var(--tt-width) !important;
}
