/* Barlow Condensed (SIL OFL, public/fonts/OFL.txt): headings, tabs, badges, big numbers. */
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/barlow-condensed-600.woff2?v=8e1575ef8c') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/barlow-condensed-700.woff2?v=d639ff4a3e') format('woff2');
}

/* Three breakpoints: 960px (tablet: columns stack), 640px (phone: bottom
   or top nav, rows reflow), 480px (small phone). Don't add others. */

/* Dark theme, a night match: deep green ground, turf bars, chalk-white text. */
:root {
  --bg: #0b140f;
  --panel: #111e17;
  --panel-2: #182920;
  --line: #22362a;
  --line-strong: #32503d;
  --ink: #edf3ec;
  --ink-dim: #a9baae;
  --ink-faint: #8a9d90;
  --pitch: #174a2b; /* app bar and page headers */
  --pitch-2: #144226; /* the darker mowing stripe */
  --on-pitch: #ffffff;
  --chalk: #d2ddd5; /* secondary text on the pitch */
  --primary: #5cbb76; /* the main button on each screen */
  --on-primary: #08140c;
  --gold: #dcb03a; /* a highlight: your team, prices, money left */
  --link: #7fd096;
  --go: #6cc283;
  --bad: #ef7064;
  --warn: #e09a3e;
  --info: #88aed4;
  --favour: #e07a6a;
  --on-gold: #1a1608; /* text on a gold fill */
  --on-go: #08140c; /* text on a green fill */
  --shadow: rgb(0 0 0 / 0.45);
  --scrim: rgb(0 0 0 / 0.6);
  --radius: 6px;
  --radius-sm: 4px;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; /* codes people type or copy */
  --font-body: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', var(--font-body);
  --fs-xs: 11px;
  --fs-sm: 12.5px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 21px;
  --fs-2xl: 30px;
  color-scheme: dark;
}

/* Light theme, a day match. Set on <html data-theme> by the inline script in index.html. */
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #eef2ea;
  --panel: #ffffff;
  --panel-2: #e4ebe0;
  --line: #d3dccd;
  --line-strong: #b3c0ab;
  --ink: #142019;
  --ink-dim: #44524a;
  --ink-faint: #5d6b62;
  --pitch: #1f5f37;
  --pitch-2: #1b5531;
  --primary: #1d6a3a;
  --on-primary: #ffffff;
  --gold: #7d600a; /* never on the pitch in light mode (1.3:1); highlights there are white */
  --link: #1d6a3a;
  --go: #25713a;
  --bad: #a92d26;
  --warn: #8a500c;
  --info: #2f5f8a;
  --favour: #b4483a;
  --on-gold: #ffffff;
  --on-go: #ffffff;
  --shadow: rgb(20 40 25 / 0.14);
  --scrim: rgb(20 20 20 / 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--fs-md) / 1.5 var(--font-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.15s,
    color 0.15s;
}
@media (prefers-reduced-motion: reduce) {
  body {
    transition: none;
  }
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Turf: mowing stripes and the faint square grid of a Blood Bowl pitch. Bars and page
   headers only. The chalk lines are white in both themes because the turf is dark in both.
   .panel.turf: a turf panel keeps the turf over .panel's own background. */
.turf,
.panel.turf,
.match-banner {
  background-color: var(--pitch);
  background-image:
    linear-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px),
    repeating-linear-gradient(90deg, var(--pitch) 0 112px, var(--pitch-2) 112px 224px);
  background-size:
    28px 28px,
    28px 28px,
    auto;
  color: var(--on-pitch);
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

/* Links: one accent colour, no browser-default blue/purple, visited or not.
   :where() keeps specificity at zero so .btn and other classed links win. */
:where(a, a:visited) {
  color: var(--link);
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 2px;
}
:where(a:hover) {
  text-decoration-color: currentColor;
}
.hidden {
  display: none !important;
}

/* Tabler icon from icon() in app.js: the SVG is a mask over currentColor. */
.icon {
  display: inline-block;
  flex: none;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* ---------------- Footer and About page ---------------- */

.site-footer {
  padding: 16px 16px 24px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}
.site-footer a {
  white-space: nowrap;
}
.about {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
.about h1 {
  margin: 8px 0 12px;
  font-size: var(--fs-2xl);
}
.about h2 {
  margin: 28px 0 8px;
  font-size: var(--fs-lg);
}
.about p,
.about li {
  color: var(--ink-dim);
}
.about ul {
  padding-left: 20px;
}
.about li + li {
  margin-top: 6px;
}

/* ---------------- Top bar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}
/* The brand gives way first when the bar is tight: its words trail off, the menu doesn't. */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand > div {
  min-width: 0;
}
.brand h1 {
  font: 700 19px / 1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.brand h1,
.brand-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Home beside the brand, on phones only: team pages there have no main menu. Wider screens
   already have Home in the menu. Hidden with the menu (landing and login screens). */
.home-btn {
  flex: none;
}
.topbar:has(#tabs.hidden) .home-btn {
  display: none;
}
@media (min-width: 641px) {
  .topbar .home-btn {
    display: none;
  }
}
.brand-sub {
  margin: 3px 0 0;
  font-size: var(--fs-xs);
  color: var(--chalk);
}
/* A small white shield: the one decorative shape, reused as the crest for teams without a logo. */
.brand-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 34px;
  padding-bottom: 6px;
  background: var(--on-pitch);
  color: var(--pitch);
  clip-path: polygon(0 0, 100% 0, 100% 64%, 50% 100%, 0 64%);
  font: 700 15px / 1 var(--font-display);
}

.tabs {
  display: flex;
  flex: none;
  align-self: stretch;
  gap: 2px;
}
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--chalk);
  padding: 0 10px;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.tab:hover,
.tab.is-active {
  color: var(--on-pitch);
}
.tab.is-active {
  font-weight: 600;
  border-bottom-color: var(--on-pitch);
}
.tab-group > .tab {
  height: 100%;
}

/* Teams, Almanac, More and the account: a button that drops a menu. */
.tab-group {
  position: relative;
  display: flex;
}
.tab-group-btn::after {
  content: '';
  width: 0.5em;
  height: 0.5em;
  margin: -0.25em 0 0 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.7;
}
.tab-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  min-width: 190px;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px var(--shadow);
}
.tab-group.is-open .tab-menu {
  display: flex;
}
.tab-menu .tab {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink-dim);
  font-weight: 400;
}
.tab-menu .tab:hover,
.tab-menu .tab.is-active {
  color: var(--ink);
  background: var(--panel-2);
}
.tab-menu .tab.is-active {
  box-shadow: inset 3px 0 0 var(--primary);
}
.tab--more,
.nav-mode {
  display: none !important;
}

/* Tablets: the full menu doesn't fit beside the brand and account name, so keep the mark,
   the menu words and the avatar. */
@media (min-width: 641px) and (max-width: 960px) {
  .brand h1,
  .brand-sub,
  .user-name,
  .tabs .tab-group-btn .icon,
  .tabs > .tab .icon {
    display: none;
  }
}

/* Phones: one row of header, and the main menu along the bottom or as a strip under it. */
@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    gap: 0 12px;
    padding: 0 12px;
  }
  .brand {
    height: 52px;
  }
  .brand h1 {
    font-size: 17px;
  }
  .brand-sub {
    display: none;
  }
  .brand-mark {
    width: 26px;
    height: 30px;
    font-size: 13px;
  }
  .user-name {
    display: none;
  }
  .nav-mode {
    display: flex !important;
  }
  /* Menus hang from the whole bar, so the scrolling strip cannot clip them. */
  .tab-group {
    position: static;
  }
  .topbar .tab-menu {
    left: 8px;
    right: 8px;
  }

  :root[data-nav='top'] .tabs > * {
    flex: none;
  }
  :root[data-nav='top'] .tabs {
    order: 3;
    flex-wrap: nowrap;
    width: calc(100% + 24px);
    height: 44px;
    margin: 0 -12px;
    padding: 0 6px;
    border-top: 1px solid rgb(255 255 255 / 0.12);
    overflow-x: auto;
    scrollbar-width: none;
  }

  :root[data-nav='bottom'] .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    gap: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--panel);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px var(--shadow);
  }
  :root[data-nav='bottom'] .tabs > .tab,
  :root[data-nav='bottom'] .tabs > .tab-group {
    flex: 1;
    min-width: 0;
  }
  :root[data-nav='bottom'] .tabs > .tab,
  :root[data-nav='bottom'] .tabs > .tab-group > .tab {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    height: 58px;
    padding: 0 2px;
    border-bottom: 0;
    border-top: 3px solid transparent;
    color: var(--ink-faint);
    font: 600 11.5px / 1 var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  :root[data-nav='bottom'] .tabs > .tab .icon,
  :root[data-nav='bottom'] .tabs > .tab-group > .tab .icon {
    width: 22px;
    height: 22px;
  }
  :root[data-nav='bottom'] .tabs > .tab.is-active,
  :root[data-nav='bottom'] .tabs > .tab-group > .tab.is-active {
    color: var(--primary);
    border-top-color: var(--primary);
  }
  :root[data-nav='bottom'] .tabs .tab-group-btn::after,
  :root[data-nav='bottom'] .tab--wide {
    display: none !important;
  }
  :root[data-nav='bottom'] .tab--more {
    display: flex !important;
  }
  :root[data-nav='bottom'] .tabs .tab-menu {
    top: auto;
    bottom: calc(100% + 6px);
  }
  /* The bottom menu lives inside the top bar's layer, so lift that layer over the team bar
     or the menu opens behind it. */
  :root[data-nav='bottom'] .topbar {
    z-index: 26;
  }
  :root[data-nav='bottom'] body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  :root[data-nav='bottom'] {
    --toast-lift: 64px;
    --nav-lift: 64px;
  }
  /* Team pages: the team bar takes the bottom on its own; the back link at the top is the
     way out. */
  :root[data-nav='bottom']:has(#view-builder:not(.hidden)),
  :root[data-nav='bottom']:has(#view-record:not(.hidden)) {
    --nav-lift: 0px;
  }
  :root[data-nav='bottom']:has(#view-builder:not(.hidden)) .tabs,
  :root[data-nav='bottom']:has(#view-record:not(.hidden)) .tabs {
    display: none;
  }
  :root[data-nav='bottom']:has(#view-builder:not(.hidden)) body,
  :root[data-nav='bottom']:has(#view-record:not(.hidden)) body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  :root[data-nav='bottom']:has(#view-builder:not(.hidden)) .team-bar,
  :root[data-nav='bottom']:has(#view-record:not(.hidden)) .team-bar {
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  }
}

/* ---------------- Setup row ---------------- */

.view {
  padding: 18px 20px 48px;
  max-width: 1680px;
  margin: 0 auto;
}

.setup {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 200px;
  min-width: 150px;
}
.field--narrow {
  flex: 0 1 170px;
}
/* Coach, NAF name, NAF number: one row under the team name (builder, guests only). */
.setup--coach {
  margin-top: -6px;
}
.setup--coach .field--naf {
  flex: 0 1 150px;
  min-width: 120px;
}
@media (max-width: 640px) {
  .setup--coach .field--naf {
    flex-basis: 100%;
  }
}
.field > span {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-faint);
}
/* A field's own message: a coach name that isn't on the list, or is taken. */
.field-hint {
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.field-hint.is-bad {
  color: var(--bad);
}
input.is-bad {
  border-color: var(--bad);
}
input[readonly] {
  color: var(--ink-dim);
}

input,
select,
#setResetContact {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 10px;
  border-radius: var(--radius);
  font: inherit;
  width: 100%;
}
/* Ticks and radios keep their own size (Safari stretches them, pushing the label aside). */
input[type='checkbox'],
input[type='radio'] {
  width: auto;
  flex: none;
}
input:focus,
select:focus,
#setResetContact:focus {
  outline: 2px solid var(--gold);
  outline-offset: -1px;
}
input::placeholder {
  color: var(--ink-faint);
}

/* Format (11s | Sevens) stacked above Budget, which it sets. */
.setup-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 1 190px;
  min-width: 170px;
}
.setup-rules .field {
  flex: none;
  min-width: 0;
}
.format-seg {
  display: flex;
}
.format-seg button {
  flex: 1;
}
.format-seg button:disabled {
  cursor: default;
}
.format-seg button:disabled:not(.is-on) {
  opacity: 0.5;
}
.format-note {
  margin-top: -6px;
}

/* Budget button in the builder setup row; opens #budgetDialog. */
.budget-btn {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  min-height: 41px;
  white-space: nowrap;
  overflow: hidden;
  padding: 8px 32px 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
}
.budget-btn::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--ink-dim);
  border-bottom: 1.5px solid var(--ink-dim);
  transform: translateY(-70%) rotate(45deg);
}
.budget-btn:hover:not(:disabled) {
  border-color: var(--gold);
}
.budget-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -1px;
}
.budget-btn:disabled {
  cursor: default;
}
.budget-btn:disabled::after {
  display: none;
}
.budget-sub {
  font-size: var(--fs-sm);
  color: var(--gold);
  overflow: hidden;
  text-overflow: ellipsis;
}
.field--budget {
  flex: 0 1 240px;
}

/* ---------------- Team picker ---------------- */

.pick-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.pick-head h2 {
  font-size: var(--fs-lg);
}
.pick-head .btn {
  flex: 0 1 auto;
}
/* "Team in progress": its own line, in the middle. */
.pick-head .continue-team {
  flex-basis: auto;
  order: 1;
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}
.pick-head h2 {
  flex-basis: 100%;
}
.continue-team .icon {
  font-size: var(--fs-lg);
  color: var(--gold);
  flex: none;
}
.continue-team-label {
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.continue-team-name {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
}
.continue-team-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.continue-team-name .roster-icon {
  flex: none;
}
.buy-skill:not(:disabled) {
  cursor: help;
}
.pick-filter {
  max-width: 360px;
  margin-bottom: 16px;
}
.pick-filter .rnav-secret {
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
.pick-filter .rnav-secret input {
  width: 18px;
  height: 18px;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.tile-heading {
  margin: 28px 0 12px;
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
.tile {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.12s,
    background 0.12s,
    transform 0.12s;
}
.tile:hover,
.tile:focus-visible {
  border-color: var(--gold);
  background: var(--panel-2);
  outline: none;
}
.tile:active {
  transform: scale(0.97);
}
/* Placeholder until each team has artwork; an <img> can replace the text. */
.tile-art {
  width: 56%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--gold);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: 1px;
  overflow: hidden;
}
.tile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Single-colour SVG used as a mask so it takes the tile's gold. */
.tile-icon {
  width: 68%;
  height: 68%;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.tile-name {
  font-weight: 600;
  font-size: var(--fs-md);
  line-height: 1.2;
}
@media (max-width: 480px) {
  .tile-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .tile-art {
    font-size: var(--fs-xl);
  }
}

.roster-fixed {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
}
.roster-icon {
  display: inline-block;
  width: 1.4em;
  height: 1.4em;
  margin-right: 6px;
  vertical-align: -0.35em;
  background: var(--gold);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
/* A team without roster artwork: a small shield with its initial, in the logo's place. */
.crest {
  display: inline-grid;
  place-items: center;
  /* Sized in its own (smaller) font: 1.75em x 2em is about a roster icon's 1.4em. */
  width: 1.75em;
  height: 2em;
  margin-right: 8px;
  padding-bottom: 0.4em;
  vertical-align: -0.5em;
  background: var(--line-strong);
  color: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 64%, 50% 100%, 0 64%);
  font: 700 0.8em / 1 var(--font-display);
}
/* On the turf, logos are chalk white: gold is too faint on green in light mode. */
.turf .roster-icon,
.match-banner .roster-icon {
  background: var(--on-pitch);
}
.turf .crest,
.match-banner .crest {
  background: var(--on-pitch);
  color: var(--pitch);
}

/* ---------------- Layout ---------------- */

.build-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#view-builder {
  max-width: 960px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.panel h2 {
  font: 600 var(--fs-lg) / 1.1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  margin-bottom: 12px;
}
.panel h2:not(:first-child) {
  margin-top: 22px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.panel-head h2 {
  margin-bottom: 10px;
}
/* A button beside the heading (a round's Pair round N) is only as wide as its text. */
.panel-head > .btn {
  flex: none;
}
/* A match side's team name opens its team page, like the banner's. */
.link.side-team {
  font: inherit;
  color: inherit;
  text-align: left;
}
.link.side-team:hover {
  color: var(--gold);
}
/* Header strip: the panel's first heading becomes a band across the top. Main screens
   only (Teams, Matches, Leagues, Tourneys, Team Builder). */
.panel--strip > .panel-head:first-child,
.panel--strip > h2:first-child,
.panel--strip > .collapse-head:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: -14px -14px 14px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--panel-2) 55%, var(--panel));
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.panel--strip > .panel-head:first-child {
  flex-wrap: wrap;
  padding-block: 6px;
}
.panel--strip > .panel-head:first-child h2 {
  margin: 0;
  flex: 1;
}
.panel--strip > h2:first-child {
  color: var(--ink-dim);
}
/* A button doesn't stretch into the negative margins on its own. */
.panel--strip > .collapse-head:first-child {
  width: calc(100% + 28px);
}
/* A folded panel is just its strip. */
.panel--strip > .collapse-head[aria-expanded='false']:first-child {
  margin-bottom: -14px;
  border-bottom: 0;
  border-radius: var(--radius);
}
.panel--strip > .panel-head:first-child #teamSearch {
  margin: 0;
}
#teamSearch {
  width: min(260px, 100%);
  margin-bottom: 10px;
}
.count {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.empty {
  color: var(--ink-faint);
  font-size: var(--fs-sm);
  text-align: center;
  padding: 22px 8px;
  margin: 0;
}

/* ---------------- Position cards ---------------- */

.position-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.collapse-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}
.collapse-head h2 {
  margin: 0 !important;
  flex: 1;
}
.panel-icon {
  color: var(--gold);
  margin-right: 8px;
}
svg.panel-icon {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
}
.panel-icon--money {
  color: var(--go);
}
.collapse-hint {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
}
.chev {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-faint);
  border-bottom: 2px solid var(--ink-faint);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s;
  align-self: center;
}
.collapse-head[aria-expanded='true'] .chev {
  transform: translateY(1px) rotate(225deg);
}
.collapse-head:hover .collapse-hint {
  color: var(--gold);
}
#hireBody,
.collapse-body {
  margin-top: 12px;
}
.collapse-head .count.is-over {
  color: var(--warn);
}

