/*
 * FlipOff styles. Colors and the title font come from the palette
 * each person picks (themes.css): Centaur by default, after Bally's
 * black-and-white Centaur backglass (1981). Archivo for everything you read
 * or type.
 *
 * Mobile first: base rules target phones, min-width queries add room.
 */

:root {
    /* Colors and the title font come from themes.css (Centaur by default). */
    --font-body: "Archivo", "Helvetica Neue", Arial, sans-serif;

    --radius: 3px;
    --gap: 16px;
    --tab-height: 66px;
    --tap: 44px; /* minimum touch target */
    --control: 48px; /* every button, field and segmented control is this tall, so nothing in a row sits higher or lower */

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

*,
*::before,
*::after { box-sizing: border-box; }

/* hidden always hides, even on elements whose class sets a display (flex, grid...). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font: 400 17px/1.5 var(--font-body);
    /* leave room for the fixed bottom tab bar on phones */
    padding-bottom: calc(var(--tab-height) + var(--safe-bottom));
}
body.is-bare { padding-bottom: var(--safe-bottom); }

img, svg { max-width: 100%; }
a { color: var(--cool, var(--accent)); text-underline-offset: 3px; }
a:hover { color: var(--text); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.muted { color: var(--muted); }
.center { text-align: center; }

/* Title font (set per palette in themes.css): titles, labels and numbers, set in capitals like backglass lettering. */
.title, .section-title, .score__label, .score__value, .plays__big,
.narrow h1, .empty h2, .feature__num {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: .03em;
}
.title, .section-title, .page-head h1, .narrow h1, .empty h2,
.machine-card__name, .feature h2 {
    text-transform: uppercase;
}
/* Every page title is the same size, in the title font's regular weight (Nate, 2026-11-01). */
.title, .page-head h1, .narrow h1 {
    font-size: 2rem;
    font-weight: 400;
    line-height: 1.2;
}
.title {
    color: var(--hot, var(--accent));
    overflow-wrap: anywhere;
}
.section-title { font-size: 1.3rem; color: var(--text); margin: 0; letter-spacing: .04em; }
.eyebrow { font-style: italic; font-size: 1.05rem; color: var(--muted); margin: 0 0 2px; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.sr-only, .skip-link:not(:focus) {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link:focus {
    position: fixed; top: 8px; left: 8px; z-index: 100;
    padding: 8px 12px; background: var(--surface); border-radius: var(--radius);
}

/* ---------- Header ---------- */

/* Optional accent tokens a palette can set (FlipOff does): --hot for titles and
   big numbers, --cool for links, outline buttons and the active tab. Others
   fall back to --accent. */
/* The header and tab bar follow the look: the page's own colors in light, the
   night marquee in dark. The FlipOff logo has no plate, so it blends into either. */
:root {
    --bar-bg: var(--surface); --bar-text: var(--text); --bar-muted: var(--muted); --bar-lamp: var(--accent);
}
:root[data-theme="dark"] {
    --bar-bg: var(--night); --bar-text: var(--night-text); --bar-muted: var(--night-muted); --bar-lamp: var(--lamp);
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] {
        --bar-bg: var(--night); --bar-text: var(--night-text); --bar-muted: var(--night-muted); --bar-lamp: var(--lamp);
    }
}
.app-header {
    position: sticky; top: 0; z-index: 20;
    background: var(--bar-bg);
    border-bottom: 2px solid var(--bar-lamp);
    color: var(--bar-text);
    padding-top: var(--safe-top);
}
.app-header__inner {
    display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
    max-width: 1100px; margin: 0 auto;
    min-height: 58px;
    padding: 0 calc(var(--gap) + var(--safe-right)) 0 calc(var(--gap) + var(--safe-left));
}
.brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--bar-lamp); text-decoration: none;
    min-height: var(--tap);
}
.brand__logo { display: block; width: auto; height: 40px; max-width: 100%; }
.brand:hover { color: var(--bar-lamp); }

/* The FlipOff logo (flipoff_logo() in app/helpers.php), lit in the theme's --logo-* colors. */
.logo__wash { stop-color: var(--logo-flip); }
.logo__wash--mid { stop-opacity: var(--logo-wash); }
.logo__flip { --tube: var(--logo-flip); --core: var(--logo-flip-core); }
.logo__off { --tube: var(--logo-off); --core: var(--logo-off-core); }
.logo__flippers { --tube: var(--logo-flippers); --core: var(--logo-flippers-core); }
.logo__ball { --tube: var(--logo-ball); --core: var(--logo-ball-core); }
:is(.logo__bloom, .logo__tube) { stroke: var(--tube); }
.logo__core { stroke: var(--core); }
/* The glow around each tube: full in dark, softer on a light header so the letters stay crisp. */
.logo__flip .logo__glow { opacity: calc(.95 * var(--logo-glow, 1)); }
.logo__off .logo__glow { opacity: calc(.9 * var(--logo-glow, 1)); }
:is(.logo__flippers, .logo__ball) .logo__glow { opacity: calc(.8 * var(--logo-glow, 1)); }
.app-header .btn--ghost { color: var(--cool, var(--bar-lamp)); border-color: var(--cool, var(--bar-lamp)); }
.app-header a:focus-visible { outline-color: var(--bar-lamp); }

/* ---------- Tabs: bottom bar on phones, top bar on larger screens ---------- */

.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: var(--bar-bg);
    border-top: 2px solid var(--bar-lamp);
    padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
}
.tabs__item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: var(--tab-height);
    color: var(--bar-muted); text-decoration: none; font-size: .95rem; font-weight: 500;
    border-top: 3px solid transparent; margin-top: -2px;
    -webkit-tap-highlight-color: transparent;
}
.tabs__item svg {
    width: 24px; height: 24px;
    fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.tabs__item:hover { color: var(--bar-text); }
.tabs__item.is-active { color: var(--cool, var(--bar-lamp)); border-top-color: var(--cool, var(--bar-lamp)); font-weight: 700; }
.tabs__item:focus-visible { outline-color: var(--bar-lamp); outline-offset: -3px; }

/* ---------- Page ---------- */

.page {
    max-width: 1100px; margin: 0 auto;
    padding: calc(var(--gap) * 1.25) calc(var(--gap) + var(--safe-right)) calc(var(--gap) * 2) calc(var(--gap) + var(--safe-left));
}
.page-head {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px;
    margin-bottom: calc(var(--gap) * 1.25);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rule);
}
.page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Collection: title and Add machine share one row, even on the narrowest phones (Nate, 2026-11-02). */
.page-head--collection { flex-wrap: nowrap; align-items: center; }
.page-head--collection .page-head__actions { flex: none; }
.page-head--collection .btn { white-space: nowrap; }
/* Arcade: the photo buttons sit on the title row, even on the narrowest phones. */
.page-head--arcade { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 0; }
.page-head--arcade .page-head__actions { flex-wrap: nowrap; }
.page-head--arcade .btn, .page-head--arcade h1 { white-space: nowrap; }
@media (max-width: 359px) {
    .page-head--arcade .btn .icon { display: none; }
}
/* Machine page: back link on its own line, then the name with Edit beside it.
   Long names wrap; the button never does (Nate, 2026-11-02). */
.page-head--machine { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 0; }
.page-head--machine .back-link { grid-column: 1 / -1; justify-self: start; }
.page-head--machine .page-head__actions { flex-wrap: nowrap; }
.page-head--machine .btn { white-space: nowrap; }
/* "Generate an ad for this machine": the last thing on the machine page, under the money box. The text may wrap on a small phone. */
.machine-ad { margin: 0 0 var(--gap); }
@media (max-width: 719px) { .machine-ad { text-align: center; } } /* centred on phones */
.machine-ad .btn { height: auto; min-height: var(--control); padding-top: 6px; padding-bottom: 6px; text-align: left; }
@media (max-width: 359px) {
    .page-head--machine .btn .icon { display: none; }
}
@media (max-width: 419px) {
    .arcade-btn__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 359px) {
    .add-machine__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.page-head h1 { margin: 0; font-family: var(--font-display); color: var(--hot, var(--accent)); overflow-wrap: anywhere; }
/* A tab's title is a button that opens what the page holds (_page_info.php): it looks exactly like the title. */
.page-title-btn {
    font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; text-shadow: inherit; text-align: left;
    background: none; border: 0; padding: 0; margin: 0; cursor: pointer; overflow-wrap: anywhere;
}
.page-title-btn:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 4px; border-radius: 2px; }
.page-info__list { margin: 10px 0 0; padding-left: 1.2em; display: grid; gap: 8px; line-height: 1.45; }
.page-info__list li::marker { color: var(--cool, var(--accent)); }
.page-sub { margin: 6px 0 0; color: var(--muted); font-style: italic; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back-link {
    display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap);
    color: var(--muted); text-decoration: none; margin-bottom: 2px;
}
.back-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back-link:hover { color: var(--text); }

.section-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px;
    margin: 0 0 10px;
    min-height: var(--tap);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 2px 0 var(--shadow);
    padding: var(--gap);
    margin-bottom: var(--gap);
}
.card > .section-title:first-child { margin-bottom: 10px; }
.empty { text-align: center; padding: calc(var(--gap) * 2) var(--gap); }
.empty h2 { font-size: 1.6rem; color: var(--hot, var(--accent)); }
.empty p { color: var(--muted); }

.flash, .alert {
    padding: 12px var(--gap); border-radius: var(--radius); margin-bottom: var(--gap);
    background: var(--surface); border: 3px double var(--rule); color: var(--text);
}
.alert--error { color: var(--bad); border: 2px solid currentColor; background: transparent; font-weight: 600; }

