/* Colours come from themes.css (generated from web/themes.go): the tokens
   --bg --card --line --tx --tx2 --acc --on --good --cell --bad --badon --warnbg
   --warntx --ring. Nothing here names a colour. */

* {
  box-sizing: border-box;
}

fieldset {
  min-width: 0;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--acc);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.i {
  width: 1.5rem;
  height: 1.5rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

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

/* Top bar: the brand (or a back arrow and the page title) and the avatar; on
   wide screens the main links are here too and the bottom bar is hidden. */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.topbar-in {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--tx);
  margin-right: auto;
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  background: var(--acc);
  color: var(--on);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-mark .i {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
  stroke: none;
}

.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin-left: -0.75rem;
  color: var(--tx);
}

.page-title {
  font-weight: 600;
  margin-right: auto;
}

.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--cell);
  color: var(--acc);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  flex: none;
}

.topnav {
  display: none;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: 10px;
  color: var(--tx);
  text-decoration: none;
}

.topnav a[aria-current="page"] {
  color: var(--acc);
  background: var(--cell);
}

.topnav a.topnav-add {
  background: var(--acc);
  color: var(--on);
  font-weight: 500;
}

/* Bottom tab bar (phones): Home, Stats, Add, Approve, More. */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  min-height: 56px;
  padding: 6px 0 8px;
  color: var(--tx2);
  font-size: 0.6875rem;
  text-decoration: none;
}

.tabbar a[aria-current="page"] {
  color: var(--acc);
}

.tabbar .add {
  width: 2.75rem;
  height: 2.75rem;
  margin-top: -1.35rem;
  border-radius: 50%;
  background: var(--acc);
  color: var(--on);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tabbar .badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
}

body.has-tabbar main {
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

@media (min-width: 641px) {
  .tabbar {
    display: none;
  }

  .topnav {
    display: flex;
  }

  .brand {
    margin-right: 0;
  }

  body.has-tabbar main {
    padding-bottom: 3rem;
  }
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: 0;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"] {
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--tx);
  width: 100%;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 1rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--acc);
  border-radius: 12px;
  background: var(--acc);
  color: var(--on);
  font-weight: 500;
  cursor: pointer;
  width: fit-content;
}

button:hover {
  opacity: 0.9;
}

button.link-button {
  background: none;
  border: none;
  color: var(--acc);
  padding: 0;
  text-decoration: underline;
}

.error {
  background: var(--card);
  color: var(--bad);
  border: 1px solid var(--bad);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
}

.muted {
  color: var(--tx2);
  font-size: 0.9rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-top: 1rem;
}

.badge {
  display: inline-block;
  background: var(--acc);
  color: var(--on);
  border-radius: 999px;
  font-size: 0.6875rem;
  line-height: 1.3;
  padding: 0 0.4rem;
  font-weight: 600;
}

/* Small status labels. "Waiting" is for things that need the user (pending
   games); "good" for active or up. */
.pill {
  display: inline-block;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1.4;
  padding: 0.05rem 0.55rem;
  background: var(--cell);
  color: var(--tx2);
}

.pill-wait {
  background: var(--warnbg);
  color: var(--warntx);
}

.pill-good {
  color: var(--good);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--tx);
  text-decoration: none;
  font-size: 0.8125rem;
}

.chip.on,
.chip[aria-current="true"] {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--on);
}

/* A bordered group of rows (settings lists, the More menu). */
.group {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.5rem 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--tx);
  text-decoration: none;
}

.group > .li:first-child {
  border-top: 0;
}

.li .i {
  color: var(--acc);
}

.li .grow {
  flex: 1;
}

.li .chev {
  color: var(--tx2);
}

/* Links that look like buttons. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--tx);
  font-weight: 500;
  text-decoration: none;
}

.btn-primary {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--on);
}

/* Scoreboard cells, used wherever a game is shown: marks in monospace, strikes
   in the accent, spares in the good colour, a split as a ring. The characters
   carry the meaning; colour is never the only cue. */
.sb {
  display: flex;
  gap: 2px;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}

.sb-cell {
  flex: 1;
  min-width: 0;
  background: var(--cell);
  border-radius: 7px;
  padding: 3px 0;
  text-align: center;
}

.sb-cell:last-child {
  flex: 1.8;
}