/* ---------------- Star Players in the builder ---------------- */

.star-pick-search {
  background: var(--panel-2);
  width: 100%;
  margin-bottom: 10px;
}
.star-pick-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
#starsHired:not(:empty) {
  margin-bottom: 8px;
}
.star-pick {
  cursor: default;
}
.star-pick.is-hired {
  border-color: var(--gold);
}
.star-pick.is-full {
  opacity: 0.55;
}
.pos-stats.pos-stats--five {
  grid-template-columns: repeat(5, 2.8em);
}
.pos-stats.pos-stats--five > span:nth-child(6n) {
  text-align: center;
  padding-left: 0;
}
.star-pick-pair,
.star-pick-rules {
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}
.star-pick-member {
  grid-column: 1 / -1;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-top: 4px;
}
.star-pick-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.star-pick-foot .pos-taken {
  grid-column: auto;
}

.pos {
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  color: var(--ink);
  font: inherit;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
}
.pos:hover:not(:disabled) {
  border-color: var(--gold);
}
.pos:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.pos-name {
  font-weight: 600;
  font-size: var(--fs-md);
}
.pos-cost {
  font-size: var(--fs-sm);
  color: var(--gold);
}
.pos-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, 2.8em) auto;
  justify-content: start;
  margin: 2px 0;
  font-size: var(--fs-sm);
  color: var(--ink);
  text-align: center;
}
.pos-stats > span {
  padding: 1px 0;
}
.pos-stats > span:nth-child(6n) {
  text-align: left;
  padding-left: 0.6em;
  white-space: nowrap;
}
.pos-stats .h {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--line);
}
.pos-skills {
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.skill-chip {
  --cat: var(--ink-faint);
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--cat) 55%, transparent);
  background: color-mix(in srgb, var(--cat) 16%, transparent);
  color: color-mix(in srgb, var(--cat) 70%, var(--ink));
  font-size: var(--fs-xs);
  line-height: 1.5;
  white-space: nowrap;
}
.pos-taken {
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}
.pos-taken.is-full {
  color: var(--warn);
}

.roster-rules {
  margin: 12px 0 0;
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* ---------------- Squad table ---------------- */

.squad-head,
.squad-row {
  display: grid;
  grid-template-columns:
    68px minmax(110px, 1.3fr) minmax(110px, 1.1fr)
    30px 30px 32px 32px 34px minmax(120px, 1.5fr) 62px;
  gap: 8px;
  align-items: center;
}
.squad-head {
  font: 600 12px / 1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  padding: 0 6px 9px;
  border-bottom: 2px solid var(--line-strong);
}
.squad-head .stat,
.squad-head .num {
  text-align: right;
}

.squad-list {
  display: flex;
  flex-direction: column;
}
.squad-row {
  padding: 6px;
  border-bottom: 1px solid var(--line);
}
.squad-row {
  cursor: pointer;
}
.squad-row:hover {
  background: var(--panel-2);
}
.squad-row:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}
.squad-row .name-label {
  font-size: var(--fs-md);
  padding: 0 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.squad-row .name-label.is-blank {
  color: var(--ink-faint);
  font-style: italic;
}
.squad-row input {
  padding: 5px 7px;
  font-size: var(--fs-md);
  background: transparent;
  border-color: transparent;
}
.squad-row input:hover {
  border-color: var(--line);
}
.squad-row .num-input {
  text-align: center;
  min-width: 0;
}
.num-cell {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.drag-handle {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 28px;
  color: var(--ink-faint);
  cursor: grab;
  touch-action: none; /* a drag on the handle moves the row, not the page */
  border-radius: var(--radius-sm);
}
.drag-handle:hover,
.drag-handle:focus-visible {
  color: var(--ink);
  background: var(--panel-2);
}
.drag-handle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}
.squad-list.is-sorting,
.squad-list.is-sorting * {
  cursor: grabbing !important;
  user-select: none;
}
.squad-list.is-sorting .squad-row {
  transition: transform 0.15s ease;
}
.squad-list.is-sorting .squad-row.is-dragging {
  transition: none;
  position: relative;
  z-index: 2;
  background: var(--panel-2);
  box-shadow: 0 6px 18px var(--shadow);
}
/* MA ST AG PA AV as one joined box, like the paper roster sheet. On desktop it spans the
   five stat columns of the row (subgrid), so it lines up with the header. */
.squad-row .squad-stats {
  grid-column: span 5;
  display: grid;
  grid-template-columns: subgrid;
  column-gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.squad-row .squad-stats .stat {
  padding: 3px 0;
  text-align: center;
  font: 600 var(--fs-lg) / 1.2 var(--font-display);
}
.squad-row .squad-stats .stat + .stat {
  border-left: 1px solid var(--line);
}
.squad-row .pos-label {
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.squad-head .stat {
  text-align: center;
}
.squad-row .skills {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  line-height: 1.35;
}
.squad-row .cost {
  text-align: right;
  font-size: var(--fs-sm);
  color: var(--gold);
}
.squad-row.is-big .pos-label {
  color: var(--gold);
}

/* Sevens: the Veteran badge, "Make Veteran" on other Linemen, changed stats. */
.vet-slot {
  display: block;
}
.vet-slot:empty {
  display: none;
}
.vet-badge,
.vet-make {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 2px 8px 2px 6px;
  border-radius: 99px;
  font: inherit;
  font-size: var(--fs-xs);
  line-height: 1.5;
  cursor: pointer;
}
.vet-badge {
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent);
  color: var(--gold);
}
.vet-badge small {
  color: var(--ink-dim);
  font-size: var(--fs-xs);
}
.vet-badge .icon {
  width: 13px;
  height: 13px;
}
.vet-badge:disabled {
  cursor: default;
}
.vet-make {
  background: none;
  border: 1px dashed var(--line);
  color: var(--ink-faint);
}
.vet-make:hover {
  border-color: var(--gold);
  color: var(--ink);
}
.squad-row .stat.is-changed {
  color: var(--warn);
}
#squadCount {
  margin-left: auto;
}
.nl-count {
  padding-left: 12px;
}
.nl-count.is-over {
  color: var(--warn);
}

/* Hired Star Players: on the roster like anyone else, picked in Star Players. */
.squad-row.is-star .pos-label {
  color: var(--gold);
}
.squad-row .star-badge {
  display: flex;
  justify-content: center;
  color: var(--gold);
  font-size: var(--fs-lg);
}
.squad-row .squad-rule {
  font-style: italic;
}
.star-pick.is-flash {
  animation: star-flash 1.2s ease-out;
}
@keyframes star-flash {
  from {
    box-shadow: 0 0 0 2px var(--gold);
  }
  to {
    box-shadow: 0 0 0 2px transparent;
  }
}

.drop {
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: var(--fs-lg);
  line-height: 1;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
}
.drop:hover {
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 12%, transparent);
}

/* ---------------- Ledger ---------------- */

.money {
  font-variant-numeric: tabular-nums;
}
.money-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
.money-row span:last-child,
.money-row strong {
  color: var(--ink);
}
.money-row--big {
  font-size: var(--fs-md);
  margin-bottom: 8px;
}
.money-row--big strong {
  font-size: var(--fs-xl);
  color: var(--gold);
}
.money-row--big.is-over strong {
  color: var(--bad);
}
.money-row--total {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 6px;
  color: var(--ink);
}
.money-row--tv {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 8px;
  color: var(--ink);
}
.money-row--tv strong {
  font-size: var(--fs-lg);
}

.bar {
  height: 8px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
}
/* Where the money went: players, staff & fans, inducements, other (bought skills). */
.bar-fill {
  display: flex;
  gap: 2px;
  height: 100%;
  width: 0;
  transition: width 0.15s ease;
}
.bar-fill span {
  flex: 0 1 0;
  min-width: 0;
}
.bar-players {
  background: var(--primary);
}
.bar-staff {
  background: color-mix(in srgb, var(--primary) 50%, var(--panel-2));
}
.bar-ind {
  background: var(--info);
}
.bar-other {
  background: var(--gold);
}
.bar-fill.is-over span {
  background: var(--bad);
}
/* The treasury cells carry the bar's colour key. */
:is(.tstat--players, .tstat--staff, .tstat--ind) .tstat-h::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 2px;
  vertical-align: 0;
}
.tstat--players .tstat-h::before {
  background: var(--primary);
}
.tstat--staff .tstat-h::before {
  background: color-mix(in srgb, var(--primary) 50%, var(--panel-2));
}
.tstat--ind .tstat-h::before {
  background: var(--info);
}

.steppers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px 28px;
}
.stepper {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.stepper-label {
  font-size: var(--fs-md);
}
.stepper-label small {
  display: block;
  color: var(--ink-faint);
  font-size: var(--fs-xs);
}
.stepper-ctrl {
  display: flex;
  align-items: center;
  gap: 2px;
}
.stepper-ctrl button {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  cursor: pointer;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  line-height: 1;
}
.stepper-ctrl button:hover:not(:disabled) {
  border-color: var(--gold);
}
.stepper-ctrl button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.stepper-ctrl output {
  width: 26px;
  text-align: center;
  font-size: var(--fs-md);
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.toggle input {
  width: auto;
}

/* ---------------- Issues ---------------- */

.issues {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.issue {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  font-size: var(--fs-sm);
  line-height: 1.45;
  padding: 7px 9px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border-left: 3px solid var(--line);
}
.issue--error {
  border-left-color: var(--bad);
}
.issue--warning {
  border-left-color: var(--warn);
}
.issue--ok {
  border-left-color: var(--go);
}
.issue-mark {
  font-weight: 700;
}
.issue--error .issue-mark {
  color: var(--bad);
}
.issue--warning .issue-mark {
  color: var(--warn);
}
.issue--ok .issue-mark {
  color: var(--go);
}

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

/* The floating team bar on a team's Record and Edit pages: always in reach, at the bottom
   (over the phone nav when that's at the bottom too). */
.team-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--nav-lift, 0px);
  z-index: 25;
  padding: 6px 12px;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px var(--shadow);
}
:root[data-nav='bottom'] .team-bar {
  padding-bottom: 6px;
}
.team-bar-in {
  display: flex;
  gap: 6px;
  max-width: 760px;
  margin: 0 auto;
}
.tb-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
}
.tb-btn:hover:not(:disabled) {
  color: var(--ink);
  background: var(--panel-2);
}
.tb-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tb-btn.is-on {
  color: var(--go);
  background: var(--panel-2);
  border-color: var(--line);
}
.tb-btn--go {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.tb-btn--go:hover:not(:disabled) {
  color: var(--on-primary);
  background: var(--primary);
  filter: brightness(1.08);
}
.tb-icon {
  width: 20px;
  height: 20px;
  flex: none;
}
.tb-more {
  position: relative;
  flex: 1;
  display: flex;
  min-width: 0;
}
.tb-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 190px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px var(--shadow);
}
.tb-menu.hidden {
  display: none;
}
.tb-menu button {
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
}
.tb-menu button:hover {
  background: var(--panel);
}
.tb-menu button.is-bad {
  color: var(--bad);
}
/* Room under the page for the bar, and toasts above it. */
#view-builder,
#view-record {
  padding-bottom: 96px;
}
:root:has(#view-builder:not(.hidden)),
:root:has(#view-record:not(.hidden)) {
  --toast-lift: calc(var(--nav-lift, 0px) + 60px);
}
@media (max-width: 640px) {
  .team-bar {
    padding-left: 6px;
    padding-right: 6px;
  }
  .team-bar-in {
    gap: 2px;
  }
  .tb-btn {
    flex-direction: column;
    gap: 3px;
    padding: 5px 2px;
    font-size: 11px;
    letter-spacing: 0.02em;
  }
  .tb-icon {
    width: 22px;
    height: 22px;
  }
}

.actions {
  display: flex;
  gap: 8px;
}
.panel--treasury {
  padding: 10px 12px;
}
.tstats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px 14px;
  align-items: end;
  margin-bottom: 4px;
}
.tstat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.tstat-h {
  font: 600 12px / 1.2 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.tstat > :last-child {
  font: 600 var(--fs-xl) / 1.1 var(--font-display);
  color: var(--ink);
}
/* Remaining is the number you build against: the scoreboard figure. */
.tstat--remaining > strong {
  font-size: 40px;
  line-height: 1;
  color: var(--gold);
}
.tstat--remaining.is-over > strong {
  color: var(--bad);
}
/* Phones: two columns' room, so a seven-figure budget ("1,150k") doesn't run into Players. */
@media (max-width: 640px) {
  .tstat--remaining {
    grid-column: span 2;
  }
}
/* Condensed treasury: fixed under the sticky top bar, slides in on scroll. */
.mini-treasury {
  position: fixed;
  top: var(--topbar-h, 59px);
  left: 0;
  right: 0;
  z-index: 19;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 16px var(--shadow);
  transform: translateY(-110%);
  visibility: hidden;
  transition:
    transform 0.18s ease,
    visibility 0s linear 0.18s;
}
.mini-treasury.is-shown {
  transform: none;
  visibility: visible;
  transition: transform 0.18s ease;
}
@media (prefers-reduced-motion: reduce) {
  .mini-treasury,
  .mini-treasury.is-shown {
    transition: none;
  }
}
.mini-inner {
  display: flex;
  align-items: baseline;
  gap: 8px 22px;
  width: 100%;
  max-width: 960px; /* matches #view-builder */
  margin: 0 auto;
  padding: 8px 20px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  font-variant-numeric: tabular-nums;
}
.mini-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.mini-h {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-faint);
}
.mini-stat > :last-child {
  font-size: var(--fs-md);
  color: var(--ink);
}
.mini-stat--remaining > strong {
  font-size: var(--fs-lg);
  color: var(--gold);
}
.mini-stat.is-over > :last-child {
  color: var(--bad);
}
.mini-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: var(--fs-sm);
  align-self: center;
}
.mini-status--error {
  font-size: var(--fs-md);
  font-weight: 600;
}
.mini-status--ok {
  color: var(--go);
}
.mini-status--error {
  color: var(--bad);
}
@media (max-width: 640px) {
  .mini-inner {
    gap: 6px 14px;
    padding: 7px 16px;
  }
  .mini-h {
    font-size: 9px;
  }
  .mini-tier {
    display: none;
  }
}