/* ---------- Ledger panel (paid vs. value) ---------- */

.scoreboard {
    background: var(--surface-2);
    color: var(--text);
    border: 3px double var(--rule);
    border-radius: var(--radius);
    padding: var(--gap);
    margin-bottom: calc(var(--gap) * 1.25);
    display: grid; gap: 14px;
}
.scoreboard__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.scoreboard__head .score__label { margin: 0; }
.money-toggle { margin: 0; }
.scoreboard__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.score { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.score__label { font-size: .85rem; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; margin: 0; }
.score__value { font-size: 2.1rem; color: var(--text); line-height: 1.25; overflow-wrap: anywhere; }
.score__value--accent { color: var(--hot, var(--accent)); font-size: 1.75rem; }
.score__fine { color: var(--muted); font-size: .95rem; margin: 0; }


/* ---------- Machine list ---------- */

.machine-grid { list-style: none; margin: 0 0 var(--gap); padding: 0; display: grid; gap: 12px; }
/* Each card fills its grid cell, so cards on one row are the same height on wide screens. */
.machine-grid > li { display: grid; }
.machine-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 2px 0 var(--shadow);
    padding: 14px; color: var(--text); text-decoration: none;
    transition: border-color .15s;
}
.machine-card:hover { color: var(--text); border-color: var(--rule); }
.machine-card.is-sold { opacity: .7; }
/* A coming soon machine: a one-line flag in Centaur red sits above its picture.
   When a list has one, every picture column takes the flag's width so names line up. */
.machine-pic { flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.machine-grid:has(.soon-flag) .machine-pic { width: max-content; min-width: 6.4rem; }
.soon-flag {
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
    font-family: var(--font-display); font-weight: 800; font-size: .8rem; line-height: 1;
    letter-spacing: .05em; text-transform: uppercase;
    padding: 4px 7px 4px 5px; border-radius: var(--radius);
    background: var(--btn); color: var(--on-btn); box-shadow: 0 2px 0 var(--shadow);
}
.soon-flag svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.machine-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.machine-card__name { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; line-height: 1.15; letter-spacing: .03em; overflow-wrap: anywhere; }
.machine-card__meta { color: var(--muted); font-size: 1rem; }
.chevron { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.machine-art {
    width: 56px; height: 68px; flex: none; display: grid; place-items: center;
    border-radius: var(--radius);
    background: var(--night); border: 2px solid var(--lamp);
}
.machine-art svg { width: 30px; height: 30px; fill: none; stroke: var(--cool-lamp, var(--lamp)); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.chip {
    display: inline-block; font-size: .88rem; font-weight: 600; line-height: 1.2;
    padding: 3px 8px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted);
    border: 1px solid transparent;
}
.chip--gold { background: transparent; border-color: var(--cool, var(--accent)); color: var(--text); } /* mod and play counts: aqua outline (Nate, 2026-11-02) */
.chip--accent { background: transparent; border-color: currentColor; color: var(--accent); }
.chip--alert { background: var(--btn); color: var(--on-btn); }

.machine-art--photo { overflow: hidden; background: var(--surface-2); }
.machine-art--photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Collection and shared lists: a bigger picture (72 x 88, then 10% more per Nate, 2026-11-02). */
.machine-card .machine-art { width: 79px; height: 97px; }
.machine-card .machine-art svg { width: 42px; height: 42px; }
.chip--pinside { background: var(--night); color: var(--lamp); }

/* ---------- Machine page: picture and Pinside rating ---------- */

.machine-hero {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--gap);
    align-items: start; margin-bottom: calc(var(--gap) * 1.25);
}
.machine-hero__frame {
    margin: 0; position: relative; overflow: hidden;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius);
    border: 3px double var(--lamp); background: var(--night);
    box-shadow: 0 2px 0 var(--shadow);
}
.machine-hero__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.machine-hero__frame figcaption {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px;
    background: rgba(13, 13, 13, .8); color: var(--night-text); font-size: .85rem; text-align: center;
}
.machine-hero__frame figcaption a { color: var(--lamp); }
.machine-hero__empty { position: absolute; inset: 0; display: grid; place-items: center; }
.machine-hero__empty svg { width: 46%; fill: none; stroke: var(--lamp); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.machine-hero__side { display: grid; gap: 12px; min-width: 0; }

.pinside {
    background: var(--surface-2); border: 3px double var(--rule); border-radius: var(--radius);
    padding: 12px 14px; display: grid; gap: 6px;
}
.pinside__rating { margin: 0; font-family: var(--font-display); font-weight: 700; color: var(--muted); font-size: 1.05rem; }
.pinside__rating span { color: var(--hot, var(--accent)); font-size: 2.4rem; line-height: 1.1; }
.pinside__facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 1rem; }
.pinside__top { font-weight: 700; }
.links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.links a { display: inline-flex; align-items: center; min-height: var(--tap); }


/* ---------- Edit machine: photo, value, Pinside ---------- */

