/* Hearts Game - Clean Minimal Style */

/* === CSS Variables === */
:root {
    --table-green: #1a472a;
    --table-felt: #2d5a3d;
    --card-white: #fefefe;
    --card-shadow: rgba(0,0,0,0.3);
    --text-dark: #222;
    --text-light: #fff;
    --red: #c41e3a;
    --black: #1a1a1a;
    --highlight: #ffd700;

    /* Button palette — three colours, one meaning each.
     *
     * primary (green)  the one action the view exists for: play, start, join.
     *                  One per view — the lobby offers four entry points and
     *                  still has a single green button, because a screen where
     *                  everything is emphasised emphasises nothing.
     * neutral (slate)  everything else that is safe and reversible: add a bot,
     *                  step through a replay, go back.
     * danger  (red)    giving up something that cannot be got back: leaving a
     *                  room, abandoning a game in progress.
     *
     * There is deliberately no blue. It used to be the default button colour
     * and appeared nowhere else in the product, so it read as a fourth meaning
     * that did not exist. */
    --btn-primary: #27ae60;
    --btn-primary-hover: #219a52;
    --btn-neutral: #55707f;
    --btn-neutral-hover: #47606d;
    --btn-danger: #e74c3c;
    --btn-danger-hover: #c0392b;
    --btn-disabled: #7f8c8d;

    --panel-bg: rgba(255,255,255,0.1);

    /* The three metals, written once. They appear as a flat colour on the
     * record screen's tier dots and on a medal toast's border, and as a disc
     * in the standings — where the *gradient* is what makes a 22px circle read
     * as metal rather than as a coloured dot. Gold's flat value is
     * `--highlight`, which it already was before any of this. */
    --medal-bronze: #cd7f32;
    --medal-silver: #c0c8d0;
    --medal-bronze-disc: linear-gradient(145deg, #e8b489 0%, #cd7f32 45%, #8a5322 100%);
    --medal-silver-disc: linear-gradient(145deg, #f2f5f8 0%, #c0c8d0 45%, #8d959d 100%);
    --medal-gold-disc:   linear-gradient(145deg, #ffe680 0%, #ffd700 45%, #c9a200 100%);

    /* Card and table sizing.
     *
     * Everything on the table is derived from these, so the layout scales with
     * the viewport instead of needing a breakpoint per element. clamp() keeps
     * it readable on a phone and stops it growing silly on a desktop.
     *
     * The preferred term is min()'d against a vh figure as well as a vw one:
     * a card game is unplayable when the trick and the hand cannot be seen at
     * once, so on a short window the table has to give way rather than push the
     * hand below the fold. On a tall window the vw term wins and nothing
     * changes.
     *
     * The ceilings are what a wide desktop gets, and raising them is the
     * sanctioned way to give it something — never dropping the vh term, which
     * is what protects a short window. Measured at 1890x975 the whole app
     * occupied 1320x808 with the cards pinned at a 76px ceiling, leaving 570px
     * of width and 170px of height around a table smaller than the room it sat
     * in. At those ceilings the vh term binds first on any window that tall, so
     * the table now takes the size the proportions were asking for all along
     * rather than the one the ceiling was cutting it back to.
     *
     * Only the widths are variables. A `--card-h` derived here would be
     * substituted once, against this element's `--card-w`, and then inherit as
     * a fixed number — so rebinding `--card-w` further down (as `.trick-play`,
     * `.last-trick-play` and the replay all do) would resize the card's width
     * and its glyphs but not its height. Everything a card needs is derived
     * from `--card-w` at the point of use instead. */
    /* **dvh, not vh, and the fallback line above it.** On iOS `100vh` is the
     * height the window would have with the browser's bars hidden, so on a
     * phone the vh term sizes the cards against a window that is not there:
     * measured on an iPhone 13 in Chrome on 2026-09-07, `100vh` claimed 777px
     * of a 669px window and every card came out 9.7px too tall. The height
     * this fills is already `dvh` — see `body` — and a card sized against a
     * taller one is how the hand ends up under the fold.
     *
     * It cannot be caught from a desktop engine: there `vh` and `dvh` are the
     * same number, which is why eight measured window sizes and fourteen
     * browser tests all passed. The vh line stays as the fallback for a
     * browser without dvh, which is the pattern `body` already uses. */
    --card-w: clamp(44px, min(5.8vw, 9vh), 92px);
    --card-w: clamp(44px, min(5.8vw, 9dvh), 92px);
    --card-ratio: 1.4;

    --trick-card-w: clamp(38px, min(5.4vw, 7.2vh), 82px);
    --trick-card-w: clamp(38px, min(5.4vw, 7.2dvh), 82px);

    --seat-max: clamp(120px, 16vw, 220px);
}

/* Present to a screen reader and to nothing else.
 *
 * The live region in `App.announce` is the only user of it, and it is why the
 * rule is this shape rather than `display: none` or `visibility: hidden`:
 * both of those take an element out of the accessibility tree as well as off
 * the screen, so the announcement would be made to nobody. A 1px clipped box
 * is still laid out, still read, and occupies nothing. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* === Base Reset === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
    background: var(--table-green);
    color: var(--text-light);
    /* dvh, not vh: on iOS Safari `100vh` is the height with the address bar
       hidden, so the bar covers exactly the bottom of the page — which is where
       the hand is. The vh line is the fallback for browsers without dvh. */
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
}

#app {
    min-height: 100vh;
    min-height: 100dvh;
}

/* === Layout === */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.panel {
    background: var(--panel-bg);
    border-radius: 6px;
    padding: 10px 15px;
    margin: 8px 0;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    font-size: 1.5rem;
}

/* === Typography === */
h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    text-align: center;
    font-size: 1rem;
    opacity: 0.7;
    margin-bottom: 1.5rem;
    font-style: italic;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

/* === Form Elements === */
input, select {
    padding: 10px 15px;
    border: 2px solid transparent;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
    color: var(--text-dark);
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--btn-primary);
}

input::placeholder {
    color: #999;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group {
    margin-bottom: 15px;
}

/* What a field expects, under the field rather than in its placeholder: a
 * placeholder disappears the moment somebody starts typing, which is exactly
 * when "at least 8 characters" is worth reading. `opacity` and not a colour,
 * because that is how every other quiet line here is drawn — see
 * `.section-desc`; there is no dim-text variable to reach for. */
.field-hint {
    display: block;
    margin-top: 4px;
    opacity: 0.7;
    font-size: 0.85em;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.form-row label {
    min-width: 100px;
    margin-bottom: 0;
}

/* === Buttons ===
 *
 * The bare element is the neutral one, so a button that says nothing about
 * itself cannot accidentally claim to be the primary action. */
button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--btn-neutral);
    color: white;
    transition: background 0.2s, transform 0.1s;
}

button:hover:not(:disabled) {
    background: var(--btn-neutral-hover);
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button.primary {
    background: var(--btn-primary);
}

button.primary:hover:not(:disabled) {
    background: var(--btn-primary-hover);
}

button.danger {
    background: var(--btn-danger);
}

button.danger:hover:not(:disabled) {
    background: var(--btn-danger-hover);
}

/* A control that sits inside another element and must not compete with it. */
button.ghost {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    font-size: 0.8rem;
    padding: 5px 12px;
}

button.ghost:hover:not(:disabled) {
    background: rgba(255,255,255,0.22);
}

/* Last, so that it beats every variant above: a disabled primary that still
   looks primary invites a click that does nothing. */
button:disabled {
    background: var(--btn-disabled);
    border-color: transparent;
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Card Styles === */
.card {
    width: var(--card-w);
    height: calc(var(--card-w) * var(--card-ratio));
    background: var(--card-white);
    border-radius: calc(var(--card-w) * 0.1);
    box-shadow: 2px 2px 6px var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
}

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

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

/* === Card face: corner indices + centre ===
 *
 * The corner index is what carries a fanned hand — when cards overlap, the top
 * left corner is the only part still visible. The centre is decoration. */
.card-corner {
    position: absolute;
    top: 5%;
    left: 7%;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 0.95;
    font-weight: 700;
}

.card-corner-br {
    top: auto;
    left: auto;
    bottom: 5%;
    right: 7%;
    transform: rotate(180deg);
}

.card-corner-rank {
    font-size: calc(var(--card-w) * 0.28);
}

.card-corner.wide .card-corner-rank {
    font-size: calc(var(--card-w) * 0.22);
}

.card-corner-suit {
    font-size: calc(var(--card-w) * 0.21);
}

/* Kept small deliberately: at this card size a large centre pip runs into the
   two corner indices. */
.card-centre {
    font-size: calc(var(--card-w) * 0.34);
    line-height: 1;
}

/* Court cards get the letter and the pip, not the letter with a hint of pip.
   The suit used to be set at 0.2 of the card and the letter at 0.38, and at a
   phone's card size that is a serif capital with a speck under it: three
   players reported J, Q and K of spades reading as the same card on
   2026-09-07. The pip is what tells them apart at a glance — the letter is
   only legible once you are already looking — so it is now set at the same
   weight as a number card's centre. */
.card-court {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    font-size: calc(var(--card-w) * 0.38);
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 0.9;
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: 3% 7%;
    opacity: 0.92;
}

.card-court-suit {
    font-size: calc(var(--card-w) * 0.34);
    line-height: 0.85;
}

.card.clickable {
    cursor: pointer;
}

.card.clickable:hover {
    transform: translateY(-10px);
    box-shadow: 4px 6px 12px var(--card-shadow);
}

.card.highlighted {
    box-shadow: 0 0 0 3px var(--highlight), 2px 2px 8px var(--card-shadow);
}

.card.highlighted.clickable:hover {
    box-shadow: 0 0 0 3px var(--highlight), 4px 6px 12px var(--card-shadow);
}

/* === The card that has been chosen and not yet played ===
 *
 * A card is chosen with one press and played with the next, and the whole
 * value of the first press is that the player can *see* what they are about to
 * do before it is done. So the chosen card leaves the fan: it rises, it grows,
 * and it comes out from under its neighbours.
 *
 * The growth is not decoration. On a phone the hand is an overlapping fan and
 * every card but one shows about twenty pixels of itself — the rank and the
 * suit and nothing else. Lifting the chosen card to a size where its whole face
 * is readable is what turns "I think I tapped the king" into a question with an
 * answer on it, and it is the reason a mis-tap now costs nothing.
 *
 * `z-index` above the focus ring's 10, because the two happen together: a card
 * chosen from the keyboard is focused and chosen at once. */
.card.armed,
.card.armed.clickable:hover {
    transform: translateY(-18px) scale(1.28);
    z-index: 20;
    box-shadow: 0 0 0 3px var(--highlight), 0 10px 22px rgba(0, 0, 0, 0.45);
}

/* === A card being dragged up to be played — see `game-gestures.js` ===
 *
 * `translate` rather than `transform`, because the lift and the drag have to
 * add up: every rule above and in the phone query writes `transform` for the
 * chosen card, and the individual property composes with it instead of
 * replacing it. The offset lives on the hand, not on the card — a state landing
 * mid-drag repaints the card and would take an inline style off it. No
 * transition while the finger is down, or the card trails behind it. */
.card.armed {
    translate: 0 var(--lift-y, 0px);
}

.hand.lifting .card.armed {
    transition: none;
}

/* Far enough that letting go plays it: said before the finger lifts. */
.hand.lift-ready .card.armed {
    box-shadow: 0 0 0 3px #fff, 0 0 18px 6px var(--highlight), 0 14px 26px rgba(0, 0, 0, 0.5);
}

/* The hand is a surface a finger slides along, not a page to scroll: without
   this the browser takes a sideways slide as a pan and cancels the pointer. */
.hand {
    touch-action: none;
}

/* A card you cannot play right now still has to be readable — a bot is thinking
   for most of a game, and that is exactly when the whole hand is disabled.
   Translucency was the wrong tool: it let the felt through the white face, and
   red pips on green lose their contrast entirely. Draining the colour and
   sitting the card lower says "not now" while leaving the rank and suit as
   sharp as on a legal card. */
/* `:not(.armed)` so a card marked before its turn keeps the lift `.card.armed`
   gives it. It stays drained — it is not playable yet and must not claim to be
   — but a mark that does not move is not a mark. This is the only reason the
   selector is not simply `.card.disabled`: the two rules would otherwise
   disagree about `transform`, and this one is written later. */
.card.disabled:not(.armed) {
    transform: translateY(5px);
    box-shadow: 1px 1px 3px var(--card-shadow);
}

.card.disabled {
    filter: grayscale(0.55) brightness(0.88);
    cursor: not-allowed;
}

/* Where the keyboard is.
 *
 * Drawn outside the card with a gap, and never in gold: a legal card already
 * wears a gold ring on its own edge, so a gold focus ring on top of it is the
 * same card slightly thicker, and the one thing a keyboard player needs to see
 * is which of thirteen is theirs. White, offset, and clear of the face.
 *
 * White is also the only colour that survives `.card.disabled` above —
 * `grayscale()` drains an outline along with the face it surrounds, and an
 * unplayable card is still focusable so that it can be asked why.
 *
 * **Two-tone, and that is the measurement rather than the taste.** A white
 * ring against the felt is 7.9:1, but in a fan its sides fall across the
 * neighbouring card, and white on a white card face is 1:1 — the indicator
 * disappeared over exactly the thing it was drawn on top of. The halo is what
 * fixes it: 4.8:1 between the ring and the halo and 4.8:1 between the halo and
 * a card face behind it, so the pair clears 3:1 against anything it can land
 * on. Measured 2026-08-26 against #fefefe, the felt, and a card wearing
 * `.card.disabled`.
 *
 * (That greyed card was the other half of the question, and it needed no
 * change: desaturating a red pip darkens it, so an unplayable card reads at
 * 7.6:1 for the red pips and 13.5:1 for the black ones — better than the 5.8:1
 * of a card in full colour, not worse.)
 *
 * `:focus-visible` and not `:focus`: clicking a card focuses it, and a ring
 * left behind on every card a mouse has touched is noise. */
.card:focus-visible {
    outline: 3px solid var(--card-white);
    outline-offset: 3px;
    box-shadow: 0 0 0 9px rgba(0, 0, 0, 0.55);
    /* The same lift hovering gives, because it is the same thing being said —
       and it is what carries the sides of the ring, which fall across the
       neighbouring cards in a fan. */
    transform: translateY(-10px);
}

.card-back {
    background: linear-gradient(135deg, #34495e, #2c3e50);
}

.card-back::after {
    content: '';
    width: 70%;
    height: 70%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(255,255,255,0.1) 3px,
        rgba(255,255,255,0.1) 6px
    );
    border-radius: 3px;
}

/* === Hand Display === */
.hand {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 8px;
}

.hand .card {
    margin: 0 -4px;
}

/* The fan only exists on a wide window — below 820px the hand becomes a grid
   (see the breakpoint) because an overlapped card shows nothing but its edge.
   In a fan every card but the last has its bottom-right corner covered by its
   neighbour, so the rotated index lands next to the neighbour's upright one and
   a hand reads as alternating right-way-up and upside-down glyphs. The top-left
   index is the one that carries a fan; the other is noise. */
.hand .card-corner-br {
    display: none;
}

/* In a fan the neighbour overlaps the ring as well as the card, so focus has
   to come out of the stack the same way hovering does. */
.hand .card:hover,
.hand .card:focus-visible {
    z-index: 10;
}

/* The label and the claim button share one row, and **the row is the height it
   always was**: a control of its own above the hand costs about 30px, and the
   layout has 0 spare at 390x669 and 667x320. See "Fitting on the screen".
   The height is the label's own line, fixed, so adding the button changes
   nothing — the button is a shade taller than the line and is allowed to
   overflow into the margin under it rather than push the hand down. That is
   the same trade the chosen card makes by rising with a transform.
   Setting `min-height` here instead put the page 3px over the fold at
   667x320, which the browser tier caught. */
.hand-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    height: 1.3em;
    margin-bottom: 5px;
    font-size: 0.8rem;
    opacity: 0.8;
}

#hand-label-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Taking the rest of a hand: offered only when nothing in it can be beaten.
 *
 * Gold rather than green, because green is the one action a view exists for
 * and this is never that — the hand is the view's action, and this is the
 * shortcut past it. One press: it is offered only when the claim cannot be a
 * mistake, so there is nothing to confirm. */
.claim-btn {
    flex: 0 0 auto;
    padding: 1px 10px;
    line-height: 1.15;
    border: 1px solid var(--highlight);
    border-radius: 12px;
    background: rgba(255, 215, 0, 0.12);
    color: var(--highlight);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    white-space: nowrap;
}

.claim-btn:hover {
    background: rgba(255, 215, 0, 0.22);
}

/* === Lobby Styles === */
.lobby-container {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
}

.lobby-header {
    text-align: center;
    margin-bottom: 25px;
}

.header-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
}