.panel--treasury .bar {
  margin: 8px 0 0;
  height: 4px;
}
.panel--treasury .issues:not(:empty) {
  margin-top: 8px;
}
.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1.2;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--ink);
}
.btn:hover:not(:disabled) {
  border-color: var(--ink-faint);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
/* The main action on a screen: one per view. */
.btn--go {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.btn--go:hover:not(:disabled) {
  filter: brightness(1.08);
  border-color: var(--primary);
}
.btn--ghost {
  background: transparent;
}
.btn--ghost:hover:not(:disabled) {
  background: var(--panel-2);
}
.btn--quiet {
  width: 100%;
  margin-top: 8px;
  background: none;
  border-color: transparent;
  color: var(--ink-faint);
  font-size: var(--fs-sm);
}
.btn--quiet:hover:not(:disabled) {
  color: var(--bad);
  border-color: transparent;
}

/* ---------------- Saved teams ---------------- */

.remove-coach-blocked {
  margin: 0 0 8px 26px;
  padding: 0;
  font-size: var(--fs-sm);
  color: var(--ink-faint);
}
.hint.remove-coach-warn {
  color: var(--warn);
}
.team-coach-filter {
  margin-bottom: 8px;
}
.team-list {
  display: flex;
  flex-direction: column;
}
.team-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 11px 6px;
  border-bottom: 1px solid var(--line);
}
.team-row:hover {
  background: var(--panel-2);
}
/* Saved Teams: the whole card opens the team. */
.team-row--open {
  cursor: pointer;
}
.team-row--open:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: -2px;
}
.team-row-chev {
  font-size: 22px;
  line-height: 1;
  color: var(--ink-faint);
}
@media (max-width: 640px) {
  .team-row--open {
    grid-template-columns: 1fr auto auto;
    gap: 4px 10px;
  }
  .team-row--open > div:first-child {
    grid-column: 1 / -1;
  }
  .team-row--open .team-row-chev {
    display: none;
  }
  .team-row--open .pill {
    justify-self: start;
  }
}
.team-name {
  font-weight: 600;
}
.team-meta {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
}
.team-stat {
  font-size: var(--fs-sm);
  color: var(--ink-dim);
  text-align: right;
}
/* Badges: tinted tags in condensed caps. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--ink-faint) 15%, transparent);
  color: var(--ink-dim);
  font: 600 12px / 1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  vertical-align: middle;
}
.pill--ready {
  background: color-mix(in srgb, var(--go) 16%, transparent);
  color: var(--go);
}
.pill--sevens {
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  color: var(--gold);
  vertical-align: middle;
}
.team-row .btn {
  flex: none;
  min-height: 30px;
  padding: 4px 11px;
  font-size: var(--fs-sm);
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: calc(22px + var(--toast-lift, 0px));
  left: 50%;
  transform: translate(-50%, calc(100% + 40px + var(--toast-lift, 0px)));
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: var(--fs-md);
  box-shadow: 0 8px 26px var(--shadow);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
  z-index: 50;
}
.toast.is-up {
  transform: translate(-50%, 0);
}
.toast.is-bad {
  border-color: var(--bad);
}

/* A new version is deployed: above everything, below the top bar. */
.reload-bar {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--gold);
  color: var(--ink);
  padding: 8px 8px 8px 16px;
  border-radius: var(--radius);
  font-size: var(--fs-md);
  box-shadow: 0 8px 26px var(--shadow);
  z-index: 60;
}

/* ---------------- Accounts ---------------- */

/* The account links and the theme toggle, together on the right of the top bar. */
.topbar-end {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: none;
}
.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
  background: none;
  border: 0;
  color: var(--chalk);
  font-size: var(--fs-lg);
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--on-pitch);
  background: rgb(255 255 255 / 0.1);
}
.theme-toggle .icon {
  width: 18px;
  height: 18px;
  vertical-align: 0;
}

/* The account menu: initial, name and a menu of the account's pages. */
.user .tab-menu {
  left: auto;
  right: 0;
}
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 4px;
  border-radius: var(--radius);
  border: 1px solid rgb(255 255 255 / 0.3);
  background: none;
  color: var(--on-pitch);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.user-btn:hover,
.user.is-open .user-btn {
  background: rgb(255 255 255 / 0.1);
}
.avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--on-pitch);
  color: var(--pitch);
  font: 700 14px / 1 var(--font-display);
}
.user-name small {
  margin-left: 6px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--chalk);
}

.link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--ink-faint);
  font: inherit;
  font-size: var(--fs-sm);
}
.link:hover {
  color: var(--ink);
}
.link--bad:hover {
  color: var(--bad);
}

.auth {
  display: grid;
  place-items: start center;
  padding: 10vh 16px 48px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-card h2 {
  font-size: var(--fs-lg);
}
.auth-lede {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
#authFields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#authFields .field {
  flex: none;
}
.auth-error {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--bad);
}
.auth-card .btn {
  flex: none;
}
.auth-back {
  align-self: center;
  font-size: var(--fs-sm);
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: var(--fs-sm);
}
.auth-note {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
/* The sign-up honeypot: off screen for people, still there for bots. */
#setResetContact {
  resize: vertical;
}
.auth-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

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

.landing {
  max-width: 960px;
  margin: 0 auto;
  padding: 8vh 16px 48px;
}
.landing-hero {
  max-width: 620px;
}
.landing-hero h2 {
  font-size: var(--fs-2xl);
  line-height: 1.25;
}
.landing-hero p {
  margin: 12px 0 20px;
  color: var(--ink-dim);
  font-size: var(--fs-lg);
}
.landing-hero .btn {
  flex: none;
  padding: 10px 22px;
}
.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Guests: trying the builder without an account (guest.js). */
.guest-banner {
  margin: 0;
  padding: 8px 16px;
  font-size: var(--fs-sm);
  text-align: center;
  color: var(--ink);
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
}
/* "Edit coach details" in a line of text (team record) */
.link--inline {
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* a second switch under a hint (Site settings) */
.hint + .check {
  margin-top: 14px;
}
#guestTeamsPanel + #accountTeamsPanel,
#accountTeamsPanel + #guestTeamsPanel {
  margin-top: 16px;
}
.landing-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-top: 40px;
}
.landing-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.landing-card h3 {
  margin: 0 0 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}
.landing-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.landing-list strong {
  display: block;
  font-weight: 600;
}
.landing-list p {
  margin: 2px 0 0;
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
.landing-date {
  display: block;
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.landing-contact {
  margin: 28px 0 0;
  color: var(--ink-dim);
  font-size: var(--fs-md);
}
.landing-contact a {
  color: var(--gold);
}
.landing-version {
  margin: 8px 0 0;
  color: var(--ink-faint);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

/* Landing page editor (Coaches tab), reusing the star editor's layout. */
.news-editor textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 10px;
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--fs-md);
  width: 100%;
  resize: vertical;
}
.news-editor textarea:focus {
  outline: 2px solid var(--gold);
  outline-offset: -1px;
}
.news-editor .field {
  flex: none;
}
.ne-top {
  flex-wrap: wrap;
}
.ne-top input[type='date'] {
  flex: 0 0 150px;
  width: auto;
}
.ne-top input[type='text'] {
  flex: 1 1 160px;
  width: auto;
  font-weight: 600;
}
.ne-moves {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.ne-moves .btn {
  min-width: 30px;
}
@media (max-width: 640px) {
  .ne-top input[type='text'] {
    order: 3;
    flex-basis: 100%;
  }
}
@media (max-width: 960px) {
  .landing {
    padding-top: 32px;
  }
  .landing-grid {
    grid-template-columns: 1fr;
    margin-top: 28px;
  }
}

.note--action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.note {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  color: var(--ink);
}
/* Matched Play: drafting in the builder for a match, and the lobby's Draft step. */
.lobby-cell .confirm-actions .btn {
  white-space: nowrap;
}
.matched-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.coach-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 960px) {
  .coach-layout {
    grid-template-columns: 1fr;
  }
}

.coach-list,
.invite-list {
  display: flex;
  flex-direction: column;
}
.coach-row,
.invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 14px;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
}
.coach-row:hover,
.invite-row:hover {
  background: var(--panel-2);
}
.coach-meta {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}
.pill--admin {
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  color: var(--gold);
}
.pill--none {
  background: none;
  border: 1px dashed var(--line);
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.inline-form .btn {
  flex: none;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .inline-form {
    flex-direction: column;
  }
}
.ex-enter-hint {
  margin: 6px 0 0;
}
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stack-form .field {
  flex: none;
}
.stack-form > .btn {
  flex: none;
}
.hint {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  margin: 10px 0 0;
}

.fresh-link {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--go) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--go) 40%, transparent);
}
.fresh-link p:first-child {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
}
.copy-row {
  display: flex;
  gap: 8px;
}
.copy-row input {
  font-family: var(--mono);
  font-size: var(--fs-sm);
}
.copy-row .btn {
  flex: none;
}

.dialog {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  width: min(360px, calc(100vw - 32px));
}
.dialog::backdrop {
  background: var(--scrim);
}
.dialog h2 {
  font-size: var(--fs-lg);
}

/* Phones: squad rows become cards, steppers get bigger touch targets. */
/* Tablets and phones: the squad table doesn't fit, so each player is a small card. */
@media (max-width: 960px) {
  .squad-head {
    display: none;
  }
  .squad-row {
    grid-template-columns: 72px minmax(0, 1fr) auto;
    grid-template-areas:
      'num name name'
      'pos pos cost'
      'stats stats stats'
      'skills skills skills';
    gap: 6px 8px;
    padding: 10px 6px;
  }
  .squad-row .num-cell,
  .squad-row .star-badge {
    grid-area: num;
  }
  .drag-handle {
    width: 26px;
    height: 34px;
  }
  .squad-row .name-label {
    grid-area: name;
    font-weight: 500;
  }
  .squad-row .pos-label {
    grid-area: pos;
    padding-left: 7px;
  }
  .squad-row .cost {
    grid-area: cost;
  }
  .squad-row .squad-stats {
    grid-area: stats;
    grid-template-columns: repeat(5, 1fr);
    max-width: 360px;
    margin-left: 7px;
  }
  .squad-row .squad-stats .stat {
    padding: 4px 0;
  }
  .squad-row .squad-stats .stat::before {
    content: attr(data-l);
    display: block;
    font: 600 10px / 1.2 var(--font-display);
    color: var(--ink-faint);
    letter-spacing: 0.08em;
  }
  .squad-row .skills {
    grid-area: skills;
    padding-left: 7px;
  }
  .squad-row input {
    border-color: var(--line);
  }
}
@media (max-width: 640px) {
  .position-list,
  .star-pick-list {
    grid-template-columns: 1fr;
  }
  .stepper-ctrl button {
    width: 36px;
    height: 36px;
  }
  .stepper-ctrl output {
    width: 30px;
  }
  #apoth {
    width: 22px;
    height: 22px;
  }
}

/* Viewing someone else's team: everything visible, nothing clickable. */
.is-readonly .star-pick {
  pointer-events: auto;
  opacity: 1;
}
.is-readonly .star-pick-btn {
  display: none;
}
.is-readonly .pos,
.is-readonly .stepper-ctrl button,
.is-readonly .drop,
.is-readonly .squad-row input,
.is-readonly #apoth,
.is-readonly .setup :is(input, select) {
  pointer-events: none;
}
.is-readonly .pos {
  opacity: 0.6;
}
.is-readonly :is(#teamNameDice, #changeRoster, #saveTeam) {
  display: none;
}

/* ---------------- Matches ---------------- */

.match-row {
  grid-template-columns: 1fr auto auto auto;
}
/* Phones: names across the full width, then score, status and Open beneath. */
@media (max-width: 640px) {
  .match-row {
    grid-template-columns: auto 1fr auto;
    gap: 6px 12px;
  }
  .match-row > :first-child {
    grid-column: 1 / -1;
  }
  .match-row .score {
    text-align: left;
    min-width: 0;
  }
  .match-row .pill {
    justify-self: end;
  }
}
/* Matches list: Current / Past, Mine only, and the coach or team search. */
.match-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 4px 0 10px;
}
.match-filters input[type='search'] {
  flex: 1 1 180px;
  min-width: 0;
}
/* Team and coach names in a match row: tapping one searches for it. */
.match-find {
  font: inherit;
  color: inherit;
  padding: 0;
  text-align: left;
}
.match-find:hover {
  color: var(--gold);
}
#matchMore {
  margin-top: 10px;
}
.vs {
  color: var(--ink-faint);
  font-weight: 400;
  margin: 0 4px;
}
.score {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  color: var(--gold);
  min-width: 44px;
  text-align: center;
}
.team-row .row-actions {
  display: flex;
  gap: 6px;
}
/* Round 1 seed, for organisers before the draw (Linear REY-74). */
.tn-seed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.tn-seed input {
  width: 4em;
}
@media (max-width: 640px) {
  .tn-seed span {
    display: none;
  }
  .tn-seed input {
    padding-inline: 6px;
  }
}

.match-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.match-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 16px;
}

/* The scoreboard: on the turf, like a league or tourney header. */
.match-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.banner-team {
  display: flex;
  flex-direction: column;
}
.banner-team--away {
  align-items: flex-end;
  text-align: right;
}
.banner-name {
  font: 700 var(--fs-xl) / 1.1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--on-pitch);
  text-align: inherit;
}
.banner-name:hover {
  color: var(--chalk);
}
.banner-team small {
  color: var(--chalk);
  font-size: var(--fs-sm);
}
.banner-score {
  font: 700 44px / 1 var(--font-display);
  color: var(--on-pitch);
  white-space: nowrap;
}
/* Phones: each team is a centred column, logo over name over coach (REY-88). */
@media (max-width: 640px) {
  .match-banner {
    gap: 10px;
    padding: 14px 12px;
    align-items: start;
  }
  .banner-team,
  .banner-team--away {
    align-items: center;
    text-align: center;
    min-width: 0;
  }
  .banner-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    overflow-wrap: anywhere;
  }
  .banner-name .roster-icon,
  .banner-team--away .banner-name .roster-icon {
    order: -1;
    margin: 0;
  }
  .banner-name.is-long {
    font-size: var(--fs-lg);
  }
  .banner-name.is-longer {
    font-size: var(--fs-md);
  }
  .banner-score {
    font-size: 36px;
    align-self: center;
  }
}
.banner-status {
  grid-column: 1 / -1;
  margin: 0;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--chalk);
}
.banner-code {
  grid-column: 1 / -1;
  margin: 0;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--chalk);
}
.banner-code strong {
  color: var(--on-pitch);
  letter-spacing: 0.12em;
  margin-right: 6px;
}
.banner-code .link {
  color: var(--chalk);
  margin-left: 6px;
}
.match-banner .pill {
  background: rgb(255 255 255 / 0.14);
  color: var(--on-pitch);
}

.match-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 960px) {
  .match-sides {
    grid-template-columns: minmax(0, 1fr);
  }
}

.half-top {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  margin-bottom: 12px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: var(--fs-md);
  padding-bottom: 8px;
}
.check input {
  width: auto;
}
.check small {
  color: var(--ink-faint);
}
/* A checkbox under a field's title, above its input (elite skill cap). */
.check--in-field {
  padding-bottom: 0;
  font-size: var(--fs-sm);
}

.add-events {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chip {
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 5px 11px;
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.chip:hover {
  border-color: var(--ink-faint);
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.event-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--panel-2);
}
.event-row:has(select[data-f='outcome']) {
  grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1fr) auto;
}
.event-row:has(select[data-f='detail']) {
  grid-template-columns: 130px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.8fr) auto;
}
.event-kind {
  font-size: var(--fs-sm);
  font-weight: 500;
}
.event-row select {
  padding: 5px 7px;
  font-size: var(--fs-sm);
}
@media (max-width: 640px) {
  .event-row,
  .event-row:has(select[data-f='outcome']),
  .event-row:has(select[data-f='detail']) {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .event-row select {
    grid-column: 1 / -1;
  }
  .event-row .drop {
    grid-column: 2;
    grid-row: 1;
  }
}

.half-summary .money-row span:last-child {
  font-family: inherit;
}
.summary-events {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-sm);
  padding: 3px 0;
}
.summary-line .ev-what {
  flex: 1;
  color: var(--ink-dim);
}
/* An event's match time (REY-131), before what happened. */
.ev-time {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.postgame {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.postgame .btn {
  width: 100%;
  margin-top: 12px;
}
.roll-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-md);
  padding: 6px 0;
}
.roll-row select {
  width: 76px;
}
.roll-row small {
  color: var(--ink-faint);
}
.roll-result {
  margin: 0 0 6px;
  font-size: var(--fs-sm);
  color: var(--gold);
  text-align: right;
}

/* Live matches: the lobby, the live columns and the end bar. */

.pill--live {
  background: color-mix(in srgb, var(--go) 16%, transparent);
  color: var(--go);
}
/* The match timer (Linear REY-78). */
.banner-timer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: -8px 0 0;
  color: var(--chalk);
  font: 600 var(--fs-md) / 1 var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.banner-weather {
  grid-column: 1 / -1;
  margin: 0;
  text-align: center;
  font-size: var(--fs-md);
}
.banner-weather span {
  color: var(--chalk);
}