.machine-extras { display: grid; gap: 14px; }
/* Machine pictures and flyer: two side by side, each a tall frame the picture fits inside. */
.image-pair { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.image-side { display: flex; flex-direction: column; min-width: 0; }
.image-side__frame {
    position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.image-side__frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .15s; }
a.image-side__frame:hover img { opacity: .85; }
a.image-side__frame:focus-visible { outline-offset: 2px; }
.image-side__frame--empty { display: grid; place-items: center; padding: 12px; border-style: dashed; text-align: center; color: var(--muted); }
.image-side__label { display: block; margin: 0 0 6px; }
/* Change and Remove on one row, centered under the flyer with a gap between them. */
.image-side__actions { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 4px clamp(8px, 4vw, 24px); margin-top: 4px; }
.image-side__actions form { margin: 0; flex: none; }
.image-side__actions .btn { padding: 0 4px; font-size: .95rem; white-space: nowrap; }
@media (max-width: 359px) {
    .image-side__actions { gap: 4px 6px; }
    .image-side__actions .btn { padding: 0 2px; font-size: .8rem; }
}
.image-side__remove { color: var(--bad); }
.image-side__remove:hover { color: var(--bad); border-color: var(--bad); }
.image-pair__hint { margin: 12px 0 0; }
@media (max-width: 299px) {
    .image-pair { grid-template-columns: 1fr; }
}
@media (min-width: 720px) {
    /* The two flyer pictures sit centred in their box (Nate, 2026-11-06). */
    .image-pair { grid-template-columns: repeat(2, minmax(0, 340px)); gap: var(--gap); justify-content: center; }
}
/* Machine Pictures: four pictures, 2 on top and 2 below on phones (the base
   two-column grid wraps), 4 equal ones across the box from 720px (Nate, 2026-11-06). */
@media (max-width: 299px) { .image-pair--four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 720px) { .image-pair--four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.machine-extras__photo { display: flex; gap: 14px; align-items: flex-start; }
.machine-extras__text { display: grid; gap: 6px; min-width: 0; }
.machine-extras__text p { margin: 0; }
.machine-extras__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.machine-extras__actions form { margin: 0; }
.machine-extras__row {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
    border-top: 1px dotted var(--rule); padding-top: 12px;
}
.machine-extras__row > div { min-width: 0; flex: 1 1 200px; }
/* Buttons sit at the right of each row, like Update value. */
.machine-extras__row > .machine-extras__actions, .machine-extras__row > .btn { flex: none; margin-left: auto; }
.machine-extras__row p { margin: 2px 0 0; overflow-wrap: anywhere; }
.machine-extras__row form { margin: 0; }
.value-picture-edit__thumb { flex: none; display: block; width: 64px; height: 64px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.value-picture-edit__thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ---------- OPDB search on the machine form ---------- */

.opdb__form { display: flex; gap: 8px; margin-bottom: 10px; }
.opdb__form input { flex: 1; min-width: 0; }
.opdb__results .row-link { justify-content: flex-start; }
.opdb__results .row-link__main { flex: 1; }
.opdb__results .row-link__amount { color: var(--accent); }
.opdb__thumb {
    width: 44px; height: 58px; flex: none; object-fit: cover; display: block;
    border-radius: var(--radius); border: 2px solid var(--lamp); background: var(--night);
}
.alert--ok { border-color: var(--good); }

/* ---------- Rows inside cards ---------- */

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-bottom: 1px dotted var(--rule); }
.rows > li:last-child { border-bottom: 0; }
.row-link {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 52px; padding: 8px 0;
    color: var(--text); text-decoration: none;
}
.row-link:hover { color: var(--text); }
.row-link:hover .row-link__title { color: var(--accent); }
div.row-link:hover .row-link__title { color: inherit; }   /* plain rows on shared pages */
.row-link__main { display: flex; flex-direction: column; min-width: 0; }
.row-link__title { font-weight: 600; overflow-wrap: anywhere; }
.row-link__meta { color: var(--muted); font-size: .95rem; }
.row-link__amount { font-weight: 600; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.row-link__amount.is-muted { color: var(--muted); font-weight: 400; }

.part-row { display: flex; align-items: center; gap: 10px; }
.quick-add { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.quick-add input[type=text] { flex: 1 1 220px; min-width: 0; }
.quick-add select { flex: 1 1 180px; width: auto; min-width: 0; }
/* With a machine picker, the name takes its own row and the picker and Add share the next, so Add never ends up alone. */
.quick-add:has(select) input[type=text] { flex-basis: 100%; }
.quick-add .btn { flex: none; }
.part-row .row-link { flex: 1; min-width: 0; }
.part-row form { margin: 0; flex: none; }

.status { font-weight: 700; }
.status--ordered, .status--shipped { color: var(--info); }
.status--received { color: var(--good); }
.status--installed, .status--cancelled { color: var(--muted); }
.due { font-weight: 700; color: var(--info); white-space: nowrap; font-size: 1rem; }
.due--late { color: var(--bad); }

/* Maintenance reminders: the job, when it's due, and a Done button. */
.reminder-row { display: flex; align-items: center; gap: 10px; }
.reminder-row .row-link { flex: 1; min-width: 0; }
.reminder-row form { margin: 0; flex: none; }
.reminder-row .due { white-space: normal; margin-top: 2px; }
.reminder-row--late { box-shadow: inset 4px 0 0 var(--bad); padding-left: 12px; }
.reminder-row--soon { box-shadow: inset 4px 0 0 var(--accent); padding-left: 12px; }
.due--soon { color: var(--accent); }
.due--ok { color: var(--muted); font-weight: 600; }
.due--waiting { color: var(--muted); font-weight: 400; font-style: italic; }
.due__flag {
    display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: var(--radius);
    background: var(--accent); color: var(--on-btn); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
}
.due-card__sum { margin: -4px 0 6px; }

.starter-list { list-style: none; margin: 4px 0 0; padding: 0; }
.starter-list > li { border-bottom: 1px dotted var(--rule); }
.starter-list > li:last-child { border-bottom: 0; }
.starter-list form { margin: 0; }
.starter {
    width: 100%; min-height: var(--tap); display: flex; align-items: center; gap: 10px; text-align: left;
    padding: 6px 0; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.starter:hover .starter__task, .starter:focus-visible .starter__task { color: var(--accent); }
.starter:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
.starter__plus { font-size: 1.3rem; font-weight: 700; line-height: 1; color: var(--accent); flex: none; width: 16px; text-align: center; }
.starter__main { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; flex: 1; min-width: 0; }
.starter__task { font-weight: 600; overflow-wrap: anywhere; }
.starter__every { color: var(--muted); font-size: .95rem; white-space: nowrap; }

/* Machine page Maintenance: Done, then Reminders, then the add link. */
.upkeep-sub { margin: 14px 0 2px; }
.section-head + .upkeep-sub { margin-top: 0; }
.section-head__actions { display: flex; align-items: center; gap: 0; flex: none; margin-left: auto; }
@media (max-width: 359px) { .section-head__actions { gap: 2px; } .section-head__actions .btn { padding: 0 6px; } }
/* Machine page Mods box: five newest first, the rest behind "Show all N mods". */
.mods-group[hidden], .rows > li[hidden] { display: none; }
.rows--fold > li, .rows--fold > li:last-child { border-bottom: 0; }
.rows--fold > li:not([hidden]) ~ li { border-top: 1px dotted var(--rule); }
/* Lists spaced apart with no divider lines (the machine page's Mods box).
   After the fold rules and as specific, so it wins over their dotted line. */
.rows--plain > li, .rows--plain.rows > li:not([hidden]) ~ li { border-top: 0; border-bottom: 0; }
.rows--plain > li + li { margin-top: 4px; }
/* One line between installed mods and the ones still to go in, in the theme's
   main colour (the purple card frame in the default theme). Only when both
   groups show, so "Show all" folding never leaves a stray line. */
.mods-group--installed:not([hidden]) ~ .mods-group--awaiting:not([hidden]) {
    border-top: 2px solid var(--btn); margin-top: 10px; padding-top: 22px;
}
/* Same type as the box's own "Mods" header (.section-title); just room under it. */
.mods-awaiting-title { margin-bottom: 4px; }
.mods-more { margin: 4px 0 0; }
.mods-more a {
    display: inline-flex; align-items: center; min-height: var(--tap);
    font-size: .85rem; color: var(--accent);
    text-decoration: underline; text-underline-offset: 3px;
}
/* Mods tab "Recently installed": title, then the game dropdown (full width on a phone). */
.installed-head { flex-wrap: wrap; }
.installed-filter { display: flex; gap: 8px; margin: 0; flex: 1 1 220px; max-width: 340px; }
.installed-filter select { flex: 1; min-width: 0; }
.installed-filter .btn[hidden] { display: none; }
@media (max-width: 520px) { .installed-filter { max-width: none; } }
details.card.history > summary { margin: calc(var(--gap) * -.25) 0; }
.recommendations summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; color: var(--accent); font-weight: 600; }
.recommendations[open] summary { margin-bottom: 4px; }

.plays { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 10px; } /* side by side when there's room, stacked on a phone so the count and its date share a row */
.plays > div { display: flex; flex-direction: column; gap: 2px; }
/* The count and its "as of" date share one row. */
.plays > .plays__now { flex-direction: row; flex-wrap: nowrap; align-items: baseline; gap: 2px 10px; white-space: nowrap; }
.plays .score__label { font-size: .72rem; }
.plays__big { font-size: 2.1rem; line-height: 1.25; }
.plays__big--accent { color: var(--hot, var(--accent)); }
.plays .muted { font-size: .95rem; font-style: italic; }

.history summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; color: var(--cool, var(--accent)); font-weight: 600; }
/* "All readings (N)" looks exactly like the Mods box's "Show all N mods" link (.mods-more a). */
.history--link summary { display: inline-flex; font-size: .85rem; font-weight: 400; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.details { margin: 0 0 12px; display: grid; gap: 8px; }
.details div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.details__link { color: var(--cool, var(--accent)); font-weight: 600; }   /* designer name with a saved link */
.details__link:hover { color: var(--text); }
.notes { white-space: normal; overflow-wrap: anywhere; color: var(--text); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    vertical-align: middle; /* line up side by side even when the fonts differ */
    min-height: var(--control); padding: 0 18px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
    font: 600 1.05rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .15s, border-color .15s, transform .05s;
}
.btn:hover { color: var(--text); border-color: var(--rule); }
.btn:active { transform: translateY(1px); }
.btn--primary {
    background: var(--btn); border-color: var(--btn); color: var(--on-btn);
    font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: .08em; text-transform: uppercase;
}
.btn--primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--on-btn); }
.btn--outline { background: transparent; border-color: var(--cool, var(--accent)); color: var(--cool, var(--accent)); }
.btn--outline:hover { background: var(--surface); color: var(--cool, var(--accent)); border-color: var(--cool, var(--accent)); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--cool, var(--accent)); }
.btn--ghost:hover { color: var(--cool, var(--accent)); border-color: var(--cool, var(--accent)); }
.btn--danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn--danger:hover { color: var(--bad); border-color: var(--bad); }
.btn--small { padding: 0 14px; font-size: 1rem; } /* narrower, never shorter */
.btn--block { width: 100%; }

/* ---------- Forms ---------- */

.form { display: grid; gap: var(--gap); }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; } /* in a two-column form, a taller neighbour must not stretch this field's input past --control */
.field__label { font-weight: 700; font-size: 1.02rem; }
.field__hint { color: var(--muted); font-size: .95rem; font-style: italic; }
.field__error { color: var(--bad); font-size: 1rem; font-weight: 700; }
.optional { color: var(--muted); font-weight: 400; font-style: italic; font-size: .92rem; margin-left: 4px; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
input, select, textarea {
    width: 100%; min-height: var(--control);
    padding: 10px 12px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--inset); color: var(--text);
    /* 16px or more stops iOS from zooming in on focus */
    font: 400 18px/1.35 var(--font-body);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; font-style: italic; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border: 2px solid var(--bad); }
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, summary:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}
.money-input { display: flex; align-items: stretch; }
.money-input span {
    display: grid; place-items: center; padding: 0 12px; min-width: 40px;
    border: 1px solid var(--border); border-right: 0; border-radius: var(--radius) 0 0 var(--radius);
    background: var(--surface-2); color: var(--text); font-weight: 700;
}
.money-input input { border-radius: 0 var(--radius) var(--radius) 0; }
.date-input { display: flex; align-items: center; gap: 8px; }
.date-input input { flex: 1 1 auto; min-width: 0; }
.date-input__clear { flex: none; text-decoration: underline; }
.date-input__clear[hidden] { display: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pinside-setup .form-actions { margin-top: 12px; }
.api-check__list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.api-check__row { display: flex; gap: 10px; align-items: flex-start; }
.api-check__mark { flex: 0 0 1.6em; height: 1.6em; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid currentColor; line-height: 1; }
.api-check__row--ok .api-check__mark { color: var(--good); }
.api-check__row--fail .api-check__mark { color: var(--bad); }
.api-check__row--wait .api-check__mark, .api-check__row--off .api-check__mark { color: var(--muted); }
.api-check__note { color: var(--muted); overflow-wrap: anywhere; }
.danger-zone { margin: calc(var(--gap) * 1.5) 0 0; }

.narrow { max-width: 440px; margin: 6vh auto 0; }
.narrow h1 { color: var(--hot, var(--accent)); }
.form-foot { margin-top: var(--gap); text-align: center; color: var(--muted); font-size: 1rem; }
.form-foot a { display: inline-block; padding: 8px 0; }

/* Segmented control (look picker) */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
    background: var(--inset); padding: 4px; border-radius: var(--radius); border: 1px solid var(--border); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; min-height: 0; }
.segmented span { display: grid; place-items: center; min-height: calc(var(--control) - 10px); /* + 4px padding and 1px border each side = --control */ padding: 0 6px; border-radius: var(--radius);
    font-size: 1rem; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.2; }
.segmented input:checked + span { background: var(--btn); color: var(--on-btn); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); }