.sb-num,
.sb-run {
  display: block;
  color: var(--tx2);
  font-size: 0.6875rem;
}

.sb-marks {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875rem;
}

.sb-x {
  color: var(--acc);
  font-weight: 600;
}

.sb-s {
  color: var(--good);
  font-weight: 600;
}

.sb-split {
  display: inline-block;
  width: 1.05rem;
  line-height: 0.9rem;
  border: 1.5px solid var(--ring);
  border-radius: 50%;
}

.sb-doubt {
  background: var(--warnbg);
  outline: 1.5px solid var(--warntx);
}

.sb-doubt .sb-num,
.sb-doubt .sb-run {
  color: var(--warntx);
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.actions form {
  display: inline;
}

button.secondary {
  background: var(--card);
  border-color: var(--line);
  color: var(--tx);
}

/* Danger is a filled button of the same weight as the primary one. */
button.danger {
  background: var(--bad);
  color: var(--badon);
  border-color: var(--bad);
}

select {
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--tx);
}

textarea {
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--tx);
  font-family: inherit;
  width: 100%;
}

.section {
  margin-top: 2rem;
}

.frame-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.frame-cell {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.frame-cell legend {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0 0.25rem;
}

.roll-label {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.roll-label input[type="text"] {
  width: 3rem;
  padding: 0.25rem 0.35rem;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--tx);
}

.split-label {
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--tx2);
}

table.scoresheet {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  table-layout: fixed;
}

table.scoresheet th,
table.scoresheet td {
  border: 1px solid var(--line);
  text-align: center;
  padding: 0.3rem 0.15rem;
}

.frame-marks span {
  display: inline-block;
  min-width: 1rem;
}

.frame-cumulative {
  color: var(--tx2);
}

.scoresheet-total {
  font-weight: 600;
  margin-top: 0.3rem;
}

.filter-form {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.filter-form label {
  min-width: 8rem;
}

#trend {
  max-width: 100%;
  height: auto;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea,
button {
  min-height: 44px;
}

.roll-label input[type="text"] {
  min-height: 36px;
}

input[type="checkbox"],
input[type="radio"] {
  min-width: 20px;
  min-height: 20px;
}

@media (max-width: 600px) {
  main {
    padding: 1rem 1rem 3rem;
  }

  .frame-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-flow: row;
    gap: 0.3rem;
  }

  .frame-cell {
    min-width: 0;
    padding: 0.2rem;
    gap: 0.15rem;
  }

  .frame-cell legend {
    padding: 0 0.1rem;
    font-size: 0.75rem;
  }

  .roll-label {
    gap: 0.2rem;
    min-width: 0;
  }

  .roll-label input[type="text"] {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0.2rem;
    font-size: 1rem;
  }

  .split-label {
    flex-wrap: wrap;
    gap: 0.15rem;
    min-width: 0;
  }

  .split-label input[type="checkbox"] {
    flex: 0 0 auto;
  }

  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-form label {
    min-width: 0;
  }
}

.notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
}