.lobby-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lobby-step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.lobby-step.is-current {
  border-color: var(--primary);
}
.lobby-step.is-todo {
  opacity: 0.55;
}
.lobby-step-head {
  display: grid;
  grid-template-columns: 26px auto 1fr;
  gap: 10px;
  align-items: baseline;
}
.lobby-step-head h3 {
  margin: 0;
  font-size: var(--fs-md);
}
.lobby-step-head small {
  color: var(--ink-faint);
  font-size: var(--fs-sm);
}
.lobby-step-num {
  font-family: var(--font-display);
  color: var(--primary);
  text-align: center;
}
.lobby-step.is-done .lobby-step-num {
  color: var(--go);
}
/* Done, but neither team took any (no journeymen, no inducements): a grey cross. */
.lobby-step.is-skipped .lobby-step-num {
  color: var(--ink-faint);
}
.lobby-cells {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
/* A sub-roll in the lobby's Weather or Stadium step (docs/plans/stadium-tables.md). */
.lobby-sub {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 10px;
  border: 1px dashed var(--gold);
  border-radius: var(--radius);
}
.lobby-sub p {
  margin: 0;
}
.lobby-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.lobby-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px;
  min-width: 0;
}
.lobby-cell-team {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-faint);
}
button.lobby-cell-team {
  text-align: left;
}
button.lobby-cell-team:hover {
  color: var(--ink);
}
.lobby-cell .hint {
  margin: 0;
}
.lobby-cell .stepper-ctrl output {
  font-size: var(--fs-md);
}
.ok {
  color: var(--go);
}
.roll-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
}
.roll-pick select {
  width: 76px;
}
/* Dice share the width they're given (six D6 faces fit a phone), up to 44px each. */
.die-btns {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 44px);
  gap: 6px;
  min-width: 0;
}
/* The Casualty roll: 16 faces, two rows of numbers under the label. */
.roll-pick--wide {
  flex-wrap: wrap;
}
.num-btns {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 40px));
  gap: 6px;
}
.num-btn {
  height: 40px;
  padding: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font: 600 var(--fs-md) / 1 var(--font-display);
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line);
}
.num-btn:hover {
  color: var(--ink);
}
.num-btn[aria-pressed='true'] {
  color: var(--gold);
  border-color: var(--gold);
}
.die-btn {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--fs-2xl);
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line);
}
.die-btn:hover {
  color: var(--ink);
}
.die-btn[aria-pressed='true'] {
  color: var(--gold);
  border-color: var(--gold);
}
.picks {
  margin: 0;
  padding-left: 18px;
  font-size: var(--fs-md);
}
.induce {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.star-picks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.induce-purse {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.induce-purse > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Labels at the top, amounts at the bottom: a label on two lines ("Petty cash") keeps the
     figures in line. */
  justify-content: space-between;
  gap: 2px;
  padding: 6px 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.induce-purse span {
  text-align: center;
  font-size: var(--fs-xs);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.induce-purse b {
  font-size: var(--fs-lg);
  color: var(--gold);
}
.induce-purse .is-over b {
  color: var(--bad);
}
.induce-purse + .hint {
  margin-top: -2px;
}
.star-browse > summary {
  cursor: pointer;
  padding: 6px 0;
  font-size: var(--fs-md);
  color: var(--gold);
}
.star-browse[open] > summary {
  margin-bottom: 6px;
}
.star-picks .star-pick-search {
  margin: 2px 0 0;
}
.star-picks .pos-name {
  text-align: left;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink);
}
.star-picks .hint {
  margin: 0;
}
.induce .problem {
  margin: 0;
  color: var(--bad);
  font-size: var(--fs-sm);
}

.weather-panel,
.extra-time-note,
.penalties-panel,
.end-bar {
  grid-column: 1 / -1;
}
.weather-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.weather-now {
  display: flex;
  flex-direction: column;
}
.weather-now small {
  color: var(--ink-faint);
  font-size: var(--fs-sm);
}
.weather-add {
  display: flex;
  gap: 6px;
  align-items: center;
}
.weather-add select {
  width: auto;
}
.weather-list {
  flex-basis: 100%;
  margin: 0;
  padding-left: 18px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.weather-list .drop {
  margin-left: 6px;
}
.kickoff-list {
  margin: 0;
  padding-left: 18px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.kickoff-list .drop {
  margin-left: 6px;
}
/* A kick-off reads as text; a tap shows what it does underneath. */
.kickoff-item {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.kickoff-item:hover,
.kickoff-item[aria-expanded='true'] {
  color: var(--ink);
}
.kickoff-effect {
  display: block;
  margin: 2px 0 4px;
  color: var(--ink-faint);
}
/* The kick-off button and list, under the weather. */
.ko-block {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ko-add {
  display: flex;
}
.ko-label {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
}
.kickoff-dice select {
  width: 64px;
}
.kickoff-result {
  border-left: 3px solid var(--gold);
  padding-left: 10px;
}
.kickoff-result p {
  margin: 2px 0 0;
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
.side-tds {
  font-size: var(--fs-xl);
  color: var(--gold);
}
.chip.is-on {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--panel-2));
  color: var(--ink);
}
.event-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 12px;
}
.event-form select {
  flex: 1 1 160px;
  min-width: 0;
  padding: 5px 7px;
  font-size: var(--fs-sm);
}
.event-form-note {
  flex: 1 1 100%;
  color: var(--ink-dim);
}
.event-form .roll-pick {
  white-space: nowrap;
}
.event-form .roll-pick select {
  flex: 0 0 76px;
}
/* In the injury dialog the label sits above the dice, which share the width. */
#eventBody .roll-pick {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  white-space: normal;
}
#eventBody .die-btns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
}
#eventBody .die-btn {
  width: auto;
  height: 44px;
  aspect-ratio: auto;
}
.event-form-btns {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.live-event {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: var(--panel-2);
  font-size: var(--fs-sm);
}
.event-list.is-timed .live-event {
  grid-template-columns: auto 130px minmax(0, 1fr) auto;
}
.end-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.end-line .btn {
  flex: none;
  width: auto;
}
.end-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .lobby-cells {
    grid-template-columns: 1fr;
  }
  .lobby-cell.is-mine {
    order: -1;
  }
  .lobby-note {
    order: -2;
  }
  .side.is-first {
    order: -1;
  }
  .weather-panel {
    order: -2;
  }
  /* One line per event: the labels share a column as wide as the longest (up to half the row),
     and the player is cut with "…". */
  .event-list {
    display: grid;
    grid-template-columns: fit-content(50%) minmax(0, 1fr) auto;
  }
  .event-list.is-timed {
    grid-template-columns: auto fit-content(50%) minmax(0, 1fr) auto;
  }
  .live-event,
  .event-list.is-timed .live-event {
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
  }
  .event-list > .empty {
    grid-column: 1 / -1;
  }
  .live-event > .ev-who {
    grid-column: 2;
    color: var(--ink-dim);
  }
  .live-event .drop {
    grid-column: 3;
  }
  .is-timed > .live-event > .ev-who {
    grid-column: 3;
  }
  .is-timed > .live-event .drop {
    grid-column: 4;
  }
  .summary-events {
    display: grid;
    grid-template-columns: fit-content(50%) minmax(0, 1fr);
    column-gap: 12px;
  }
  .summary-line {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: subgrid;
  }
  .summary-events.is-timed {
    grid-template-columns: auto fit-content(50%) minmax(0, 1fr);
  }
  .summary-events > .empty {
    grid-column: 1 / -1;
  }
  .event-kind,
  .summary-line > .ev-what {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ev-who {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .ev-pos {
    display: none;
  }
  .ev-star {
    display: inline;
  }
}
.ev-star {
  display: none;
}

/* ---------------- Team record ---------------- */

.record-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}
.record-name {
  font-size: var(--fs-xl);
}
.record-stats {
  display: flex;
  gap: 26px;
}
.record-stats div {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.record-stats strong {
  font-size: var(--fs-lg);
}
.record-stats small {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.view > .panel + .panel,
#recordBody .panel + .panel {
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
}
.record-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
.record-table th {
  text-align: left;
  font: 600 12px / 1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  padding: 9px 8px;
  border-bottom: 2px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel-2) 55%, var(--panel));
  white-space: nowrap;
}
.record-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.record-table tbody tr:hover td {
  background: color-mix(in srgb, var(--panel-2) 50%, transparent);
}
.record-table .num {
  text-align: right;
}
.record-table .dim {
  color: var(--ink-dim);
}
.record-tap-hint {
  margin: 0 0 12px;
}
/* Each player row opens their card. */
.record-table tr.is-tappable {
  cursor: pointer;
}
.record-table tr.is-tappable:focus-visible td {
  background: var(--panel-2);
  outline: none;
}
.record-table tr.is-tappable:focus-visible td:first-child {
  box-shadow: inset 3px 0 0 var(--link);
}
.record-table tr.is-dead td {
  color: var(--ink-faint);
  text-decoration: line-through;
}
.record-table tr.is-dead td:last-child {
  text-decoration: none;
}

.tag {
  font-size: var(--fs-xs);
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink-dim);
}
.tag--warn {
  border-color: color-mix(in srgb, var(--warn) 50%, transparent);
  color: var(--warn);
}
.tag--bad {
  border-color: color-mix(in srgb, var(--bad) 50%, transparent);
  color: var(--bad);
}

/* ---------------- Progression ---------------- */

.btn--small {
  min-height: 28px;
  padding: 3px 10px;
  font-size: var(--fs-sm);
  flex: none;
}
.btn.is-bad {
  border-color: var(--bad);
  color: var(--bad);
}
.btn.is-on {
  border-color: var(--go);
  color: var(--go);
}
/* Post-game: picking a new Team Captain; Hire & fire: the same, above the squad. */
.captain-pick {
  margin: 12px 0;
}
.captain-pick h3 {
  margin: 0 0 4px;
}
.captain-pick select {
  width: auto;
  flex: 1 1 auto;
  max-width: 60%;
}
.tag--gold {
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
  color: var(--gold);
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.record-actions .btn {
  white-space: nowrap;
}
.record-stats {
  flex-wrap: wrap;
}
/* Phones: a two-column stat sheet, results on the left and money on the right. */
@media (max-width: 640px) {
  .record-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, auto);
    grid-auto-flow: column;
    column-gap: 24px;
    row-gap: 6px;
    width: 100%;
  }
  .record-stats div {
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
  }
  .record-stats strong {
    font-size: var(--fs-md);
  }
  .record-stats .wide-only {
    display: none;
  }
}

.record-table .stat.is-up {
  color: var(--go);
  font-weight: 600;
}
.record-table .stat.is-down {
  color: var(--bad);
}
.record-table .skills-cell {
  white-space: normal;
  min-width: 160px;
  font-size: var(--fs-sm);
}
.record-table small.dim {
  color: var(--ink-faint);
  margin-left: 1px;
}
/* The Record's Players table: position under the name, level stars under that; # and Player stay put while the rest scrolls. */
/* Shorter rows than other record tables, so more players fit on a phone. */
.roster-table td {
  padding-top: 5px;
  padding-bottom: 5px;
}
.roster-name {
  line-height: 1.25;
}
.roster-pos {
  font-size: var(--fs-xs);
  line-height: 1.25;
  color: var(--ink-dim);
}
/* Level stars on their own line under the position, so they don't widen the column (REY-114). */
.roster-table .roster-lvl {
  margin-left: 0;
  font-size: 9px;
  line-height: 1.1;
}
.roster-table th:nth-child(-n + 2),
.roster-table td:nth-child(-n + 2) {
  position: sticky;
  z-index: 1;
}
.roster-table td:nth-child(-n + 2) {
  background: var(--panel);
}
.roster-table th:first-child,
.roster-table td:first-child {
  left: 0;
  box-sizing: border-box;
  width: 36px;
  min-width: 36px;
  max-width: 36px;
}
.roster-table th:nth-child(2),
.roster-table td:nth-child(2) {
  left: 36px;
  box-shadow: inset -1px 0 0 var(--line-strong);
}
.roster-table tbody tr:hover td:nth-child(-n + 2) {
  background: color-mix(in srgb, var(--panel-2) 50%, var(--panel));
}
.roster-table tr.is-star td:nth-child(-n + 2) {
  background: color-mix(in srgb, var(--gold) 5%, var(--panel));
}
.roster-table tr.is-tappable:focus-visible td:nth-child(-n + 2) {
  background: var(--panel-2);
}
@media (max-width: 640px) {
  .roster-name span {
    display: inline-block;
    max-width: 12ch;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
  }
}
.skill {
  color: var(--ink-faint);
}
.skill--gained {
  color: var(--gold);
  font-weight: 600;
}

.tx-row {
  grid-template-columns: 1fr auto auto;
}
/* The Record's History: Hiring and firing starts folded away. */
.tx-log > summary {
  cursor: pointer;
}
.tx-log > summary h2 {
  display: inline;
}
.tx-log[open] > summary {
  margin-bottom: 8px;
}

/* ---------------- Budget dialog ---------------- */

