/* The iOS table design language, ported: downlit baize, capsule pills and
   buttons, yellow playability glows. Geometry comes from tableLayout.ts;
   this file carries colour, type, and shape. */

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
    /* Any letterboxing/backdrop the browser does paint should read as table felt,
       never white. */
    background: rgb(45, 90, 45);
}
::backdrop { background: rgb(45, 90, 45); }

#table {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Downlit-baize radial gradient — same stops as the iOS RadialGradient,
       which was itself copied from this app's original CSS. */
    background: radial-gradient(circle 900px at 50% 50%,
                rgb(34, 139, 34) 0%, rgb(67, 86, 67) 100%);
}

/* SwiftUI .position(): children centred on their anchor point. */
.positioned { transform: translate(-50%, -50%); }

/* --- Cards ------------------------------------------------------------- */

.card {
    aspect-ratio: 224.23 / 312.81;
    flex-shrink: 0;
}
.card svg { display: block; width: 100%; height: 100%; }

.pile-placeholder {
    border: 2px dashed rgba(255, 255, 255, 0.35);
    border-radius: 8px;
}

/* --- Opponents ---------------------------------------------------------- */

.opponent {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fan { position: relative; }
.fan-card,
.pile-card {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.overflow-pill {
    position: absolute;
    transform: translateY(-50%);
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    white-space: nowrap;
}
.overflow-pill.small { font-size: 12px; }

.label-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.seat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.25);
}
.seat-label.active { background: rgba(0, 122, 255, 0.75); }
.seat-label-text {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.compact .seat-label-text { font-size: 12px; }

.last-cards-badge {
    font-size: 11px;
    font-weight: 700;
    color: #000;
    padding: 2px 6px;
    border-radius: 999px;
    background: #ffcc00;
    white-space: nowrap;
}

/* --- Piles --------------------------------------------------------------- */

.piles { display: flex; align-items: center; }

.pile-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.pile-stack { position: relative; }

.deck-count {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.85);
}