.thumb {
  max-width: 100%;
  max-height: 260px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Nothing in a card starts or ends with extra margin. */
.card > :first-child {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

/* One offer on the Approvals page: the text, then its actions below it. */
.offer {
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.offer p {
  margin: 0 0 0.5rem;
}

.offer .actions {
  align-items: center;
  gap: 1rem;
  margin-top: 0;
}

/* photo history: a grid of kept photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.photo-grid .card { margin: 0; }
.kept-thumb { display: block; width: 100%; height: auto; border-radius: 4px; }

/* More page */
.card-first {
  margin-top: 0;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-card .grow {
  flex: 1;
  min-width: 0;
}

.avatar-lg {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 0.9375rem;
}

button.block {
  width: 100%;
}

.logout-form {
  margin-top: 1rem;
}

/* Home */
.k {
  color: var(--tx2);
  font-size: 0.8125rem;
  margin: 0;
}

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.big {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
}

h2.sh {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tx2);
  margin: 1.5rem 0.25rem 0;
}

.hero p {
  margin: 0.15rem 0;
}

.hero-num {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.trend {
  color: var(--tx2);
  font-size: 0.8125rem;
}

.trend.up {
  color: var(--good);
}

.spark {
  width: 100%;
  height: 2.25rem;
  margin: 0.4rem 0;
}

.spark polyline {
  fill: none;
  stroke: var(--acc);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--warnbg);
  color: var(--warntx);
  text-decoration: none;
  font-weight: 500;
}

/* An openable card (a native <details>, so it needs no script). */
details.fold {
  padding: 0;
}

details.fold > summary {
  display: block;
  padding: 0.9rem 1rem;
  cursor: pointer;
  list-style: none;
}

details.fold > summary::-webkit-details-marker {
  display: none;
}

details.fold:focus-within {
  outline: none;
}

.fold-head,
.fold-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.fold-score {
  justify-content: flex-start;
  gap: 0.75rem;
}

.chev-flip {
  color: var(--tx2);
  display: inline-flex;
  transition: transform 0.15s ease;
}

details.fold[open] .chev-flip {
  transform: rotate(180deg);
}

.fold-body {
  padding: 0 1rem 1rem;
}

.sb-ribbon .sb-run {
  display: none;
}

.sb-full {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-top: 0;
}

.sb-full .sb-cell:last-child {
  grid-column: auto;
}

.fold-body .actions .btn {
  flex: 1;
}

@media (prefers-reduced-motion: reduce) {
  .chev-flip {
    transition: none;
  }
}

/* Stats and profile */
.pagehead {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pagehead h1 {
  margin: 0;
}

.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.two .card {
  margin-top: 0.75rem;
}

.card p.big {
  margin: 0;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.ranges {
  margin-top: 1rem;
}

details.sheet {
  margin-top: 0.75rem;
}

details.sheet > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
}

details.sheet > summary .fold-head {
  width: 100%;
}

details.sheet .i {
  vertical-align: -0.3em;
}

.filter-form.fold-body {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  padding-top: 0;
}

.kinds {
  border: 0;
  margin: 0;
  padding: 0;
}

.kinds legend {
  padding: 0 0 0.3rem;
}

.chip-radio {
  position: relative;
  padding: 0;
}

.chip-radio input {
  position: absolute;
  opacity: 0;
  inset: 0;
  min-height: 0;
  margin: 0;
  cursor: pointer;
}

.chip-radio span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.8rem;
  border-radius: 999px;
}

.chip-radio input:checked + span {
  background: var(--acc);
  color: var(--on);
}

.chip-radio input:focus-visible + span {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

.bars {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
}

.bars li {
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.bars li:first-child {
  border-top: 0;
}

.bar-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.bar {
  display: block;
  width: 100%;
  height: 6px;
  margin: 0.3rem 0 0.15rem;
}

.bar-bg {
  fill: var(--cell);
}

.bar-fg {
  fill: var(--acc);
}

.li .sub {
  display: block;
}

/* The closed last-game card shows the ribbon and "tap to open"; open, the full
   scoreboard below replaces the ribbon and the hint says "tap to close". */
.when-open {
  display: none;
}

details[open] .when-open {
  display: inline;
}

details[open] .when-closed,
details[open] .sb-ribbon {
  display: none;
}

.chart-box {
  position: relative;
  height: 15rem;
}

/* Add games */
.add-form {
  display: block;
}

.outing-card > summary {
  min-height: 44px;
}

.outing-line {
  display: block;
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0.15rem 0;
}

.link-text {
  color: var(--acc);
}

.add-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.choice {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}

.tile {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--tx);
  text-align: left;
  font-weight: 400;
}

.tile-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--cell);
  color: var(--acc);
  flex: none;
}

.tile-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.outing-note {
  margin: 0 0 0.5rem;
}

.total-form .total-input {
  font-size: 2.5rem;
  font-weight: 600;
  text-align: center;
  min-height: 4.5rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.photo-pick {
  align-items: center;
  gap: 0.35rem;
  padding: 1.75rem 1rem;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  background: var(--card);
  text-align: center;
  cursor: pointer;
}

.photo-pick-ic {
  color: var(--acc);
}

.photo-pick-ic .i {
  width: 2.25rem;
  height: 2.25rem;
}

.photo-pick input[type="file"] {
  max-width: 100%;
}

.saved-card {
  text-align: center;
}

.saved-ic {
  color: var(--good);
}

.saved-ic .i {
  width: 2rem;
  height: 2rem;
}

.group .li.newest {
  background: var(--cell);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.center {
  text-align: center;
  margin-top: 1rem;
}

/* Frame keypad (frame-keypad.js turns it on; without the script the plain inputs show) */
.frames-form.kp-on .frame-grid,
.frames-form.kp-on #scoresheet {
  display: none;
}

.kp-score {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0;
}

.kp-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 0.5rem 0 0;
}

.kp-strip .sb-cell {
  min-height: 3.6rem;
}

.kp-strip .sb-cell:last-child {
  flex: initial;
}

.kp-active {
  outline: 2px solid var(--acc);
  background: var(--card);
}

.kp-keys {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 0.75rem;
}

.kp-key {
  width: 100%;
  min-height: 52px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--tx);
  font-size: 1.25rem;
  font-weight: 600;
}

.kp-x {
  color: var(--acc);
}

.kp-s {
  color: var(--good);
}

.kp-wide {
  grid-column: span 2;
  font-size: 1rem;
}

.kp-key.on {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--on);
}