.dialog--budget {
  width: min(480px, calc(100vw - 32px));
}
/* Import a team (start screen's Copy over a team). */
.dialog--import {
  width: min(460px, calc(100vw - 32px));
}
.import-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.import-name {
  margin: 0;
  font-weight: 700;
}
.import-summary {
  margin: 0;
  color: var(--ink-dim);
  line-height: 1.45;
}
.import-summary .ok {
  color: var(--go);
}
.import-summary .off {
  color: var(--warn);
}
.import-notes {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-dim);
  font-size: var(--fs-md);
  line-height: 1.4;
  max-height: 180px;
  overflow: auto;
}
.import-notes:empty {
  display: none;
}
.dialog--confirm {
  width: min(380px, calc(100vw - 32px));
}
.confirm-msg {
  margin: 0;
  line-height: 1.45;
}
.confirm-text {
  margin: 0;
  color: var(--warn);
}
.dialog--confirm .hint {
  margin: 0;
}
.budget-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.budget-sec {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.budget-tabs {
  display: flex;
}
.budget-tabs button {
  flex: 1;
  padding: 7px 8px;
}
@media (max-width: 480px) {
  /* Four tabs: two rows of two on a phone. */
  .budget-tabs {
    flex-wrap: wrap;
  }
  .budget-tabs button {
    flex: 1 1 45%;
  }
}
.budget-summary {
  margin: -6px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.budget-summary b {
  color: var(--gold);
  font-weight: 600;
}
.budget-summary small {
  color: var(--ink-faint);
  margin-left: 4px;
}
.budget-sec input[type='search'] {
  width: 100%;
}
.pkg-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}
.pkg-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pkg-group h4 {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-faint);
}
.pkg-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
}
.pkg-item:hover {
  border-color: var(--ink-faint);
}
.pkg-item.is-on {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}
.pkg-item-name {
  font-size: var(--fs-md);
  font-weight: 500;
}
.pkg-item-meta {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}
.pkg-item--none .pkg-item-name {
  color: var(--ink-dim);
}
.budget-sec h3 {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-dim);
}
.budget-sec .field {
  flex: none;
  min-width: 0;
}
.budget-sec .hint {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.budget-sec .hint.budget-unres-note {
  display: block;
}
.budget-sec .hint .link {
  font-size: inherit;
  text-decoration: underline;
}
.budget-sec .check {
  padding-bottom: 0;
  flex-wrap: wrap;
}
.budget-sec .check small {
  flex-basis: 100%;
  padding-left: 21px;
  margin-top: -6px;
}
.budget-skills {
  border: 0;
  margin: 0;
  padding: 0 0 0 24px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.budget-skills.is-off {
  opacity: 0.4;
}
.budget-modes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  padding: 12px;
  background: var(--panel-2);
  border-radius: var(--radius);
}
.budget-grid .field {
  gap: 4px;
}
.budget-grid .field > span:first-child {
  font-size: var(--fs-xs);
}
.budget-grid .is-off {
  opacity: 0.4;
}
.budget-custom {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.budget-grid-h,
.budget-wide {
  grid-column: 1 / -1;
}
.budget-grid-h {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-dim);
}
.budget-grid-h small {
  font-weight: 400;
  color: var(--ink-faint);
  margin-left: 6px;
}
.budget-grid input::placeholder {
  color: var(--ink-faint);
}
.budget-pkg {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--panel-2);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}
.budget-pkg ul {
  margin: 0;
  padding-left: 18px;
}
.budget-pkg .pkg-notes {
  color: var(--ink-dim);
}
.pkg-tiers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pkg-tier {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pkg-tier.is-this {
  border-color: var(--gold);
}
.pkg-tier h4 {
  margin: 0 0 2px;
  font-size: var(--fs-sm);
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.pkg-tier h4 small {
  color: var(--gold);
  font-weight: 500;
}
.pkg-tier p {
  margin: 0;
  color: var(--ink-dim);
  font-size: var(--fs-sm);
}
.pkg-tier .pkg-teams {
  color: var(--ink-faint);
}
.pkg-tier .pkg-teams .is-this {
  color: var(--gold);
}
.buy-tier {
  margin: -4px 0 0;
}
.buy-skill:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.buy-skill:disabled:hover {
  background: none;
  border-color: inherit;
}
/* An input with a unit ("k") and optional prefix ("+") inside the box. */
.affix {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.affix:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: -1px;
}
.affix input {
  border: 0;
  background: none;
  min-width: 0;
  padding-right: 4px;
}
.affix input:focus {
  outline: none;
}
.affix em,
.affix b {
  font-style: normal;
  font-weight: 400;
  color: var(--ink-faint);
  padding: 0 10px 0 0;
}
.affix b {
  padding: 0 0 0 10px;
}
.affix--both input {
  padding-left: 3px;
}
/* Locked, e.g. a skill package sets the budget. */
.affix:has(input:disabled) {
  background: transparent;
  border-style: dashed;
  cursor: not-allowed;
}
.affix input:disabled {
  color: var(--ink-dim);
  cursor: not-allowed;
  -webkit-text-fill-color: var(--ink-dim);
}

/* ---------------- Player dialog (tap a squad row) ---------------- */

.dialog--player {
  /* Phone: full width minus gutter. Laptop+: grows with the viewport up to 640px. */
  width: min(max(400px, 48vw), 640px, calc(100vw - 32px));
}
.player-dialog {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.player-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}
.player-head h2 {
  margin: 0;
  overflow-wrap: anywhere;
}
/* Changing the name: the box takes the cost's room. */
.player-head:has(.pc-rename) {
  grid-template-columns: auto 1fr;
}
.player-head:has(.pc-rename) .player-cost {
  display: none;
}
.player-num {
  font-size: var(--fs-lg);
  min-width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.player-pos {
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.player-pos.is-big {
  color: var(--gold);
}
.player-cost {
  color: var(--gold);
}
.player-dialog .field {
  flex: none;
  min-width: 0;
}
.player-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.player-stats span {
  text-align: center;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 4px 0;
}
.player-stats b {
  display: block;
  font-family: inherit;
  font-weight: 400;
  font-size: 9.5px;
  color: var(--ink-faint);
  letter-spacing: 0.4px;
}
.player-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 0; /* column spacing is dd padding, so the divider runs unbroken */
  margin: 0;
  font-size: var(--fs-sm);
}
.player-info dt {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-faint);
  padding-top: 2px;
}
.player-info dd {
  margin: 0;
  padding-left: 12px;
}
/* Divider between a player's skills and the categories they can learn from. */
.player-info .is-split {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.player-info .skill-chip {
  font-size: var(--fs-sm);
  padding: 2px 8px;
}
.skill-chip.is-link {
  font-family: inherit;
  cursor: pointer;
}
.skill-chip.is-link:hover,
.skill-chip.is-link:focus-visible {
  background: color-mix(in srgb, var(--cat) 30%, transparent);
  border-color: var(--cat);
  outline: none;
}
/* Buying skills in the player dialog. */
.player-buy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.buy-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.buy-head h3 {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-faint);
}
.buy-meta {
  font-size: var(--fs-sm);
  color: var(--gold);
}
.player-buy .hint {
  margin: 0;
}
.buy-blocked {
  color: var(--warn);
}
.buy-owned {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  padding: 2px 4px 2px 8px;
}
.buy-owned button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.buy-name:hover,
.buy-name:focus-visible {
  text-decoration: underline;
  outline: none;
}
.buy-price {
  font-size: var(--fs-xs);
  opacity: 0.8;
}
.buy-x {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  font-size: 15px !important;
  line-height: 1;
}
.buy-x:hover,
.buy-x:focus-visible {
  background: color-mix(in srgb, var(--bad) 25%, transparent);
  outline: none;
}
.buy-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.buy-cat,
.buy-skill {
  font-family: inherit;
  cursor: pointer;
}
.buy-cat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: var(--fs-sm);
  padding: 4px 10px;
  opacity: 0.7;
}
.buy-cat small,
.buy-skill small {
  font-size: var(--fs-xs);
  opacity: 0.85;
}
.buy-cat.is-on {
  opacity: 1;
  border-color: var(--cat);
  background: color-mix(in srgb, var(--cat) 30%, transparent);
}
.buy-list {
  max-height: 180px;
  overflow-y: auto;
}
.buy-skill {
  font-size: var(--fs-sm);
  padding: 3px 9px;
}
.buy-skill small {
  margin-left: 5px;
}
.buy-cat:hover,
.buy-cat:focus-visible,
.buy-skill:hover,
.buy-skill:focus-visible {
  background: color-mix(in srgb, var(--cat) 30%, transparent);
  border-color: var(--cat);
  opacity: 1;
  outline: none;
}
.squad-row .skills .bought {
  color: var(--gold);
}

/* Unrestricted teams: what a player carried over from another league. */
.squad-row .stat.is-up,
.player-stats .is-up {
  color: var(--go);
  font-weight: 700;
}
.squad-row .stat.is-down,
.player-stats .is-down {
  color: var(--bad);
  font-style: italic;
}
.carry-tag {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  color: var(--ink-dim);
  white-space: nowrap;
}
.carry-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  align-items: center;
  gap: 4px 12px;
}
.carry-h {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.carry-stat {
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.carry-grid .stepper-ctrl,
.carry-niggles .stepper-ctrl {
  justify-self: start;
}
.carry-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-end;
}
.carry-spp input {
  width: 100px;
}
/* Unrestricted: the builder's Treasury box can be typed into. */
.tstat.is-editable {
  cursor: pointer;
  border-radius: var(--radius);
}
.tstat.is-editable:hover,
.tstat.is-editable:focus-visible {
  background: color-mix(in srgb, var(--gold) 12%, transparent);
}
.treasury-edit {
  width: 100%;
  max-width: 120px;
  font-weight: 700;
}
.carry-tag.is-warn {
  border-color: var(--warn);
  color: var(--warn);
}
.carry-mng {
  flex-wrap: wrap;
}
.carry-mng small {
  flex-basis: 100%;
  padding-left: 24px;
  color: var(--ink-faint);
}
.carry-n {
}

.btn--bad {
  background: transparent;
  border-color: color-mix(in srgb, var(--bad) 55%, transparent);
  color: var(--bad);
}
.btn--bad:hover:not(:disabled) {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 12%, transparent);
}

.dialog--wide {
  width: min(520px, calc(100vw - 32px));
}
.adv-kinds {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 12px 0;
}
.adv-kind {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--fs-md);
}
.adv-kind:has(input:checked) {
  border-color: var(--gold);
  background: var(--panel-2);
}
.adv-kind.is-off {
  opacity: 0.45;
  cursor: not-allowed;
}
.adv-kind input {
  width: auto;
}
.adv-cost {
  font-size: var(--fs-sm);
  color: var(--gold);
}
.adv-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.adv-row {
  display: grid;
  grid-template-columns: 76px auto 1fr;
  gap: 10px;
  align-items: center;
  font-size: var(--fs-md);
}
.adv-row > span:first-child {
  color: var(--ink-dim);
}
.adv-row > select {
  grid-column: 2 / -1;
}
.dice {
  display: flex;
  gap: 4px;
  align-items: center;
}
.dice select {
  width: 58px;
  padding: 5px;
}
/* Dice the server rolled: shown, not picked. */
.dice-shown {
  font: 600 var(--fs-lg) / 1 var(--font-display);
  letter-spacing: 0.04em;
}
.adv-row > .btn {
  justify-self: start;
  flex: none;
}
.adv-rolled .btn {
  margin-left: 8px;
}
.adv-typed summary {
  cursor: pointer;
  color: var(--ink-faint);
  font-size: var(--fs-sm);
}
.adv-typed[open] summary {
  margin-bottom: 8px;
}
.adv-rolled {
  color: var(--gold);
}
.adv-rolled.is-bad {
  color: var(--bad);
}
.adv-pick {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.adv-pick label {
  display: flex;
  gap: 6px;
  align-items: center;
}
.adv-pick input {
  width: auto;
}
.adv-ok {
  margin: 14px 0 0;
  color: var(--go);
  font-size: var(--fs-md);
}
.adv-msg {
  margin: 14px 0 0;
  color: var(--ink-dim);
  font-size: var(--fs-sm);
}
@media (max-width: 480px) {
  .adv-row {
    grid-template-columns: 1fr;
  }
  .adv-row > select,
  .adv-pick {
    grid-column: 1;
  }
}

/* A name field with its random-name dice (builder player dialog, hiring). */
.name-row {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.name-row input {
  flex: 1;
  min-width: 0;
}
.name-row .icon-btn {
  flex: none;
}
.stepper-label em {
  font-style: normal;
  color: var(--ink-faint);
  font-size: var(--fs-sm);
}
.journeymen {
  margin: 0 0 12px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: var(--radius);
}
/* The Record's Hire + popup and Pick captain (REY-117). */
.team-dialog {
  width: min(560px, calc(100vw - 32px));
}
.hire-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 12px;
}
.hire-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hire-row .pos {
  flex: 1;
  min-width: 0;
}
.hire-count {
  min-width: 2.2em;
  text-align: right;
  font-weight: 700;
  color: var(--go);
}
.hire-actions {
  justify-content: flex-end;
}
.team-meta .is-bad {
  color: var(--bad);
}
.captain-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.captain-list .team-row {
  width: 100%;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font: inherit;
  color: inherit;
}
/* Purchase on the staff panel: the change's treasury under the steppers. */
.staff-total {
  margin: 10px 0 0;
  color: var(--ink-dim);
}
.staff-total .is-bad,
.stepper-label .is-bad {
  color: var(--bad);
  font-size: var(--fs-sm);
}
/* The player card's pencil, and the number and name fields it opens. */
.pc-pencil {
  vertical-align: middle;
  width: 30px;
  height: 30px;
}
.pc-pencil .tb-icon {
  width: 16px;
  height: 16px;
}
.pc-head > div:has(> .pc-rename) {
  flex: 1;
  min-width: 0;
}
.pc-rename {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}
.pc-rename .num-input {
  width: 56px;
  flex: none;
  text-align: center;
}
.pc-rename #pcName,
.pc-rename #playerName {
  flex: 1;
  min-width: 0;
}
.pc-rename .icon-btn {
  flex: none;
}

.record-tabs {
  margin: 0 0 12px;
}
.memoriam-lede {
  margin: 0 0 8px;
}
.memoriam-list {
  display: flex;
  flex-direction: column;
}
.memoriam-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
}
.memoriam-row .dim {
  color: var(--ink-faint);
  font-weight: 400;
  font-size: var(--fs-sm);
  margin-left: 4px;
}
.memoriam-deeds {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.memoriam-deeds small {
  font-family: inherit;
  color: var(--gold);
  font-size: var(--fs-xs);
}
@media (max-width: 640px) {
  .memoriam-row {
    grid-template-columns: 1fr auto;
  }
  .memoriam-deeds {
    grid-column: 1 / -1;
    align-items: flex-start;
  }
}

/* ---------------- Roster editor ---------------- */

.roster-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
}
@media (max-width: 960px) {
  .roster-layout {
    grid-template-columns: 1fr;
  }
}
.roster-layout > * {
  min-width: 0;
}
.roster-side {
  position: sticky;
  top: 76px;
}
@media (max-width: 960px) {
  .roster-side {
    position: static;
  }
}
.roster-side > .btn {
  width: 100%;
  margin-top: 10px;
}

.rnav-search {
  background: var(--panel-2);
  width: 100%;
  margin-bottom: 8px;
}
.rnav-secret {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
}
.rnav-empty {
  margin: 4px 2px;
}

.rnav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* Narrow screens: a sideways strip of roster cards, with a drawn scroll bar under it. */
.rnav-track {
  display: none;
}
@media (max-width: 960px) {
  .rnav-list {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .rnav-list::-webkit-scrollbar {
    display: none;
  }
  .rnav-list .rnav {
    flex: none;
    border-color: var(--line);
    background: color-mix(in srgb, var(--panel-2) 45%, var(--panel));
  }
  .rnav-track {
    display: block;
    position: relative;
    height: 4px;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--line);
  }
  .rnav-track.is-off {
    display: none;
  }
  .rnav-track span {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 2px;
    background: var(--ink-faint);
  }
}
.rnav {
  display: flex;
  flex-direction: column;
  text-align: left;
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 10px;
  color: var(--ink);
  font: inherit;
}
.rnav:hover {
  background: var(--panel-2);
}
.rnav.is-active,
.rnav-list .rnav.is-active {
  background: var(--panel-2);
  border-color: var(--gold);
}
.rnav.is-new {
  border-style: dashed;
  cursor: default;
}
.rnav-name {
  font-weight: 600;
  font-size: var(--fs-md);
}
.rnav-meta {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  white-space: nowrap;
}

.re-setup {
  margin-bottom: 12px;
}
.field--tiny {
  flex: 0 1 110px;
  min-width: 90px;
}
.re-apoth {
  flex: 0 0 auto;
  padding-bottom: 9px;
}
.re-fumbbl,
.re-source {
  flex: 1 1 260px;
}
.sheet-source {
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.re-rules {
  margin-bottom: 18px;
}
.sheet-updated .link {
  font-size: inherit;
}
.re-history .hint {
  margin: 2px 0 6px;
}
.re-history-list {
  display: grid;
  gap: 6px;
}
.re-change {
  display: grid;
  grid-template-columns: 9.5em 10em 1fr auto;
  gap: 6px;
  align-items: center;
}
.re-history-add {
  justify-self: start;
  margin-top: 8px;
}
@media (max-width: 640px) {
  .re-change {
    grid-template-columns: 1fr 1fr auto;
  }
  .re-change [data-h='note'] {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px;
  min-height: 38px;
  cursor: text;
  flex: 1;
  min-width: 0;
}
.chips:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: -1px;
}
.chip--static {
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 4px 3px 10px;
}
.chip--static:hover {
  border-color: var(--line);
}
.chip--static button {
  background: none;
  border: 0;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: var(--fs-md);
  line-height: 1;
  padding: 0 4px;
  border-radius: 99px;
}
.chip--static button:hover {
  color: var(--bad);
}
.chip.is-unknown {
  border-color: var(--warn);
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
}
.pe-warn {
  margin: -2px 0 8px 78px;
  font-size: var(--fs-sm);
  color: var(--warn);
}
@media (max-width: 640px) {
  .pe-warn {
    margin-left: 0;
  }
}
.pe-warn.re-warn {
  margin: 6px 0 0;
}
.rnav-warn {
  color: var(--warn);
  font-size: var(--fs-sm);
}
.pe-warn-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
  padding: 5px 8px;
  border-left: 3px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 8%, transparent);
  border-radius: 0 4px 4px 0;
}
.pe-warn-line + .pe-warn-line {
  margin-top: 4px;
}
.pe-warn-line b {
  color: var(--ink);
}
.pe-warn-mark {
  flex: none;
}
.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
}
.chip-input {
  flex: 1 1 120px;
  min-width: 100px;
  border: 0;
  background: none;
  padding: 4px 6px;
}
.chip-input:focus {
  outline: none;
}

.pe-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pe {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pe.is-big {
  border-left-color: var(--gold);
}
.pe-top {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}
.pe-name {
  flex: 1 1 200px;
}
.pe-num {
  flex: 0 1 96px;
  min-width: 76px;
}
.pe-tools {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.icon-btn {
  width: 34px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-md);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-dim);
}
.icon-btn:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--ink);
}
.icon-btn--bad:hover:not(:disabled) {
  border-color: var(--bad);
  color: var(--bad);
}
.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pe-stats {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}
.pe-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 62px;
}
.pe-stat > span:first-child {
  font-size: var(--fs-xs);
  letter-spacing: 0.6px;
  color: var(--ink-faint);
  text-align: center;
}
.pe-stat-in {
  position: relative;
}
.pe-stat-in input {
  text-align: center;
  padding: 7px 4px;
}
.pe-stat-in.has-plus input {
  padding-right: 14px;
}
.pe-stat-in.has-plus::after {
  content: '+';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}
.pe-stat input::-webkit-inner-spin-button {
  display: none;
}
.pe-stat input {
  -moz-appearance: textfield;
}
.pe-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.pe-label {
  width: 68px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-faint);
}
.pe-note {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
}

