/*
 * Layout and components for the landing, host, organizer and super-admin pages. Mobile first:
 * everything is laid out for a phone and only spreads out from 700px up.
 *
 * Colours and fonts come only from tokens. The theme's skin (themes/{key}/skin-royale.css, the
 * same colours as the player pages) is mapped onto these names by skin-map.css:
 *   --color-bg --color-surface --color-surface-2 --color-surface-3 --color-text --color-muted
 *   --color-border --color-border-soft --color-primary --color-on-primary --color-accent
 *   --color-on-accent --color-danger --color-on-danger --color-success --color-warning-bg
 *   --color-warning-text --status-* --font-display --font-body --radius --radius-sm --focus
 */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(var(--hl2-rgb), .14), transparent 60%),
    var(--color-bg);
  background-attachment: fixed;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--color-link); text-underline-offset: 2px; }
h1, h2, h3, h4 {
  font-family: var(--font-display); font-weight: 400; line-height: 1.05; margin: 0 0 .5em;
  letter-spacing: var(--display-tracking); text-transform: uppercase;
}
h1 { font-size: clamp(1.8rem, 8vw, 2.4rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 .75em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
summary { cursor: pointer; }

.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--color-surface); padding: .5rem 1rem; }
.skip:focus { left: .5rem; top: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main { position: relative; z-index: 1; }

/* ------------------------------------------------------------ buttons & forms */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 46px; padding: .55em 1.1em;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface-2); color: var(--color-text);
  font-weight: 700; line-height: 1.15; text-align: center; text-decoration: none; cursor: pointer;
  transition: transform .06s ease, background-color .15s ease, filter .15s ease;
}
.btn:hover { background: var(--color-surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-primary); filter: brightness(1.08); }
.btn-accent { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.btn-accent:hover { background: var(--color-accent); filter: brightness(1.08); }
.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: var(--color-on-danger); }
.btn-danger:hover { background: var(--color-danger); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--color-link); }
.btn-ghost:hover { background: var(--color-surface-2); }
.btn-small { min-height: 38px; padding: .35em .8em; font-size: .92rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.btn-row.fill > .btn { flex: 1 1 auto; }
.linklike { background: none; border: 0; padding: 0; color: var(--color-link); text-decoration: underline; cursor: pointer; font-weight: 700; }

.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: .6em .8em;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-bg); color: var(--color-text);
  font-size: 16px; /* 16px stops phones zooming in on focus */
}
select.input { padding-right: 2rem; }
textarea.input { min-height: 8em; resize: vertical; line-height: 1.4; }
.input::placeholder { color: var(--color-muted); opacity: .8; }
.input:focus { border-color: var(--color-accent); outline: none; box-shadow: 0 0 0 3px var(--focus); }
.input.small { min-height: 40px; padding: .35em .6em; }
.input.num { width: 6em; text-align: center; }
.field { display: grid; gap: .35rem; min-width: 0; }
.field-label { font-weight: 700; }
.field-row { display: grid; gap: .85rem; grid-template-columns: 1fr; }
.hint { color: var(--color-muted); font-size: .94rem; }
.form-error { color: var(--color-danger); font-weight: 700; }
.stack { display: grid; gap: 1rem; }
.stack-sm { display: grid; gap: .5rem; }
.check { display: flex; gap: .65rem; align-items: flex-start; cursor: pointer; min-height: 32px; }
.check input { width: 1.35rem; height: 1.35rem; margin-top: .1rem; accent-color: var(--color-primary); flex: none; }

/* choice cards (radio buttons that look like cards) */
.choices { display: grid; gap: .6rem; }
.choices.cols { grid-template-columns: 1fr; }
.choice { display: block; position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice-body {
  display: block; height: 100%; padding: .85rem 1rem; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-surface-2);
}
.choice-body b { display: block; }
.choice-body small { display: block; color: var(--color-muted); margin-top: .2rem; font-size: .9rem; }
.choice input:checked + .choice-body { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary) inset; background: var(--color-highlight); }
.choice input:focus-visible + .choice-body { outline: 3px solid var(--focus); outline-offset: 2px; }
.rec { display: inline-block; margin-left: .35rem; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 800;
  background: var(--color-primary); color: var(--color-on-primary); vertical-align: middle; text-transform: uppercase; letter-spacing: .04em; }