.kp-key.off {
  opacity: 0.4;
}

.kp-key:active {
  background: var(--cell);
}

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--acc);
}

.kp-redo {
  cursor: pointer;
}

.kp-redo:hover {
  outline: 1px solid var(--line);
}

/* Game page */
.game-score {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0.25rem 0 0.75rem;
}

.banner-note {
  margin: 0.75rem 0;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--warnbg);
  color: var(--warntx);
}

.banner-note p {
  margin: 0;
}

.banner-note .actions {
  margin-top: 0.6rem;
}

.siblings {
  margin-top: 0.75rem;
}

.card .btn {
  margin-top: 0.25rem;
}

.delete-form {
  margin-top: 1.25rem;
  align-items: center;
}

button.link-danger {
  width: auto;
  min-height: 44px;
  padding: 0 1rem;
  border: 0;
  background: none;
  color: var(--bad);
  font-weight: 500;
}

/* Outings */
a.outing-row,
a.game-card {
  display: block;
  color: var(--tx);
  text-decoration: none;
  margin-top: 0.6rem;
}

.outing-top,
.game-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.outing-pills {
  display: inline-flex;
  gap: 0.35rem;
}

.outing-sum {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  text-align: center;
}

.outing-sum span {
  display: block;
}

.big-sm {
  font-size: 1.25rem;
}

/* Approvals */
.pending-outing .card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.pending-game {
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.pending-game:first-of-type {
  border-top: 0;
  padding-top: 0.25rem;
}

.pending-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.two-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.two-buttons form {
  display: block;
}

.two-buttons button {
  width: 100%;
}

.two-buttons.bulk {
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.dup-note {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: var(--warnbg);
  color: var(--warntx);
  font-size: 0.8125rem;
}

.offer p {
  margin: 0.2rem 0;
}

.offer .actions {
  margin-top: 0.6rem;
  align-items: center;
}

.empty {
  text-align: center;
  padding: 3rem 1rem;
}

.empty p {
  margin: 0.3rem 0;
}

.empty-ic {
  color: var(--good);
}

.empty-ic .i {
  width: 2.75rem;
  height: 2.75rem;
}

/* Access */
details.grant > summary {
  list-style: none;
  cursor: pointer;
}

details.grant > summary::-webkit-details-marker {
  display: none;
}

.group > details.grant {
  border-top: 1px solid var(--line);
}

.group > details.grant:first-child {
  border-top: 0;
}

details.grant[open] .chev-flip {
  transform: rotate(180deg);
}

.grant-body {
  padding: 0 0.9rem 0.9rem;
  background: var(--cell);
}

.grant-body p {
  margin: 0;
  padding-top: 0.75rem;
}

.grant-body form {
  margin-top: 0.6rem;
}

.grant-body button {
  width: 100%;
}

.hint {
  margin: 0.4rem 0.25rem 0;
}

.seg {
  background: var(--cell);
  border-radius: 12px;
  padding: 3px;
}

.seg .chip {
  flex: 1;
  border: 0;
  background: none;
  justify-content: center;
}

.seg .chip-radio span {
  width: 100%;
  justify-content: center;
}

.grant-form:has(input[value="request"]:checked) .expiry-field {
  display: none;
}

/* Settings */
.sh.first {
  margin-top: 0;
}

.settings-form {
  gap: 0;
}

.settings-form > button {
  margin-top: 0.9rem;
}

.choice-row {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.choice-row .sub,
.switch-row .sub {
  display: block;
  font-weight: 400;
}

.choice-row input {
  flex: none;
}

.switch-row {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.switch-row .grow {
  flex: 1;
}

button.switch {
  position: relative;
  width: 3rem;
  min-width: 3rem;
  height: 1.75rem;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cell);
  flex: none;
}

button.switch::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.2rem;
  width: 1.3rem;
  height: 1.3rem;
  margin-top: -0.65rem;
  border-radius: 50%;
  background: var(--tx2);
  transition: left 0.15s ease;
}

button.switch.on {
  background: var(--acc);
  border-color: var(--acc);
}

button.switch.on::after {
  left: 1.5rem;
  background: var(--on);
}

.alias-chips {
  margin-top: 0.5rem;
}

.chip-form {
  flex-direction: row;
  gap: 0.25rem;
  padding: 0 0.2rem 0 0.8rem;
}

.chip-x {
  width: 1.9rem;
  min-height: 1.9rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--tx2);
  font-size: 1.1rem;
}

.alias-add {
  margin-top: 0.75rem;
}

.danger-card {
  border-color: var(--bad);
}

.danger-ic {
  color: var(--bad);
}

.danger-ic .i {
  width: 1.75rem;
  height: 1.75rem;
}

button.danger.block {
  min-height: 48px;
}

.problems {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

@media (prefers-reduced-motion: reduce) {
  button.switch::after {
    transition: none;
  }
}

.switch-row + p {
  margin-top: 0.75rem;
}

.card > p.k + p {
  margin-top: 0.5rem;
}

/* Theme picker (Settings). The swatch colours come from themes.css. */
.look-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.5rem;
}

.swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.swatch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  min-height: 0;
  margin: 0;
  cursor: pointer;
}