.cats {
  display: flex;
  gap: 5px;
}
.cat {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  display: inline-grid;
  place-items: center;
}
.cat--none {
  background: none;
  border: 1px dashed var(--line);
  color: var(--ink-faint);
}
.cat--primary {
  background: var(--gold);
  border: 1px solid var(--gold);
  color: var(--on-gold);
}
.cat--secondary {
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  border: 1px solid var(--gold);
  color: var(--gold);
}
.cat:hover {
  filter: brightness(1.15);
}
.cat-key {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.cat-key .cat {
  width: 20px;
  height: 20px;
  font-size: var(--fs-xs);
  cursor: default;
  margin-left: 6px;
}
@media (max-width: 640px) {
  .cat-key {
    display: none;
  }
  .pe-label {
    width: 100%;
  }
}

.re-add {
  width: 100%;
  margin: 10px 0 4px;
  border-style: dashed;
}
.re-file {
  margin-top: 12px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.re-file summary {
  cursor: pointer;
}
.re-file code {
  font-family: var(--mono);
  font-size: var(--fs-sm);
}
.re-file pre {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: 1.45;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  overflow: auto;
  max-height: 420px;
  margin: 8px 0 0;
}
.re-actions {
  flex-wrap: wrap;
}
.re-actions .btn {
  flex: 0 1 auto;
}
.re-actions .btn--go {
  flex: 0 1 160px;
}
.re-delete {
  width: auto;
  margin: 0 auto 0 0;
}
@media (max-width: 640px) {
  .re-actions .btn {
    flex: 1 1 40%;
  }
  .re-delete {
    order: 5;
    flex-basis: 100% !important;
  }
}

/* Roster sheet (read-only, coaches) */
.sheet-head {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
/* One item of a "·" line: moves down whole, and only breaks inside when wider than the line. */
.meta-item {
  display: inline-block;
  max-width: 100%;
}
.team-meta .meta-yes {
  color: var(--go);
}
.team-meta .meta-no {
  color: var(--bad);
}
.sheet-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.sheet-table td.sheet-skills {
  white-space: normal;
  min-width: 220px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
/* Primary letters sit together; secondary group is set off by one square's width. */
.sheet-cats {
  display: inline-flex;
  gap: 20px;
}
.cat-group {
  display: inline-flex;
  gap: 3px;
}
.cat-group--primary {
  width: calc(var(--max-primary, 1) * 23px - 3px);
}
.cat--sm {
  width: 20px;
  height: 20px;
  font-size: var(--fs-xs);
  cursor: default;
  border-radius: var(--radius-sm);
}
.cat--sm:hover {
  filter: none;
}
.dim {
  color: var(--ink-faint);
}

/* On phones each position becomes a card: name and cost, stats, skills, access. */
@media (max-width: 640px) {
  .sheet-head {
    flex-direction: column;
  }
  .sheet-table thead {
    display: none;
  }
  .sheet-table,
  .sheet-table tbody {
    display: block;
  }
  .sheet-table tr {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px 4px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--panel-2) 45%, var(--panel));
  }
  .sheet-table td,
  .sheet-table tbody tr:hover td {
    border: 0;
    padding: 0;
    background: none;
  }
  .sheet-table .sheet-name {
    grid-column: 1 / 6;
    order: 1;
    white-space: normal;
  }
  .sheet-table .sheet-cost {
    grid-column: 6;
    order: 2;
    color: var(--gold);
  }
  .sheet-table .sheet-stat,
  .sheet-table .sheet-qty {
    order: 3;
    text-align: center;
  }
  .sheet-table .sheet-qty {
    order: 4;
  }
  .sheet-table [data-label]::before {
    content: attr(data-label);
    display: block;
    font: 600 11px / 1.2 var(--font-display);
    letter-spacing: 0.1em;
    color: var(--ink-faint);
  }
  /* Stats as tiles, like the player card; Qty is a roster limit, so it stays bare. */
  .sheet-table tbody tr td.sheet-stat {
    padding: 6px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
    font-size: var(--fs-lg);
  }
  .sheet-table .sheet-qty {
    align-self: center;
  }
  .sheet-table td.sheet-skills {
    grid-column: 1 / -1;
    order: 5;
    min-width: 0;
  }
  .sheet-table .sheet-access {
    grid-column: 1 / -1;
    order: 6;
  }
  /* No column header here, so label the two groups. */
  .sheet-table .cat-group {
    align-items: center;
  }
  .sheet-table .cat-group::before {
    margin-right: 3px;
    font-size: var(--fs-xs);
    color: var(--ink-faint);
  }
  .sheet-table .cat-group--primary {
    width: auto;
    min-width: calc(var(--max-primary, 1) * 23px + 15px);
  }
  .sheet-table .cat-group--primary::before {
    content: 'P:';
  }
  .sheet-table .cat-group--secondary::before {
    content: 'S:';
  }
  .sheet-table .cat-group:empty {
    display: none;
  }
  /* P: and S: say it on the cards, and there's no hover on a phone. */
  .sheet-key {
    display: none;
  }
}

/* Admin toggle between the roster editor and the coaches' read-only sheet */
.roster-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  max-width: 1180px;
  margin: 0 auto 12px;
}
.roster-bar .hint {
  margin: 0;
}
/* Segmented control: switching a view of the same data (Summary / Full stats). */
.seg {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px;
  background: var(--panel-2);
}
.seg button {
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.seg button:hover {
  color: var(--ink);
}
.seg button.is-on {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-strong);
}

/* Page sections (league, tourney, team record): underline tabs in condensed caps. */
.seg.tn-tabs,
.seg.record-tabs,
.seg.team-switch {
  display: flex;
  gap: 2px;
  padding: 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.seg.team-switch {
  display: inline-flex;
}
.seg.tn-tabs button,
.seg.record-tabs button,
.seg.team-switch button {
  flex: none;
  padding: 10px 12px;
  margin-bottom: -1px;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  font: 600 15px / 1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.seg.tn-tabs button:hover,
.seg.record-tabs button:hover,
.seg.team-switch button:hover {
  color: var(--ink);
}
.seg.tn-tabs button.is-on,
.seg.record-tabs button.is-on,
.seg.team-switch button.is-on {
  background: none;
  box-shadow: none;
  color: var(--ink);
  border-bottom-color: var(--primary);
}

/* Position keywords (e.g. Human · Lineman) */
.keywords {
  font-size: var(--fs-xs);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
}

/* ---------------- Skills & Traits, Tables (reference) ---------------- */

.cat-G {
  --cat: #8a93a0;
}
.cat-A {
  --cat: #43b06a;
}
.cat-S {
  --cat: #c34132;
}
.cat-P {
  --cat: #d8a531;
}
.cat-M {
  --cat: #a566c9;
}
.cat-D {
  --cat: #c84f8c;
}
.cat-T {
  --cat: #3f95cf;
}
/* A Star Player's own special rule. */
.cat-R {
  --cat: #e8833a;
}
.cat-all {
  --cat: var(--ink);
}
/* Darker category colours for light mode, so they still read as text on white. */
:root[data-theme='light'] .cat-G {
  --cat: #636b78;
}
:root[data-theme='light'] .cat-A {
  --cat: #257a42;
}
:root[data-theme='light'] .cat-S {
  --cat: #b0372a;
}
:root[data-theme='light'] .cat-P {
  --cat: #866410;
}
:root[data-theme='light'] .cat-M {
  --cat: #8a4bb0;
}
:root[data-theme='light'] .cat-D {
  --cat: #a83a72;
}
:root[data-theme='light'] .cat-T {
  --cat: #22699c;
}
:root[data-theme='light'] .cat-R {
  --cat: #a8541a;
}

.ref-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.ref-bar input {
  flex: 1 1 240px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  padding: 8px 12px;
}
.ref-bar input:focus {
  outline: none;
  border-color: var(--gold);
}
.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 4px;
}
.cat-chip {
  background: none;
  border: 1.5px solid color-mix(in srgb, var(--cat) 45%, transparent);
  color: var(--cat);
  border-radius: 99px;
  padding: 4px 11px;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.cat-chip span {
  font-size: var(--fs-xs);
  opacity: 0.8;
}
.cat-chip.is-on {
  background: var(--cat);
  border-color: var(--cat);
  color: var(--bg);
}
.letter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 8px;
}
.letter-bar button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--gold);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.letter-bar button:disabled {
  background: none;
  color: var(--ink-faint);
  opacity: 0.4;
  cursor: default;
}

.skill-group {
  margin-top: 22px;
  scroll-margin-top: 120px;
}
.skill-group h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--cat, var(--gold));
  margin: 0 0 10px;
}
.skill-group h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.skill-group.is-letter h2 {
  font-size: var(--fs-xl);
}
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.skill-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--cat);
  border-radius: var(--radius);
  padding: 11px 13px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.skill-card:hover,
.skill-card:focus-visible {
  border-color: var(--cat);
  outline: none;
}
.skill-card-name {
  font-weight: 600;
  font-size: var(--fs-md);
}
.skill-card-text {
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--ink-dim);
  /* Clamp to 3 lines on the card; the skill dialog shows the full text. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  white-space: normal; /* card preview ignores \n; the dialog honours it */
}
.is-missing {
  color: var(--ink-faint);
  font-style: italic;
}
.skill-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 3px;
}
.skill-cat {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--cat);
}
.skill-kind {
  font-size: 0.8em;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink-faint);
}
.skill-kind.is-active {
  color: var(--gold);
}
.skill-page {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--ink-dim);
}
.skill-date {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}
.skill-date.is-revised {
  color: var(--gold);
}

.dialog--skill {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  overflow-x: hidden;
}
.skill-dialog {
  border-top: 4px solid var(--cat);
  padding: 16px 18px 18px;
}
.skill-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.skill-dialog-head > div {
  flex: 1;
}
.skill-dialog-head .skill-cat {
  white-space: nowrap;
}
.skill-dialog-head h2 {
  font-size: var(--fs-xl);
  line-height: 1.1;
}
.skill-dialog-head > div {
  min-width: 0;
}
.skill-dialog-head .btn {
  flex: none;
  width: auto;
  margin-top: 0;
  font-size: var(--fs-lg);
  line-height: 1;
}
.skill-dialog-text {
  font-size: var(--fs-md);
  line-height: 1.5;
  white-space: pre-line;
  margin: 14px 0 6px;
}
.skill-updated {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  margin: 0 0 16px;
}
.skill-pageref {
  font-size: var(--fs-sm);
  color: var(--ink-dim);
  margin: 0 0 4px;
}
.skill-pageref b {
  color: var(--ink);
}
.skill-updated b {
  color: var(--ink-dim);
}
.skill-dialog h3 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin: 0 0 10px;
}
.skill-history {
  list-style: none;
  margin: 0;
  padding: 0;
}
.skill-history li {
  position: relative;
  padding: 0 0 12px 20px;
  border-left: 2px solid var(--line);
  margin-left: 5px;
}
.skill-history li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}
.skill-history li::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 2px solid var(--line);
}
.skill-history li.is-current::before {
  background: var(--cat);
  border-color: var(--cat);
}
.skill-history b {
  font-size: var(--fs-sm);
}
.skill-history p {
  margin: 2px 0 0;
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
.skill-now {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--cat);
}

.ref-tables {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 760px;
  margin-inline: auto;
}
/* The Inducements tab's format switch sits over its centred table. */
#view-inducements .ref-bar {
  max-width: 760px;
  margin: 0 auto 10px;
}
.ref-table {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.ref-table-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel-2);
  border-left: 4px solid var(--gold);
  cursor: pointer;
  list-style: none;
}
.ref-table-head::-webkit-details-marker {
  display: none;
}
.ref-table-head::after {
  content: '▸';
  flex: none;
  order: 3;
  color: var(--gold);
  transition: transform 0.15s;
}
.ref-table[open] > .ref-table-head {
  border-bottom: 2px solid var(--gold);
}
.ref-table[open] > .ref-table-head::after {
  transform: rotate(90deg);
}
.ref-table-head:hover {
  background: color-mix(in srgb, var(--gold) 12%, var(--panel-2));
}
.ref-table-head > div {
  flex: 1;
}
.ref-table-head h2 {
  font-size: var(--fs-md);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.ref-table-head p {
  margin: 3px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.ref-table-head p.ref-source {
  font-size: var(--fs-xs);
  font-style: italic;
}
.ref-roll {
  flex: none;
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius);
  color: var(--gold);
  border: 1px solid var(--gold);
}
.ref-table table {
  width: 100%;
  border-collapse: collapse;
}
.ref-table td {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  vertical-align: top;
  font-size: var(--fs-md);
}
.ref-table tr:first-child td {
  border-top: 0;
}
.ref-table tr:nth-child(even) td {
  background: color-mix(in srgb, var(--panel-2) 45%, transparent);
}
.ref-table td b {
  display: block;
}
.ref-table td span {
  color: var(--ink-dim);
}
.ref-result {
  width: 1%;
  white-space: nowrap;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
}

/* Inducements tab */
.ind-ref {
  max-width: 760px;
}
/* A table head that doesn't fold (Tables and Inducements tabs). */
.ref-table-head.is-static {
  cursor: default;
  border-bottom: 2px solid var(--gold);
}
.ref-table-head.is-static::after {
  content: none;
}
.ref-table-head.is-static:hover {
  background: var(--panel-2);
}

/* Tables tab tiles: each in its table's colour; the picked one lit. */
.tile-grid--ref {
  /* --cols is set by renderTables to the widest row's tile count. */
  max-width: min(760px, calc(var(--cols, 5) * 160px + (var(--cols, 5) - 1) * 12px));
  margin-inline: auto;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  margin-bottom: 16px;
}
/* First tile of a new 'row' group in tables.json starts a fresh grid line. */
.tile--row-start {
  grid-column-start: 1;
}
.tile--ref .tile-art {
  color: var(--gold);
  flex: none;
}
/* A row's tiles match its tallest (a long name wraps to three lines), icons level at the top. A
   tile with an aspect-ratio only stretches when asked. */
.tile--ref {
  align-self: stretch;
  justify-content: flex-start;
}
.tile--ref:hover,
.tile--ref:focus-visible {
  border-color: var(--gold);
}
.tile--ref.is-on {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 14%, var(--panel-2));
  box-shadow: inset 0 0 0 1px var(--gold);
}
.tile--ref.is-on .tile-art {
  border-color: var(--gold);
}
/* Versions of one table (11s / Sevens), under its head. */
.ref-subtabs {
  display: flex;
  gap: 6px;
  padding: 10px 14px 0;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.ref-subtabs button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
  padding: 10px 20px 11px;
  font: inherit;
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--ink-dim);
  cursor: pointer;
}
.ref-subtabs button:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--gold) 8%, transparent);
}
.ref-subtabs button.is-on {
  color: var(--ink);
  border-bottom-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 16%, transparent);
}
@media (max-width: 480px) {
  .ref-subtabs button {
    flex: 1;
    padding: 10px 8px 11px;
    font-size: var(--fs-md);
  }
}
.ref-table td.ref-norows {
  padding: 18px 14px;
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
}
.ref-pick {
  color: var(--ink-dim);
  text-align: center;
}
@media (max-width: 480px) {
  .tile-grid--ref {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .tile--ref {
    padding: 8px 6px;
    gap: 4px;
  }
  .tile--ref .tile-name {
    font-size: var(--fs-sm);
  }
}
.ind-ref th {
  padding: 8px 14px;
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-faint);
}
.ref-table.ind-ref tr:nth-child(even) td {
  background: none;
}
.ref-table.ind-ref tbody:nth-of-type(even) td {
  background: color-mix(in srgb, var(--panel-2) 45%, transparent);
}
.ref-table.ind-ref tr.ind-more td {
  border-top: 1px dashed var(--line);
}
.ref-table.ind-ref tr:first-child td {
  border-top: 1px solid var(--line);
}
.ind-name span {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-sm);
}
.ind-name span.ind-source {
  font-size: var(--fs-xs);
  font-style: italic;
  color: var(--ink-dim);
}
.ind-tv {
  display: inline-block;
  margin-top: 3px;
  font-style: normal;
  font-size: var(--fs-xs);
  color: var(--gold);
}
.ref-table td.ind-who {
  color: var(--ink-dim);
}
.ind-ref .ind-num {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
/* Phones: a card per inducement in place of the table (REY-96). */
.ind-cards {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (max-width: 640px) {
  .ind-ref table {
    display: none;
  }
  .ind-cards {
    display: block;
  }
}
.ind-card {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.ind-card:first-child {
  border-top: 0;
}
.ind-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.ind-cost {
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
}
.ind-card-line {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.ind-card .ind-name > span:not(.ind-source) {
  color: var(--ink-dim);
}

.panel--treasury .issues {
  gap: 4px;
}
.panel--treasury .issue {
  padding: 4px 8px;
  font-size: var(--fs-sm);
  line-height: 1.35;
}

/* ---------------- Star Players ---------------- */

.star-for {
  flex: 0 1 260px;
  width: auto;
}
#starNew {
  flex: none;
}
.star-count {
  margin: 10px 0 12px;
  min-height: 1em;
}
.star-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.star-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
}
.star-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.star-head h2 {
  flex: 1;
  font-size: var(--fs-lg);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.st-hint {
  margin: 0;
}
.tag--favour {
  border-color: color-mix(in srgb, var(--bad) 50%, transparent);
  color: var(--favour);
}
.star-keywords {
  margin-top: -6px;
}
.star-cost {
  color: var(--gold);
  font-weight: 600;
}
.star-head .btn {
  align-self: center;
}
.star-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.star-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0 5px;
  background: var(--panel-2);
}
.star-stats > div + div {
  border-left: 1px solid var(--line);
}
.star-stats span {
  font-size: var(--fs-xs);
  letter-spacing: 0.6px;
  color: var(--ink-faint);
}
.star-stats b {
  font-size: var(--fs-lg);
}
.star-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.star-skill {
  background: none;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--ink-dim);
  font: inherit;
  font-size: var(--fs-sm);
  padding: 2px 9px;
  cursor: pointer;
}
.star-skill:hover,
.star-skill:focus-visible {
  border-color: var(--gold);
  color: var(--ink);
  outline: none;
}
/* A skill in the Skills & Traits list wears its category colour, like the filter chips there. */
.star-skill[class*='cat-'] {
  border-color: color-mix(in srgb, var(--cat) 45%, transparent);
  color: var(--cat);
}
.star-skill[class*='cat-']:hover,
.star-skill[class*='cat-']:focus-visible {
  border-color: var(--cat);
  background: color-mix(in srgb, var(--cat) 14%, transparent);
}
.star-rule {
  border-left: 3px solid var(--gold);
  padding: 2px 0 2px 10px;
}
.star-rule b {
  font-size: var(--fs-md);
}
.star-rule p {
  margin: 2px 0 0;
  white-space: pre-line;
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--ink-dim);
}
.star-pair-note {
  margin: -4px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-faint);
}
.star-member {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.star-member + .star-member {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.star-member h3 {
  margin: 0;
  font-size: var(--fs-md);
}
.star-member .star-keywords {
  margin-top: -4px;
}
.st-pair {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
}
.st-pair .field {
  flex: none;
  width: 100%;
}
.star-plays {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.star-source {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}
.star-plays > span:first-child {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-faint);
  margin-right: 3px;
}

.dialog--star {
  width: min(620px, calc(100vw - 24px));
}
.star-editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.star-editor .setup {
  margin: 0;
}
.star-editor > .field {
  flex: none;
}
.star-editor .pe-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 62px));
}
.star-editor .pe-stat {
  width: auto;
}
.st-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.st-head h2 {
  flex: 1;
  line-height: 1.2;
}
.st-head .btn {
  flex: none;
  width: auto;
  font-size: var(--fs-lg);
  line-height: 1;
}
.star-editor h2 {
  font-size: var(--fs-xl);
}
.st-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.st-rules:empty {
  display: none;
}
.st-rule {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.st-rule-top {
  display: flex;
  gap: 8px;
}
.st-rule-top input {
  font-weight: 600;
}
.st-rule textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 10px;
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--fs-md);
  width: 100%;
  resize: vertical;
}
.st-rule textarea:focus {
  outline: 2px solid var(--gold);
  outline-offset: -1px;
}
.st-add {
  align-self: flex-start;
}
.star-editor .issues:empty {
  display: none;
}
@media (max-width: 640px) {
  .star-for {
    flex: 1 1 100%;
  }
  .dialog--star {
    padding: 14px;
  }
  .star-editor .actions {
    flex-wrap: wrap;
  }
  .star-editor .actions .btn {
    flex: 1 1 40%;
  }
  .star-editor .re-delete {
    order: 5;
    flex-basis: 100%;
  }
}