/* on / off switch (a checkbox) */
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 700; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 48px; height: 28px; flex: none; border-radius: 999px; background: var(--color-surface-3); border: 1px solid var(--color-border); transition: background .15s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--color-text); transition: transform .15s ease; }
.switch input:checked + .switch-track { background: var(--color-primary); border-color: var(--color-primary); }
.switch input:checked + .switch-track::after { transform: translateX(20px); background: var(--color-on-primary); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------ surfaces */

.card {
  background: var(--color-surface); border: 1px solid var(--color-border-soft);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1rem;
  min-width: 0;
}
.card + .card, .card + details.card, details.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-head h2, .card-head h3 { margin: 0; }
details.card > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: .75rem; font-weight: 700; min-height: 28px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: ""; width: .6em; height: .6em; flex: none; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-right: .2rem; transition: transform .15s ease; }
details.card[open] > summary::after { transform: rotate(-135deg); }
.muted { color: var(--color-muted); }
.small { font-size: .9rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .76rem; font-weight: 800; color: var(--color-muted); margin: 0 0 .25rem; }
.note { background: var(--color-surface-2); border-radius: var(--radius-sm); padding: .7rem .85rem; }
.warn { background: var(--color-warning-bg); color: var(--color-warning-text); border: 1px solid rgba(var(--hl1-rgb), .4); border-radius: var(--radius-sm); padding: .7rem .85rem; font-weight: 700; }
.empty { text-align: center; color: var(--color-muted); padding: 1.5rem 1rem; }
.loading { color: var(--color-muted); padding: 2rem 0; text-align: center; }
.divider { border: 0; border-top: 1px solid var(--color-border-soft); margin: 1rem 0; }
.section-title { margin: 1.5rem 0 .65rem; font-size: 1.3rem; }

/* ------------------------------------------------------------ landing / login */

.landing { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.landing-card {
  width: min(460px, 100%); background: var(--color-surface); border: 1px solid var(--color-border-soft);
  border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); padding: 1.75rem 1.25rem; text-align: center;
}
.brand { margin-bottom: 1.5rem; }
.brand-mark { width: 72px; height: 72px; color: var(--color-link); }
.brand-name { font-size: clamp(2.4rem, 12vw, 3.4rem); margin: .25rem 0 .2rem; color: var(--color-link); }
.brand-name.small { font-size: clamp(1.9rem, 9vw, 2.4rem); }
.brand-tag { color: var(--color-muted); margin: 0; }
.code-form { text-align: left; }
.code-label { display: block; font-weight: 700; margin-bottom: .4rem; }
.code-row { display: flex; flex-direction: column; gap: .5rem; }
.code-input { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: 1.15rem; }
.pin-input { letter-spacing: .3em; font-size: 1.3rem; text-align: center; }
.landing-links { margin: 1.25rem 0 0; font-size: .95rem; }
.lead { font-size: 1.05rem; }

/* ------------------------------------------------------------ app shells */

.app { min-height: 100vh; }
.app-body { width: min(1100px, 100%); margin: 0 auto; padding: 16px 16px calc(var(--nav-height) + 40px + env(safe-area-inset-bottom)); }
.app-player .app-body { width: min(720px, 100%); }

/* header: brand + actions on one line, the page title under it (never cut off) */
.adminbar { padding: 12px 16px 4px; width: min(1100px, 100%); margin: 0 auto; }
.adminbar-row { display: flex; align-items: center; gap: .5rem; min-height: 40px; }
.adminbar-brand {
  font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--color-link); text-decoration: none; margin-right: auto; white-space: nowrap;
}
.adminbar-brand svg, .btn-ghost svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.12em; margin-right: .15em; }
.adminbar-actions { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.adminbar-title { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .6rem; margin-top: .35rem; }
.adminbar-title h1 { margin: 0; font-size: clamp(1.7rem, 8vw, 2.4rem); overflow-wrap: anywhere; }
.adminbar-sub { color: var(--color-muted); font-weight: 600; margin: .2rem 0 0; font-size: .95rem; }

.super-banner {
  display: flex; align-items: center; gap: .5rem .75rem; flex-wrap: wrap; justify-content: space-between;
  margin: 0 auto; width: min(1100px, 100%); padding: .55rem 16px;
  background: var(--color-warning-bg); color: var(--color-warning-text); border-bottom: 1px solid rgba(var(--hl1-rgb), .35);
  font-weight: 700; font-size: .92rem;
}
.super-banner .switch { font-size: .92rem; }

/* old top tabs, still used for small in-page switches */
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 1rem; padding: .3rem; background: var(--color-surface-2); border-radius: var(--radius); }
.tab {
  flex: 1 1 auto; min-height: 42px; padding: .4rem .7rem; border: 0; border-radius: calc(var(--radius) - 6px);
  background: transparent; color: var(--color-muted); font-weight: 700; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }

/* bottom navigation, like the player pages */
.app-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(var(--panel-rgb, 4, 24, 46), .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--color-border-soft); box-shadow: var(--shadow-bar, 0 -10px 30px rgba(0, 0, 0, .3));
}
.app-nav-inner { display: flex; width: min(640px, 100%); gap: 2px; }
.app-nav button, .app-nav a {
  flex: 1 1 0; min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 4px 2px; border: 0; border-radius: 14px; background: transparent; color: var(--color-muted);
  font: 700 .72rem/1.1 var(--font-body); letter-spacing: .01em; text-align: center; text-decoration: none; cursor: pointer;
}
.app-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-nav [aria-current="page"] { color: var(--color-link); background: rgba(var(--hl1-rgb), .14); }
.app-nav .nav-label { display: block; max-width: 100%; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ lists of things (host, super) */

.item-list { display: grid; gap: .75rem; }
.item { display: grid; gap: .6rem; }
.item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.item-title { font-size: 1.3rem; line-height: 1.1; overflow-wrap: anywhere; margin: 0; }
.item-meta { color: var(--color-muted); font-size: .92rem; display: flex; flex-wrap: wrap; gap: .15rem .9rem; margin: 0; }
.item-meta span { white-space: nowrap; }
.item-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.item-actions .btn { flex: 1 1 auto; }
.item.is-dim { opacity: .62; }

/* ------------------------------------------------------------ player view (old JS view) */

.event-head { text-align: center; padding: 1.25rem 16px .5rem; }
.event-site { margin: 0; font-size: .85rem; }
.event-site a { color: var(--color-muted); text-decoration: none; font-weight: 600; }
.event-name { font-size: clamp(1.8rem, 7vw, 2.6rem); margin: .2rem 0 .3rem; }
.event-meta { color: var(--color-muted); margin: 0; }
.announce {
  display: flex; gap: .6rem; align-items: flex-start; margin-bottom: 1rem; padding: .75rem .9rem;
  border-radius: var(--radius-sm); background: var(--color-highlight); border: 1px solid rgba(var(--hl1-rgb), .45); font-weight: 700;
}
.announce::before { content: "📣"; }
.me-picker { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.me-picker label { font-weight: 700; white-space: nowrap; }
.updated { text-align: center; color: var(--color-muted); font-size: .85rem; margin: 1.25rem 0 0; }

.next-card { margin-bottom: 1rem; border-width: 2px; }
.next-card .who { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.2; }
.vs { color: var(--color-muted); font-weight: 700; margin: .15rem 0; }

.badge {
  display: inline-flex; align-items: center; gap: .35em; padding: .2em .65em; border-radius: 999px;
  font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.badge-live { background: var(--status-live); color: var(--status-live-text); }
.badge-live::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
.badge-ondeck { background: var(--status-ondeck); color: var(--status-ondeck-text); }
.badge-upcoming { background: var(--status-upcoming); color: var(--status-upcoming-text); }
.badge-done { background: var(--color-surface-3); color: var(--color-muted); }
.badge-bye { background: var(--color-surface-3); color: var(--color-text); }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .badge-live::before { animation: none; } }

.match {
  display: grid; grid-template-columns: 1fr; gap: .3rem; align-items: center;
  padding: .75rem .85rem; border: 1px solid var(--color-border-soft); border-radius: var(--radius-sm); background: var(--color-surface);
}
.match + .match { margin-top: .5rem; }
.match-meta { grid-column: 1 / -1; display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; font-size: .86rem; color: var(--color-muted); font-weight: 700; }
.side { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.side .names { font-weight: 600; overflow-wrap: anywhere; }
.side.won .names { font-weight: 800; color: var(--color-text); }
.side .score { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.15rem; }
.side.won .score { color: var(--color-link); }
.match.is-me { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary) inset; }
.me { background: var(--color-highlight); border-radius: 4px; padding: 0 .2em; }
.match-actions { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.match-actions .btn-primary { flex: 1 1 6rem; }

.round { margin-bottom: 1.25rem; }
.round-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin: 0 0 .5rem; }
.round-head h3 { margin: 0; }
.round-time { color: var(--color-muted); font-weight: 700; font-size: .9rem; }
.byes { font-size: .9rem; color: var(--color-muted); margin-top: .45rem; }
.seg { margin: 0 0 1rem; padding: .55rem .8rem; border-radius: var(--radius-sm); background: var(--color-surface-2); font-weight: 700; display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }

/* standings */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.standings { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.standings th, .standings td { padding: .55rem .35rem; text-align: right; border-bottom: 1px solid var(--color-border-soft); white-space: nowrap; }
.standings th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--color-muted); }
.standings th:nth-child(2), .standings td:nth-child(2) { text-align: left; white-space: normal; }
.standings td:first-child { font-weight: 800; width: 2.2em; }
.standings tr.is-me td { background: var(--color-highlight); }
.standings tr.cut td { border-top: 3px solid var(--color-primary); }
.why { display: block; font-size: .76rem; color: var(--color-muted); font-weight: 600; }
.tier-tag { font-size: .7rem; font-weight: 800; padding: .1em .45em; border-radius: 4px; background: var(--color-surface-3); margin-left: .3rem; }

/* bracket */
.bracket { display: grid; gap: 1rem; }
.bracket-tier h3 { margin-bottom: .4rem; }
.bracket-rounds { display: grid; gap: .75rem; grid-template-columns: 1fr; }

/* ------------------------------------------------------------ organizer */

.layout-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.layout-2 > .card + .card { margin-top: 0; }
.controls { display: grid; gap: 1rem; }
.control-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.courts { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.court-col { background: var(--color-surface-2); border: 1px solid var(--color-border-soft); border-radius: var(--radius); padding: .75rem; min-width: 0; }
.court-col h3 { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.queue-list { display: grid; gap: .5rem; }
.queue-list .match + .match { margin-top: 0; }

.roster { display: grid; gap: .5rem; }
.roster-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .35rem .7rem; align-items: center;
  padding: .65rem .75rem; border-radius: var(--radius-sm); background: var(--color-surface-2); border: 1px solid var(--color-border-soft);
}
.roster-row > input[type="checkbox"] { width: 1.35rem; height: 1.35rem; accent-color: var(--color-primary); }
.roster-row .who { min-width: 0; overflow-wrap: anywhere; }
.roster-row .who b { font-size: 1.02rem; }
.roster-row .row-actions { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; }
.roster-row .row-actions .btn { flex: 1 1 auto; }
.roster-row.withdrawn { opacity: .6; }
.tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: .12em .5em; border-radius: 6px; background: var(--color-surface-3); color: var(--color-text); vertical-align: middle; margin: .1rem .1rem 0 0; }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.add-row .btn { grid-column: 1 / -1; }

.seg-btns { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }
.seg-btns button { border: 0; background: var(--color-surface-2); padding: .25rem .7rem; min-height: 38px; min-width: 40px; font-weight: 800; cursor: pointer; }
.seg-btns button + button { border-left: 1px solid var(--color-border); }
.seg-btns button[aria-pressed="true"] { background: var(--color-primary); color: var(--color-on-primary); }
.quality { display: grid; gap: .35rem; }
.quality li { list-style: none; }
.quality .ok::before { content: "✓ "; color: var(--color-success); font-weight: 800; }
.quality .bad::before { content: "! "; color: var(--color-danger); font-weight: 800; }
ul.plain { padding: 0; margin: 0; }
.grid-sched { display: grid; gap: .75rem; }
.swap-pick { outline: 3px solid var(--color-accent); border-radius: 4px; }
.pname { cursor: default; }
.editing .pname { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; padding: .1em 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; }
.kv dt { color: var(--color-muted); font-weight: 600; }
.kv dd { margin: 0; }
.qr { display: grid; place-items: center; background: #fff; padding: 12px; border-radius: var(--radius-sm); width: fit-content; margin: 0 auto; }
.qr svg { display: block; width: min(240px, 64vw); height: auto; }
.big-code { font-family: var(--font-display); font-size: clamp(2.5rem, 13vw, 4.5rem); letter-spacing: .08em; text-align: center; margin: .25rem 0; color: var(--color-link); }
.share-url { word-break: break-all; font-size: .85rem; color: var(--color-muted); }

/* wizard */
.wizard { max-width: 760px; margin: 0 auto; }
.steps { position: relative; display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 1rem; padding: 0 16px .25rem; list-style: none; counter-reset: s; }
.steps::-webkit-scrollbar { display: none; }
.steps li { counter-increment: s; flex: none; font-size: .82rem; font-weight: 800; color: var(--color-muted); padding: .3rem .7rem; border-radius: 999px; background: var(--color-surface-2); white-space: nowrap; }
.steps li::before { content: counter(s) ". "; }
.steps li[aria-current="step"] { background: var(--color-primary); color: var(--color-on-primary); }
.steps li.done { color: var(--color-text); }
.wizard-nav {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; gap: .5rem;
  margin: 1.25rem -16px 0; padding: .75rem 16px calc(.75rem + env(safe-area-inset-bottom));
  background: rgba(var(--panel-rgb, 4, 24, 46), .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border-soft);
}
.wizard-nav .btn { flex: 1 1 0; }
.timeline { display: grid; gap: .25rem; font-variant-numeric: tabular-nums; }
.timeline div { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem .55rem; border-radius: 8px; }
.timeline .tl-break { background: var(--color-surface-2); }

/* status chips */
.status { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: .2em .6em; border-radius: 999px; background: var(--color-surface-3); color: var(--color-muted); white-space: nowrap; vertical-align: middle; }
.status-live { background: var(--status-live); color: var(--status-live-text); }
.status-draft { background: rgba(var(--hl1-rgb), .2); color: var(--color-text); }
.status-completed { background: var(--color-accent); color: var(--color-on-accent); }

/* old list helpers */
.t-list { display: grid; gap: .75rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data th, .data td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--color-border-soft); vertical-align: top; }
.data th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--color-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* activity log: a simple list on phones */
.log { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.log li { display: grid; gap: .1rem; padding: .65rem 0; border-bottom: 1px solid var(--color-border-soft); }
.log li:last-child { border-bottom: 0; }
.log .log-when { color: var(--color-muted); font-size: .82rem; font-weight: 700; }
.log .log-what { overflow-wrap: anywhere; }
.log pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0 0; }

/* dialogs: a sheet from the bottom on phones */
dialog {
  position: fixed; inset: 0; z-index: 60;
  border: 1px solid var(--color-border-soft); padding: 0; color: var(--color-text); background: var(--color-surface); box-shadow: var(--shadow);
  width: 100%; max-width: 100%; max-height: 92vh; margin: auto auto 0; border-radius: var(--radius) var(--radius) 0 0;
  overflow: auto; overscroll-behavior: contain;
}
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog-body { padding: 1.25rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom)); }
.dialog-body h2 { font-size: 1.4rem; overflow-wrap: anywhere; }
.dialog-body .btn-row.end .btn { flex: 1 1 auto; }
.score-inputs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .6rem; align-items: center; text-align: center; }
.score-inputs .input { font-size: 1.8rem; font-weight: 800; text-align: center; min-height: 60px; }
.score-inputs .team { font-weight: 700; font-size: .95rem; overflow-wrap: anywhere; }
.stepper { display: flex; gap: .3rem; justify-content: center; margin-top: .3rem; }
.stepper button { width: 46px; height: 42px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-height) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--color-text); color: var(--color-bg); padding: .7rem 1.1rem; border-radius: 999px;
  font-weight: 800; box-shadow: var(--shadow); max-width: calc(100vw - 32px); z-index: 50; text-align: center;
}
.toast.error { background: var(--color-danger); color: var(--color-on-danger); }

/* ------------------------------------------------------------ wider screens */

@media (min-width: 700px) {
  .adminbar { padding-top: 18px; }
  .field-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .choices.cols { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
  .code-row { flex-direction: row; }
  .courts { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .bracket-rounds { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
  .card { padding: 1.2rem 1.3rem; }
  .item-list.grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .roster-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .roster-row .row-actions { grid-column: auto; }
  .roster-row .row-actions .btn { flex: 0 0 auto; }
  .add-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .add-row .btn { grid-column: auto; }
  .item-actions .btn { flex: 0 0 auto; }
  dialog { width: min(540px, calc(100vw - 32px)); margin: auto; border-radius: var(--radius); }
  .dialog-body { padding: 1.3rem 1.4rem; }
  .dialog-body .btn-row.end .btn { flex: 0 0 auto; }
  .wizard-nav { margin: 1.25rem 0 0; border-radius: var(--radius); border: 1px solid var(--color-border-soft); }
  .wizard-nav .btn { flex: 0 0 auto; }
}
@media (min-width: 900px) {
  .layout-2 { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}

@media print {
  .adminbar-actions, .app-nav, .btn, .toast, .super-banner { display: none !important; }
  body { background: #fff; color: #000; }
}