.sw-chip {
  display: flex;
  height: 2.5rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.sw-chip i {
  flex: 1;
  position: relative;
}

.sw-chip i::after {
  content: "";
  position: absolute;
  inset: auto 0.4rem 0.4rem auto;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
}

.sw-l {
  background: var(--sw-lbg);
}

.sw-l::after {
  background: var(--sw-lacc);
}

.sw-d {
  background: var(--sw-dbg);
}

.sw-d::after {
  background: var(--sw-dacc);
}

.sw-name {
  font-weight: 500;
}

.swatch:has(input:checked) {
  border-color: var(--acc);
  box-shadow: 0 0 0 1px var(--acc);
}

.swatch:has(input:focus-visible) {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

/* Photos, history, saved for later */
.btn.block {
  display: flex;
  width: 100%;
}

.group .li .sub {
  display: block;
  font-weight: 400;
}

.photo-job {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.photo-job p {
  margin: 0;
}

.photo-job-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--tx);
  text-decoration: none;
}

.rv-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rv-card p {
  margin: 0;
}

.rv-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.rv-ribbon .sb-marks {
  font-size: 0.8125rem;
}

.rv-split {
  text-decoration: underline;
  text-decoration-color: var(--ring);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.rv-who {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rv-who button {
  min-height: 44px;
}

.rv-done {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--good);
}

.missed {
  margin-top: 1rem;
}

.usage {
  display: block;
  width: 100%;
  height: 0.6rem;
  margin: 0.4rem 0;
}

.usage::-webkit-meter-bar {
  background: var(--cell);
  border: 0;
  border-radius: 999px;
}

.usage::-webkit-meter-optimum-value,
.usage::-webkit-meter-suboptimum-value,
.usage::-webkit-meter-even-less-good-value {
  background: var(--acc);
  border-radius: 999px;
}

.usage::-moz-meter-bar {
  background: var(--acc);
  border-radius: 999px;
}

.kept-tile {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--tx);
  text-decoration: none;
}

.kept-full {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.delete-fold {
  margin-top: 1rem;
}

.rv-who button {
  width: 100%;
}

.rv-card form.center {
  display: flex;
  justify-content: center;
}

/* Leagues */
.create-league {
  margin-top: 1rem;
}

.create-league > summary {
  list-style: none;
  cursor: pointer;
}

.create-league > summary::-webkit-details-marker {
  display: none;
}

.create-league .card {
  margin-top: 0.75rem;
}

.rank {
  min-width: 1.25rem;
  color: var(--tx2);
  text-align: center;
}

.li.leader {
  background: var(--cell);
}

.li.leader .rank {
  color: var(--acc);
  font-weight: 600;
}

/* Signed-out pages */
.lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
  color: var(--acc);
}

.lockup-mark .i {
  width: 4.5rem;
  height: 4.5rem;
  fill: currentColor;
  stroke: none;
}

.lockup-the {
  margin-top: 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  text-transform: uppercase;
  color: var(--tx);
}

.lockup-name {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-transform: uppercase;
  color: var(--tx);
}

.auth-title {
  margin: 1.25rem 0 0.75rem;
  text-align: center;
  font-size: 1.4rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form > .card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pw-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pw-field input {
  flex: 1;
}

.pw-toggle {
  flex: none;
  min-height: 44px;
}

.invited {
  margin-bottom: 0.75rem;
}

.step-label {
  margin: 0 0 0.5rem;
}

.choice-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.choice-card input {
  flex: none;
  margin-top: 0.2rem;
}

.choice-card .sub {
  display: block;
  font-weight: 400;
}

[hidden] {
  display: none !important;
}

.seg a.chip.on {
  background: var(--acc);
  color: var(--on);
}

.auth-form [data-step] {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.choice-card strong .k {
  display: inline;
  font-weight: 400;
}

.rv-card form.center button {
  width: auto;
}

/* The scoreboard photo kept in view while reviewing */
.photo-pin {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.4rem 0;
  background: var(--bg);
}

.photo-pin a {
  position: relative;
  display: block;
}

.photo-pin-img {
  display: block;
  width: 100%;
  height: 7.5rem;
  object-fit: contain;
  background: var(--cell);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.photo-pin-hint {
  position: absolute;
  right: 0.5rem;
  bottom: 0.4rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--card);
  color: var(--tx);
  font-size: 0.75rem;
}

.zoom-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--tx);
}

.zoom-dialog[open] {
  display: flex;
  flex-direction: column;
}

.zoom-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  padding-top: calc(0.5rem + env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.zoom-bar button {
  min-width: 44px;
}

.zoom-close {
  margin-left: auto;
}

.zoom-scroll {
  flex: 1;
  overflow: auto;
}

.zoom-img {
  display: block;
  height: auto;
}

.zoom-img.z1 { width: 100%; }
.zoom-img.z2 { width: 200%; max-width: none; }
.zoom-img.z3 { width: 300%; max-width: none; }
.zoom-img.z4 { width: 400%; max-width: none; }

.zoom-dialog::backdrop {
  background: var(--bg);
}

/* One row's strip of the photo */
.strip {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--cell);
}

.strip-svg {
  display: block;
  width: 100%;
  height: auto;
}

.zoom-strip {
  display: block;
  height: auto;
  max-width: none;
}

.zoom-strip.z1 { width: 100%; }
.zoom-strip.z2 { width: 200%; }
.zoom-strip.z3 { width: 300%; }
.zoom-strip.z4 { width: 400%; }

/* One night's stats */
.night-head h1 {
  margin: 0;
  font-size: 1.15rem;
}

.night-head p {
  margin: 0.15rem 0 0.6rem;
}

.night-note {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0.4rem 0.8rem;
  border-radius: 10px;
  background: var(--warnbg);
  color: var(--warntx);
}

.night-note a {
  color: var(--warntx);
  font-weight: 500;
}

.trend.dn {
  color: var(--bad);
}

.night-chart {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 0.25rem;
}

.nc-bar {
  fill: var(--acc);
}

.nc-score {
  fill: var(--tx);
  font-size: 11px;
}

.nc-label {
  fill: var(--tx2);
  font-size: 11px;
}

.nc-base {
  stroke: var(--line);
  stroke-width: 1;
}

.nc-usual {
  stroke: var(--tx2);
  stroke-width: 1.5;
}

.bar-tick {
  fill: var(--tx);
}

.tick-key {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.4rem 0 0;
  color: var(--tx2);
  font-size: 0.8125rem;
}

.tick-swatch {
  display: inline-block;
  width: 2px;
  height: 0.8rem;
  background: var(--tx);
}