/* Account > Modules: name and what it is, then an On/Off switch on the right */
.module-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 6px 14px; align-items: center;
    margin: 0; padding: 0 0 var(--gap); border: 0; border-bottom: 1px solid var(--border); min-width: 0;
}
.module-row__text { display: grid; gap: 2px; min-width: 0; }
.module-row__name { font-weight: 700; font-size: 1.05rem; }
.module-row__about { color: var(--muted); font-size: .92rem; line-height: 1.35; }
.module-row__switch span { min-height: calc(var(--control) - 10px); }

/* Theme picker: one card per palette, with its colors */
.palettes { display: grid; gap: 10px; }
.palette { position: relative; display: block; cursor: pointer; }
.palette input { position: absolute; opacity: 0; inset: 0; margin: 0; min-height: 0; }
.palette__card {
    display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center;
    padding: 12px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--inset);
}
.palette__swatches { grid-row: span 2; display: grid; grid-template-columns: repeat(2, 18px); gap: 3px; }
.palette__swatches i { width: 18px; height: 18px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.palette__name { font-weight: 700; }
.palette__about { color: var(--muted); font-size: .95rem; line-height: 1.35; }
.palette input:checked + .palette__card { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.palette input:checked + .palette__card .palette__name::after { content: " \2713"; color: var(--accent); }
.palette input:focus-visible + .palette__card { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (min-width: 720px) { .palettes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* On/off rows */
.switch { display: flex; align-items: center; gap: 12px; min-height: var(--tap); cursor: pointer; font-weight: 600; }
.switch input { width: 24px; height: 24px; min-height: 0; flex: none; accent-color: var(--btn); margin: 0; }

/* ---------- Avatars ---------- */

.avatar { display: block; border-radius: var(--radius); object-fit: cover; background: var(--surface-2); flex: none; }
.avatar--small { width: 38px; height: 38px; border: 2px solid var(--lamp); }
.avatar--large { width: 96px; height: 96px; border: 3px double var(--rule); }
.avatar--initials { display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: var(--lamp); background: var(--night); }
.avatar--small.avatar--initials { font-size: .95rem; }
.avatar--large.avatar--initials { font-size: 2rem; }
.app-header .avatar--small { border-color: var(--bar-lamp); }
.app-header .avatar--initials { background: var(--bar-bg); color: var(--bar-lamp); }
.header-avatar {
    text-decoration: none; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    min-width: var(--tap); min-height: var(--tap); border-radius: var(--radius); flex: none;
}
/* Gamer tag: high-score initials, lit like a score display. */
.gamer-tag {
    font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; line-height: 1;
    letter-spacing: .12em; text-transform: uppercase; color: var(--bar-lamp);
    font-variant-numeric: tabular-nums;
}
.gamer-tag-input { max-width: 8em; text-transform: uppercase; letter-spacing: .12em; font-family: var(--font-display); font-weight: 700; }
.gamer-tag-input::placeholder { text-transform: none; letter-spacing: normal; font-family: inherit; font-weight: 400; }

/* Account page: two columns of boxes on wide screens, one on phones. */
.account-grid { display: grid; gap: var(--gap); max-width: 760px; }
.account-grid > .card { margin: 0; }
@media (min-width: 960px) {
    .account-grid { display: block; columns: 2; column-gap: var(--gap); max-width: none; }
    .account-grid > .card { break-inside: avoid; margin: 0 0 var(--gap); }
    .account-grid .palettes { grid-template-columns: minmax(0, 1fr); }
    .account-grid + .account-foot { margin-left: auto; margin-right: auto; }
}

.avatar-edit { display: flex; align-items: center; gap: var(--gap); margin-bottom: var(--gap); }
.avatar-edit__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-edit__actions form { margin: 0; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }

/* ---------- Sharing ---------- */

.share-link { margin-top: var(--gap); padding-top: var(--gap); border-top: 1px dotted var(--rule); }
.share-link input { font-size: 16px; color: var(--accent); border-style: dashed; border-color: var(--rule); }
.share-link__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.share-link__actions form { margin: 0; }

.profile-head { display: flex; align-items: center; gap: var(--gap); margin-bottom: calc(var(--gap) * 1.25); }
.profile-head h1 { margin: 0; }
.profile-head p { margin: 4px 0 0; }
.bio { overflow-wrap: anywhere; }
.share-foot { text-align: center; margin-top: calc(var(--gap) * 2); font-style: italic; color: var(--muted); }
.view-only {
    display: flex; align-items: center; gap: 8px; margin-bottom: var(--gap);
    padding: 10px 12px; border: 1px dashed var(--rule); border-radius: var(--radius); color: var(--muted); font-size: 1rem;
}

.account-foot { display: grid; gap: 12px; margin-top: calc(var(--gap) * 1.5); text-align: center; }
.account-foot form { margin: 0; }

/* ---------- Setup checklist ---------- */

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist__item {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 0; border-bottom: 1px dotted var(--rule);
}
.checklist__item:last-child { border-bottom: 0; }
.checklist__item p { margin: 4px 0 0; }
.checklist__mark {
    flex: none; display: grid; place-items: center;
    width: 28px; height: 28px; border-radius: 50%;
    font-weight: 700; color: var(--surface);
}
.is-ok .checklist__mark { background: var(--good); }
.is-bad .checklist__mark { background: var(--bad); }

/* ---------- Splash ---------- */

.hero { text-align: center; padding: calc(var(--gap) * 1.5) 0 var(--gap); max-width: 560px; margin: 0 auto; }
.hero__logo { margin: 0 auto var(--gap); line-height: 0; }
.hero__logo svg { display: block; width: 100%; max-width: 520px; height: auto; margin: 0 auto; }
.hero__tagline { font-size: 1.35rem; font-style: italic; margin-bottom: 8px; }
.hero__lead { color: var(--muted); font-size: 1.1rem; }
.hero__actions { display: grid; gap: 12px; max-width: 360px; margin: calc(var(--gap) * 1.5) auto 0; }
/* Welcome page: no header, so the hero clears the phone's status bar itself; the "Free" line sits under the four blocks. */
.is-splash .hero { padding-top: calc(var(--gap) * 1.5 + var(--safe-top)); }
.splash-note { text-align: center; margin: 16px auto 0; max-width: 560px; }

.features {
    display: grid; gap: 0; margin-top: calc(var(--gap) * 2);
    background: var(--surface); border: 3px double var(--rule); border-radius: var(--radius); padding: 6px var(--gap);
}
.feature { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px dotted var(--rule); }
.feature:last-child { border-bottom: 0; }
.feature__num { font-size: 1.3rem; color: var(--hot, var(--accent)); padding-top: 2px; }
.feature h2 { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: .03em; margin-bottom: 2px; }
.feature p { color: var(--muted); font-size: 1.02rem; }

/* ---------- Tablet and up ---------- */

@media (min-width: 720px) {
    body { padding-bottom: var(--safe-bottom); }

    .tabs {
        position: sticky; top: calc(60px + var(--safe-top)); bottom: auto; z-index: 19;
        display: flex; justify-content: center; gap: 4px;
        border-top: 0; border-bottom: 1px solid var(--bar-lamp);
        padding: 0 var(--gap);
    }
    .tabs__item {
        flex-direction: row; gap: 8px;
        min-height: 50px; padding: 0 18px;
        font-size: 1.05rem;
        border-top: 0; margin-top: 0; border-bottom: 3px solid transparent;
    }
    .tabs__item svg { width: 20px; height: 20px; }
    .tabs__item.is-active { border-bottom-color: var(--cool, var(--bar-lamp)); }

    .page { padding-top: calc(var(--gap) * 2); }
    .title, .page-head h1, .narrow h1 { font-size: 2.5rem; }
    .section-title { font-size: 1.4rem; }
    .score__value { font-size: 2.6rem; }
    .score__value--accent { font-size: 2.1rem; }

    .machine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .form--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
    .field--wide { grid-column: 1 / -1; }
    form.card, .danger-zone { max-width: 760px; }

    .hero__actions { grid-template-columns: 1fr 1fr; }
    .hero__actions .btn:only-child { grid-column: 1 / -1; }
    .features { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
    .feature:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
    .card { padding: calc(var(--gap) * 1.25); }
    .page > .card:not(.narrow):not(.empty):not(.card--full), .account-foot { max-width: 760px; }
}

@media (min-width: 1000px) {
    .machine-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Create ad ---------- */

.ad { display: grid; gap: 14px; }
.ad__part { display: grid; gap: 8px; }
.ad__part textarea { font-size: 16px; line-height: 1.45; }
.ad__part input { font-size: 16px; }
.ad__part .btn { justify-self: start; }

/* ---------- Machine page layout ----------
   Phones: one column, in page order. From 720px every section sits on the
   same two equal columns with one gap, and boxes in a row share a height:
   picture | Pinside + Details, then Mods down the left (it's the longest
   list) beside Maintenance and Plays, then the flyer and Paid vs. value
   across both. */

@media (min-width: 720px) {
    .machine-top, .machine-logs {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--gap); margin: 0 0 var(--gap);
    }
    .machine-top > .card, .machine-logs > .card, .machine-hero__frame, .pinside { margin: 0; }
    .machine-top { grid-template-rows: auto 1fr; }
    .machine-top .machine-hero { display: contents; }
    .machine-top .machine-hero__frame { grid-column: 1; grid-row: 1 / span 2; aspect-ratio: auto; min-height: 420px; }
    .machine-top .machine-hero__frame img { position: absolute; inset: 0; }   /* fill the box, whatever the photo's shape */
    .machine-top .machine-hero__side { grid-column: 2; grid-row: 1; }
    .machine-top .machine-details { grid-column: 2; grid-row: 2; }
    .machine-logs { grid-template-areas: "mods upkeep" "mods plays"; }
    #mods { grid-area: mods; }
    #plays { grid-area: plays; }
    #upkeep { grid-area: upkeep; }
    .machine-pair { margin-bottom: var(--gap); }
}

/* ---------- Site admin: user list ---------- */

.admin-search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: var(--gap); }
.admin-search .field { flex: 1 1 220px; }
.admin-counts { text-align: right; line-height: 1.35; }
.admin-counts .muted { font-weight: 400; }
.row-link__title .chip { margin-left: 6px; vertical-align: middle; }
.admin-ban { border: 2px solid var(--bad); }
@media (min-width: 720px) {
    .admin-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.admin-message { padding: 10px 0; }
.admin-message p { margin: 0 0 4px; overflow-wrap: anywhere; }
.admin-message .chip { margin-left: 6px; }

/* ---------- Suspended account page ---------- */

.suspended .section-title { margin-top: calc(var(--gap) * 1.25); }
.suspended__note { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; margin: var(--gap) 0; }
.suspended__note p { margin: 0 0 4px; overflow-wrap: anywhere; }
.suspended textarea { min-height: 120px; }

/* ---------- Site admin: site stats ---------- */

.stats-range { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin-bottom: var(--gap);
    background: var(--inset); padding: 4px; border-radius: var(--radius); border: 1px solid var(--border); max-width: 420px; }
.stats-range a { display: grid; place-items: center; min-height: calc(var(--control) - 10px); border-radius: var(--radius);
    font-weight: 600; color: var(--muted); text-decoration: none; }
.stats-range a[aria-current] { background: var(--btn); color: var(--on-btn); }
.stats-trend__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.stats-legend { display: flex; gap: 14px; margin: 0; color: var(--muted); font-size: .95rem; }
.stats-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; }
.stats-legend__visitors, .stats-trend__visitors { background: var(--accent); }
.stats-legend__views, .stats-trend__views { background: var(--accent); opacity: .3; }
.stats-trend { display: flex; align-items: flex-end; gap: 2px; height: 160px; border-bottom: 1px solid var(--rule); }
.stats-trend__day { position: relative; flex: 1 1 0; height: 100%; min-width: 0; }
.stats-trend__day:hover { background: var(--surface-2); }
.stats-trend__views, .stats-trend__visitors { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 2px 2px 0 0; }
.stats-trend__visitors { left: 20%; right: 20%; }
.stats-trend__visitors[style="height: 0%"], .stats-trend__views[style="height: 0%"] { display: none; }
.stats-trend__axis { display: flex; justify-content: space-between; gap: 8px; margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
.stats-grid { display: grid; gap: 0 var(--gap); align-items: start; }
.stats-card { min-width: 0; }
.stat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.stat-list__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.stat-list__name { font-weight: 600; overflow-wrap: anywhere; }
.stat-list__count { font-weight: 600; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.stat-list__count .muted { font-weight: 400; }
.stat-list__track { grid-column: 1 / -1; height: 8px; background: var(--inset); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.stat-list__track span { display: block; height: 100%; background: var(--accent); }
@media (min-width: 720px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Arcade: game room photos and the full-screen viewer ---------- */

.arcade-status:empty { display: none; }
.arcade-status ul { margin: 6px 0 0; padding-left: 1.2em; }
.arcade-status .btn { margin-top: 10px; }
.arcade-full { margin: 0 0 var(--gap); font-style: italic; }
/* The cover photo sits in a cabinet frame like a lit backglass, with a
   speaker panel under it whose dot-matrix display (DMD) shows the caption.
   The DMD stays dark in every theme: it's a display, not a card. */
.arcade-top { display: grid; gap: var(--gap); margin-bottom: calc(var(--gap) * 1.5); }
.arcade-cover {
    display: flex; flex-direction: column; gap: 10px; min-width: 0;
    padding: 10px; border-radius: calc(var(--radius) + 4px);
    background: #05030a; border: 2px solid var(--btn);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--btn) 20%, transparent), 0 0 26px color-mix(in srgb, var(--btn) 30%, transparent);
}
.arcade-stage { position: relative; border-radius: 4px; overflow: hidden; background: var(--night); line-height: 0; }
.arcade-stage img { display: block; width: 100%; height: auto; }
.arcade-stage__link { display: block; }
.arcade-stage__link:focus-visible { outline-offset: -3px; }
.arcade-cover .arcade-stage { box-shadow: 0 0 22px rgba(255, 138, 42, .22); }

/* Numbered pin markers, placed by percent so they stay on the machine at any width.
   The button is a full 44px target; the dot inside is smaller so neighbors don't hide each other. */
.arcade-marker {
    position: absolute; width: var(--tap); height: var(--tap); margin: calc(var(--tap) / -2) 0 0 calc(var(--tap) / -2);
    display: grid; place-items: center; padding: 0; border: 0; background: transparent; cursor: pointer;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation; line-height: 1;
}
.arcade-marker span, .arcade-num {
    display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none;
    font: 800 15px/1 var(--font-display); letter-spacing: 0;
    background: rgba(10, 6, 20, .85); color: var(--cool, var(--accent)); border: 2px solid var(--cool, var(--accent));
}
.arcade-marker[aria-pressed="true"] span, .arcade-marker.is-on span, .arcade-num.is-on, [aria-pressed="true"] > .arcade-num {
    background: var(--cool, var(--accent)); color: #0a0614; box-shadow: 0 0 12px var(--cool, var(--accent));
}
.arcade-marker:focus-visible { outline: none; }
.arcade-marker:focus-visible span { outline: 3px solid #fff; outline-offset: 2px; }
.arcade-marker--new { pointer-events: none; }
.arcade-marker--new span { background: #ff4fd0; border-color: #ff4fd0; color: #0a0614; box-shadow: 0 0 14px #ff4fd0; }
.arcade-marker--new::before {
    content: ""; position: absolute; inset: 8px; border-radius: 50%; border: 2px solid #ff4fd0;
    animation: arcade-ping 1.4s ease-out infinite;
}
@keyframes arcade-ping { from { transform: scale(1); opacity: .9; } to { transform: scale(2); opacity: 0; } }

.arcade-more {
    position: absolute; top: 4px; right: 4px; width: var(--tap); height: var(--tap);
    display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius);
    background: rgba(10, 6, 20, .7); color: #f6f0ff; cursor: pointer;
}
.arcade-more svg { width: 20px; height: 20px; fill: currentColor; }
.arcade-more:hover { background: rgba(10, 6, 20, .9); color: var(--cool, var(--accent)); }
.arcade-more--cover { position: static; flex: none; background: transparent; color: #a99bd0; }
.arcade-more--cover:hover { background: #1a1230; }

.dmd {
    display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0;
    padding: 6px 10px; border-radius: 4px; border: 1px solid #2a1f3d;
    background-color: #0b0703;
    background-image: radial-gradient(circle, rgba(255, 255, 255, .07) 1px, transparent 1.5px);
    background-size: 4px 4px;
    color: #ff8a2a; font: 900 1.25rem/1.2 "Doto", "Courier New", monospace;
    text-transform: uppercase; letter-spacing: .08em; text-shadow: 0 0 6px rgba(255, 138, 42, .65);
}
.dmd__text { flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.dmd__text {
    font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer;
    min-height: var(--tap); border: 0; background: transparent; padding: 0;
}
button.dmd { width: 100%; min-height: var(--tap); cursor: pointer; }
.dmd__add { opacity: .55; }
button:hover > .dmd__add, button.dmd__add:hover { opacity: 1; }
.dmd__grille {
    width: 30px; height: 30px; flex: none; border-radius: 50%; border: 2px solid #2a1f3d;
    background-image: radial-gradient(circle, #2a1f3d 1.2px, transparent 1.6px); background-size: 5px 5px;
}
.dmd--speaker { min-height: 48px; }
.dmd--tile { font-size: .95rem; padding: 4px 6px; min-height: 34px; }

.arcade-plate {
    display: flex; align-items: center; gap: 12px; padding: 8px 6px 8px 12px;
    border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
}
.arcade-plate[hidden] { display: none; }
.arcade-plate__body, .arcade-pin__body { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.arcade-plate__name, .arcade-pin__name {
    font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; line-height: 1.1; letter-spacing: .02em;
    color: var(--text); overflow-wrap: anywhere;
}
.arcade-pin__edition { font-weight: 400; color: var(--muted); }
.arcade-plate__meta, .arcade-pin__meta { color: var(--muted); font-size: .9rem; line-height: 1.3; }
.arcade-plate__open { min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 10px; font-weight: 600; white-space: nowrap; }

.arcade-pins { min-width: 0; }
.arcade-pins__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.arcade-pins__add { min-height: var(--tap); display: inline-flex; align-items: center; font-weight: 600; white-space: nowrap; }
.arcade-pins__empty { margin: 0; }
/* Phones: the pins are one row of chips that scrolls sideways. */
.arcade-pins__list {
    list-style: none; margin: 0 calc(var(--gap) * -1); padding: 2px var(--gap) 8px;
    display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.arcade-pins__list li { flex: none; scroll-snap-align: start; }
.arcade-pin {
    display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 4px 12px 4px 6px;
    border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); color: var(--text);
    font: 500 .95rem/1.2 var(--font-body); cursor: pointer; white-space: nowrap;
}
.arcade-pin[aria-pressed="true"] { border-color: var(--cool, var(--accent)); }
.arcade-pin .arcade-pin__name { font-size: 1.05rem; }
.arcade-pin__art, .arcade-pin .arcade-pin__meta { display: none; }

.arcade-more-title { margin: 0 0 10px; }
.arcade-grid {
    list-style: none; margin: 0 0 var(--gap); padding: 0;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start;
}
.arcade-tile {
    display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 6px;
    background: #05030a; border: 2px solid var(--border); border-radius: calc(var(--radius) + 2px);
}
.arcade-tile__pic { position: relative; }
.arcade-tile__link {
    position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 3px;
    background: var(--night);
}
.arcade-tile__link img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .15s; }
.arcade-tile__link:hover img { opacity: .85; }
.arcade-tile__link:focus-visible { outline-offset: -3px; }
.arcade-tile__pins {
    position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: var(--radius);
    background: rgba(10, 6, 20, .85); border: 1px solid var(--cool, var(--accent)); color: var(--cool, var(--accent));
    font-size: .8rem; font-weight: 600; pointer-events: none;
}
.arcade-private { text-align: center; font-size: .9rem; }
.arcade-top { scroll-margin-top: 90px; }
.arcade-tile__cover {
    position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: var(--radius);
    background: var(--btn); color: var(--on-btn); font-size: .8rem; font-weight: 700; pointer-events: none;
}

/* The ⋯ pop-up for one photo: caption, tag, cover, replace, delete */
.arcade-edit__pic { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--radius); margin: 4px 0 12px; }
.arcade-edit__row { display: flex; gap: 8px; }
.arcade-edit__row input { flex: 1; min-width: 0; }
.arcade-edit__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.arcade-edit__actions form { margin: 0; }

/* Tag pins: the photo to tap, and a sheet of pins to pick from */
.arcade-tagger__hint { margin: 0 0 12px; }
.arcade-tagger { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: calc(var(--radius) + 4px); background: #05030a; border: 2px solid var(--btn); margin-bottom: var(--gap); }
.arcade-tagger__stage { cursor: crosshair; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.arcade-pick { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.arcade-pick__list { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.arcade-pick__row {
    display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 10px;
    border-radius: var(--radius); border: 2px solid transparent; cursor: pointer;
}
.arcade-pick__row:hover { background: var(--surface-2); }
.arcade-pick__row:has(input:checked) { border-color: #ff4fd0; background: var(--surface-2); }
.arcade-pick__row:has(input:focus-visible) { outline: 3px solid var(--focus, var(--accent)); outline-offset: 1px; }
.arcade-pick__row[data-full] { opacity: .5; cursor: not-allowed; }
.arcade-pick__row[hidden] { display: none; }
.arcade-pick__row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.arcade-pick__row .machine-art { width: 40px; height: 49px; }
.arcade-pick__row .machine-art svg { width: 22px; height: 22px; }
.arcade-pick__row .soon-flag { display: none; }
.arcade-pick__note { font-size: .85rem; font-weight: 600; color: var(--muted); text-align: right; }
.arcade-pick__row:has(input:checked) .arcade-pick__note { color: #ff4fd0; }
.arcade-pick .btn--block { position: sticky; bottom: 0; }
/* Phones: the pin picker rises from the bottom like a sheet. */
@media (max-width: 719px) {
    .popup.popup--sheet {
        width: 100vw; max-width: none; margin: auto 0 0; max-height: 78vh; max-height: 78dvh;
        border-radius: 14px 14px 0 0; padding-bottom: calc(16px + var(--safe-bottom));
    }
}
/* Computers: the pins stand beside the cover as a list of nameplates. */
@media (min-width: 960px) {
    .arcade-top.has-tags { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
    .arcade-top.has-tags .arcade-pins__list { flex-direction: column; overflow: visible; margin: 0; padding: 0; gap: 6px; }
    .arcade-top.has-tags .arcade-pin { width: 100%; white-space: normal; padding: 4px 10px; min-height: 52px; }
    .arcade-top.has-tags .arcade-pin__art { display: block; }
    .arcade-top.has-tags .arcade-pin .arcade-pin__meta { display: block; font-size: .85rem; }
    .arcade-pin__art .machine-pic { gap: 0; }
    .arcade-pin__art .machine-art { width: 30px; height: 37px; border-width: 2px; }
    .arcade-pin__art .machine-art svg { width: 18px; height: 18px; }
    .arcade-pin__art .soon-flag { display: none; }
    .dmd--speaker { font-size: 1.8rem; }
    .dmd--speaker .dmd__grille { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
    .arcade-marker--new::before { animation: none; }
}

body.is-viewing { overflow: hidden; }
.viewer {
    position: fixed; inset: 0; z-index: 50;
    display: grid; grid-template-rows: auto minmax(0, 1fr);
    background: #050505; color: #f2efe8;
    padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
    /* Taps, swipes and pinches in here are the viewer's own: the page behind
       doesn't zoom or scroll, and the script zooms just the picture. */
    touch-action: none; overscroll-behavior: contain;
}
.viewer[hidden] { display: none; }
.viewer__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 16px; }
.viewer__count { font-family: var(--font-display); font-weight: 700; letter-spacing: .12em; font-size: 1.1rem; color: var(--lamp); }
.viewer__stage { position: relative; min-height: 0; margin: 0 8px 12px; }
/* The picture fills the space under the bar and is scaled down to fit inside it, whatever its shape. */
.viewer__img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    display: block; object-fit: contain;
    user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none;
    transform-origin: 50% 50%; will-change: transform;
}
.viewer__img { cursor: zoom-in; }
.viewer.is-zoomed .viewer__img { cursor: grab; }
.viewer.is-dragging .viewer__img { cursor: grabbing; }
.viewer.is-zoomed .viewer__stage { overflow: hidden; }
.viewer__loading {
    position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
    padding: 4px 12px; border-radius: 999px; background: rgba(13, 13, 13, .8);
    color: var(--lamp); font-size: .95rem; font-weight: 600; pointer-events: none;
}
.viewer__loading[hidden] { display: none; }
.viewer__btn {
    width: 52px; height: 52px; display: grid; place-items: center; flex: none;
    padding: 0; border: 2px solid var(--lamp); border-radius: 50%;
    background: rgba(13, 13, 13, .75); color: var(--lamp); cursor: pointer;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.viewer__btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.viewer__btn:hover { background: var(--lamp); color: #0d0d0d; }
.viewer__btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.viewer__nav { position: absolute; top: 50%; transform: translateY(-50%); }
.viewer__nav--prev { left: calc(10px + var(--safe-left)); }
.viewer__nav--next { right: calc(10px + var(--safe-right)); }

@media (min-width: 720px) {
    .arcade-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
    .viewer__stage { margin: 0 84px 20px; }
    .viewer__nav--prev { left: calc(18px + var(--safe-left)); }
    .viewer__nav--next { right: calc(18px + var(--safe-right)); }
    .viewer__btn { width: 56px; height: 56px; }
}
@media (min-width: 1000px) {
    .arcade-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .arcade-tile__link img { transition: none; }
}
.file-btn.is-busy { opacity: .6; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
    .file-btn--camera { display: none; }
}
/* Six tabs: smaller labels on narrow phones so "Collection" keeps some room. */
@media (max-width: 419px) {
    .tabs__item { font-size: .82rem; }
}
@media (max-width: 359px) {
    .tabs__item { font-size: .76rem; }
}

/* ---------- Paid vs. value (machine page) ----------
   Phones: the three figures stack. From 720px they sit in a row. */

.money-box { gap: 18px; }
.money-figures { display: grid; gap: 14px; }
.money-figure { display: grid; gap: 2px; align-content: start; min-width: 0; }
.money-figure + .money-figure { border-top: 1px dotted var(--rule); padding-top: 12px; }
.money-figure__diff.is-good { color: var(--good); }
.money-figure__diff.is-bad { color: var(--bad); }
.money-bars { display: grid; gap: 8px; }
.money-bar { display: grid; grid-template-columns: 5.8em minmax(0, 1fr); align-items: center; gap: 10px; }
.money-bar__label { color: var(--muted); font-size: .9rem; }
.money-bar__track { display: flex; height: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.money-bar__fill { background: var(--text); }
.money-bar--value .money-bar__fill { background: var(--accent); }
.money-bar__range { background: var(--accent); opacity: .4; }
.money-history { border-top: 1px solid var(--rule); padding-top: 12px; }
.money-history .section-head { margin-bottom: 4px; }
/* The owner's Value picture: its own section at the bottom, the whole picture shown, tap to open big. */
.value-picture { border-top: 1px solid var(--rule); padding-top: 12px; display: grid; gap: 8px; }
.value-picture .section-head { margin: 0; }
.value-picture__frame {
    display: flex; justify-content: center; overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.value-picture__frame img { display: block; width: auto; max-width: 100%; height: auto; max-height: 480px; object-fit: contain; transition: opacity .15s; }
a.value-picture__frame:hover img { opacity: .85; }
a.value-picture__frame:focus-visible { outline-offset: 2px; }
@media (min-width: 720px) {
    .money-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
    .money-figure { padding: 0 var(--gap); }
    .money-figure:first-child { padding-left: 0; }
    .money-figure:last-child { padding-right: 0; }
    .money-figure + .money-figure { border-top: 0; padding-top: 0; border-left: 1px dotted var(--rule); }
}

/* Numbered how-to steps (Setup > Reminder emails). */
.steps { margin: 8px 0 10px; padding-left: 1.4em; display: grid; gap: 6px; }

/* ---------- Collection totals ----------
   Four figures: two by two on phones, one row from 720px. Then a bar chart:
   Investment and Worth side by side for the whole collection and each machine.
   The Investment bar is stacked: machine, shipping, mods. A palette can set
   --invest-machine/-shipping/-mods (FlipOff does); others fall back to these. */

.collection-money .money-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.collection-money .money-figure + .money-figure { border-top: 0; padding-top: 0; }
.collection-money .money-figure:nth-child(n+3) { border-top: 1px dotted var(--rule); padding-top: 12px; }
.collection-money .score__value { font-size: 1.7rem; }
@media (min-width: 720px) {
    .collection-money .money-figures { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
    .collection-money .money-figure:nth-child(n+3) { border-top: 0; padding-top: 0; }
    .collection-money .money-figure + .money-figure { border-left: 1px dotted var(--rule); }
    .collection-money .score__value { font-size: 2rem; }
}

.money-chart { margin: 0; border-top: 1px solid var(--rule); padding-top: 12px; display: grid; gap: 14px; }
/* One row of keys, phones included (Nate, 2026-11-02); the range note joins it from 720px. */
.money-chart__legend { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.money-chart__key { display: inline-flex; align-items: center; gap: 6px; }
.money-chart__key::before { content: ""; flex: none; width: 14px; height: 11px; border-radius: 3px; background: var(--text); }
.money-chart__key-note { display: none; }
@media (max-width: 359px) {
    .money-chart__legend { gap: 8px; font-size: .8rem; }
    .money-chart__key { gap: 4px; }
    .money-chart__key::before { width: 11px; height: 9px; }
}
@media (min-width: 720px) {
    .money-chart__legend { gap: 18px; font-size: .95rem; }
    .money-chart__key { gap: 8px; }
    .money-chart__key::before { width: 16px; height: 12px; }
    .money-chart__key-note { display: inline; }
}
.money-chart__key--machine::before, .money-chart__seg--machine { background: var(--invest-machine, var(--text)); }
.money-chart__key--shipping::before, .money-chart__seg--shipping { background: var(--invest-shipping, var(--muted)); }
.money-chart__key--mods::before, .money-chart__seg--mods { background: var(--invest-mods, var(--info)); }
.money-chart__key--value::before { background: var(--accent); }
/* A thin cut between stacked parts, drawn inside so the total length stays true. */
.money-chart__seg + .money-chart__seg { box-shadow: inset 2px 0 0 var(--surface); }
.money-chart__group { display: grid; gap: 6px; }
.money-chart__name { margin: 0; font-weight: 700; }
/* Value page: "Collection totals" matches the chart's "Whole collection" line (Nate, 2026-11-02). */
.money-chart__group--total .money-chart__name, .totals-title { text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; }
/* Every bar in the chart gets the same track width so lengths compare:
   on phones the amount sits above its bar, from 720px in a fixed column. */
.money-chart__row { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "label amount" "bar bar"; align-items: center; gap: 2px 10px; }
.money-chart__label { grid-area: label; }
.money-chart__track { grid-area: bar; }
.money-chart__amount { grid-area: amount; justify-self: end; }
.money-chart__none { grid-area: bar; }
.money-chart__label { color: var(--muted); font-size: .9rem; }
.money-chart__track { display: flex; height: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.money-chart__fill { background: var(--text); }
.money-chart__row--value .money-chart__fill { background: var(--accent); }
.money-chart__range { background: var(--accent); opacity: .4; }
.money-chart__amount { font-weight: 600; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; font-size: .95rem; }
.money-chart__none { color: var(--muted); font-size: .95rem; font-style: italic; }
@media (min-width: 720px) {
    .money-chart__row { grid-template-columns: 5.6em minmax(0, 1fr) 9.5em; grid-template-areas: "label bar amount"; gap: 10px; }
    .money-chart__none { grid-area: 1 / 2 / 2 / 4; }
}

/* Spend split donut (Value page, Collection totals box), same colors as the bars. */
/* Phones: donut on top, the list full width below it; side by side from 560px. */
.split { margin: 0; border-top: 1px solid var(--rule); padding-top: 12px; display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.split__donut { flex: none; align-self: center; width: 128px; height: 128px; }
.split__track { fill: none; stroke: var(--surface-2); stroke-width: 7; }
.split__slice { fill: none; stroke-width: 7; background: none; }
.split__slice.money-chart__seg--machine { stroke: var(--invest-machine, var(--text)); }
.split__slice.money-chart__seg--shipping { stroke: var(--invest-shipping, var(--muted)); }
.split__slice.money-chart__seg--mods { stroke: var(--invest-mods, var(--info)); }
.split__list { flex: 1 1 auto; min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: .95rem; }
.split__title { color: var(--text); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; }
.split__row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; }
.split__pct { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.split__amount { font-variant-numeric: tabular-nums; min-width: 5.5em; text-align: right; }

/* Value page, Mod spending box: a wheel by machine (built like "Where it went"),
   then bars by category and by store (built like the Investment/Worth rows).
   Wheel colours are the theme's --series-1..6 (themes.css), in slice order. */
.collection-mods { display: grid; gap: 14px; }
.collection-mods .scoreboard__head { margin-bottom: 0; }
.mod-spend__total { display: grid; gap: 2px; }
.collection-mods .mod-spend__total .score__value { font-size: 1.7rem; }
.mod-slice--1, .mod-key--1::before { stroke: var(--series-1, var(--accent)); background: var(--series-1, var(--accent)); }
.mod-slice--2, .mod-key--2::before { stroke: var(--series-2, var(--info)); background: var(--series-2, var(--info)); }
.mod-slice--3, .mod-key--3::before { stroke: var(--series-3, var(--good)); background: var(--series-3, var(--good)); }
.mod-slice--4, .mod-key--4::before { stroke: var(--series-4, var(--lamp)); background: var(--series-4, var(--lamp)); }
.mod-slice--5, .mod-key--5::before { stroke: var(--series-5, var(--btn)); background: var(--series-5, var(--btn)); }
.mod-slice--6, .mod-key--6::before { stroke: var(--series-6, var(--text)); background: var(--series-6, var(--text)); }
.mod-slice--other, .mod-key--other::before { stroke: var(--muted); background: var(--muted); }
.mod-slice { background: none; }
.mod-wheel .split__row .money-chart__key { min-width: 0; }
.mod-wheel .split__row .money-chart__key { overflow-wrap: anywhere; }
/* Bars: one series in the theme's Mods colour; the label column is wider than
   Investment/Worth's because store and category names run longer. */
.mod-bars { gap: 8px; }
.mod-bars__fill { background: var(--invest-mods, var(--accent)); }
.mod-bars__label { overflow-wrap: anywhere; }
/* A store's page (from "By store"): three figures in one row, then its mods. */
.store-money .money-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.store-money .money-figure + .money-figure { border-top: 0; padding-top: 0; border-left: 1px dotted var(--rule); padding-left: 12px; }
.store-money .score__value { font-size: 1.5rem; }
.store-money .score__fine { margin: 10px 0 0; }
@media (min-width: 720px) { .store-money .score__value { font-size: 2rem; } }
@media (min-width: 720px) {
    .mod-bars .money-chart__row { grid-template-columns: minmax(8em, 13em) minmax(0, 1fr) 7.5em; }
    .collection-mods .mod-spend__total .score__value { font-size: 2rem; }
}
@media (min-width: 560px) {
    .split { flex-direction: row; align-items: center; gap: 24px; }
    .split__donut { width: 140px; height: 140px; }
    .split__list { max-width: 26em; }
}

/* Collection trend (Value page, Collection totals box): Investment line and
   a Worth band over time. The SVG stretches to the plot; labels are HTML. */
.trend { margin: 0; border-top: 1px solid var(--rule); padding-top: 12px; display: grid; gap: 10px; }
.trend__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; color: var(--muted); font-size: .95rem; }
.trend__title { color: var(--text); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; }
.trend__keys { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.trend__key { display: inline-flex; align-items: center; gap: 8px; }
.trend__key::before { content: ""; width: 18px; height: 3px; border-radius: 2px; background: var(--text); }
.trend__key--value::before { height: 12px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.trend__plot { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; }
.trend__ticks { position: relative; min-width: 2.6em; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.trend__ticks span { position: absolute; right: 0; transform: translateY(50%); white-space: nowrap; line-height: 1; }
.trend__area { position: relative; height: 180px; touch-action: pan-y; cursor: crosshair; }
.trend__area svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trend__grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.trend__base { stroke: var(--rule); stroke-width: 1; }
.trend__band { fill: var(--accent); opacity: .28; }
.trend__edge { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.trend__line { fill: none; stroke: var(--text); stroke-width: 2.5; stroke-linejoin: round; }
.trend__dates { grid-column: 2; position: relative; height: 1.5em; margin-top: 4px; font-size: .8rem; color: var(--muted); }
.trend__dates span { position: absolute; top: 0; white-space: nowrap; }
.trend__dates .trend__year { transform: translateX(-50%); }
/* On phones a year close to the start would run into the start date. */
@media (max-width: 719px) { .trend__dates .trend__year--near { display: none; } }
.collection-machines .money-chart { border-top: 0; padding-top: 0; }
/* Machines box: a line between machines, after each one's Historical Trend picture, not above the picture (Nate, 2026-11-02). */
.collection-machines .money-chart__group + .money-chart__group { border-top: 1px solid var(--rule); padding-top: 14px; }
.money-chart .value-picture { border-top: 0; padding-top: 4px; }
.trend__guide { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--muted); pointer-events: none; }
.trend__tip { position: absolute; top: 6px; display: grid; gap: 2px; padding: 6px 9px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; white-space: nowrap; pointer-events: none; z-index: 2; }
.trend__tip b { font-weight: 600; }
.trend__tip[hidden], .trend__guide[hidden] { display: none; }
@media (min-width: 720px) {
    .trend__area { height: 240px; }
}

/* ---------- Host a tournament ----------
   Host pages, and the phone page players open from the TV's QR code.
   The TV screen itself has its own stylesheet (tv.css). */

.field[hidden] { display: none; }
.more-rows > summary { list-style: none; margin-top: 8px; }
.more-rows > summary::-webkit-details-marker { display: none; }
.more-rows[open] > summary { display: none; }
.pick-list { gap: 0; }
.pick-list .switch { border-bottom: 1px dotted var(--rule); }
.pick-list .switch:last-of-type { border-bottom: 0; }
.switch--top { align-items: flex-start; padding: 6px 0; }
.switch--top input { margin-top: 2px; }
.switch__hint { display: block; font-weight: 400; }

.host-links { display: grid; gap: var(--gap); }
.host-links__qr { width: 180px; justify-self: center; background: #fff; padding: 8px; border-radius: var(--radius); border: 1px solid var(--border); }
.host-links__qr svg { display: block; width: 100%; height: auto; }
.host-links__text { min-width: 0; }
.host-links .share-link__actions { margin-bottom: 12px; }
@media (min-width: 720px) {
    .host-links { grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
    .host-links__qr { width: 100%; }
}

.standings__row { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 48px; padding: 6px 0; }
.standings__place { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: var(--muted); text-align: center; }
.standings__row:first-child .standings__place { color: var(--accent); }
.standings__name { font-weight: 600; overflow-wrap: anywhere; }
.standings__name .muted { font-weight: 400; font-size: .95rem; }
.standings__points { font-weight: 700; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
#standings .score__fine { margin-top: 10px; }
.standings__prize { margin-left: 4px; vertical-align: middle; font-variant-numeric: lining-nums tabular-nums; }

/* Prize pot: a switch, then the pot and split boxes when it's on. */
.prize { display: grid; gap: 12px; }
.prize__body { display: grid; gap: 14px; padding-left: 14px; border-left: 3px solid var(--accent); }
.prize__body[hidden] { display: none; }
.prize__preview { margin: 0; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.prize__preview:empty { display: none; }
.prize__preview.is-off { color: var(--bad); font-weight: 600; }
@media (min-width: 560px) {
    .prize__body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
    .prize__preview { grid-column: 1 / -1; }
}
.play-prize { margin: 6px 0 0; font-weight: 600; }

/* Photo proof of a score: the phone's picker, and a tiny picture on the host's score list. */
.play-photo__pick { display: grid; gap: 10px; cursor: pointer; }
.play-photo__pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.play-photo__pick:focus-within .play-photo__btn { outline: 3px solid var(--focus); outline-offset: 2px; }
.play-photo__pick { position: relative; }
.play-photo__preview { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.play-photo__preview[hidden] { display: none; }
.play-confirm__photo { display: block; width: 96px; height: 96px; object-fit: cover; margin: 0 auto 10px; border-radius: var(--radius); }
.play-confirm__photo[hidden] { display: none; }
.score-proof + .row-link__main { flex: 1; }
.score-proof { flex: none; display: block; width: 40px; height: 40px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.score-proof img { display: block; width: 100%; height: 100%; object-fit: cover; }
.quick-add__photo { display: grid; gap: 4px; flex-basis: 100%; }
.quick-add__photo input { min-height: 0; padding: 8px 0; border: 0; background: none; }
.play-prize strong { font-family: var(--font-display); font-size: 1.3rem; color: var(--accent); letter-spacing: .02em; }

.part-row > .row-link { flex: 1; min-width: 0; }
.part-row > form { margin: 0; flex: none; }

.host-actions { display: grid; gap: 10px; }
.host-actions form { margin: 0; }
@media (min-width: 720px) { .host-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.play-form { max-width: 560px; }
.play-games { display: grid; gap: 8px; }
.play-game { position: relative; display: block; cursor: pointer; }
.play-game input { position: absolute; opacity: 0; inset: 0; margin: 0; min-height: 0; }
.play-game span {
    display: flex; align-items: center; min-height: 56px; padding: 10px 14px;
    background: var(--inset); border: 2px solid var(--border); border-radius: var(--radius);
    font-weight: 700; font-size: 1.1rem;
}
.play-game input:checked + span { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.play-game input:checked + span::after { content: "\2713"; margin-left: auto; }
.play-game input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (min-width: 480px) { .play-games { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.play-score { font-family: var(--font-display); font-weight: 700; font-size: 2.2rem; letter-spacing: .04em; font-variant-numeric: tabular-nums; text-align: right; min-height: 64px; }

.play-posted { max-width: 560px; text-align: center; border-top: 4px solid var(--accent); }
.play-posted__place { font-family: var(--font-display); font-weight: 800; font-size: 3.4rem; line-height: 1.1; color: var(--accent); margin: 0 0 6px; }

.play-confirm { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--gap); background: color-mix(in srgb, var(--night) 75%, transparent); }
.play-confirm[hidden] { display: none; }
.play-confirm__box { width: 100%; max-width: 440px; text-align: center; display: grid; gap: 10px; margin: 0; }
.play-confirm__score { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.4rem, 13vw, 4rem); line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; margin: 0; }
.play-confirm__who { font-weight: 700; font-size: 1.15rem; margin: 0 0 6px; }

/* The short TV link, big enough to read while typing it on a TV remote. */
.tv-link {
    margin: 4px 0 12px; padding: 12px 14px;
    background: var(--inset); border: 2px dashed var(--rule); border-radius: var(--radius);
    font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere;
}
.tv-link strong { font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; letter-spacing: .12em; color: var(--accent); }
.tv-code-form { max-width: 560px; margin: 4vh auto 0; text-align: center; }
.tv-code-form input { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; letter-spacing: .2em; text-align: center; text-transform: uppercase; min-height: 72px; }

/* ---------- Version link and changelog pop-up ---------- */

.version-foot { text-align: center; margin: calc(var(--gap) * 1.5) 0 var(--gap); }
.version-link {
    background: none; border: 0; padding: 6px 8px; margin: 0;
    font: inherit; font-size: .85rem; color: var(--muted); cursor: pointer;
    text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
}
.version-link:hover, .version-link:focus-visible { color: var(--text); text-decoration-color: currentColor; }

.changelog, .popup {
    width: min(520px, calc(100vw - 24px));
    max-height: min(80vh, 640px); max-height: min(80dvh, 640px);
    padding: var(--gap); overflow: auto;
    background: var(--surface); color: var(--text);
    border: 3px double var(--rule); border-radius: var(--radius);
    box-shadow: 0 6px 0 var(--shadow);
}
.changelog::backdrop, .popup::backdrop { background: rgba(0, 0, 0, .55); }
.changelog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.changelog__head .section-title { margin: 0; }
.changelog__close { padding: 0; width: var(--tap); }
.changelog__close .icon { margin: 0; }
.changelog__list { list-style: none; margin: 0; padding: 0; }
.changelog__item { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--border); }
.changelog__item:first-child { border-top: 0; }
.changelog__item[hidden] { display: none; }
.changelog__meta { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: .85rem; color: var(--muted); }
.changelog__version { letter-spacing: .1em; text-transform: uppercase; }
.changelog__text { line-height: 1.4; }
.changelog__more { margin: 6px 0 0; text-align: center; }

/* Host's "+ New" tournament pop-up: taller than the changelog, the form scrolls inside it. */
.popup { width: min(560px, calc(100vw - 24px)); max-height: 90vh; max-height: 90dvh; }
.popup__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.popup__head .section-title { margin: 0; }
.popup__close { padding: 0; width: var(--tap); }
.popup__close .icon { margin: 0; }
.popup__intro { margin: 0; }

/* ---------- Tab title rows ----------
   Collection, Modifications, Upkeep, Tournaments, Arcade and Spend share
   one title row (Nate, 2026-11-05): the title is centred against its buttons,
   the row is always one --control high, and nothing wraps, in every theme.
   On phones the title shrinks only as far as its theme's font needs for the
   longest title ("Modifications", --tab-title-em in themes.css) to fit
   beside its "+ Add more" button; every tab in a theme gets the same size. */
.page-head--tab { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 0; }
.page-head--tab > :first-child { min-height: var(--control); display: flex; align-items: center; min-width: 0; }
.page-head--tab h1 { white-space: nowrap; font-size: min(2rem, calc((100vw - 164px) / var(--tab-title-em, 4.5))); }
/* Centre the capital letters themselves, not the font's line box: some title fonts (Toy Story's) sit their capitals high. */
.page-head--tab h1, .page-head--tab h1 .page-title-btn { text-box: trim-both cap alphabetic; }
.page-head--tab .page-head__actions { flex-wrap: nowrap; }
.page-head--tab .btn { white-space: nowrap; }
@media (min-width: 720px) { .page-head--tab h1 { font-size: 2.5rem; } }
/* Upkeep's "+ Log work" reads "+ Log" on phones (labels shorten under 420px) so both buttons fit beside the title. */
@media (max-width: 419px) { .upkeep-btn__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }

/* Modifications, Upkeep and Tournaments (_tab_columns.php): the boxes stack, as wide as
   other pages' cards, until a PC-sized screen; then two columns across the
   full width under the title line, each stacking its own boxes so a short
   box never leaves a gap (Nate, 2026-11-06). */
.tab-columns { max-width: 760px; display: flex; flex-direction: column; }
.tab-columns__col { display: contents; }
@media (min-width: 960px) {
    .tab-columns { max-width: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
    .tab-columns__col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
    .tab-columns__box > .card { margin: 0; }
}