.header-title h1 {
    margin-bottom: 5px;
}

.decorative-card {
    --card-w: 70px;
    width: var(--card-w);
    height: calc(var(--card-w) * 1.4);
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.4);
    transform: rotate(-8deg);
    transition: transform 0.3s ease;
}

.decorative-card.right-card {
    transform: rotate(8deg);
}

.decorative-card:hover {
    transform: rotate(0deg) scale(1.1);
}

@media (max-width: 600px) {
    .decorative-card {
        --card-w: 50px;
    }

    .header-cards {
        gap: 15px;
    }
}

.lobby-name-section {
    background: var(--panel-bg);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.lobby-name-section label {
    margin-bottom: 0;
    white-space: nowrap;
}

.lobby-name-section input {
    flex: 1;
}

.lobby-main {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.lobby-section {
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.lobby-section h3 {
    margin-bottom: 8px;
    padding-bottom: 0;
    border-bottom: none;
}

.lobby-section .section-desc {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-bottom: 15px;
}

/* What a difficulty actually means. The names order the opponents; only this
   says how they differ. */
.bot-hint {
    font-size: 0.78rem;
    opacity: 0.65;
    margin: -4px 0 12px;
    min-height: 1.1rem;
}

/* === Your record ===
 *
 * Shown only once there is something in it. Broken down by opponent, because a
 * combined win rate averages Beginner and Advanced into a number that describes
 * neither. */
.record-section {
    margin-top: 20px;
}

.record-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.record-table th {
    text-align: left;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    font-weight: 600;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.record-table td {
    padding: 7px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.record-table tr:last-child td {
    border-bottom: none;
}

/* Seven columns at a phone's width: the headings lose their tracking and the
   numbers a step of size, which is what lets a row fit without scrolling. */
@media (max-width: 480px) {
    .record-table { font-size: 0.78rem; }
    .record-table th { letter-spacing: 0; font-size: 0.6rem; }
}

/* Seven columns on a phone run their headings together without a gutter. */
.record-table th + th,
.record-table td + td {
    padding-left: 6px;
}

/* The columns that name a row — the opponent, the table size, or both — read
   left; the numbers after them line up on the right. */
.record-table td.record-key {
    font-weight: 600;
}

.record-table th:not(.record-key),
.record-table td:not(.record-key) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* The tabs and the chance switch on one row; the switch is not a fourth tab,
   since it changes how every tab is drawn, so it stands apart at the end. */
.record-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.record-controls .medal-tabs {
    margin-bottom: 0;
}

/* A rate set against chance: green on the good side of it, red on the other.
   The side differs by column — above chance is good for winning, below it for
   coming last — which is why the verdict is worked out in record.js. */
.record-table td.chance-better { color: #5fd38a; }
.record-table td.chance-worse  { color: #ff7b7b; }

.vs-chance {
    display: block;
    white-space: nowrap;
    font-size: 0.68rem;
    opacity: 0.6;
    color: var(--text-light);
    font-weight: 400;
}

/* The case for an account, made inside the record panel rather than as a banner
   of its own: it only means anything next to the numbers it is about. */
.record-pitch {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.record-pitch p {
    flex: 1 1 260px;
    font-size: 0.85rem;
    line-height: 1.5;
    opacity: 0.85;
}

.record-pitch button {
    flex: 0 0 auto;
}

/* Arrived from an invite link: the code is already filled in, and this is what
   says which panel to look at. */
.lobby-section.is-invited {
    border: 1px solid var(--highlight);
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.2);
}

.lobby-section.is-invited .section-desc {
    opacity: 1;
    color: var(--highlight);
}

.lobby-section button {
    margin-top: auto;
}

/* The tables this browser is still seated at. Outlined like an invite, because
   it is the same kind of sentence: the one thing on the screen to read before
   pressing anything else. */
.lobby-tables {
    margin-bottom: 20px;
    padding: 14px 20px;
    border: 1px solid var(--highlight);
}

.lobby-table-list {
    list-style: none;
}

.lobby-table-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
}

.lobby-table-list button {
    margin-top: 0;
    padding: 8px 18px;
}

.lobby-quickplay {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.3), rgba(39, 174, 96, 0.1));
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.lobby-quickplay button {
    width: 100%;
    font-size: 1.1rem;
    padding: 12px 20px;
}

@media (max-width: 600px) {
    .lobby-main {
        grid-template-columns: 1fr;
    }

    .lobby-name-section {
        flex-direction: column;
        align-items: stretch;
    }

    .lobby-name-section label {
        margin-bottom: 5px;
    }
}

/* === Room Styles === */
/* The side gutter the lobby has. Without it the code box and the Leave button
   touched the left edge of a phone and the difficulty ran off the right. */
.room-container {
    max-width: 600px;
    margin: 30px auto;
    padding-inline: 16px;
}

/* The header is a single baseline-aligned row: the code, then the room's
   settings as label/value pairs, then the way out. It used to be a stack of
   loose lines next to a button, aligned to nothing. */
.room-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 14px;
}

.room-code-label,
.room-meta dt {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    margin-bottom: 3px;
}

.room-code {
    font-size: 2rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: rgba(0,0,0,0.3);
    padding: 6px 18px;
    border-radius: 6px;
    letter-spacing: 4px;
    line-height: 1.2;
}

.room-meta {
    display: flex;
    gap: 20px;
    flex: 1;
}

.room-meta dd {
    font-size: 0.95rem;
    font-weight: 600;
}

.player-list {
    list-style: none;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    overflow: hidden;
}

.player-list li {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-list li:last-child {
    border-bottom: none;
}

.player-list .empty-seat {
    opacity: 0.5;
    font-style: italic;
}

.player-tags {
    display: flex;
    gap: 5px;
}

.tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag.bot {
    background: #9b59b6;
}

.tag.you {
    background: #27ae60;
}

.tag.host {
    background: #f39c12;
}

/* === How the table is seated ===
 *
 * Three choices of which exactly one is in force, so they are drawn as one
 * control with a filled segment rather than three buttons that each look
 * pressable. Only the host has it; everybody gets the sentence under it. */
.seating {
    margin: 6px 0 10px;
}

.seating-choices {
    display: inline-flex;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    overflow: hidden;
}

.seating-choice {
    padding: 8px 14px;
    border-radius: 0;
    font-size: 0.85rem;
    background: transparent;
}

.seating-choice + .seating-choice {
    border-left: 1px solid rgba(255,255,255,0.25);
}

/* No lift on hover: a segment that rises out of its own border reads as a
   rendering fault, which the base button's translate would be here. */
.seating-choice:hover:not(:disabled) {
    background: rgba(255,255,255,0.12);
    transform: none;
}

.seating-choice[aria-checked="true"],
.seating-choice[aria-checked="true"]:hover:not(:disabled) {
    background: var(--btn-primary);
    font-weight: 600;
}

.seating-hint {
    margin-top: 6px;
    font-size: 0.82rem;
    opacity: 0.75;
}

/* A seat the host can move. The name takes the slack, so the grip stays at
   the left edge and the arrows at the right however long the name is. */
.player-list li.movable {
    justify-content: flex-start;
    gap: 10px;
    padding-left: 8px;
}

.player-list li.movable .seat-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* `touch-action: none` is what makes the grip a grip on a phone: without it a
   finger that starts here scrolls the page, and the browser cancels the
   pointer the drag is following. It is on the grip and not on the row, so the
   rest of the list still scrolls. */
.seat-grip {
    padding: 6px;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.6;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.player-list li.dragging {
    background: rgba(255,255,255,0.14);
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}

.player-list li.dragging .seat-grip {
    opacity: 1;
    cursor: grabbing;
}

.seat-moves {
    display: flex;
    gap: 4px;
}

.seat-move {
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    font-size: 0.7rem;
}

.room-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Inviting someone is a link, not six characters dictated over the phone. The
   code is still there — once, in the header — for when the phone is all there
   is. */
.room-share {
    padding: 14px 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
}

.share-row {
    display: flex;
    gap: 8px;
}

.share-row input {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
}

.share-row button {
    flex-shrink: 0;
}

.share-hint {
    font-size: 0.78rem;
    opacity: 0.65;
    margin-top: 7px;
}

@media (max-width: 600px) {
    .share-row {
        flex-direction: column;
    }
}

/* === Game Styles === */
/* Wider than it was, and still capped — and the cap is what a hand needs
   rather than a round number. A three-player hand is seventeen cards, which at
   the card width above is about 1090px of fan; the side panel takes 180 and
   the gap 20, and that is where 1400 comes from. Going wider than a hand needs
   makes nothing bigger: it only stretches the felt, which is the complaint
   this was written about. Measured at 1890x975 the app now fills 1400x846
   against the 1320x808 it used to, with the cards up from 76px to 88px. */
.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 15px;
}

.game-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.game-header #btn-exit-game {
    position: absolute;
    left: 10px;
    padding: 5px 12px;
    font-size: 0.8rem;
}

/* === The settings menu ===
 *
 * Anchored to the end of the header rather than sitting in it: the middle of
 * that bar is four numbers a player reads mid-hand, and a control among them
 * is read as a fifth. Absolutely positioned for the same reason Exit is — the
 * row centres its items, and anything in the flow pushes the numbers off
 * centre as it changes width. */
.settings-wrap {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    /* The transform above makes this a stacking context, so the menu's own
       z-index is confined inside it and counts for nothing outside — without
       this the panel drawn later in the document painted straight over an open
       menu. The number has to live on whichever element holds the context. */
    z-index: 40;
}

/* The drawer's cross — see `sidebarBlocks`. Only a drawer has one: the phone
   query below draws it, and a desktop's column has nothing to close. */
.panel-close {
    display: none;
}

/* The phone's own button for the side panel — see `renderSettings`. Not drawn
   on a desktop, where the panel is a column that stays put and the gear's row
   is enough; the phone query below turns it on. */
.panel-toggle {
    display: none;
}

.settings-gear {
    font-size: 1.1rem;
    line-height: 1;
    text-decoration: none;
    opacity: 0.75;
}

.settings-gear:hover {
    opacity: 1;
}

/* Drawn above everything on the table: the felt below it carries cards that
   are raised on hover, and the menu has to stay on top of them. What puts it
   there is the z-index on `.settings-wrap`, not this one. */
.settings-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 160px;
    padding: 6px 10px;
    background: #23412f;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    text-align: left;
}

.settings-menu.open {
    display: block;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 7px 0;
    font-size: 0.8rem;
    white-space: nowrap;
}

.settings-row + .settings-row {
    border-top: 1px solid rgba(255,255,255,0.12);
}

/* The two controls in there are a glyph and a word, and a menu whose right
   edge is ragged reads as two unrelated things. */
.settings-row .link-button,
.settings-row .sound-toggle {
    min-width: 44px;
    text-align: right;
    font-size: 0.8rem;
}

/* The level and the mute are one setting drawn twice, so they sit together at
   the end of the row rather than as two rows that could be read as two
   settings. The slider is 96px because the menu is anchored to the right edge
   of a phone's header and grows leftwards: wider, and it leaves the screen. */
.settings-sound {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sound-volume {
    width: 96px;
    margin: 0;
    accent-color: var(--highlight);
    cursor: pointer;
}

.game-header-item {
    text-align: center;
}

.game-header-item .label {
    font-size: 0.7rem;
    opacity: 0.7;
}

.game-header-item .value {
    font-size: 0.95rem;
    font-weight: 600;
}

.game-table {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 14px clamp(8px, 2vw, 20px);
    background: radial-gradient(ellipse at center,
                #35684b 0%, #2b5a3e 65%, #245032 100%);
    border-radius: clamp(16px, 4vw, 40px);
    box-shadow: inset 0 0 50px rgba(0,0,0,0.3),
                0 8px 24px rgba(0,0,0,0.35);
    border: 2px solid rgba(0,0,0,0.25);
}

.table-top-row,
.table-middle-row,
.table-bottom-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(6px, 1.5vw, 16px);
    width: 100%;
}

.table-top-row {
    flex-wrap: wrap;
}

/* Seats lay out sideways, not in a stack.
 *
 * The felt is far wider than its contents — at 1512px it spans 950px around a
 * 235px trick — while the page is short enough that the hand was being pushed
 * below the fold. Putting the face-down card beside its seat instead of under
 * it, and the turn status beside the player's own seat, spends that spare width
 * on the two rows that were costing the most height. */
.player-position {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* The two side seats take equal halves of the row, so the trick sits at the
   felt's centre and stays there.
 *
 * Without this the middle row is three items merely centred as a group, so the
 * trick's position is decided by the *difference* between the seat badges
 * either side of it. That difference moves during a hand: a seat gains an
 * OFFLINE, AWAY or BOT chip and the whole grid slides — measured at 50px
 * sideways for one tag — while cards are landing on it. Every table size from
 * three to six has exactly one `left` and one `right` seat (see
 * `Table.ARRANGEMENTS`), so equal halves is the whole of the fix. */
.table-middle-row > .player-position {
    flex: 1 1 0;
}

/* The opponent's face-down card is decoration; shrink it so it never competes
   with the seat badge for space. */
.player-position .card-back {
    width: calc(var(--card-w) * 0.72);
    height: calc(var(--card-w) * var(--card-ratio) * 0.72);
}

/* === Seats (avatar + name + running score) === */
.seat {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 8px 4px 4px;
    border-radius: 20px;
    background: rgba(0,0,0,0.28);
    border: 1px solid transparent;
    max-width: var(--seat-max);
}

.seat.is-me {
    background: rgba(39, 174, 96, 0.22);
    border-color: rgba(39, 174, 96, 0.45);
}

.seat.current-turn {
    border-color: var(--highlight);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.35);
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.25);
}

.avatar.is-bot {
    border: 1px dashed rgba(255,255,255,0.45);
}

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

/* A flex row of the name and its tag, with the *name* as the part that gives
   way. The ellipsis used to be on this box, which holds both — so on a phone a
   long name pushed the AWAY chip past the edge and the ellipsis ate it, and the
   one sign that a player had left the table was a one-pixel red sliver. */
.seat-name {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.seat-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seat.current-turn .seat-name {
    color: var(--highlight);
}

/* `flex-shrink: 0` is what stops these being the thing that gives way. The
   badge is a flex row of a name and a tag, and the name is the flexible half —
   so on a narrow table the browser squeezed `BOT` down to `B…` and left the
   name at full width, which is precisely backwards: the name is what has an
   ellipsis for, and a three-letter chip that says `B…` says nothing. */
.bot-tag,
.away-tag,
.offline-tag {
    font-size: 0.55rem;
    font-weight: 700;
    opacity: 0.6;
    border: 1px solid currentColor;
    border-radius: 3px;
    padding: 0 3px;
    vertical-align: middle;
    flex-shrink: 0;
    white-space: nowrap;
}

/* A seat whose owner stopped playing. Marked, not dimmed to nothing: they are
   still in the game and their score still counts. */
.away-tag {
    color: var(--btn-danger);
    opacity: 0.85;
}

.seat.is-away .avatar {
    filter: grayscale(0.7);
}

/* A seat whose player is not connected *right now* — which is a different
   thing from one the bot has taken over, and deliberately a quieter one. The
   player is still in the game, still holds the turn, and may well be back
   before it comes round: amber says "wait", red says "gone". A seat can only
   ever carry one of the three tags; see `Table.seatTag`. */
.offline-tag {
    color: #e0a33e;
    opacity: 0.9;
}

.seat.is-offline .avatar {
    filter: grayscale(0.45);
}

.seat.is-offline .seat-name {
    opacity: 0.75;
}

.seat-meta {
    font-size: 0.65rem;
    opacity: 0.65;
    white-space: nowrap;
}

.seat-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
    flex-shrink: 0;
    padding-left: 4px;
    border-left: 1px solid rgba(255,255,255,0.15);
}

.seat-score .total {
    font-size: 1rem;
    font-weight: 700;
}

.seat-score .delta {
    font-size: 0.6rem;
    color: #ff9d9d;
    font-weight: 600;
}

.trick-area {
    /* The cell size is derived here, not at :root, so that a container which
       rebinds --trick-card-w (the replay does) actually resizes the grid and
       not only the cards sitting in it. */
    --trick-cell-w: calc(var(--trick-card-w) + 1.6rem);
    --trick-cell-h: calc(var(--trick-card-w) * var(--card-ratio) + 1.15rem);

    background: rgba(0,0,0,0.12);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 1 auto;
}

.no-cards-label {
    font-size: 0.8rem;
    opacity: 0.5;
    text-align: center;
    /* Sit in the middle of the grid rather than in its first cell, so the table
       does not shift when the first card of a trick lands — and across the full
       width of that row, or the label wraps to three lines inside one cell. */
    grid-row: 2;
    grid-column: 1 / -1;
}

.trick-cards {
    display: grid;
    grid-template-areas:
        "top-left  top       top-right"
        "left      center    right"
        ".         bottom    .";
    grid-template-columns: repeat(3, var(--trick-cell-w));
    grid-template-rows: repeat(3, var(--trick-cell-h));
    align-items: center;
    justify-items: center;
}

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

/* A claimed hand, face up before it goes to the claimer.
 *
 * Not a trick, so not the seat grid: every card left in the hand, in one
 * overlapping spread across the space the grid takes, so the felt keeps its
 * size and nothing around it moves. The margins are negative on every side,
 * which is what lets the spread wrap onto a second row and still overlap. */
.trick-cards.claiming {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    width: calc(var(--trick-cell-w) * 3);
    height: calc(var(--trick-cell-h) * 3);
    padding: calc(var(--trick-card-w) * 0.35) calc(var(--trick-card-w) * 0.3);
    box-sizing: border-box;
}

.claim-card {
    margin: calc(var(--trick-card-w) * -0.22) calc(var(--trick-card-w) * -0.24);
    animation: claim-card-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
    animation-delay: calc(var(--i, 0) * 45ms);
}

.claim-card .card {
    --card-w: var(--trick-card-w);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

@keyframes claim-card-in {
    from { opacity: 0; transform: translateY(-18px) scale(0.9); }
    to   { opacity: 1; transform: none; }
}

/* === Cards arriving, and a hand being dealt =====================================
 *
 * **These run because an element that survives a repaint does not restart its
 * animation, and the paint-instead-of-rebuild render is what made that true.** A CSS animation fires
 * when its element enters the document, so under the old renderer — which
 * rebuilt the felt and the hand on every event — each of these would have
 * re-fired on every card of every trick, for every card on the table at once.
 * That is not a slower version of the effect, it is a flicker, and it is why
 * there was no arrival animation here before.
 *
 * Now `Dom.list` keeps the elements whose key survives and inserts only what
 * is new, so "animate on insert" means exactly what it says: the card that has
 * just been played, and no other. Nothing in JavaScript has to arrange that —
 * the identity of the element is the whole mechanism.
 */
@keyframes trick-card-in {
    from { opacity: 0; transform: translate(var(--from-x, 0), var(--from-y, -28px)) scale(0.86); }
    to   { opacity: 1; transform: translate(0, 0) scale(1); }
}

.trick-play {
    animation: trick-card-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

/* A card comes in from the side its seat sits on, so the felt reads as four
   people playing towards a middle rather than cards appearing in slots. */
.trick-play.pos-top       { --from-y: -46px; }
.trick-play.pos-bottom    { --from-y: 46px; }
.trick-play.pos-left      { --from-x: -52px; --from-y: 0; }
.trick-play.pos-right     { --from-x: 52px;  --from-y: 0; }
.trick-play.pos-top-left  { --from-x: -38px; --from-y: -32px; }
.trick-play.pos-top-right { --from-x: 38px;  --from-y: -32px; }

/* A hand being dealt: thirteen cards, staggered. Same mechanism — this fires
   when the cards are inserted, which is once a hand, because playing one keeps
   the other twelve exactly where they are. */
@keyframes hand-card-in {
    from { opacity: 0; transform: translateY(26px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* **`backwards` and not `both`, and the difference is every other transform on
   a card.** `both` includes `forwards`, which holds the last keyframe after the
   animation ends — and a keyframe outranks a normal declaration in the cascade.
   The last keyframe here is `translateY(0) scale(1)`, the identity, so from the
   moment a hand finished being dealt nothing could transform a card again: the
   chosen card did not rise or grow, the legal card's `translateY(-4px)` never
   arrived, and neither did hover or the focus lift. Held for a whole hand,
   because the animation only fires when cards are inserted.

   `forwards` bought nothing anyway — the state it was holding is the state the
   card has with no animation at all. `backwards` is the half that is load
   bearing: the cards are staggered by `animation-delay` below, and without it
   the twelve still waiting would be drawn at full opacity first. */
.hand .card {
    animation: hand-card-in 0.3s ease-out backwards;
}

/* Staggered from `nth-child` rather than an index written into the markup: the
   index of a card changes every time one is played, so writing it would have
   `Dom.sync` rewriting the style of all twelve survivors to move one — against
   the whole rule of `dom.js`, which is to write only what changed. The
   selector costs nothing and is recomputed by the browser for free. */
.hand .card:nth-child(2)  { animation-delay: 0.035s; }
.hand .card:nth-child(3)  { animation-delay: 0.07s; }
.hand .card:nth-child(4)  { animation-delay: 0.105s; }
.hand .card:nth-child(5)  { animation-delay: 0.14s; }
.hand .card:nth-child(6)  { animation-delay: 0.175s; }
.hand .card:nth-child(7)  { animation-delay: 0.21s; }
.hand .card:nth-child(8)  { animation-delay: 0.245s; }
.hand .card:nth-child(9)  { animation-delay: 0.28s; }
.hand .card:nth-child(10) { animation-delay: 0.315s; }
.hand .card:nth-child(11) { animation-delay: 0.35s; }
.hand .card:nth-child(12) { animation-delay: 0.385s; }
.hand .card:nth-child(13) { animation-delay: 0.42s; }

@media (prefers-reduced-motion: reduce) {
    /* Still an arrival — a card that appears with no transition at all is the
       thing this replaced — but one that neither travels nor overshoots. */
    .trick-play { animation: fadeIn 0.2s ease-out both; }
    .hand .card, .hand .card:nth-child(n) {
        animation: fadeIn 0.2s ease-out both;
        animation-delay: 0s;
    }
}

.trick-play.pos-top { grid-area: top; }
.trick-play.pos-top-left { grid-area: top-left; }
.trick-play.pos-top-right { grid-area: top-right; }
.trick-play.pos-left { grid-area: left; }
.trick-play.pos-right { grid-area: right; }
.trick-play.pos-bottom { grid-area: bottom; }

.trick-play .player-name {
    font-size: 0.65rem;
    text-align: center;
    max-width: var(--trick-cell-w);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Rebinding --card-w is all a card needs: its width, height, corner radius and
   every glyph size derive from it. */
.trick-play .card {
    --card-w: var(--trick-card-w);
}

.trick-play.trick-winner {
    background: rgba(255, 215, 0, 0.25);
    border-radius: 6px;
    padding: 5px;
    margin: -5px;
}

/* === Trick collected by the winner ===
 *
 * The whole grid slides towards the seat that took the trick, so the cards are
 * seen going somewhere instead of simply vanishing. */
.trick-cards.collecting {
    transition: transform var(--collect-ms, 420ms) cubic-bezier(0.5, 0, 0.75, 0.3),
                opacity var(--collect-ms, 420ms) ease-in;
    opacity: 0;
}

/* === The trick that has been taken, still on the felt ===
 *
 * It stays where it was until the table leads again — see `restingTrick` in
 * `game-render.js`. Drawn back so it cannot be mistaken for the trick in play:
 * the one in play is the question in front of you, this one is history. The
 * winning card keeps its full colour, because whose trick it was is the whole
 * of what is still worth reading here.
 *
 * `filter` and not `opacity`: a translucent card lets the felt through and the
 * red pips lose their contrast against the green, which is the same reason
 * `.card.disabled` is drained rather than faded. */
.trick-cards.resting .trick-play {
    filter: grayscale(0.45) brightness(0.82);
    transition: filter 0.25s ease-out;
}

.trick-cards.resting .trick-play.trick-winner {
    filter: none;
}

.trick-cards.collect-top       { transform: translateY(-120%) scale(0.3); }
.trick-cards.collect-bottom    { transform: translateY(120%) scale(0.3); }
.trick-cards.collect-left      { transform: translateX(-120%) scale(0.3); }
.trick-cards.collect-right     { transform: translateX(120%) scale(0.3); }
.trick-cards.collect-top-left  { transform: translate(-95%, -95%) scale(0.3); }
.trick-cards.collect-top-right { transform: translate(95%, -95%) scale(0.3); }

/* === "Somebody wins the trick" ===
 *
 * **The space is reserved whether or not there is a message**, and that is the
 * whole of this rule. The line is 1.1rem and bold, so an empty box growing to
 * hold it added about 31px to the middle row of the table — which pushed the
 * felt, the hand and everything under it down, and then let it all spring back
 * a second later. Every trick. The page visibly bounced, on the one screen
 * where the player is trying to read four cards.
 *
 * `min-height` on the container rather than on the message: the message is
 * absent half the time, and a rule on an element that is not there reserves
 * nothing. The gap that used to be the message's `margin-top` is the
 * container's `padding-top` for the same reason. */
#trick-message {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 10px;
    /* One line of the message's own type, and nothing left over. */
    min-height: calc(1.1rem * 1.35);
    box-sizing: content-box;
}

.trick-winner-message {
    color: var(--highlight);
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1.35;
    text-align: center;
    animation: fadeIn 0.3s ease-in;
}

/* Opacity only. It used to arrive with `translateY(-5px)`, which is a second
   and smaller version of the same complaint — the text lands by dropping into
   place, in a box that is now exactly its own size. */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === Movement the player asked their system not to send them ===
 *
 * The cards are the one thing this query did not reach: it was honoured for
 * the connection dot and for the flourishes, in a UI whose whole idea is cards
 * crossing a table.
 *
 * What goes is travel, not information. The trick still leaves — it fades in
 * place instead of sliding towards the seat that took it, over the same 0.42s,
 * so `GameView.collectDelay` still matches the transition it is waiting on and
 * the rhythm of the hand is unchanged.
 *
 * A hovered card still rises and an unplayable one still sits low: with the
 * transitions off those are positions a card is in, not journeys it makes, and
 * they are the whole of how the hand says which card is which. Taking them as
 * well would cost this player the affordance and remove no movement.
 *
 * `fadeIn` used to be redefined in here without its `translateY`, and is not
 * any more: the base definition is opacity only now, because a message sliding
 * 5px into a box that is exactly its own size was a small bounce for everybody
 * rather than movement anybody had asked for. An override that says what the
 * rule above it already says is a rule that stops being checked. */
@media (prefers-reduced-motion: reduce) {
    .card {
        transition: none;
    }

    .trick-cards.collecting {
        transition: opacity var(--collect-ms, 420ms) ease-in;
    }

    /* The claimed cards appear where they lie rather than dropping in. */
    .claim-card {
        animation: fadeIn 0.3s ease-in backwards;
    }

    .trick-cards.collect-top,
    .trick-cards.collect-bottom,
    .trick-cards.collect-left,
    .trick-cards.collect-right,
    .trick-cards.collect-top-left,
    .trick-cards.collect-top-right {
        transform: none;
    }
}

.your-turn-indicator {
    text-align: center;
    color: var(--highlight);
    font-weight: 600;
    padding: 10px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.waiting-indicator {
    text-align: center;
    opacity: 0.7;
    padding: 10px;
}

/* The turn countdown.
   It keeps its box whether or not it has anything to say, so the seat below it
   does not jump when the last ten seconds begin. */
.turn-timer {
    text-align: center;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    min-height: 1.2em;
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

.turn-timer.visible {
    opacity: 0.75;
}

.turn-timer.urgent {
    color: var(--btn-danger);
    opacity: 1;
    font-weight: 700;
    animation: pulse 1s infinite;
}

/* Losing the seat is a consequence, so it is stated before it happens and not
   after. Deliberately quieter than the countdown next to it: this is a standing
   fact about the game, and the countdown is the thing that is running out. */
.turn-strikes {
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.3;
    margin-top: 2px;
    color: var(--highlight);
    opacity: 0.85;
}

.turn-strikes.urgent {
    color: var(--btn-danger);
    font-weight: 700;
    opacity: 1;
}

/* === Game Layout === */
.game-main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.game-left {
    flex: 1;
    min-width: 0;
    /* The sweep slides the trick 120% towards the seat that took it, and the
       Queen shakes the felt: both reached past the right edge for a moment, and
       on a phone the whole page wobbled sideways. `clip` rather than `hidden`
       so the vertical axis stays visible — the chosen card rises out of the
       hand, over the felt — and so nothing here becomes a scroll container. */
    overflow-x: clip;
}

/* === Scores Panel (Right Sidebar) === */
.scores-panel {
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 10px;
    min-width: 100px;
    flex-shrink: 0;
}

/* The game's own sidebar: no score list, because every seat already carries its
 * total and what it has taken this hand, and a second copy of both was the
 * widest thing on the page. What is left — the last trick and what is still out
 * — is information the felt does not hold, and it fits in a strip. The replay
 * keeps the full `.scores-panel`: it has no live seats to read scores off. */
.side-panel {
    /* Wide enough for the last trick's three-by-three diamond at the bottom of
       the range, and for a name beside its void suits at the top. The ceiling
       moved with the card ceiling above and for the same reason: the width was
       there and was going to empty felt. */
    width: clamp(98px, 11vw, 180px);
    min-width: 0;
    padding: 10px 8px;
    /* The felt beside it is a radial gradient with an inset shadow; a flat
       black rectangle next to that reads as a hole rather than as a panel. */
    background: linear-gradient(180deg, rgba(0,0,0,0.34), rgba(0,0,0,0.22));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* Folded away. The panel is still drawn — the header's control flips this
   class on the live row rather than re-rendering the view — and `.game-left`
   is `flex: 1`, so the felt simply takes the width back. */
.game-main.sidebar-hidden .side-panel {
    display: none;
}

/* After the drawer's cross too, which is the panel's first child and is only
   drawn on a phone — see `sidebarBlocks`. */
.side-panel .side-block:first-child,
.side-panel .panel-close + .side-block {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.scores-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.score-item {
    text-align: center;
    padding: 6px 6px;
    border-radius: 4px;
    margin-bottom: 5px;
    background: rgba(255,255,255,0.05);
}

.score-item:last-child {
    margin-bottom: 0;
}

.score-item.is-me {
    background: rgba(39, 174, 96, 0.2);
    border: 1px solid rgba(39, 174, 96, 0.4);
}

.score-item .player-name {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-item .score {
    font-size: 1.1rem;
    font-weight: 700;
}

.score-item .hand-points {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 1px;
}

.score-item.current-turn {
    color: var(--highlight);
    border-color: var(--highlight);
}

/* === Sidebar blocks: last trick, suits still out === */
.side-block {
    margin-top: 14px;
    padding-top: 12px;
    /* A rule that fades out at both ends rather than a line stopping short of
       the padding, which is the detail that made the panel look unfinished. */
    border-top: 1px solid transparent;
    border-image: linear-gradient(90deg,
        transparent, rgba(255,255,255,0.22) 20%,
        rgba(255,255,255,0.22) 80%, transparent) 1;
}

.side-title {
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    opacity: 0.55;
    margin-bottom: 9px;
}

/* The same diamond the felt lays the trick out in, at a quarter of the size:
   each card sits at the seat that played it. A row would have put them in the
   order they were played instead, which answers a question nobody asks. */
.last-trick-cards {
    --mini-cell: 30px;

    display: grid;
    grid-template-areas:
        "top-left  top     top-right"
        "left      center  right"
        ".         bottom  .";
    grid-template-columns: repeat(3, var(--mini-cell));
    /* Automatic rather than a fixed height: a three-player trick has nothing in
       the top row, and a fixed row would leave a band of empty felt above the
       cards. The felt's own grid keeps fixed rows on purpose — there the
       diamond has to stay centred between the seats whatever its size. */
    grid-template-rows: repeat(3, auto);
    row-gap: 3px;
    align-items: center;
    justify-items: center;

    /* `justify-items` centres a card inside its cell; this centres the three
       cells inside the panel. Without it the columns are laid out from the
       left edge and the whole diamond sits off to one side of a panel that is
       wider than 3 × --mini-cell — which it is at every size. */
    justify-content: center;
}

.last-trick-play.pos-top       { grid-area: top; }
.last-trick-play.pos-top-left  { grid-area: top-left; }
.last-trick-play.pos-top-right { grid-area: top-right; }
.last-trick-play.pos-left      { grid-area: left; }
.last-trick-play.pos-right     { grid-area: right; }
.last-trick-play.pos-bottom    { grid-area: bottom; }

.last-trick-play .card {
    --card-w: 26px;
    border-radius: 3px;
    opacity: 0.75;
}

/* At this size a corner index and a centre would both be illegible. Drop the
   centre and let the single index sit in the middle of the card. */
.last-trick-play .card-centre,
.last-trick-play .card-corner-br {
    display: none;
}

.last-trick-play .card-corner {
    position: static;
    margin: auto;
}

.last-trick-play .card-corner-rank {
    font-size: calc(var(--card-w) * 0.42);
}

.last-trick-play .card-corner-suit {
    font-size: calc(var(--card-w) * 0.38);
}

.last-trick-play.won .card {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--highlight);
}

.last-trick-winner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.65rem;
    margin-top: 6px;
    min-width: 0;
}

.last-trick-name {
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Most tricks are worth nothing, so the ones that are not have to look
   different rather than merely say a different number. */
.last-trick-points {
    flex-shrink: 0;
    padding: 1px 5px;
    border-radius: 8px;
    background: rgba(231, 76, 60, 0.25);
    color: #ff9aa2;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Two by two: at this width four across left every cell narrower than the
   glyph in it. A pair of columns gives each suit a chip it fits inside, which
   is also what lets an exhausted suit be struck through rather than merely
   dimmed — a suit nobody has left is the one thing here worth spotting. */
.suit-counts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.suit-count {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 2px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    line-height: 1;
}

.suit-count.red .suit-glyph {
    color: #ff6b7a;
}

.suit-count.black .suit-glyph {
    color: #cfd8dc;
}

/* Not opacity alone: a faded chip reads as "still loading" next to three that
   are not, and the number it is showing is zero — which is the point. */
.suit-count.exhausted {
    background: none;
    opacity: 0.4;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.suit-glyph {
    font-size: 0.95rem;
}

.suit-num {
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* === Where the Queen is ===
 *
 * The card itself rather than the word, because that is what a player is
 * looking for, and two states that look different rather than two that read
 * differently: still out is the alarming one and is drawn as such. */
.queen-watch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 4px;
    border-radius: 6px;
    line-height: 1.15;
    text-align: center;
}

.queen-watch.out {
    background: rgba(196, 30, 58, 0.18);
    border: 1px solid rgba(196, 30, 58, 0.5);
}

.queen-watch.gone {
    background: rgba(255,255,255,0.06);
    border: 1px solid transparent;
}

.queen-card {
    font-size: 1rem;
    font-weight: 700;
    color: #cfd8dc;
}

.queen-watch.out .queen-card {
    color: #fff;
}

.queen-state {
    font-size: 0.62rem;
    opacity: 0.8;
    overflow-wrap: anywhere;
}

/* === Who is void in what ===
 *
 * A name and its glyphs on one line. The name is allowed to be cut off and the
 * glyphs are not: a truncated "Bartolo…" is still the right player, and half a
 * suit symbol is nothing at all. */
.void-rows {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.void-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 0.66rem;
    line-height: 1.3;
}

.void-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.75;
}

.void-suits {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.void-suit {
    font-size: 0.85rem;
    line-height: 1;
}

.void-suit.red {
    color: #ff6b7a;
}

.void-suit.black {
    color: #cfd8dc;
}

/* Nobody has shown anything yet. Dimmed as a block rather than hidden: a panel
   that grows a section partway through a hand reads as a glitch, and "nothing
   yet" is a true and useful answer on trick one. */
.void-rows.empty {
    opacity: 0.5;
}

.void-none {
    opacity: 0.5;
}

/* === Illegal-move hint === */
/* Laid over the hand's label rather than pushed in above the hand: in the flow
   it moved every card 35px down for three seconds, under the finger that had
   just pressed one. */
.hand-panel {
    position: relative;
}

.hand-panel .play-hint {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 16px);
    z-index: 5;
}

.play-hint {
    text-align: center;
    font-size: 0.8rem;
    color: var(--highlight);
    background: rgba(0,0,0,0.35);
    border-radius: 4px;
    padding: 5px 10px;
    margin: 0 auto 6px;
    max-width: 420px;
    animation: fadeIn 0.2s ease-in;
}

.modal-text {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 20px;
}

/* === Game Over Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: var(--table-felt);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal h2 {
    margin-bottom: 20px;
    font-size: 1.8rem;
}

/* A dialog never taller than the window it is in. The standings at six seats,
   with medals and three buttons, run past a short phone's height — and a modal
   overlay does not scroll the page behind it, so the buttons were unreachable
   rather than merely below the fold. */
.modal,
.hand-summary-modal {
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
}

/* The headline, and **the direct child is the whole of it**: `.modal .winner`
   also matched `.final-scores li.winner`, so the first row of the standings was
   set at 1.3rem with a 26px medal beside it and the list came out lopsided.
   The headline is a child of the modal; a placing is a grandchild. */
.modal > .winner {
    font-size: 1.3rem;
    color: var(--highlight);
    margin-bottom: 20px;
}

.final-scores {
    text-align: left;
    background: rgba(0,0,0,0.2);
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    list-style: none;
    counter-reset: none;
}

.final-scores li {
    padding: 6px 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* A row per seat, separated rather than merely stacked: at six seats the list
   was six lines of the same weight and the eye had nothing to hold on to. */
.final-scores li + li {
    border-top: 1px solid rgba(255,255,255,0.07);
}

.place-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.place-score {
    font-variant-numeric: tabular-nums;
    opacity: 0.9;
}

/* The medal beside a placing.
 *
 * **The lowest score wins**, so the discs are the clearest statement on the
 * screen of which way round a Hearts table reads. Three metals and then a
 * plain one: a fourth metal would say that fourth of six is an achievement.
 *
 * Each is a gradient rather than a flat fill, because a flat gold circle and a
 * flat yellow circle are the same circle — the band across it is what makes it
 * read as metal at 26px. */
.place-medal {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(0,0,0,0.65);
    box-shadow: inset 0 -2px 3px rgba(0,0,0,0.25),
                inset 0 2px 3px rgba(255,255,255,0.45);
}

.place-gold {
    background: var(--medal-gold-disc);
}

.place-silver {
    background: var(--medal-silver-disc);
}

.place-bronze {
    background: var(--medal-bronze-disc);
}

/* Fourth and below: the same disc with the metal taken out of it, so the
   column still lines up and nothing pretends to be a medal. */
.place-rest {
    background: rgba(255,255,255,0.13);
    color: rgba(255,255,255,0.75);
    box-shadow: none;
}

.final-scores li.winner {
    color: var(--highlight);
    font-weight: 600;
}

/* The other end of the same result. Red rather than gold, and not bolder than
   the row above it: last place is worth naming, not worth celebrating. */
.final-scores li.loser {
    color: #e88b8b;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* === Replay ===
 *
 * The replay reuses the game's felt, seats, trick grid and scores panel through
 * `Table`, so almost nothing is needed here: a header, the transport controls,
 * and the two things a replay has that a game does not — the other players'
 * hands, and an explanation when the server is still withholding them. */
.replay-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 15px;

    /* The replay carries the transport controls and the scrubber as well as the
       table, so it has about 90px less height to spend than the game does. That
       is paid for by rebinding the two size variables — never by a fixed height
       on anything, which is what made the old table break at every width. */
    --card-w: clamp(34px, min(4vw, 5.9vh), 46px);
    --card-w: clamp(34px, min(4vw, 5.9dvh), 46px);
    --trick-card-w: clamp(28px, min(3.6vw, 4.5vh), 42px);
    --trick-card-w: clamp(28px, min(3.6vw, 4.5dvh), 42px);
}

.replay-container .panel {
    margin: 6px 0;
    padding: 8px 12px;
}

/* The replay rebuilds its view every step, so "animate on insert" there means
   every card, every step: the hand dealt itself again on each press of ▶. Off
   inside the replay, and back on for the one card the step played, which
   `ReplayView.renderReplay` marks `.replay-new`. See "Cards arriving" above for
   why the game, which paints rather than rebuilds, needs none of this. */
.replay-container .hand .card,
.replay-container .trick-play {
    animation: none;
}

.replay-container .trick-play.replay-new {
    animation: trick-card-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

@media (prefers-reduced-motion: reduce) {
    .replay-container .trick-play.replay-new { animation: fadeIn 0.2s ease-out both; }
}

.replay-bar #btn-back-lobby {
    position: absolute;
    left: 10px;
}

/* What just happened, in words. The transport moves one event at a time, and
   without this there is no way to tell which one you are looking at. */
.replay-caption {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--highlight);
    margin-bottom: 8px;
    min-height: 1.35rem;
}

.replay-winner {
    text-align: center;
    font-weight: 700;
    color: var(--highlight);
    font-size: 0.9rem;
}

/* Why a replay of a game in progress has no hands in it. */
.replay-hands-hidden {
    font-size: 0.85rem;
    line-height: 1.55;
    opacity: 0.85;
}

/* Every other player's hand, behind the "show every hand" toggle. Compact, so
   that turning it on does not push the felt off the screen. */
.replay-other-hands {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.replay-other-hand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.replay-other-name {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 90px;
    flex-shrink: 0;
    opacity: 0.8;
}

.replay-other-hand .hand {
    --card-w: 30px;
    flex: 1;
    justify-content: flex-start;
    padding: 2px;
}

.replay-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.replay-controls button {
    min-width: 46px;
}

.replay-controls select {
    padding: 6px 8px;
    font-size: 0.9rem;
}

.replay-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.85;
    cursor: pointer;
}

.replay-toggle input {
    width: auto;
    padding: 0;
    accent-color: var(--btn-primary);
}

.replay-progress {
    margin-top: 8px;
}

.replay-progress input[type="range"] {
    width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    accent-color: var(--highlight);
}

/* === Error Messages ===
 *
 * Drawn over the page from `document.body`, so it is above the felt, the hand
 * and any modal, and it outlives the re-render of whatever view raised it. */
.error-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    max-width: min(90vw, 420px);
    padding: 12px 18px;
    border-radius: 8px;
    border: 1px solid var(--btn-danger);
    background: rgba(120, 26, 20, 0.96);
    color: #ffd9d5;
    font-size: 0.95rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    animation: toast-in 0.18s ease-out;
}

/* News rather than a refusal — somebody left the table. Same place and shape
   as the error toast, in the felt's colours instead of the danger red. */
.notice-toast {
    /* Over the header rather than the seats: at six seats on a phone, lower
       down it sat on the badge of the very player it was announcing. */
    top: 4px;
    border-color: var(--highlight);
    background: rgba(24, 58, 38, 0.96);
    color: var(--text-light);
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* === Responsive ===
 *
 * Card and table dimensions are already fluid (see the clamp()ed custom
 * properties at the top), so these breakpoints only need to change the
 * *arrangement*, never the sizes. */
@media (max-width: 820px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    .game-container {
        padding: 6px 8px;
    }

    /* Side seats rise above the felt so the trick gets the full width. */
    .table-middle-row {
        flex-wrap: wrap;
    }

    .table-middle-row > .player-position {
        order: -1;
    }

    .trick-area {
        flex: 1 0 100%;
    }

    /* Sidebar becomes a strip under the hand. */
    .game-main {
        flex-direction: column;
    }

    .scores-panel {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: center;
        gap: 8px;
    }

    .scores-title {
        width: 100%;
        margin-bottom: 0;
    }

    .score-item {
        margin-bottom: 0;
        min-width: 74px;
        flex: 0 1 auto;
    }

    .side-block {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        border-left: 1px solid rgba(255,255,255,0.15);
        padding-left: 10px;
    }

    /* === The hand is one overlapping row, and the overlap is computed ===
     *
     * It was a grid of thirteen cards that did not overlap, one per cell, and
     * that is what fixed the card at **34px wide on a phone** — thirteen cards
     * plus their gaps have to fit across 390px, and there is no other answer if
     * none of them may cover another. Four people played a game on four phones
     * on 2026-09-07 and the first thing all of them said was that they could
     * not read their own hand.
     *
     * Overlapping is what buys the size back, and it is how a hand of cards is
     * held anyway: the corner index is the whole of what a covered card needs
     * to show. At 390px the card goes from 34px to about 66 — nearly double —
     * in the same strip of screen, because the row is one deep instead of two.
     *
     * **`--hand-step` is the mechanism and it is the only clever thing here.**
     * It is how far apart two cards sit: their full width plus a hair when
     * there is room for that, and otherwise whatever divides the space the hand
     * actually has between the cards it actually holds. The percentage resolves
     * against `.hand`, and `--hand-count` is written onto the element by
     * `GameRender.paintHand` — the one fact CSS cannot reach on its own. So a
     * thirteen-card hand and a seventeen-card one at a three-player table both
     * fit exactly, with no breakpoint per size and nothing that can overflow.
     *
     * The vh terms in the clamps still do the work they always did: below this
     * width the height is what runs out first, and a vw-only clamp cannot see
     * it coming. What has changed is that one row of tall cards costs about
     * what two rows of short ones did. */
    :root {
        --card-w: clamp(46px, min(20vw, 9vh), 88px);
        --card-w: clamp(46px, min(20vw, 9dvh), 88px);
        --trick-card-w: clamp(34px, min(11vw, 5.1vh), 56px);
        --trick-card-w: clamp(34px, min(11vw, 5.1dvh), 56px);
    }

    .game-table {
        padding: 6px;
    }

    .trick-area {
        padding: 4px;
    }

    .hand {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        /* Its width comes from the container and never from the cards. This is
           the other half of breaking the circle described on `--hand-step`
           below: with the width pinned, content that overflows overflows
           rather than widening the box it is in. */
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        /* **No room is reserved above for the chosen card.** It rises and grows
           by a transform, which costs no layout at all, so it simply overlaps
           the bottom of the felt — which is what a card being picked out of a
           hand looks like anyway. Reserving the space instead cost 33px of
           height at a phone's card size, and height is the thing that runs out
           first here: it put a 780x724 window 92px over the fold, which is the
           exact failure this breakpoint was written to fix. */
        padding: 4px 6px;
    }

    .hand .card {
        /* `--hand-avail` is the room measured from the viewport by
           `GameRender.handRoom`, and the `100%` is only what a first paint
           uses before that has run. It is not a preference between two ways of
           writing the same thing: `100%` here is circular — the hand is a
           nowrap row of auto-width cards, so its width can come from its
           content, which is what this arithmetic produces — and an iPhone
           resolved that circle the other way on 2026-09-07, laying thirteen
           cards end to end and making the page twice the width of the window.
           See `handRoom` for the whole of it. */
        --hand-step: min(
            calc(var(--card-w) + 2px),
            calc((var(--hand-avail, 100%) - var(--card-w)) / (var(--hand-count, 13) - 1))
        );
        flex: 0 0 auto;
        width: var(--card-w);
        margin: 0 0 0 calc(var(--hand-step) - var(--card-w));
    }

    .hand .card:first-child {
        margin-left: 0;
    }

    /* Tapping cannot hover, so a legal card has to stand out on its own. */
    .hand .card.highlighted {
        transform: translateY(-4px);
    }

    /* And the chosen one has to beat it — see `.card.armed`, which this
       overrides only because a media query later in the file would otherwise
       win on source order alone. */
    .hand .card.armed {
        transform: translateY(-16px) scale(1.35);
    }
}

@media (max-width: 480px) {
    /* Below this the seat badge cannot show everything; the card count is the
       first thing to go, since the same number is implied by the table. */
    .seat-meta {
        display: none;
    }

    .game-header {
        gap: 12px;
        padding-left: 90px;
    }

    .player-position .card-back {
        display: none;
    }

    /* The dashed avatar ring already marks a bot; the label costs room the
       name needs. */
    .bot-tag {
        display: none;
    }
}

/* === Hand Summary Overlay === */
.hand-summary-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    animation: fadeIn 0.3s ease-out;
}

.hand-summary-modal {
    background: linear-gradient(145deg, #2d5a3d, #1a472a);
    padding: 30px 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 350px;
    width: 90%;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.hand-summary-modal h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.shoot-moon-alert {
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    margin-bottom: 20px;
    font-size: 1.1rem;
    animation: pulse 1s infinite;
}

/* Champagne, in the one place the standings it is about are on screen.
   No name on it: there is no winner of a champagne, the whole table has it. */
.champagne-alert {
    background: linear-gradient(135deg, #d4b24c, #f7e7a0 55%, #c9a227);
    color: #2b2200;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    font-size: 1.05rem;
}

.hand-points-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
}

.hand-points-item {
    align-items: center;
    padding: 10px 15px;
    border-radius: 6px;
    margin: 5px 0;
    transition: transform 0.2s;
}

/* Three columns — who, what the hand cost, where it leaves them — as a grid so
   the numbers line up down the list whatever the length of the names. */
.hand-points-item,
.hand-points-head {
    display: grid;
    grid-template-columns: 1fr 3.5em 3.5em;
    text-align: left;
}

.hand-points-head {
    padding: 0 15px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

.hand-points-head span,
.hand-points-item .points,
.hand-points-item .total {
    text-align: right;
}

.hand-points-item .player {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hand-points-item .points {
    font-weight: bold;
    font-size: 1.1rem;
}

.hand-points-item .total {
    color: var(--text-light);
    opacity: 0.85;
}

/* How a claimed hand ended, inside the summary that waits for a tap. */
.claim-summary {
    margin-bottom: 14px;
    padding: 10px 12px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 8px;
}

.claim-summary-text {
    font-size: 0.88rem;
    margin-bottom: 8px;
}

.claim-summary-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-left: 18px;
}

.claim-summary-cards .card {
    --card-w: 34px;
    margin-left: -18px;
    margin-bottom: 4px;
}

.hand-summary-note {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 12px;
}

.hand-summary-hint {
    margin-top: 14px;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* The summary waits for its own tap, so it can be what stands between a player
   and their turn — see `noteSummaryTurn`. Then the line has to be seen. */
.hand-summary-hint.waiting {
    opacity: 1;
    font-weight: 700;
    color: var(--highlight);
}

.hand-summary-overlay {
    cursor: pointer;
}

.hand-points-item.no-points {
    background: rgba(39, 174, 96, 0.3);
    color: #6bff6b;
}

.hand-points-item.some-points {
    background: rgba(241, 196, 15, 0.3);
    color: #ffd93d;
}

.hand-points-item.high-points {
    background: rgba(231, 76, 60, 0.4);
    color: #ff6b6b;
}

.hand-points-item.is-me {
    border: 2px solid var(--highlight);
    transform: scale(1.02);
}

/* === Game Over Modal Improvements === */
.game-over-modal .winner.you-won {
    font-size: 1.8rem;
    color: #2ecc71;
    text-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
    animation: celebrate 0.5s ease-out;
}

.game-over-modal .winner.you-lost {
    font-size: 1.6rem;
    color: #e74c3c;
}

.game-over-modal .winner.second-place {
    font-size: 1.5rem;
    color: #f1c40f;
}

.game-over-modal .winner.third-place,
.game-over-modal .winner.other-place {
    font-size: 1.4rem;
    color: #bdc3c7;
}

/* Both ends of the result on one line — whichever of them the headline above
   has not already said. It keeps its margin when it holds nothing but the
   loser, so the modal does not change height depending on who won. */
.game-over-modal .winner-name {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 15px;
}

.game-over-modal .end-winner {
    color: var(--highlight);
}

.game-over-modal .end-loser {
    color: #e88b8b;
}

/* Why a placing is not being celebrated. Shown only for a seat the server
   finished, where `stats_service.record_finished_game` writes nothing down — see `renderGameOver`.
   Quiet rather than alarming: it is an explanation, not a refusal. */
.game-over-modal .game-over-note {
    font-size: 0.9rem;
    opacity: 0.75;
    line-height: 1.4;
    margin: 0 0 15px;
}

.final-scores li.is-me {
    background: rgba(39, 174, 96, 0.2);
    border-radius: 4px;
    padding: 5px 8px;
    margin: 2px -8px;
}

@keyframes celebrate {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.game-over-modal .modal-buttons {
    flex-wrap: wrap;
}

.game-over-modal .modal-buttons button {
    min-width: 100px;
}

/* ============================================================
   Connection banner
   ============================================================
   Appended to <body>, never to #app: every view rebuilds its container's
   innerHTML on each event, so anything inside it is wiped by the next card
   played. Fixed to the top so it is visible whichever view is on screen and
   whatever that view has scrolled to.

   It only ever appears when the socket is down. A banner during the normal
   first connection would be noise on every page load. */

#connection-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;      /* above the game-over modal at 150 */

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    padding: 0.5rem 1rem;
    background: var(--btn-danger);
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* The dot pulses so that a banner nobody has read still reads as "working on
   it" rather than as a frozen error message. */
#connection-banner .connection-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--text-light);
    animation: connection-pulse 1.2s ease-in-out infinite;
}

@keyframes connection-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

/* A player who has asked not to be animated still needs to see the banner;
   what they do not need is the blinking. */
@media (prefers-reduced-motion: reduce) {
    #connection-banner .connection-dot {
        animation: none;
    }
}

/* === Table flourishes (js/fx.js) ===
 *
 * Everything here is drawn into one fixed layer above the table and removed
 * again by the code that made it. `pointer-events: none` is not decoration:
 * the layer covers the hand, so anything that forgot it would eat the clicks
 * that play cards. */
#fx-layer {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    overflow: hidden;
}

/* A wash of colour over the whole table. Radial rather than flat so the middle
   — where the trick is — is what lights up. */
.fx-flash {
    position: absolute;
    inset: 0;
    animation: fx-flash-fade 0.9s ease-out forwards;
}

.fx-flash-red {
    background: radial-gradient(ellipse at center,
                rgba(196, 30, 58, 0.45) 0%, rgba(196, 30, 58, 0) 70%);
}

.fx-flash-dark {
    background: radial-gradient(ellipse at center,
                rgba(0, 0, 0, 0.55) 0%, rgba(120, 0, 24, 0.25) 45%,
                rgba(0, 0, 0, 0) 75%);
    animation-duration: 1s;
}

.fx-flash-gold {
    background: radial-gradient(ellipse at center,
                rgba(255, 215, 0, 0.4) 0%, rgba(255, 215, 0, 0) 72%);
    animation-duration: 1.4s;
}

@keyframes fx-flash-fade {
    0%   { opacity: 0; }
    18%  { opacity: 1; }
    100% { opacity: 0; }
}

.fx-caption {
    position: absolute;
    /* Above the middle of the table, so the Queen — which lands *in* the
       middle — is not read through her own caption. */
    top: 24%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.6rem, 5.5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    /* A name can be twenty characters, so the caption has to be allowed to
       wrap rather than run off the side of a phone. */
    max-width: 92vw;
    text-align: center;
    text-shadow: 0 3px 14px rgba(0,0,0,0.75);
    animation: fx-caption-pop 1.4s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}

/* Clears the trick itself, for the one effect that decorates the cards. */
.fx-caption-high { top: 10%; }

.fx-caption-red  { color: #ff5b6e; }
/* The odd/even run. Teal rather than gold, because it is a different event and
   two flourishes in the same colour are one flourish seen twice. */
.fx-caption-teal { color: #4fd6d2; }
.fx-caption-dark { color: #fff; text-shadow: 0 0 18px #c41e3a, 0 3px 14px rgba(0,0,0,0.8); }
.fx-caption-gold { color: var(--highlight); }

@keyframes fx-caption-pop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
    22%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
    34%  { transform: translate(-50%, -50%) scale(1); }
    72%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -85%) scale(1); }
}

/* One animation for every particle; the path is per-particle, in the custom
   properties fx.js sets on each one. */
.fx-particle {
    position: absolute;
    left: 50%;
    top: 62%;
    font-size: clamp(1.2rem, 3vw, 2.2rem);
    opacity: 0;
    animation: fx-particle-fly 1.4s ease-out forwards;
    will-change: transform, opacity;
}

.fx-heart { color: #ff4d63; }
.fx-spade { color: #12121a; text-shadow: 0 0 10px rgba(255,255,255,0.55); }
.fx-star  { color: var(--highlight); }
.fx-gem   { color: #4fd6d2; }
/* The bubbles out of the bottle. Pale rather than gold: gold is already the
   caption and the flash, and eighteen more gold specks on top of both is one
   bright shape instead of three legible ones. */
.fx-bubble { color: rgba(255, 253, 235, 0.92); }

@keyframes fx-particle-fly {
    0% {
        opacity: 0;
        transform: translate(calc(-50% + var(--fx-x)), 0) scale(0.3) rotate(0deg);
    }
    15% { opacity: 1; }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--fx-x) + var(--fx-drift)), -58vh)
                   scale(var(--fx-scale)) rotate(var(--fx-spin));
    }
}

/* The Queen herself, at four times the size she is played at. */
.fx-queen {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: fx-queen-drop 1.3s cubic-bezier(0.2, 1.3, 0.4, 1) forwards;
}

.fx-queen .card {
    --card-w: clamp(90px, 16vw, 150px);
    box-shadow: 0 0 40px rgba(196, 30, 58, 0.8), 0 12px 30px rgba(0,0,0,0.6);
}

@keyframes fx-queen-drop {
    0%   { opacity: 0; transform: translate(-50%, -140%) scale(0.7) rotate(-14deg); }
    28%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(4deg); }
    42%  { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    78%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9) rotate(0deg); }
}

/* The bottle, over the middle of the table. It is one character, so it is
   sized in `em` off the same clamp the Queen uses rather than being given a
   box: an emoji has no face to light and nothing to drop onto. */
.fx-champagne {
    position: absolute;
    top: 46%;
    left: 50%;
    font-size: clamp(64px, 12vw, 120px);
    line-height: 1;
    transform: translate(-50%, -50%);
    animation: fx-champagne-pop 1.6s cubic-bezier(0.2, 1.3, 0.4, 1) forwards;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.55));
}

@keyframes fx-champagne-pop {
    0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.5) rotate(-28deg); }
    22%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(-14deg); }
    38%  { transform: translate(-50%, -50%) scale(1) rotate(-20deg); }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -62%) scale(0.95) rotate(-20deg); }
}

/* The moon coming apart: a second seat has taken points this hand. Two halves
   of one disc, each clipped to its side, which part and fall away. */
.fx-caption-silver { color: #dfe6ee; text-shadow: 0 0 14px rgba(160, 180, 210, 0.7), 0 3px 14px rgba(0,0,0,0.8); }

.fx-moon-closed {
    position: absolute;
    top: 46%;
    left: 50%;
    width: clamp(64px, 11vw, 110px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 6px 20px rgba(0,0,0,0.55));
}

.fx-moon-half {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 62% 38%, rgba(150, 140, 110, 0.45) 0 9%, transparent 10%),
        radial-gradient(circle at 36% 64%, rgba(150, 140, 110, 0.4) 0 7%, transparent 8%),
        radial-gradient(circle at 35% 32%, #fffbe8, #e4dcb8 55%, #b3aa86);
    animation: 1.5s cubic-bezier(0.5, 0, 0.7, 1) forwards;
}

.fx-moon-left  { clip-path: polygon(0 0, 54% 0, 44% 30%, 56% 52%, 42% 76%, 50% 100%, 0 100%); animation-name: fx-moon-left; }
.fx-moon-right { clip-path: polygon(54% 0, 100% 0, 100% 100%, 50% 100%, 42% 76%, 56% 52%, 44% 30%); animation-name: fx-moon-right; }

@keyframes fx-moon-left {
    0%   { opacity: 0; transform: scale(0.7); }
    18%  { opacity: 1; transform: scale(1); }
    40%  { transform: none; }
    100% { opacity: 0; transform: translate(-40%, 60%) rotate(-24deg); }
}

@keyframes fx-moon-right {
    0%   { opacity: 0; transform: scale(0.7); }
    18%  { opacity: 1; transform: scale(1); }
    40%  { transform: none; }
    100% { opacity: 0; transform: translate(40%, 70%) rotate(20deg); }
}

/* The points a trick was worth, rising off the seat that took them. */
.fx-points {
    position: absolute;
    transform: translate(-50%, 0);
    font-size: clamp(1.1rem, 2.6vw, 1.9rem);
    font-weight: 800;
    color: #ff5b6e;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    animation: fx-points-rise 1.2s ease-out forwards;
}

@keyframes fx-points-rise {
    0%   { opacity: 0; transform: translate(-50%, 10px) scale(0.7); }
    20%  { opacity: 1; transform: translate(-50%, -6px) scale(1.15); }
    35%  { transform: translate(-50%, -10px) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -60px) scale(1); }
}

/* Each card of a straight, lit in turn. Applied to a card on the felt rather
   than to something in the effect layer, so it is removed again by hand. */
.fx-run {
    animation: fx-run-glow 1.1s ease-out;
    position: relative;
    z-index: 3;
}

/* The colour of the lift is a variable so the odd/even run can rebind it and
   share every keyframe. */
.fx-run {
    --fx-run-ring: var(--highlight);
    --fx-run-glow: 255, 215, 0;
}

.fx-run-alt {
    --fx-run-ring: #4fd6d2;
    --fx-run-glow: 79, 214, 210;
}

@keyframes fx-run-glow {
    0%   { transform: translateY(0) scale(1);
           box-shadow: 0 0 0 0 rgba(var(--fx-run-glow), 0); }
    25%  { transform: translateY(-10px) scale(1.12);
           box-shadow: 0 0 0 3px var(--fx-run-ring),
                       0 0 24px 6px rgba(var(--fx-run-glow), 0.7); }
    60%  { transform: translateY(-4px) scale(1.04);
           box-shadow: 0 0 0 3px var(--fx-run-ring),
                       0 0 16px 3px rgba(var(--fx-run-glow), 0.5); }
    100% { transform: translateY(0) scale(1);
           box-shadow: 0 0 0 0 rgba(var(--fx-run-glow), 0); }
}

.fx-shake {
    animation: fx-shake 0.5s ease-in-out;
}

@keyframes fx-shake {
    0%, 100% { transform: translateX(0); }
    12%  { transform: translateX(-9px) rotate(-0.4deg); }
    30%  { transform: translateX(8px) rotate(0.4deg); }
    48%  { transform: translateX(-6px); }
    66%  { transform: translateX(5px); }
    84%  { transform: translateX(-3px); }
}

/* Movement the player asked their system not to send them. The captions stay:
   they carry the information, and the particles carry only the pleasure. */
@media (prefers-reduced-motion: reduce) {
    .fx-queen, .fx-caption, .fx-points, .fx-champagne, .fx-moon-half {
        animation-duration: 0.6s;
        animation-timing-function: ease-out;
    }

    /* The run is the one flourish drawn on the cards themselves, so it is the
       one this query has to reach into the felt for. It keeps the ring and the
       glow, which are what say *which* cards made the run; the lift and the
       scale said nothing the colour did not. */
    .fx-run {
        animation-name: fx-run-still;
    }

    .fx-shake {
        animation: none;
    }
}

@keyframes fx-run-still {
    0%   { box-shadow: 0 0 0 0 rgba(var(--fx-run-glow), 0); }
    25%  { box-shadow: 0 0 0 3px var(--fx-run-ring),
                       0 0 24px 6px rgba(var(--fx-run-glow), 0.7); }
    60%  { box-shadow: 0 0 0 3px var(--fx-run-ring),
                       0 0 16px 3px rgba(var(--fx-run-glow), 0.5); }
    100% { box-shadow: 0 0 0 0 rgba(var(--fx-run-glow), 0); }
}

/* === Account bar ===
 *
 * The same strip wherever it appears, which is why it is drawn by `App` and
 * not by a view. It states who the player is, because that is the one thing an
 * account changes at every table: a guest's name is a label anybody may type,
 * and a registered one is theirs. */
.account-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 14px;
    padding: 8px 4px;
    font-size: 0.85rem;
}

.account-bar {
    justify-content: flex-end;
    gap: 10px;
}

.account-who {
    opacity: 0.9;
}

/* The trigger reads as a name with something behind it, not as a button: it
   sits above every screen and a filled button there would compete with the one
   green button each screen is allowed. */
.account-menu {
    position: relative;
}

.account-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    padding: 5px 10px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 16px;
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
}

.account-trigger:hover {
    background: rgba(255,255,255,0.13);
}

.account-caret {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Anchored to the trigger and painted over whatever is under it. `z-index` is
   on the menu rather than on the wrapper because nothing here transforms the
   wrapper — unlike `.settings-wrap` on the table, where the transform makes a
   stacking context and the menu's own z-index counts for nothing outside it. */
/* `display: flex` below would otherwise beat the `hidden` attribute, which is
   only `display: none` from the user agent's own stylesheet — so the menu was
   open on every screen it was drawn on, over the page, from the first render.
   Any author rule that sets `display` on an element toggled with `hidden`
   needs this line beside it. */
.account-menu-items[hidden] {
    display: none;
}

.account-menu-items {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    min-width: 190px;
    padding: 6px;
    background: #21384a;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.45);
    display: flex;
    flex-direction: column;
    text-align: left;
}

.menu-item {
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 5px;
    color: var(--text-light);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}

.menu-item:hover {
    background: rgba(255,255,255,0.1);
}

/* The legal pages are in the menu because they have to be reachable from
   everywhere, not because anybody is looking for them mid-game. */
.menu-item-quiet {
    opacity: 0.7;
    font-size: 0.8rem;
}

.menu-separator {
    height: 1px;
    margin: 5px 4px;
    background: rgba(255,255,255,0.12);
}

/* The legal pages, folded. `list-style: none` plus the `::marker` rule is what
   removes Safari's triangle as well as Chrome's — they use different ones. */
.menu-fold > summary {
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    opacity: 0.7;
    cursor: pointer;
    list-style: none;
}

.menu-fold > summary::-webkit-details-marker,
.menu-fold > summary::marker {
    display: none;
    content: '';
}

.menu-fold > summary::after {
    content: ' ▸';
    opacity: 0.6;
}

.menu-fold[open] > summary::after {
    content: ' ▾';
}

.menu-fold > summary:hover {
    background: rgba(255,255,255,0.1);
    opacity: 1;
}

.menu-fold .menu-item {
    padding-left: 22px;
}

/* === The footer ===
 *
 * One line, on every screen. A privacy notice that can only be found by opening
 * a menu is a privacy notice; one in the footer is a link. */
.site-footer {
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    opacity: 0.6;
}

.site-footer:hover {
    opacity: 0.85;
}

/* A button that has to sit inside a sentence. `.link-button` is a block in
   several of its contexts; this one never is. */
.inline-link {
    display: inline;
    width: auto;
    padding: 0;
    background: none;
    border: none;
    color: var(--highlight);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.inline-link:hover {
    background: none;
    opacity: 0.85;
}

.account-guest-tag {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 6px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

/* A button that reads as a link: these are navigation, not actions on the
   game, and giving them button chrome would put three more of them on a screen
   whose one green button is supposed to be the thing to do. */
.link-button {
    background: none;
    border: none;
    padding: 0;
    width: auto;
    color: var(--text-light);
    font-size: 0.85rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    opacity: 0.8;
    cursor: pointer;
}

.link-button:hover {
    opacity: 1;
    background: none;
}

/* The mute button is a link-button carrying an emoji rather than a word, so it
   drops the link chrome: an underline under an emoji reads as a rendering
   fault, and the dimmed opacity makes a glyph look disabled rather than quiet.
   It must stay *after* `.link-button` — same specificity, so order decides. */
.sound-toggle {
    font-size: 1.15rem;
    text-decoration: none;
    line-height: 1;
    opacity: 0.95;
}

.sound-toggle:hover {
    opacity: 1;
    transform: scale(1.12);
}

/* === Welcome === */
.welcome-container {
    max-width: 460px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

/* The panel is narrow, so the header has to give way rather than break the
   title over two lines. Smaller cards and a tighter gap, here only. */
.welcome-container .header-cards {
    gap: 14px;
}

.welcome-container .decorative-card {
    --card-w: 54px;
}

.welcome-container h1 {
    font-size: clamp(1.7rem, 7vw, 2.2rem);
}

.welcome-panel {
    background: var(--panel-bg);
    border-radius: 10px;
    padding: 20px;
}

/* Full width, the buttons and the fields alike: the buttons are the ways out
   of this screen, and a field narrower than the button under it reads as a
   form that was never finished. */
.welcome-panel > button,
.welcome-panel input {
    width: 100%;
}

.welcome-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.welcome-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 10px 0;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0.55;
    cursor: pointer;
}

.welcome-tab:hover {
    background: none;
    opacity: 0.8;
}

.welcome-tab.active {
    opacity: 1;
    border-bottom-color: var(--btn-primary);
}

.welcome-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 14px;
    opacity: 0.45;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.welcome-divider::before,
.welcome-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.3);
}

/* Google's own button, drawn by its script into an iframe. The box holds the
   button's height before the script arrives, so the form under it does not
   jump down a line when it does. */
.google-button {
    display: flex;
    justify-content: center;
    min-height: 44px;
    margin: 8px 0;
}

/* This site's own "Continue with Google", standing in for Google's button
   until it is pressed — see google.js for why nothing of Google's is loaded
   before that. Drawn to read as the same thing Google's will be: white, a G,
   a pill, the same height. */
.google-start {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 40px;
    /* 400px is the widest Google draws its own button (google.js asks for
       the slot's width up to that), so the two are the same size. */
    width: min(100%, 400px);
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid #dadce0;
    background: #fff;
    color: #3c4043;
    font-weight: 500;
}

.google-start:hover {
    background: #f8f9fa;
}

.google-g {
    font-weight: 700;
    color: #4285f4;
}

.google-button {
    flex-direction: column;
    align-items: center;
}

.welcome-note {
    margin-top: 10px;
    font-size: 0.78rem;
    text-align: center;
    opacity: 0.7;
}

.welcome-note a {
    color: var(--highlight);
}

/* === Learn === */
.learn-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 12px 16px 24px;
}

/* The guided hand carries the coach's panel as well as the table, and the coach
   is often three or four lines. That is height the game does not have to spend,
   so the two size variables are rebound rather than any fixed height being set
   anywhere — the same move the replay makes, and for the same reason: without
   it the hand a player is being told to click sits below the fold. */
.learn-container.game-container {
    /* The guided hand ends at the fold, so there is nothing below it to leave
       room for. */
    padding-bottom: 10px;

    --card-w: clamp(38px, min(5vw, 7vh), 58px);
    --card-w: clamp(38px, min(5vw, 7dvh), 58px);
    --trick-card-w: clamp(32px, min(4.2vw, 5.5vh), 50px);
    --trick-card-w: clamp(32px, min(4.2vw, 5.5dvh), 50px);
}

/* The table, the coach and the hand have to fit on one screen together, and the
   coach is four lines at its longest. These are the millimetres that buys —
   spent on the cards, which is the thing a player is being asked to read. */
.learn-container.game-container .learn-top {
    margin-bottom: 6px;
}

.learn-container.game-container .coach {
    margin-bottom: 6px;
}

.learn-container.game-container .panel {
    margin: 0;
    padding: 8px 12px;
}

/* The felt is as wide as the page in a real game because the sidebar sits
   beside it. Here there is no sidebar, so the seats end up marooned at the far
   edges of an empty field — and the space that buys nothing is space the cards
   could have had. */
.learn-container.game-container .game-table {
    max-width: 1040px;
    margin: 0 auto;
}

.learn-top {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.learn-top h1 {
    flex: 1;
    font-size: clamp(1.4rem, 4vw, 2.2rem);
    text-align: left;
    margin: 0;
}

.learn-top button {
    width: auto;
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* Which table the six cards are written for. Beside the title rather than
   under it: the page is one laptop screen, and a line of its own would cost
   the button its place. */
.learn-scope {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* The one thing the six rule cards cannot say, because it is not a rule: the
   deck is not the same at every table size, and a player who sits down at six
   meets two cards that are not in any other deck. */
.learn-sizes {
    max-width: 125ch;
    margin: 14px auto 0;
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.45;
    opacity: 0.8;
}

.learn-cta {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.learn-cta button {
    width: auto;
    min-width: 200px;
}

/* The six rules, the deck note and the button into the guided hand are meant
   to be one screen on a laptop, read without scrolling: so the cards are wide
   and short rather than tall, and the text is set a step below body size. */
.basics-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
    margin-top: 6px;
}

.basics-rule {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 12px 14px 12px 18px;
}

.basics-number {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0.35;
}

/* Overlapped, so a rule about two cards reads as a pair rather than as two
   things that happen to be beside each other. */
.basics-cards {
    display: flex;
    flex-shrink: 0;
    padding-top: 4px;
}

.basics-cards .card {
    --card-w: 40px;
}

.basics-cards .card + .card {
    margin-left: -16px;
    transform: rotate(7deg);
}

.basics-body h3 {
    font-size: 0.95rem;
    margin-bottom: 5px;
}

/* Bullets rather than a paragraph, and the marker is drawn rather than a
   list-style: the global reset zeroes every padding, so an `outside` marker
   would sit outside the panel and be clipped. */
.basics-body ul {
    list-style: none;
    display: grid;
    gap: 3px;
}

.basics-body li {
    position: relative;
    padding-left: 14px;
    font-size: 0.8rem;
    line-height: 1.38;
    opacity: 0.88;
}

.basics-body li::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 0.55em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--btn-primary);
}

.basics-body li strong {
    opacity: 1;
}

/* The standings of the teaching hand.
 *
 * Four rows across 1300px read as a spreadsheet, so they are held to a column
 * and given a bar: the number is the answer, but the bar is what makes "Otto
 * took twenty-one and you took none" land without anybody doing arithmetic. */
.learn-standings {
    list-style: none;
    /* The panel is a column flex container, and an `auto` cross-axis margin
       turns off the stretch that would otherwise size this — without the
       explicit width the list shrinks to its text and the bars vanish. */
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    display: grid;
    gap: 4px;
}

.learn-standings li {
    display: grid;
    grid-template-columns: 24px 5.5em 1fr 2.5em;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(0,0,0,0.18);
}

.learn-standings .standing-place {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.45;
    text-align: center;
}

.learn-standings .standing-who {
    font-weight: 600;
    font-size: 0.92rem;
}

/* An empty track is drawn even at zero, so the row that took nothing reads as a
   result rather than as a row that failed to render. */
.learn-standings .standing-bar {
    height: 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}

.learn-standings .standing-bar i {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #d98b3a, var(--btn-danger));
}

.learn-standings .standing-pts {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.learn-standings li.is-best {
    background: rgba(39, 174, 96, 0.22);
}

.learn-standings li.is-best .standing-place,
.learn-standings li.is-best .standing-pts {
    color: var(--highlight);
    opacity: 1;
}

.learn-standings li.is-me {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}

/* The standings are a block to be read and then a sentence about them, not a
   caption; and the two panels on that screen are two separate points. Neither
   had any air around it. */
.learn-standings + .section-desc {
    margin-top: 20px;
}

.learn-container .lobby-section + .lobby-section {
    margin-top: 18px;
}

/* The coach: one voice, always in the same place, so the player learns where
   to look rather than hunting for what changed. */
.coach {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(0,0,0,0.3);
    border-left: 3px solid var(--btn-primary);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 10px;
    min-height: 62px;
}

.coach-avatar {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.coach-text p {
    font-size: 0.9rem;
    line-height: 1.45;
}

.coach-flash {
    margin-top: 6px;
    color: var(--highlight);
    font-size: 0.82rem !important;
}

/* The coach holding the hand until the trick has been read.
 *
 * It is the same panel, marked so it reads as a stop rather than as more
 * commentary: the whole point of the pause is that the player notices it. */
.coach-waiting {
    border-left-color: var(--highlight);
    background: rgba(0,0,0,0.45);
}

.coach-text p + p {
    margin-top: 6px;
}

.coach-continue {
    margin-top: 10px;
    padding: 6px 16px;
    font-size: 0.85rem;
}

.coach-hint {
    margin-left: 10px;
    font-size: 0.78rem;
    opacity: 0.6;
}

/* The card the coach is pointing at. A ring rather than a lift: the whole hand
   is already lifted when it is legal, so the recommendation needs to differ in
   kind and not in degree. */
.hand .card.recommended {
    box-shadow: 0 0 0 3px var(--highlight), 0 6px 16px rgba(0,0,0,0.45);
    z-index: 5;
}


/* === The lobby's two panels, and the two folds under them ===
 *
 * Four equal cards became two: playing now and playing with friends. Creating a
 * room and watching a replay are both behind a `<details>` — they are the ones
 * people reach for on purpose, and giving them a whole panel each is what made
 * the lobby read as a form to fill in. */
.lobby-join-row {
    margin-bottom: 14px;
}

.lobby-join-row label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.lobby-create-details,
.lobby-replay {
    border-top: 1px solid rgba(255,255,255,0.12);
    padding-top: 12px;
}

.lobby-create-details summary,
.lobby-replay summary {
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.8;
    padding: 4px 0;
}

.lobby-create-details summary:hover,
.lobby-replay summary:hover {
    opacity: 1;
}

.lobby-create-details[open] summary,
.lobby-replay[open] summary {
    margin-bottom: 12px;
}

.lobby-aside {
    margin-top: 20px;
    background: var(--panel-bg);
    padding: 14px 20px;
    border-radius: 8px;
}

.lobby-aside .lobby-replay {
    border-top: none;
    padding-top: 0;
}

/* The account's finished games, newest first. Two lines a game: where you
   finished and against what, then the final board with every name on it —
   which is what makes a replay worth opening. A list and not a table, so the
   board can wrap at six seats on a phone instead of scrolling sideways. */
.past-games {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
}

.past-game {
    display: grid;
    grid-template-columns: 3.2em 1fr auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-size: 0.85rem;
}

.past-game:last-child {
    border-bottom: none;
}

.past-place {
    grid-row: span 2;
    font-weight: 800;
    font-size: 1.05rem;
    opacity: 0.85;
}

.past-place.won {
    color: var(--highlight);
    opacity: 1;
}

.past-meta {
    opacity: 0.85;
}

.past-watch {
    width: auto;
    padding: 4px 12px;
    font-size: 0.8rem;
}

.past-board {
    grid-column: 2 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    font-size: 0.78rem;
    opacity: 0.75;
}

.past-seat.mine {
    opacity: 1;
    color: var(--highlight);
}

.past-left {
    font-size: 0.7rem;
    opacity: 0.7;
    font-style: italic;
}

/* === Your record, and the legal pages ===
 *
 * Both are a column of prose in the middle of the screen, so they share their
 * width rather than each choosing one. */
.record-container,
.account-container,
.legal-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.record-header,
.legal-header {
    margin: 10px 0 20px;
}

.record-header h1,
.legal-header h1 {
    margin-top: 8px;
}

.record-container .lobby-section,
.account-container .lobby-section,
.legal-container .lobby-section {
    margin-bottom: 18px;
}

/* A record table on a phone is six columns of numbers in 340px. It scrolls
   inside its own box rather than making the page scroll sideways. */
.table-scroll {
    overflow-x: auto;
}

/* === Medals ===
 *
 * Three dots per family, filled or hollow. Deliberately not three different
 * shapes or three icons: what is being said is "one of three, and how far the
 * next one is", and a bar under it says the second half. */
.medal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.medal-row {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.medal-row:last-child {
    border-bottom: none;
}

/* A family this player has never hit. **There is nothing here to un-blur**:
   the server replaced the label and the description before they were sent, so
   the blocks below are this file's own invention and the answer is not in the
   page. See `summarise` in `games/achievements.py`. */
.medal-row.is-secret .medal-blur {
    display: inline-block;
    filter: blur(4px);
    opacity: 0.55;
    letter-spacing: 2px;
    user-select: none;
}

.medal-secret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px dashed rgba(255,255,255,0.4);
    font-size: 0.75rem;
    opacity: 0.6;
}

/* No bar and no "3 / 7" on a secret row: a progress count towards a thing
   nobody has named is a puzzle with the answer written under it. */
.medal-row.is-secret .medal-desc {
    font-style: italic;
    opacity: 0.7;
}

.medal-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.medal-name {
    font-weight: 600;
}

.medal-tiers {
    display: inline-flex;
    gap: 4px;
    font-size: 1rem;
    line-height: 1;
}

/* An unearned medal is hollow and dim; an earned one carries its metal. The
   colours are the three metals rather than the app's palette, because these are
   the one place in the product where the colour *is* the information. */
.medal {
    opacity: 0.28;
}

.medal.is-earned {
    opacity: 1;
}

.medal-bronze.is-earned { color: var(--medal-bronze); }
.medal-silver.is-earned { color: var(--medal-silver); }
.medal-gold.is-earned   { color: var(--highlight); }

.medal-desc {
    margin: 4px 0 8px;
    font-size: 0.82rem;
    opacity: 0.7;
}

.medal-bar {
    height: 5px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.medal-bar span {
    display: block;
    height: 100%;
    background: var(--btn-primary);
    border-radius: 3px;
}

.medal-progress {
    margin-top: 5px;
    font-size: 0.75rem;
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
}

/* The standings' own medal list: shorter, and gold-lit, because it is the one
   moment where a medal is news rather than a record. */
.game-over-medals {
    margin: 14px 0 4px;
    padding: 12px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.28);
    border-radius: 6px;
}

/* The heading is a row of three: a mark, the words, and how many. It was one
   dim uppercase line at 0.7rem, which is the size a legal footer is set at —
   and this is the best thing on the screen. */
.game-over-medals h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--highlight);
    opacity: 0.95;
    margin: 0 0 10px;
    border-bottom: none;
    padding-bottom: 0;
}

.medals-spark {
    font-size: 0.85rem;
    line-height: 1;
}

.medals-count {
    margin-left: auto;
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 10px;
    background: rgba(255, 215, 0, 0.18);
    font-size: 0.72rem;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.game-over-medals ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

/* A row is a disc, two lines of text and a tier — three weights instead of
   four spans at one, which is what made this read as a footnote. */
.medal-unlocked {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.9rem;
}

.medal-unlocked + .medal-unlocked {
    border-top: 1px solid rgba(255, 215, 0, 0.16);
}

.medal-disc {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: inset 0 -2px 3px rgba(0,0,0,0.3),
                inset 0 2px 3px rgba(255,255,255,0.4);
}

.medal-unlocked.medal-bronze .medal-disc {
    background: var(--medal-bronze-disc);
}

.medal-unlocked.medal-silver .medal-disc {
    background: var(--medal-silver-disc);
}

.medal-unlocked.medal-gold .medal-disc {
    background: var(--medal-gold-disc);
}

.medal-unlocked-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.medal-unlocked-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.medal-tier-name {
    margin-left: auto;
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid currentColor;
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
}

.medal-unlocked.medal-bronze .medal-tier-name { color: #e0a06a; }
.medal-unlocked.medal-silver .medal-tier-name { color: #d5dce2; }
.medal-unlocked.medal-gold .medal-tier-name   { color: var(--highlight); }

/* === The account screen === */
.account-facts {
    margin: 0 0 12px;
}

.account-facts div {
    display: flex;
    gap: 10px;
    padding: 5px 0;
    font-size: 0.9rem;
}

.account-facts dt {
    min-width: 120px;
    opacity: 0.6;
}

.account-facts dd {
    margin: 0;
    font-weight: 600;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.account-actions button {
    width: auto;
}

/* Deleting an account is the one irreversible thing a player can do to
   themselves here, so its panel says so before its button does. */
.account-danger {
    border: 1px solid rgba(231, 76, 60, 0.45);
}

.account-danger h3 {
    color: #ff8a7a;
}

/* === The legal pages ===
 *
 * Long-form prose, which nothing else in this app is: the measure is narrower
 * than the panel it sits in and the line height is looser. */
.legal-body {
    background: var(--panel-bg);
    padding: 24px;
    border-radius: 8px;
    font-size: 0.92rem;
    line-height: 1.65;
}

.legal-lead {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 18px;
}

.legal-body h2 {
    margin: 24px 0 8px;
    font-size: 1rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding-bottom: 5px;
}

.legal-body p,
.legal-body ul {
    margin-bottom: 12px;
    opacity: 0.88;
}

.legal-body ul {
    padding-left: 20px;
}

.legal-body li {
    margin-bottom: 6px;
}

/* The gear's first row states who is playing, and states nothing that could
   give the seat up. It is a fact rather than a control, so it does not look
   like the two rows under it. */
.settings-who {
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding-bottom: 8px;
    margin-bottom: 4px;
    opacity: 0.85;
}

/* Its own rule under it is the divider. The row below would draw a second one
   four pixels further down, and two hairlines read as a rendering fault. */
.settings-who + .settings-row {
    border-top: none;
}


/* The operator's identity, the last section of the privacy notice. A definition list
   rather than a paragraph: four facts somebody is scanning for, not reading. */
.legal-operator {
    margin: 0;
    padding: 14px 16px;
    background: rgba(0,0,0,0.16);
    border-radius: 6px;
    font-size: 0.85rem;
}

.legal-operator div {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 3px 0;
}

.legal-operator dt {
    min-width: 150px;
    opacity: 0.6;
}

.legal-operator dd {
    margin: 0;
    flex: 1 1 220px;
}

.legal-operator a {
    color: var(--highlight);
}


/* === The medal panel's table-size tabs ===
 *
 * Twenty medals rather than five, so the panel needs a way in. Each tab carries
 * how many of that size's medals are held, because otherwise finding out means
 * opening all four. */
.medal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.medal-tab {
    width: auto;
    padding: 6px 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    color: var(--text-light);
    font-size: 0.82rem;
    cursor: pointer;
}

.medal-tab:hover {
    background: rgba(255,255,255,0.12);
}

.medal-tab.active {
    background: var(--btn-primary);
    border-color: var(--btn-primary);
}

.medal-tab-count {
    margin-left: 6px;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

.medal-tab.active .medal-tab-count {
    opacity: 0.9;
}

/* Which table a medal was earned at, in the standings. Not an afterthought in
   small print: twenty straights is an afternoon at three seats and a year at
   six, so the size is part of the name of the thing. */
/* Which table it was earned at — half of what a medal is. Its own line under
   the name in the standings, and inline after it on the record screen. */
.medal-at {
    font-size: 0.72rem;
    opacity: 0.65;
}

.medal-row .medal-at {
    margin-left: 6px;
    font-size: 0.78rem;
}


/* === A medal, the moment it is earned ===
 *
 * In the corner rather than across the middle, because this one arrives while
 * a hand is being played: the captions are drawn over the trick, which is the
 * thing the player is reading. Three seconds rather than 1.4 — it carries a
 * sentence, not a flourish — and `pointer-events: none` comes from the layer,
 * so it can sit over the felt without swallowing a click on a card. */
.fx-medal {
    position: fixed;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(20, 38, 28, 0.95);
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-left-width: 4px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    animation: medalIn 0.35s ease-out;
    max-width: min(320px, 70vw);
}

.fx-medal-body {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.fx-medal-label {
    font-weight: 700;
    font-size: 0.95rem;
}

.fx-medal-meta {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

.fx-medal-dot {
    font-size: 1.3rem;
    line-height: 1;
}

.fx-medal-bronze { border-color: var(--medal-bronze); }
.fx-medal-bronze .fx-medal-dot { color: var(--medal-bronze); }
.fx-medal-silver { border-color: var(--medal-silver); }
.fx-medal-silver .fx-medal-dot { color: var(--medal-silver); }
.fx-medal-gold { border-color: var(--highlight); }
.fx-medal-gold .fx-medal-dot { color: var(--highlight); }

@keyframes medalIn {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}

/* It slides in from the edge, which is travel — so for a player who asked for
   less of it, it simply appears. The medal is the information; the entrance is
   not. */
@media (prefers-reduced-motion: reduce) {
    .fx-medal {
        animation: fadeIn 0.35s ease-out;
    }
}


/* What a player who is not the host sees where the two buttons would be. A
   sentence rather than two disabled buttons: a disabled control invites a
   click and then explains nothing, and this is not a thing they are waiting to
   be allowed to do — it is somebody else's job. */
.room-waiting-host {
    font-size: 0.88rem;
    opacity: 0.75;
    text-align: center;
    padding: 10px 4px;
}


/* === A narrow window is the case the table has to give way in ===
 *
 * The side panel costs 93px of height at narrow widths that the felt and the
 * hand need more, and there is no width beside the felt for a column at all.
 *
 * **But it was `display: none` here whatever the player asked for**, and the
 * header's Show control sat above it doing nothing at all: pressed on four
 * phones on 2026-09-07, and nothing happened on any of them. A control that
 * cannot be obeyed is worse than one that is not offered. So the panel opens,
 * and it opens *over* the table as a drawer rather than beside it — pushing the
 * hand below the fold is exactly what hiding it was avoiding.
 *
 * **Width alone, and deliberately not `GamePanel.sidebarHidden`'s query.** The
 * two answer different questions: when the panel *starts* folded is about how
 * little room there is to spare, so a short window counts there; whether it
 * has to be a drawer instead of a column is about width, because width is what
 * a column needs. They were once written as if they had to agree, and both
 * ways of making them agree are wrong. `and (max-height: 800px)` missed the
 * commonest phone there is — a 390x844 window folds the panel by width and
 * clears 800 by height, so Show laid the panel out as a column under the hand
 * and pushed the felt off the screen, found on a phone on 2026-09-07. An OR to
 * match the JS breaks the other end: a 1440x900 laptop's window is under 800
 * tall, and every one of them would have got a bottom strip instead of its
 * column.
 *
 * The last trick is no longer among the things this is the only home for. It
 * stays on the felt until the table leads again — see `.trick-cards.resting` —
 * which is where a phone can actually read it. */
@media (max-width: 820px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    /* **A drawer from the right, not a strip along the bottom.** The strip sat
       over the player's own hand and fitted its four blocks into 190px of
       height by shrinking every one of them — at a table of phones on
       2026-09-18 the report was that it was not simple to see at all. The
       drawer has the whole height of the window, so the blocks keep the
       column the desktop gives them and grow instead of shrinking; it leaves a
       strip of the table showing on the left, so what it is over is never in
       doubt; and it slides, which is what a swipe on the felt opens and
       closes — see `GamePanel.attachPanelSwipe`. */
    .scores-panel.side-panel {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(84vw, 340px);
        max-height: none;
        overflow-y: auto;
        overscroll-behavior: contain;
        z-index: 120;
        padding: calc(env(safe-area-inset-top, 0px) + 18px) 18px
                 calc(env(safe-area-inset-bottom, 0px) + 18px);
        border-radius: 16px 0 0 16px;
        /* Opaque, because it sits over the felt rather than beside it. */
        background: linear-gradient(180deg, #21503a, #16341f);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        transition: transform 0.22s ease, visibility 0s;
    }

    /* Folded is off the right edge rather than `display: none`, so it slides.
       `visibility` goes after the slide, so nothing in it is focusable or
       read out while it is away. */
    .game-main.sidebar-hidden .scores-panel.side-panel {
        display: block;
        transform: translateX(105%);
        visibility: hidden;
        transition: transform 0.22s ease, visibility 0s 0.22s;
    }

    /* Back to the desktop's column, one block under the next — the narrow
       layout's rule above lays them out as a strip. */
    .side-panel .side-block {
        margin-top: 18px;
        padding-top: 16px;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid transparent;
    }

    .side-panel .side-title {
        font-size: 0.78rem;
        margin-bottom: 12px;
    }

    .side-panel .last-trick-cards { --mini-cell: 52px; row-gap: 6px; }
    .side-panel .last-trick-play .card { --card-w: 44px; }
    .side-panel .last-trick-winner { font-size: 0.9rem; }

    .side-panel .suit-counts { gap: 8px; }
    .side-panel .suit-count { padding: 8px 10px; }
    .side-panel .suit-glyph { font-size: 1.35rem; }
    .side-panel .suit-num { font-size: 1.05rem; }

    .side-panel .queen-card { font-size: 1.5rem; }
    .side-panel .queen-state { font-size: 0.9rem; }

    .side-panel .void-row { font-size: 0.95rem; }
    .side-panel .void-suit { font-size: 1.2rem; }

    button.panel-close,
    button.panel-close:hover:not(:disabled) {
        display: block;
        margin: -6px -6px 0 auto;
        width: 40px;
        height: 40px;
        padding: 0;
        font-size: 1.6rem;
        line-height: 1;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, 0.3);
        background: rgba(0, 0, 0, 0.3);
        color: var(--text-light);
    }

    /* The first block after the cross needs no rule above it — the narrow
       layout's `.side-block` above outranks the base rule on source order. */
    .side-panel .panel-close + .side-block {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }

    /* Sideways is the drawer's — see `attachPanelSwipe` — and up and down is
       still the browser's, so the drawer's own contents scroll. Said on the
       drawer as well as the page: it scrolls, and a scroll container starts
       the question afresh rather than inheriting the answer, so a sideways
       swipe on it was taken as a pan and cancelled. */
    .game-container,
    .scores-panel.side-panel {
        touch-action: pan-y pinch-zoom;
    }

    .game-container {
        padding: 4px 6px;
    }
}


/* What is behind a fold, said on the fold itself. */
.fold-hint {
    display: block;
    font-size: 0.72rem;
    opacity: 0.6;
    margin-top: 2px;
}

/* === A short desktop window ==================================================
 *
 * 1280x720 put a four- or six-seat table 28px below the fold, so pressing a
 * card scrolled the page and the header's labels went off the top. The cards
 * are not what gives way here — their clamps' vh terms are the lever that must
 * not move, see "Fitting on the screen" in frontend/CLAUDE.md — but the
 * padding and gaps between the header, the felt and the hand were sized for a
 * tall window and can be. Above 820px wide only: the phone layout below that
 * has its own arrangement. */
@media (min-width: 821px) and (max-height: 780px) {
    .game-container { padding-block: 6px; }
    .game-header { padding-block: 4px; margin-bottom: 6px; }
    .game-table { padding-block: 8px; gap: 6px; margin-bottom: 6px; }
    .hand-panel { margin-block: 4px; padding-block: 6px; }
}

/* === A phone on its side =====================================================
 *
 * **A different arrangement, not different numbers.** 844x390 was 189px taller
 * than the window and the hand was entirely below the fold, so "Your Turn!"
 * was never on screen. Three stacked rows — the seats across the top, the
 * trick in a 3x3 grid between the side seats, and the player's own seat and
 * status under it — cost more height than a phone on its side has, at any card
 * size; widening the portrait breakpoint was tried and changed nothing. What
 * a landscape phone has instead is width, so the table spends width:
 *
 * - The felt is one grid. The rows become `display: contents`, so every seat is
 *   placed directly: the side seats beside the trick, and the player's own
 *   seat and status in the corner *under* the left seat rather than in a row of
 *   their own. The trick's caption takes the other corner.
 * - The trick is two rows, not three. The seat across sits above, and the left
 *   seat, the player and the right seat play into the row below — so a card
 *   still lands on the side its player sits, and the names under each card,
 *   which that position already says, go.
 * - The header is one slim line, the face-down cards beside the seats go, and
 *   the hand is the portrait breakpoint's overlapping fan (the query above is
 *   shared with it), sized from the height.
 *
 * `max-height: 500px` and a coarse pointer are what say "a phone on its side".
 * Height alone is not enough: a laptop window with the developer tools docked
 * along the bottom is that short too, and a window is not a screen — see
 * "Fitting on the screen" in frontend/CLAUDE.md. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    :root {
        --card-w: clamp(40px, min(8vw, 16.5vh), 72px);
        --card-w: clamp(40px, min(8vw, 16.5dvh), 72px);
        --trick-card-w: clamp(28px, min(6.5vw, 11.5vh), 56px);
        --trick-card-w: clamp(28px, min(6.5vw, 11.5dvh), 56px);
        /* The side columns have width to give, and at 16vw a seat on a 667px
           phone cut every name to its first letter. */
        --seat-max: clamp(150px, 24vw, 220px);
    }

    .game-container { padding: 2px 8px; }

    /* `.game-main` is a column here and aligns its children to the start, so
       without this the table was as wide as its content — the full window with
       thirteen cards in hand, two thirds of it with nine. */
    .game-left { align-self: stretch; }

    .game-header { padding: 2px 8px; margin-bottom: 3px; gap: 14px; }
    .game-header-item { display: flex; align-items: baseline; gap: 4px; }
    .game-header-item .label { font-size: 0.62rem; }
    .game-header-item .value { font-size: 0.8rem; }
    .game-header #btn-exit-game { padding: 3px 10px; font-size: 0.75rem; }

    .game-table {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        grid-template-areas:
            "top-left top   top-right"
            "left     trick right"
            "me       trick message";
        align-items: center;
        column-gap: 12px;
        row-gap: 2px;
        padding: 2px 10px;
        margin-bottom: 3px;
    }

    .table-top-row,
    .table-middle-row,
    .table-bottom-row,
    .trick-area {
        display: contents;
    }

    .player-position.top-left  { grid-area: top-left;  justify-self: end; }
    .player-position.top       { grid-area: top; }
    .player-position.top-right { grid-area: top-right; justify-self: start; }
    .player-position.left      { grid-area: left;      justify-self: end; }
    .player-position.right     { grid-area: right;     justify-self: start; }

    .player-position.bottom {
        grid-area: me;
        justify-self: end;
        align-self: start;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .player-position .card-back { display: none; }

    /* A slimmer badge: the top row of seats is the one row of the felt that
       costs height of its own. */
    .seat { padding: 2px 6px 2px 2px; }
    .seat .avatar { width: 24px; height: 24px; font-size: 0.62rem; }
    .seat-meta { font-size: 0.6rem; }

    .trick-area {
        --trick-cell-w: calc(var(--trick-card-w) + 0.8rem);
        --trick-cell-h: calc(var(--trick-card-w) * var(--card-ratio) + 2px);
    }

    .trick-cards {
        grid-area: trick;
        grid-template-areas:
            "top-left top    top-right"
            "left     bottom right";
        grid-template-rows: repeat(2, var(--trick-cell-h));
        padding: 4px;
        background: rgba(0, 0, 0, 0.12);
        border-radius: 12px;
    }

    .trick-cards.claiming {
        height: calc(var(--trick-cell-h) * 2 + 8px);
    }

    .trick-play .player-name { display: none; }

    #trick-message {
        grid-area: message;
        justify-self: start;
        align-self: start;
        padding-top: 0;
        min-height: 0;
    }

    .hand-panel { margin-block: 2px; padding: 3px 8px; }

    /* The dialogs spend less of the height on their own padding. */
    .modal, .hand-summary-modal { padding: 12px 20px; }
    .modal h2 { margin-bottom: 8px; font-size: 1.3rem; }
    .hand-summary-modal h3 { margin-bottom: 8px; font-size: 1.1rem; }
    .hand-points-item { padding: 4px 12px; margin: 2px 0; }
    .hand-label { margin-bottom: 1px; font-size: 0.7rem; }
}

/* === A replay on a phone =====================================================
 *
 * **The game's arrangement, and the replay's own controls under it.** The felt,
 * the seats and the hand are the game's markup already, so both phone queries
 * above reach them unchanged — the overlapping fan, the landscape grid. What
 * kept a replay from looking like a game on a phone was the replay's own: the
 * card sizes `.replay-container` rebinds for a laptop (34px, where the game's
 * hand is 60 to 76), a scores panel repeating what every seat badge already
 * says, and transport controls sized for a mouse. At 390x664 that was 192px
 * over the fold, with the controls — the one thing a replay is worked with —
 * below it.
 *
 * The cards are the game's clamps with a smaller vh term, because the replay
 * spends height the game does not: a caption, the controls and the scrubber.
 * Measured, like every clamp here — see "Fitting on the screen" in
 * frontend/CLAUDE.md. The scores panel goes: the seats carry every total and
 * what the hand has cost, and the last event names the winner. */
@media (max-width: 820px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    .replay-container {
        padding: 4px 6px;
        --card-w: clamp(40px, min(20vw, 7vh), 88px);
        --card-w: clamp(40px, min(20vw, 7dvh), 88px);
        --trick-card-w: clamp(30px, min(11vw, 4.4vh), 56px);
        --trick-card-w: clamp(30px, min(11vw, 4.4dvh), 56px);
    }

    .replay-container .scores-panel { display: none; }

    .replay-container .game-header { margin-bottom: 4px; padding-block: 4px; }
    .replay-bar #btn-back-lobby { padding: 4px 10px; font-size: 0.8rem; }
    .replay-caption { margin-bottom: 4px; font-size: 0.82rem; min-height: 1.1rem; }
    .replay-container .panel { margin: 4px 0; padding: 4px 8px; }

    .replay-controls {
        gap: 6px;
        padding: 6px;
        margin-top: 4px;
    }

    .replay-controls button {
        min-width: 40px;
        padding: 6px 10px;
    }

    .replay-controls select { padding: 4px 6px; }
    .replay-progress { margin-top: 2px; }
}

/* The narrowest phones wrap the toggle onto a second line of the controls, and
   at 360x640 that line was what put the scrubber 6px under the fold. */
@media (max-width: 400px) {
    .replay-controls { padding: 4px; row-gap: 2px; }
    .replay-controls button { padding: 4px 10px; }
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    .replay-container {
        padding: 2px 8px;
        --card-w: clamp(36px, min(8vw, 14.5vh), 72px);
        --card-w: clamp(36px, min(8vw, 14.5dvh), 72px);
        --trick-card-w: clamp(26px, min(6.5vw, 10.5vh), 56px);
        --trick-card-w: clamp(26px, min(6.5vw, 10.5dvh), 56px);
    }

    .replay-bar #btn-back-lobby { padding: 3px 10px; font-size: 0.75rem; }
    .replay-caption { margin-bottom: 2px; font-size: 0.75rem; min-height: 0; }

    /* One row: the transport, the speed and the scrubber side by side. Height
       is what a phone on its side does not have, and width is what it does. */
    .replay-transport {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 2px;
    }

    .replay-container .replay-controls {
        flex-wrap: nowrap;
        margin-top: 0;
        padding: 3px 6px;
    }

    .replay-controls button { padding: 3px 10px; }
    .replay-progress { flex: 1; margin-top: 0; }
}

/* === The side panel's own button, on a phone ================================
 *
 * The panel is a drawer over the table here — see "On a small screen it starts
 * folded" above — and it was reached through the gear: three presses to open
 * it, three more to get the hand back. A pill does it in one, and says what it
 * will do ("Tracker", "Close"). Lit while the drawer is up, because the drawer
 * covers the table and the way back has to be the obvious thing on the screen.
 *
 * `GamePanel.panelToggle` draws it twice and one of them shows. Held upright,
 * in the trick area's top corner: the header there is Exit, four numbers and
 * the gear in 378px, and the pill put it on two lines and the hand 22px under
 * the fold, where the corner of the trick area is empty at every table size —
 * the trick's grid is centred in it. On its side, beside the gear: that header
 * is one slim line with room to spare, and the trick area is `display:
 * contents` there, so it has no corner to put anything in. */
@media (max-width: 820px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    /* `button.` and the `:hover` twins because `button:hover:not(:disabled)`
       outranks a class and an attribute, and a phone keeps the hover after a
       tap — so the pill went grey the moment it was pressed, which is the one
       moment it has to say "you are in the panel now". */
    /* Big enough to find without looking for it: 25px tall and grey-on-green
       was not, on 2026-09-18. 40px is the height a thumb hits first time, and
       the glyph says what is behind it before the word does. */
    button.panel-toggle,
    button.panel-toggle:hover:not(:disabled) {
        min-height: 40px;
        padding: 6px 14px;
        font-size: 0.9rem;
        font-weight: 700;
        line-height: 1.2;
        border-radius: 999px;
        border: 2px solid var(--highlight);
        background: rgba(0, 0, 0, 0.35);
        color: var(--highlight);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
        cursor: pointer;
    }

    button.panel-toggle[aria-pressed="true"],
    button.panel-toggle[aria-pressed="true"]:hover:not(:disabled) {
        background: var(--highlight);
        border-color: var(--highlight);
        color: #1a2e22;
    }

    .trick-area { position: relative; }

    .panel-toggle-felt {
        display: inline-block;
        position: absolute;
        top: 6px;
        right: 6px;
        z-index: 5;
    }
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    .panel-toggle-felt { display: none; }

    .settings-wrap {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    button.panel-toggle-bar,
    button.panel-toggle-bar:hover:not(:disabled) {
        display: inline-block;
        min-height: 0;
        padding: 2px 10px;
        font-size: 0.72rem;
        border-width: 1px;
    }

    /* Room for the pill and the gear at the end of the bar, the way the left
       end already keeps room for Exit. */
    .game-container .game-header { padding-right: 118px; }
}