.suit-chip {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: #000;
    padding: 1px 12px;
    border-radius: 999px;
    background: #fff;
}
.suit-chip.red { color: #e00000; }

/* --- Bottom stack --------------------------------------------------------- */

.bottom-stack {
    position: absolute;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

/* The staged chain sits in a grey pill that hugs it and expands card by card;
   the area itself draws nothing and only reserves its height (empty chain =
   nothing on screen). Padding and radius come inline from stagingArea. */
.staging {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.staging-pill {
    height: 100%;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.18);
}
/* Hand/staged cards are FLIP-animated across re-renders, so they're positioned
   purely with left/top — no transforms (flip.ts owns the transform channel). */
.staging-strip { position: relative; height: 100%; }
.staged-card { position: absolute; cursor: pointer; }

/* --- Status pills + buttons ------------------------------------------------ */

.action-bar { position: relative; }
.compact-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-row {
    display: flex;
    justify-content: center;
    align-items: center;
}
.overlay-bar .centered-pills {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pill {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    padding: 5px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
.compact .pill { font-size: 12px; }
.pill.red    { background: rgba(255, 59, 48, 0.85); }
.pill.orange { background: rgba(255, 149, 0, 0.85); }
.pill.blue   { background: rgba(0, 122, 255, 0.85); }
.pill.purple { background: rgba(175, 82, 222, 0.85); }

.button-row {
    display: flex;
    align-items: center;
    position: relative;
}
.flex-spacer { flex: 1; }

.btn {
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: 999px;
    padding: 8px 18px;
    cursor: pointer;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
    white-space: nowrap;
}
.compact .btn { font-size: 15px; font-weight: 700; padding: 6px 12px; }
.btn:disabled { cursor: default; }

.prominent-btn { background: #007aff; }
.teal-btn      { background: #30b0c7; }
.orange-btn    { background: #ff9500; }
.bordered-btn  { background: rgba(255, 255, 255, 0.16); }
.btn:disabled  { background: rgba(120, 120, 128, 0.32); color: rgba(255, 255, 255, 0.4); }

.btn-caption { font-size: 11px; font-weight: 500; }

/* Invisible zero-width sizing templates: .status-row and .button-row keep the
   height of their tallest variant (a pill / the two-line naked-king Play
   button), so the staging bar above the action bar never moves vertically. */
.pill.ghost, .btn.ghost {
    visibility: hidden;
    width: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
    flex: none;
}

/* --- Hand row --------------------------------------------------------------- */

.hand-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hand-strip {
    flex: 1;
    height: 100%;
    display: flex;
    justify-content: center;
}
.hand-strip-inner { position: relative; height: 100%;
    touch-action: none;
}

.hand-card { position: absolute; }
.hand-card.stageable {
    filter: drop-shadow(0 0 7px rgba(255, 214, 10, 0.75));
    cursor: pointer;
}
.hand-card.dimmed { opacity: 0.45; }

/* Drag-to-reorder: the strip owns its touches; neighbours animate into the gap
   (spring ≈ iOS .spring(duration: 0.22)); the dragged card rides the pointer. */
.hand-card.drag-anim { transition: left 0.22s cubic-bezier(0.34, 1.3, 0.44, 1); }
.hand-card.dragging {
    filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.5));
    transform: scale(1.06);
    transform-origin: center;
    pointer-events: none;
}

.flip-ghost {
    position: fixed;
    pointer-events: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
    z-index: 500;
}

.page-btn-box {
    width: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.page-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: rgb(40, 92, 40);
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding-bottom: 4px;
}
.page-btn.disabled { background: rgba(255, 255, 255, 0.25); cursor: default; }
.page-badge {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.8);
}

/* --- Menu button --------------------------------------------------------------- */

.home-btn { position: absolute; }

/* --- Full-screen toggle (persistent, above table and menu) ----------------------- */

#fullscreenBtn {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 960;
    width: 38px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.85);
}
#fullscreenBtn .fs-exit { display: none; }
#fullscreenBtn.full .fs-enter { display: none; }
#fullscreenBtn.full .fs-exit { display: block; }

/* --- Spinner (small, white — SwiftUI ProgressView approximation) ---------------- */

.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}
.spinner.large { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Overlays (suit picker, winner, inspector, coach) ----------------------------- */

#overlay { position: absolute; inset: 0; z-index: 900; display: none; }
.overlay-backdrop { position: absolute; inset: 0; }
.overlay-backdrop.dim { background: rgba(0, 0, 0, 0.55); }

.overlay-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 26px;
    border-radius: 20px;
    background: rgb(15, 71, 38);
    max-width: min(92vw, 760px);
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.overlay-title { font-size: 22px; font-weight: 700; color: #fff; text-align: center; }
.overlay-title.big { font-size: 30px; }
.overlay-title.best { color: rgb(140, 230, 140); }
.overlay-subtitle { font-size: 12px; color: rgba(255, 255, 255, 0.7); text-align: center; }
.overlay-action { padding: 9px 26px; }

.suit-tiles { display: flex; gap: 12px; }
.suit-tile {
    width: 96px;
    height: 96px;
    border: none;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: inherit;
}
.suit-tile.small { width: 68px; height: 68px; }
.suit-tile-glyph { font-size: 34px; line-height: 1; color: #000; }
.suit-tile.small .suit-tile-glyph { font-size: 26px; }
.suit-tile-name { font-size: 13px; font-weight: 700; color: #000; }
.suit-tile.small .suit-tile-name { font-size: 11px; }
.suit-tile.red .suit-tile-glyph, .suit-tile.red .suit-tile-name { color: #e00000; }

.score-list { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.score-row {
    display: flex;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.75);
    font-size: 16px;
}
.score-row.winner { color: #fff; font-weight: 700; }
.score-pts { font-variant-numeric: tabular-nums; }

.inspector-body { display: flex; align-items: center; gap: 8px; }
.inspector-strip-box { display: flex; align-items: center; justify-content: center; }
.inspector-strip { position: relative; height: 100%; }
.inspector-card { position: absolute; top: 50%; transform: translateY(-50%); }
.inspector-card.top-glow { filter: drop-shadow(0 0 6px rgba(255, 214, 10, 0.8)); }

/* Coach verdict — iOS CoachOverlay visual language */
.coach-panel { min-width: min(88vw, 480px); gap: 12px; }
.coach-thinking-text { font-size: 17px; font-weight: 600; color: #fff; }
.coach-comparison { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.coach-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
}
.coach-row.best {
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 0 0 1.5px rgba(140, 230, 140, 0.7);
}
.coach-row-label {
    width: 104px;
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
}
.compact .coach-row-label { width: 92px; }
.coach-move { display: flex; align-items: center; gap: 6px; flex: 1; }
.coach-mini-chain { position: relative; }
.coach-mini-card { position: absolute; top: 0; }
.coach-suit-chip {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    padding: 1px 7px;
    border-radius: 6px;
    background: #fff;
}
.coach-suit-chip.red { color: #e00000; }
.coach-suit-chip.big { font-size: 26px; padding: 2px 11px; }
.coach-action-pill {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
}
.coach-score {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.9);
}
.coach-caption { font-size: 13px; color: rgba(255, 255, 255, 0.75); text-align: center; }
.coach-divider { width: 100%; height: 1px; background: rgba(255, 255, 255, 0.2); }
.coach-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}
.coach-meter { display: flex; align-items: center; gap: 8px; width: 100%; }
.coach-meter-track {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
}
.coach-meter-fill { height: 100%; border-radius: 999px; }
.coach-meter-fill.good { background: rgb(77, 191, 77); }
.coach-meter-fill.ok   { background: rgb(224, 160, 0); }
.coach-meter-fill.poor { background: rgb(214, 69, 47); }
.coach-meter-pct {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.8);
}

.loading-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    font-weight: 600;
    z-index: 950;
}

/* --- Menu system (landing menu, settings, how-to-play, attributions) ------------ */

.menu-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow: auto;
    /* Opaque baize: dismissing the menu fades straight into the table. */
    background: radial-gradient(circle 900px at 50% 50%,
                rgb(34, 139, 34) 0%, rgb(67, 86, 67) 100%);
}

.menu-fan {
    position: relative;
    height: 160px;
    width: 300px;
    margin-bottom: 30px;
}
.menu-fan-card {
    position: absolute;
    left: calc(50% - 50px);
    top: 0;
    transform-origin: bottom center;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.menu-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 44px;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
@media (max-height: 500px), (max-width: 500px) {
    .menu-title { font-size: 34px; }
    .menu-fan { height: 120px; margin-bottom: 16px; transform: scale(0.75); }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}
.menu-primary { font-size: 19px; font-weight: 700; padding: 10px 36px; }
.menu-secondary { font-size: 16px; }

/* Sheets (settings / how-to-play / attributions) */
.menu-screen.sheet { justify-content: flex-start; }
.sheet-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(20, 60, 30, 0.88);
    backdrop-filter: blur(8px);
}
.sheet-back { font-size: 14px; }
.sheet-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}
.sheet-bar-spacer { width: 74px; }

/* Fullscreen: the top-left belongs to Safari's exit button and the iOS clock
   sits in the safe-area band, so the sheet header drops below the status bar
   (aligned with our fullscreen toggle) and the back button docks to the right
   beside it. Non-fullscreen layouts are untouched (env() is 0, no .fs class). */
body.fs .sheet-bar {
    padding-top: max(12px, env(safe-area-inset-top));
}
body.fs .sheet-back {
    order: 3;
    margin-right: calc(max(12px, env(safe-area-inset-right)) + 46px - 16px);
}
body.fs .sheet-title { order: 2; }
body.fs .sheet-bar-spacer {
    order: 1;
    width: calc(74px + max(12px, env(safe-area-inset-right)) + 30px);
}
.sheet-body {
    width: min(92vw, 620px);
    padding: 20px 0 48px;
}

.settings-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.6);
    margin: 22px 4px 8px;
}
.settings-group {
    background: rgba(0, 0, 0, 0.22);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    color: #fff;
}
.settings-row + .settings-row { border-top: 1px solid rgba(255, 255, 255, 0.12); }
.settings-row-label { font-size: 16px; font-weight: 600; color: #fff; }
.settings-check { font-size: 17px; font-weight: 700; color: #6db9ff; }
.settings-footer {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    margin: 8px 4px 0;
}

/* Quiet Attributions link at the foot of Settings (moved off the main menu). */
.settings-attrib-link {
    display: block;
    margin: 22px auto 0;
    padding: 0;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: underline;
    cursor: pointer;
}
.settings-attrib-link:hover { color: rgba(255, 255, 255, 0.9); }

.settings-group.segmented {
    flex-direction: row;
    padding: 3px;
    gap: 3px;
}
.settings-seg {
    flex: 1;
    padding: 7px 0;
    border: none;
    border-radius: 9px;
    background: none;
    color: rgba(255, 255, 255, 0.75);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.settings-seg.selected { background: rgba(255, 255, 255, 0.22); color: #fff; }

.toggle {
    width: 50px;
    height: 30px;
    border-radius: 999px;
    background: rgba(120, 120, 128, 0.4);
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle.on { background: #34c759; }
.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle.on .toggle-knob { left: 22px; }

/* Prose sheets (how-to-play, attributions) */
.prose .prose-h {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin: 22px 0 6px;
}
.prose .prose-p {
    font-size: 14px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.85);
    margin: 6px 0;
}
.prose .prose-quote {
    font-size: 12px;
    font-style: italic;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 8px 0;
    word-break: break-word;
}
.prose .prose-link {
    display: block;
    font-size: 14px;
    color: #8ec9ff;
    margin: 6px 0;
    text-decoration: none;
}
.prose .prose-link:hover { text-decoration: underline; }

.special-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 10px 0;
}
.special-card { flex-shrink: 0; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3)); }
.special-title { font-size: 14px; font-weight: 700; color: #fff; }
.special-blurb { font-size: 13px; line-height: 1.5; color: rgba(255, 255, 255, 0.65); }

/* Tournament standings */
.score-row.out { opacity: 0.5; }
.score-row.out .score-name { text-decoration: line-through; }
.standings-sub { color: rgba(255,255,255,0.75); font-size: 14px; margin: -4px 0 10px; text-align: center; }
.standings-delta { color: #ffd54a; font-size: 13px; margin-left: 4px; }
.standings-out { color: #ff8a80; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; margin-left: 10px; }
.menu-blurb { color: rgba(255,255,255,0.8); font-size: 14px; max-width: 420px; margin: 6px auto 14px; text-align: center; line-height: 1.45; }
.standings-btn { font-size: 12px; }

/* Stylised opponent strip — compact screens with 4-5 opponents (the fans don't
   fit). One chip per seat: short name, mini card back + count, active turn
   highlight, LAST CARDS ribbon. Same baize design language as the seat labels. */
.opponent-strip {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
/* One chip row per ring level: a single row inline, or the clockwise grid
   (2x2 / 1+2x2) when the screen has the height for it. */
.opp-strip-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 6px;
}
.opp-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    min-width: 52px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1.5px solid transparent;
}
.opp-chip.active {
    background: rgba(0, 122, 255, 0.55);
    border-color: rgba(255, 255, 255, 0.85);
}
.opp-chip-name {
    display: flex;
    align-items: center;
    gap: 4px;
}
.opp-chip-label {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.opp-chip-count {
    display: flex;
    align-items: center;
    gap: 4px;
}
.opp-chip-back { border-radius: 2px; }
.opp-chip-n {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
}
.opp-chip-n.out {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
}
.opp-chip-last {
    font-size: 9px;
    font-weight: 800;
    color: #000;
    padding: 1px 5px;
    border-radius: 999px;
    background: #ffcc00;
    white-space: nowrap;
}

/* Grid mode has the vertical canvas to spend (the whole zone above the piles),
   so its chips run ~20% larger than the single row's (mirrors OpponentStrip). */
.opponent-strip.grid { gap: 8px; }
.opponent-strip.grid .opp-strip-row { gap: 8px; }
.opponent-strip.grid .opp-chip {
    gap: 4px;
    padding: 7px 11px;
    min-width: 64px;
    border-radius: 14px;
}
.opponent-strip.grid .opp-chip-label { font-size: 15px; }
.opponent-strip.grid .opp-chip-n { font-size: 16px; }
.opponent-strip.grid .opp-chip-n.out { font-size: 13px; }
.opponent-strip.grid .opp-chip-last { font-size: 11px; padding: 1px 6px; }

/* Networked tournaments (MULTIPLAYER.md): lobby, join code entry, seat config. */
.lobby-code {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: 4px;
    color: #fff;
    text-align: center;
    margin: 10px 0 2px;
    font-variant-numeric: tabular-nums;
}
.lobby-count {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-top: 10px;
}
.standings-waiting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    color: rgba(255, 255, 255, 0.8);
}
.standings-waiting-text { font-size: 14px; font-weight: 600; }
.join-code-line { opacity: 0.85; letter-spacing: 1px; }
.join-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 4px 0 6px;
}
.join-input {
    /* The table suppresses selection globally (html/body user-select: none);
       an input inheriting that is un-typable on iOS Safari and headless
       Chromium — re-enable selection explicitly. */
    user-select: text;
    -webkit-user-select: text;
    flex: 1;
    min-width: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 3px;
    text-align: center;
    text-transform: uppercase;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    outline: none;
    font-family: inherit;
}
.join-input:focus { border-color: rgba(255, 255, 255, 0.85); }
/* Nicknames keep the case the player typed: iOS Safari applies an input's
   text-transform to the VALUE it submits, not just the rendering. */
.nick-input {
    text-transform: none;
    letter-spacing: 1px;
    font-size: 18px;
    max-width: 220px;
}
.join-btn { padding: 10px 18px; }
/* The invite code on the join sheet (display only — the code came in the link). */
.join-code-display {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 4px;
    text-align: center;
    color: #fff;
    margin: 2px 0 10px;
}
.seats-box { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.seat-config-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.seat-config-label {
    width: 58px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
}
.seat-kind-seg { flex: 1; margin: 0; }
.reconnect-seat {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    padding: 10px;
}

/* Lobby invite link + QR (MULTIPLAYER.md). */
.lobby-link-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    max-width: 100%;
}
.lobby-link {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 10px;
    border-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
    user-select: text;
    -webkit-user-select: text;
}
.lobby-copy-btn { font-size: 13px; padding: 6px 12px; }
.lobby-qr {
    display: block;
    width: 132px;
    height: 132px;
    margin: 12px auto 0;
    border-radius: 8px;
    background: #fff;
    padding: 6px;
}

/* Nickname entry + lobby roster (networked tournaments). */
.input-error { border-color: rgba(255, 99, 71, 0.95) !important; }
.lobby-names {
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
    text-align: center;
    margin-top: 10px;
}

/* Join/host failure reason on the Play Online sheet. */
.online-error {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 59, 48, 0.75);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    text-align: center;
}