/* ---------------- Waiting on the server ---------------- */
/* app.js: body.is-busy after a request takes 200ms; button[aria-busy] on the
   button that started a save. */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes busy-slide {
  from {
    left: -35%;
  }
  to {
    left: 100%;
  }
}

.spinner,
button[aria-busy='true']::after {
  display: inline-block;
  flex: none;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.12em;
  animation: spin 0.7s linear infinite;
}

.busy-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
body.is-busy .busy-bar {
  opacity: 1;
}
.busy-bar::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  background: var(--gold);
  animation: busy-slide 1.1s ease-in-out infinite;
}

button[aria-busy='true'] {
  pointer-events: none; /* no second save while the first is on its way */
  cursor: progress;
}
button[aria-busy='true']::after {
  content: '';
  margin-left: 0.5em;
}

.boot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18vh 0 0;
  color: var(--ink-dim);
}

@media (prefers-reduced-motion: reduce) {
  .busy-bar::before {
    left: 0;
    width: 100%;
    animation: none;
    opacity: 0.7;
  }
  .spinner,
  button[aria-busy='true']::after {
    animation-duration: 2s;
  }
}

/* ---------------- Exhibition codes (matches.js) ---------------- */

.ex-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ex-choices .btn.is-on {
  box-shadow: inset 0 0 0 1px var(--gold);
}
#exCodeInput,
#leagueCodeInput {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 2px;
}
.ex-code {
  background: var(--panel-2);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.ex-code p {
  margin: 8px 0 0;
  font-size: var(--fs-md);
}
.ex-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ex-code-big {
  font-family: var(--mono);
  font-size: var(--fs-2xl);
  letter-spacing: 4px;
  color: var(--gold);
}
.ex-code-small {
  font-family: var(--mono);
  color: var(--gold);
  letter-spacing: 1px;
  margin-right: 6px;
}
.ex-sub {
  margin: 20px 0 2px;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-faint);
}
.ex-open-row {
  grid-template-columns: minmax(0, 1fr) auto;
}
.ex-admin {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.ex-admin summary {
  cursor: pointer;
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
.ex-admin .hint {
  margin-bottom: 12px;
}

/* "Ann joined with Ann's team" box, on any page */
.invite-box {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 340px;
  background: var(--panel-2);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  z-index: 60;
}
.invite-box p {
  margin: 0 0 12px;
  font-size: var(--fs-md);
}
.invite-box-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
@media (max-width: 640px) {
  .invite-box {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}

/* Confirm: both teams side by side (stacked when narrow) */
.confirm-cells .lobby-cell {
  align-items: stretch;
}
.confirm-team .team-meta {
  margin: 0;
}
.confirm-figures {
  display: flex;
  gap: 22px;
  margin: 8px 0 4px;
}
.confirm-figures div {
  display: flex;
  flex-direction: column;
}
.confirm-figures strong {
  font-size: var(--fs-lg);
}
.confirm-figures small {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.confirm-staff {
  margin: 0 0 6px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.confirm-roster {
  font-size: var(--fs-sm);
}
.confirm-pos {
  display: block;
  font-size: var(--fs-xs);
}
.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.confirm-actions .hint {
  margin: 0;
}
@media (max-width: 960px) {
  .confirm-cells {
    grid-template-columns: 1fr;
  }
}
.match-gone {
  text-align: center;
}
.match-gone .btn {
  margin-top: 14px;
}

.carry-tally {
  margin-top: 10px;
}
.carry-tally small {
  color: var(--ink-dim);
  font-weight: 400;
}
.carry-tally-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.carry-tally-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  text-align: center;
}
.carry-tally-box input {
  width: 4.75em;
  min-width: 0;
  padding-left: 4px;
  padding-right: 2px;
  text-align: center;
}
.carry-traits {
  margin-top: 10px;
}
.carry-traits small {
  color: var(--ink-dim);
  font-weight: 400;
}
.carry-trait-add {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
.carry-trait-add input {
  flex: 1 1 8em;
  min-width: 0;
}
.carry-trait-add .btn {
  margin-left: 4px;
}
.carry-trait-name {
  white-space: nowrap;
}
.lvl {
  margin-left: 0.35em;
  font-size: 0.75em;
  letter-spacing: -0.05em;
  color: var(--gold, #c9a227);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .carry-tally-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .carry-tally-box input {
    width: 100%;
  }
}

/* ---------------- Rosters on the match page ---------------- */
.rosters-panel {
  grid-column: 1 / -1;
  margin-top: 16px;
}
.rosters-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.rosters-panel.is-closed .rosters-head {
  margin-bottom: 0;
}
.roster-tabs {
  display: none;
  gap: 6px;
}
.rosters-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.roster-col h4 {
  margin: 0 0 8px;
}
.confirm-roster tr.is-out,
select option.is-out {
  color: var(--ink-faint);
}
.banner-name .roster-icon {
  margin-left: 0;
}
.banner-team--away .banner-name .roster-icon {
  margin-left: 6px;
  margin-right: 0;
}
@media (max-width: 960px) {
  .roster-tabs {
    display: flex;
  }
  .rosters-cols {
    grid-template-columns: 1fr;
  }
  .rosters-panel[data-roster-show='mine'] [data-roster-col='opp'],
  .rosters-panel[data-roster-show='opp'] [data-roster-col='mine'] {
    display: none;
  }
}

.match-sides > *,
.rosters-cols > * {
  min-width: 0;
}

.friendly-note {
  grid-column: 1 / -1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2, var(--panel));
}
.friendly-note.is-counts {
  border-color: var(--gold);
}
#exCounts .check {
  margin: 4px 0;
}

.mvp {
  margin-bottom: 12px;
}
.mvp h3 {
  margin: 0 0 6px;
}
.mvp-rows {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}
.mvp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mvp-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mvp-who small {
  font-size: var(--fs-sm);
  color: var(--ink-faint);
}
.mvp-row.is-on .mvp-who small {
  color: inherit;
  opacity: 0.8;
}
.mvp-row.is-on {
  color: var(--gold);
}
/* The order a player was ticked in, at the end of the row so the name sits by its box. */
.mvp-n {
  display: inline-block;
  min-width: 1.4em;
  margin-left: auto;
  text-align: center;
  font-family: var(--font-display);
}
.mvp-list {
  margin: 0 0 8px;
  padding-left: 1.6em;
}
.mvp-nominees > summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  margin-bottom: 4px;
}
.mvp .roll-result + .roll-row,
.mvp .roll-result + .mvp-nominees {
  margin-top: 4px;
}

.live-event.is-wiped > span:not(.drop) {
  text-decoration: line-through;
  color: var(--ink-faint);
}
.concede-btn {
  margin: 6px 0;
}
.mercy-notice {
  grid-column: 1 / -1;
  border-color: var(--gold);
}
.leave-rows {
  margin: 8px 0;
}

.prayer-list {
  list-style: none;
  margin: 6px 0;
  padding: 0;
}
.prayer-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 4px 0;
}
.prayer-form {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}
.in-play {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0;
}
.in-play-label {
  color: var(--ink-faint);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.chip.is-used,
.is-used {
  opacity: 0.5;
  text-decoration: line-through;
}
.chip--static {
  cursor: default;
}
.prayers-listing {
  margin-top: 8px;
  font-size: var(--fs-sm);
}
.prayers-line {
  margin: 4px 0;
}
.tag--prayer {
  border-color: var(--gold);
  color: var(--gold);
}
.skill--prayer {
  color: var(--gold);
}
.stat--mod {
  color: var(--gold);
  font-weight: 600;
}

/* Star Players on a match roster: a row each (a pair's members on their own). */
.tag--star {
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
  color: var(--gold);
  font-weight: 600;
}
.star-row td {
  background: color-mix(in srgb, var(--gold) 6%, transparent);
}
.star-row-name {
  font-weight: 600;
  text-align: left;
}
.skill--star {
  font-style: italic;
}
.dialog--star-card .star-card {
  border: 0;
  padding: 0;
}
.star-card-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.star-card-head .btn {
  width: auto;
}
.star-card-head select {
  flex: 1 1 auto;
  min-width: 0;
}

.sv-form,
.big-leagues {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}
.bl-row {
  flex-wrap: wrap;
}
.bl-choice {
  display: inline-flex;
  gap: 6px;
}
.mvp-prompt {
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin: 8px 0;
  display: grid;
  gap: 6px;
}

/* ---------------- Leagues ---------------- */

.league-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}
.league-make-head {
  margin-top: 22px;
}
/* League and tourney pages open on a turf band with the name large. */
.league-head.turf {
  border: 0;
  padding: 18px 20px;
}
.league-head .panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 12px;
}
/* The next step, at the right of the header: white on the turf. */
.head-next {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.league-head.turf .btn--go {
  flex: none;
  background: var(--on-pitch);
  border-color: var(--on-pitch);
  color: var(--pitch);
}
.league-head.turf h2 {
  margin: 0;
  font: 700 var(--fs-2xl) / 1.05 var(--font-display);
  letter-spacing: 0.01em;
  color: var(--on-pitch);
  text-wrap: balance;
}
.league-head.turf .team-meta,
.league-head.turf .league-mine,
.league-head.turf .hint {
  color: var(--chalk);
  font-size: var(--fs-sm);
}
.league-head.turf .team-meta {
  margin: 8px 0 0;
}
.league-head.turf .link,
.league-head.turf strong {
  color: var(--on-pitch);
  font-weight: 600;
}
.league-head.turf .pill {
  background: rgb(255 255 255 / 0.14);
  color: var(--on-pitch);
}
.league-head.turf .ex-sub {
  color: var(--chalk);
}
.league-mine {
  margin: 8px 0 0;
}
.league-code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}
.league-code {
  color: var(--gold);
  font-family: var(--mono);
  font-size: var(--fs-xl);
  letter-spacing: 2px;
}
.league-settings,
.league-divs,
.league-div-teams,
.league-fx-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  margin-top: 12px;
}
.league-bonuses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
/* Manager panel: each switch sits with its hint, apart from the next switch (REY-125). */
.league-manage .league-bonuses {
  margin-top: 18px;
}
.league-manage .ex-sub + .league-bonuses {
  margin-top: 6px;
}
.league-manage .league-bonuses + .hint {
  margin-top: 0;
}
.league-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin-top: 12px;
}
.league-table td:nth-child(2) {
  white-space: normal;
  min-width: 120px;
}
/* Fixed number columns: the team column takes the slack, so division tables line up. */
.league-table th.num,
.league-table td.num {
  width: 3.75em;
}
.league-table tr.is-mine td {
  background: color-mix(in srgb, var(--gold) 9%, transparent);
}
.league-table tr.is-mine td:first-child {
  box-shadow: inset 3px 0 0 var(--gold);
}
.league-tie {
  font-size: var(--fs-sm);
}
.league-table tr.is-gone td {
  color: var(--ink-faint);
  border-top: 1px dashed var(--line);
}
.league-stats-toggle {
  margin-bottom: 10px;
}
/* Leaders: a grid of top-5 boards. */
.league-boards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px 24px;
}
.league-boards-head {
  margin-top: 22px;
}
.league-leaders {
  list-style: none;
  margin: 4px 0 10px;
  padding: 0;
}
.league-leaders li {
  display: grid;
  grid-template-columns: 1.6em minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.lb-rank {
  color: var(--ink-faint);
  font-family: var(--font-display);
}
.lb-who {
  overflow-wrap: anywhere;
}
.lb-who small {
  display: block;
  color: var(--ink-faint);
}
.lb-mark {
  margin-left: 5px;
  color: var(--ink-faint);
}
.lb-value {
  font-weight: 600;
}
.league-round + .league-round {
  margin-top: 14px;
}
.league-fixture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 9px 6px;
  border-bottom: 1px solid var(--line);
}
.league-fixture.is-mine {
  background: color-mix(in srgb, var(--gold) 6%, transparent);
}
.league-fixture .btn {
  flex: none;
  padding: 6px 11px;
  font-size: var(--fs-sm);
}
.league-fx-teams {
  overflow-wrap: anywhere;
}
.league-fx-teams .dim {
  color: var(--ink-faint);
  margin: 0 4px;
}
.league-score {
  font-family: var(--font-display);
  margin: 0 6px;
}
.league-mine-team {
  font-weight: 600;
}
.league-note {
  margin-top: 2px;
}
.league-fx-edit {
  grid-column: 1 / -1;
}
.league-order ol {
  margin: 6px 0;
  padding-left: 22px;
  display: grid;
  gap: 4px;
}
.league-order li button {
  margin-left: 8px;
}
.league-team-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}
.league-season-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.league-table td .link {
  text-align: left;
}
.league-actions .btn,
.league-settings .btn {
  flex: none;
}
.league-settings .field,
.league-divs .field,
.league-div-teams .field,
.league-fx-edit .field {
  flex: 0 1 220px;
}
@media (max-width: 640px) {
  .league-table .col-wide,
  .league-redraft .col-wide {
    display: none;
  }
  .league-table th,
  .league-table td {
    padding-left: 4px;
    padding-right: 4px;
  }
  .league-table th.num,
  .league-table td.num {
    width: 2.25em;
  }
  .league-fixture {
    grid-template-columns: minmax(0, 1fr);
  }
  .league-fixture .row-actions {
    justify-content: flex-start;
  }
}
.league-settle,
.league-withdraw {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
/* Long team names in the transfer picker mustn't widen the panel on a phone. */
.league-withdraw > * {
  min-width: 0;
}
.league-withdraw h4 {
  margin: 4px 0 0;
}
.league-settle-how {
  display: grid;
  gap: 6px;
}
.league-drafts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.league-draft {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--fs-sm);
}
.league-draft.is-on {
  border-color: var(--gold);
}
.league-draft-teams,
.league-draft-round {
  color: var(--ink-dim);
}
.league-pool-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}
.league-pool .bad,
#poolUsed.bad {
  color: var(--bad);
}
.league-open {
  margin: 4px 0 10px;
  padding-left: 20px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.league-po-first {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.league-po-game {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.league-po-game select {
  flex: 1 1 160px;
  min-width: 0;
}
.league-champion {
  color: var(--gold);
}
.penalties-panel select {
  width: auto;
}
.penalties-panel .bad {
  color: var(--bad);
}
.league-podium {
  margin: 6px 0 0;
  padding-left: 22px;
  display: grid;
  gap: 4px;
}
.league-podium li::marker {
  color: var(--gold);
  font-weight: 600;
}
.record-table tr.is-retired td {
  color: var(--ink-faint);
}
.league-redraft {
  display: grid;
  gap: 6px;
  margin: 6px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.league-budget {
  margin: 4px 0;
}
.league-budget .bad {
  color: var(--bad);
}
.league-hires {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.league-hire {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.league-hire .name-row {
  flex: 1 1 200px;
}
.league-hire input[data-hire-num] {
  width: 60px;
}
.league-keep button {
  padding: 4px 10px;
}
.league-redraft td select {
  width: auto;
}

/* ---------------- Team Builder start screen (start.js) ---------------- */

.start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.start-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 112px;
  padding: 16px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
}
.start-card:hover,
.start-card:focus-visible {
  border-color: var(--gold);
}
.start-card-h {
  font-weight: 700;
  font-size: var(--fs-md);
}
.start-card-p {
  color: var(--ink-dim);
  font-size: var(--fs-sm);
}
.start-panel {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.start-panel[data-start-panel='tourney'] {
  max-width: 1000px;
}
.start-panel[data-start-panel='tourney'] .start-tp-tabs,
.start-panel[data-start-panel='tourney'] .start-code {
  align-self: flex-start;
  max-width: 560px;
  width: 100%;
}
.start-tp-tabs {
  flex-wrap: wrap;
}
.start-panel h3 {
  font-size: var(--fs-lg);
  margin: 0;
}
.start-panel > .btn {
  align-self: flex-start;
}
.start-back {
  align-self: flex-start;
}
.start-lede {
  margin: -6px 0 14px;
}
.start-sub {
  margin: 14px 0 0;
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
.start-code {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.start-code .field {
  flex: 1 1 auto;
}
.start-budgets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.start-budgets .btn.is-on {
  border-color: var(--gold);
  color: var(--gold);
}
.start-found {
  margin: 8px 0 0;
}
.start-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.start-team .btn {
  flex: none;
}
.start-team.is-off {
  color: var(--ink-faint);
}
.start-team small {
  color: var(--ink-dim);
}
.start-team-why {
  display: block;
}

/* The tip by the Budget button on a new team, and the Unrestricted note. */
.field--budget {
  position: relative;
}
.budget-callout {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5;
  box-shadow: 0 4px 12px var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 8px 6px 10px;
  font-size: var(--fs-sm);
  border-radius: var(--radius);
  background: var(--gold);
  color: var(--on-gold);
}
.budget-callout::before {
  /* the arrow, pointing up at the button */
  content: '';
  position: absolute;
  top: -6px;
  left: 18px;
  border: 6px solid transparent;
  border-top: 0;
  border-bottom-color: var(--gold);
}
.budget-callout .link {
  color: inherit;
  font-size: var(--fs-lg);
  line-height: 1;
  margin-left: auto;
}
.build-note b {
  color: var(--gold);
}
.budget-adv-h {
  font-size: var(--fs-md);
  margin: 0 0 6px;
}

/* ---------------- Tourneys ---------------- */

.tourney-rules,
.tourney-organisers {
  margin: 8px 0 0;
  padding-left: 18px;
}
/* A round's games: table number, home, score, away (and a Rematch flag). */
.tn-games {
  display: grid;
}
/* The knockout bracket (REY-76): a column per round, games spaced so each sits between the two
   it comes from. Scrolls sideways inside the panel on a phone, not the page. */
.tn-bracket {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.tn-bk-round {
  display: flex;
  flex-direction: column;
  flex: 0 0 200px;
}
.tn-bk-games {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex: 1;
  gap: 10px;
}
.tn-bk-game {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.tn-bk-game.is-empty {
  visibility: hidden;
  min-height: 60px;
}
.tn-bk-game small {
  display: block;
  padding: 0 8px 4px;
  font-size: var(--fs-xs);
}
.tn-bk-team {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  min-height: 30px;
  align-items: center;
}
.tn-bk-team + .tn-bk-team {
  border-top: 1px solid var(--line);
}
.tn-bk-team span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tn-bk-team.is-won {
  font-weight: 600;
  color: var(--ink);
}
.tn-game {
  display: grid;
  grid-template-columns: 2em minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
}
.tn-game.is-mine {
  background: color-mix(in srgb, var(--gold) 6%, transparent);
}
.tn-table {
  color: var(--ink-faint);
  text-align: center;
}
.tn-team {
  display: grid;
  overflow-wrap: anywhere;
}
.tn-game > .tn-team:last-of-type,
.tn-game > .tn-spot:last-of-type {
  text-align: right;
}
.tn-team small {
  color: var(--ink-dim);
  font-size: var(--fs-sm);
}
.tn-score {
  font-family: var(--font-display);
  font-weight: 600;
  text-align: center;
  min-width: 2.5em;
}
.tn-flag {
  grid-column: 2 / -1;
  justify-self: start;
}
.tn-score small {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--ink-dim);
  white-space: nowrap;
}
/* Under a game: Play, Open match, Enter score, Forfeit; or its score / forfeit form. */
.tn-game-actions,
.tn-game-form {
  grid-column: 2 / -1;
}
.tn-game-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
/* Buttons keep their own width here (.btn grows to fill a row elsewhere). */
.tn-game-actions .btn {
  flex: none;
}
.tn-score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5em 5em;
  gap: 8px;
  align-items: end;
  max-width: 420px;
  margin-bottom: 6px;
}
.tn-score-row .field {
  margin: 0;
  min-width: 0;
}
.tn-score-name {
  overflow-wrap: anywhere;
  padding-bottom: 8px;
}
.tn-bye {
  margin-top: 8px;
}
.tn-spot {
  font: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-height: 40px;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.tn-spot small {
  display: block;
  color: var(--ink-dim);
  font-size: var(--fs-sm);
}
.tn-spot.is-picked {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
.tn-earlier {
  margin-top: 12px;
}
.tn-earlier summary {
  cursor: pointer;
  color: var(--ink-dim);
  padding: 4px 0;
}
.tn-tiebreaks {
  margin: 6px 0;
  padding-left: 22px;
  display: grid;
  gap: 4px;
}
.tn-tiebreaks li button {
  margin-left: 8px;
}
.tn-spot {
  width: 100%;
}
/* The scoring numbers sit side by side, phones included. */
.tn-nums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  max-width: 520px;
}
.tn-nums .field {
  min-width: 0;
}
.tn-bye .tn-spot {
  width: auto;
  min-width: 10em;
}

/* A tourney's tabs: one row that scrolls sideways when the rounds run long. */
.tn-tabs {
  display: flex;
  max-width: 100%;
  overflow-x: auto;
  margin: 12px 0;
  scrollbar-width: none;
}
/* Phones: fade the edge so a cut-off tab reads as "scroll for more". */
@media (max-width: 640px) {
  .tn-tabs {
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
}
.tn-tabs button {
  flex: none;
  white-space: nowrap;
}
/* A league's Fixtures tab: a sub-tab per round, at the top of the panel. */
.lg-rounds {
  margin-top: 0;
}
/* A team with its logo: the name wraps beside the logo, not under it. */
.lg-team {
  display: inline-flex;
  align-items: center;
  text-align: left;
}
.lg-team .roster-icon {
  flex: none;
}

/* Tourney awards: place, team, figure. */
.tn-awards {
  display: grid;
}
.tn-award {
  display: grid;
  grid-template-columns: 8.5em minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.tn-award-label {
  color: var(--ink-dim);
  font-weight: 600;
}
.tn-award--p1 .tn-award-label {
  color: var(--gold);
  font-size: 1.15em;
}
.tn-award-n {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  color: var(--ink-dim);
  white-space: nowrap;
}
.tn-award-teams {
  display: grid;
  gap: 6px;
}
.tn-award-show {
  margin-top: 12px;
}
@media (max-width: 640px) {
  .tn-award {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .tn-award-label {
    grid-column: 1 / -1;
  }
}

/* Match steps as a dialog over the page (docs/plans/match-day-feedback.md, Phase 5). */
.dialog--step {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.step-dialog {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.step-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.step-dialog-head h2 {
  margin: 0 0 2px;
}
.step-dialog-head .btn {
  flex: none;
  width: auto;
}
.step-dialog .lobby-cells {
  margin-top: 0;
}
.step-dialog .side {
  border: 0;
  padding: 0;
  box-shadow: none;
}
.step-wait {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border-left: 3px solid var(--gold);
  font-weight: 600;
}
.step-back {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
}
.step-back span {
  flex: 1 1 200px;
}
.step-open-note {
  grid-column: 1 / -1;
  margin: 0;
}
.step-bar {
  position: sticky;
  top: calc(var(--topbar-h, 59px) + 8px);
  z-index: 19;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgb(0 0 0 / 12%);
  font-size: var(--fs-md);
}
.step-bar .btn {
  flex: none;
  width: auto;
}
@media (max-width: 640px) {
  .dialog--step {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 14px 16px;
  }
  .step-dialog .lobby-cells {
    grid-template-columns: 1fr;
  }
}

/* A match code as a QR (Phase 6): always dark on white, whatever the theme. */
.dialog--qr {
  width: min(360px, calc(100vw - 32px));
}
.qr-code {
  background: #fff;
  border-radius: var(--radius);
  padding: 4px;
}
.qr-code svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Team pages: back link and the Record / Edit switch (2026-10-13). */
.match-top .team-switch {
  margin-left: auto;
}
.record-extras {
  gap: 14px 26px;
}
.record-extras div {
  align-items: flex-start;
}
.record-table tr.is-star td {
  background: color-mix(in srgb, var(--gold) 5%, transparent);
}
/* Tourney games and standings: the team's name opens it; roster under it. */
.tn-team > .link {
  text-align: inherit;
}
.tn-roster {
  display: block;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}

/* Tourney package form (packageForm.js): organiser's package builder and "Enter tourney rules". */
.pf {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.sep {
  margin: 20px 0 4px;
  border: 0;
  border-top: 1px solid var(--line);
}
.sep--double {
  margin-top: 28px;
  border-top: 3px double var(--line);
}
.pf-head {
  margin: 14px 0 2px;
  font-size: var(--fs-md);
  color: var(--ink-dim);
}
/* A small title in a field's style (Skills, Stacking), matching .field > span. */
.pf-label {
  margin: 14px 0 6px;
  font-size: var(--fs-xs);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-faint);
}
.pf-modes,
.pf-checks {
  display: grid;
  gap: 4px;
}
.pf-checks--grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.pf-indent {
  display: grid;
  gap: 6px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.pf-sub {
  margin-left: 24px;
}
.pf .field small.hint {
  display: block;
  margin-top: 2px;
}
.pf-tabs {
  margin: 4px 0;
}
.pf-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.pf-details summary {
  cursor: pointer;
  font-weight: 600;
}
.pf-table-wrap {
  max-height: 360px;
  overflow: auto;
  margin-top: 8px;
}
.pf-stars {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.pf-stars th,
.pf-stars td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.pf-stars .num {
  text-align: right;
}
.pf-tax {
  width: 5.5em;
}
.pf-off {
  color: var(--ink-dim);
}
.pf-off td:first-child {
  text-decoration: line-through;
}
.pf-teams {
  columns: 2 180px;
  margin: 0;
  padding-left: 18px;
}
.pf-dialog {
  width: min(480px, calc(100vw - 32px));
}
.pf-dialog-list {
  display: grid;
  gap: 4px;
  max-height: 60vh;
  overflow: auto;
  margin: 8px 0 12px;
}
.pf-dialog .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Make a Team for a Tourney: the list, and the picked package's rules beside it (under it when narrow). */
.tp-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: start;
}
.tp-search--single {
  grid-template-columns: minmax(0, 1fr);
}
@media (max-width: 960px) {
  .tp-search {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Stacked: sticky would let the list scroll through it. */
  .tp-search .tp-detail {
    order: -1;
    position: static;
  }
}
.tp-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.tp-filters .field {
  flex: 1 1 140px;
  min-width: 0;
}
.tp-filters .check {
  align-self: flex-end;
  margin-bottom: 9px; /* level with the boxes under their labels */
}
.tp-list {
  display: grid;
  gap: 6px;
  max-height: 60vh;
  overflow: auto;
}
.tp-item {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.tp-item.is-on {
  box-shadow: inset 0 0 0 1px var(--gold);
  background: var(--panel-2);
}
.tp-item small {
  color: var(--ink-dim);
}
.tp-detail {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--panel);
  position: sticky;
  top: 8px;
}
.tp-detail ul {
  margin: 6px 0;
  padding-left: 18px;
}
.tp-detail .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* ---------- Weather tables (docs/plans/weather-tables.md) ---------- */
.wx-rows {
  width: 100%;
  border-collapse: collapse;
}
.wx-rows td {
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  vertical-align: top;
  font-size: var(--fs-sm);
}
.wx-rows tr:first-child td {
  border-top: 0;
}
.wx-rows td b {
  display: block;
}
.wx-rows td span {
  color: var(--ink-dim);
}
.wx-result {
  width: 1%;
  white-space: nowrap;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
}
.wx-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.wx-controls .btn {
  flex: none;
  width: auto;
}
.wx-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 12px;
  margin-top: 12px;
  align-items: start;
}
.wx-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
}
.wx-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 2px solid var(--gold);
}
.wx-card-head h3 {
  font-size: var(--fs-md);
  margin: 0;
}
.wx-card-acts {
  margin-left: auto;
  display: flex;
  gap: 12px;
}
.wx-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.wx-editor > .field {
  flex: none;
  width: min(100%, 320px);
}
.wx-edit-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.wx-edit-row {
  display: grid;
  grid-template-columns: 4.5em minmax(6em, 1fr) minmax(8em, 2fr) auto;
  gap: 6px;
  align-items: center;
}
.wx-edit-row input {
  min-width: 0;
  width: 100%;
}
.wx-edit-labels {
  font-size: var(--fs-xs);
  color: var(--ink-dim);
}
.wx-problems {
  margin: 0;
  color: var(--bad);
  font-size: var(--fs-sm);
}
.wx-problems.ok {
  color: var(--go);
}
.wx-round {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
.wx-round span {
  color: var(--ink-dim);
  font-size: var(--fs-sm);
}
.wx-match {
  flex-basis: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 10px;
}
.wx-match summary {
  cursor: pointer;
  padding: 6px 10px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
/* Sub-rolls (docs/plans/stadium-tables.md): indented under their row. */
.wx-rows tr.wx-sub td {
  border-top-style: dashed;
}
.wx-rows tr.wx-sub td:first-child {
  padding-left: 22px;
  font-weight: 600;
  color: var(--ink-dim);
}
.wx-rows tr.wx-sub td:last-child {
  padding-left: 22px;
}
.wx-edit-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wx-sub-add {
  align-self: flex-start;
  margin-left: 4.5em;
  font-size: var(--fs-sm);
}
.wx-sub-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 6px 1.5em;
  padding: 8px 0 8px 10px;
  border-left: 2px solid var(--gold);
}
.wx-sub-edit > .link {
  align-self: flex-start;
}
.wx-sub-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.wx-sub-head label {
  display: flex;
  white-space: nowrap;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--ink-dim);
}
.wx-round-row {
  display: flex;
  flex-wrap: wrap;
  column-gap: 20px;
}
@media (max-width: 520px) {
  .wx-edit-row {
    grid-template-columns: 4.6em 1fr auto;
  }
  .wx-edit-row input[data-wx-cell$=':2'],
  .wx-edit-row input[data-wx-sub$=':2'] {
    grid-column: 1 / 3;
    grid-row: 2;
  }
  .wx-edit-labels span:nth-child(3) {
    display: none;
  }
  .wx-sub-add {
    margin-left: 0;
  }
  .wx-sub-edit {
    margin-left: 0.25em;
  }
}

/* ---------------- Player card (tap a player on the Record) ---------------- */

.player-card {
  width: min(460px, calc(100vw - 24px));
}
.pc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.pc-head h2 {
  margin: 0;
}
.pc-head .team-meta {
  margin: 2px 0 0;
}
.pc-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.pc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.pc-stat small {
  font: 600 11px / 1.2 var(--font-display);
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}
.pc-stat strong {
  font-size: var(--fs-lg);
}
.pc-stat.is-up strong {
  color: var(--go);
}
.pc-stat.is-down strong {
  color: var(--bad);
}
.pc-skills {
  margin: 0 0 12px;
  font-size: var(--fs-sm);
}
.pc-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px 14px;
  margin-bottom: 12px;
}
.pc-facts > div {
  display: flex;
  flex-direction: column;
}
.pc-facts small {
  font: 600 11px / 1.2 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.pc-facts .dim,
.pc-history .dim {
  color: var(--ink-faint);
  font-size: var(--fs-sm);
}
.player-card h3 {
  margin: 4px 0 6px;
  font: 600 12px / 1.2 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.pc-history {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
}
.pc-history li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.pc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.pc-actions .btn {
  flex: 1 1 140px;
}

/* Reopen blocked: each team's changes and a link to its record. */
.changes-list {
  display: grid;
  gap: 14px;
}
.changes-team h3 {
  margin: 0 0 4px;
  font-size: var(--fs-md);
}
.changes-team ul {
  margin: 0 0 8px;
  padding-left: 18px;
  color: var(--ink-dim);
}

/* Back to top on the Almanac pages (REY-98): bottom right, above the phone's bottom bar. */
.to-top {
  position: fixed;
  right: 16px;
  bottom: 24px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--panel);
  color: var(--gold);
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.15s,
    transform 0.15s,
    visibility 0.15s;
}
.to-top.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.to-top:hover,
.to-top:focus-visible {
  background: var(--panel-2);
  outline: none;
}
@media (max-width: 640px) {
  :root[data-nav='bottom'] .to-top {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}
