/* Familien-Darts. Light pages for the tournament, a dark theme for the game. */

:root {
  --ground: #f5f3ee;
  --surface: #ffffff;
  --sunken: #ece8df;
  --line: #e3ded3;
  --line-strong: #d6d0c4;
  --ink: #1b1a17;
  --muted: #5f5a50;
  --accent: #b8322a;
  --accent-ink: #ffffff;
  --good-bg: #e4f0e9;
  --good-ink: #17573a;
  --warn-bg: #fbe9d7;
  --warn-ink: #7a3e0a;
  --bad-bg: #fbe3e1;
  --bad-ink: #8e241e;
  --radius: 12px;
  --numbers: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  color-scheme: light;
}

.dark {
  --ground: #121417;
  --surface: #1c1f24;
  --sunken: #2c3038;
  --line: #2c3038;
  --line-strong: #3a3f48;
  --ink: #f2efe8;
  --muted: #a3a7ae;
  --accent: #c8372d;
  --good-bg: #16352a;
  --good-ink: #b5e3c9;
  --warn-bg: #3a2a14;
  --warn-ink: #f9d9a6;
  --bad-bg: #3a1f1f;
  --bad-ink: #f8c4bf;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
}
h1 {
  font-size: clamp(32px, 5vw, 44px);
}
h2 {
  font-size: 22px;
}
h3 {
  font-size: 15px;
  color: var(--muted);
}
p {
  margin: 0;
}
a {
  color: var(--accent);
}

.num {
  font-family: var(--numbers);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 14px;
}
.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Layout */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.nav a {
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}
.nav a[aria-current="page"] {
  background: var(--sunken);
  color: var(--ink);
}
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.page.narrow {
  max-width: 880px;
}
.head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.split {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
.split > .main {
  flex: 999 1 520px;
  min-width: 0;
}
.split > .side {
  flex: 1 1 300px;
  min-width: 0;
}
.grid4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card.flush {
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.card.flush > .card-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.notice {
  border-radius: var(--radius);
  padding: 14px 16px;
  font-weight: 600;
}
.notice.good {
  background: var(--good-bg);
  color: var(--good-ink);
}
.notice.warn {
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.notice.bad {
  background: var(--bad-bg);
  color: var(--bad-ink);
}

/* Controls */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.button.danger {
  border: 2px solid var(--accent);
  color: var(--accent);
}
.button.wide {
  width: 100%;
}
.button:disabled {
  opacity: 0.4;
  cursor: default;
}
.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
}

label {
  font-size: 14px;
  font-weight: 600;
}
input[type="text"],
input[type="password"],
input[type="number"],
select {
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}
input[type="number"] {
  width: 120px;
  text-align: right;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
legend {
  font-size: 14px;
  font-weight: 600;
  padding: 0;
  margin-bottom: 10px;
}

/* Pill choices: radio or checkbox inputs styled as buttons. */
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.choice input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--ground);
}
.choice input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--sunken);
}
.segmented a {
  padding: 8px 14px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}
.segmented a[aria-current="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}

/* Tables and lists */

table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
}
td {
  padding: 12px;
  border-top: 1px solid var(--line);
}
th:first-child,
td:first-child {
  padding-left: 24px;
}
th:last-child,
td:last-child {
  padding-right: 24px;
}
.right {
  text-align: right;
}
.scroll {
  overflow-x: auto;
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list > li {
  border-top: 1px solid var(--line);
}
.list > li:first-child {
  border-top: 0;
}
.list-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 14px 24px;
  color: var(--ink);
  text-decoration: none;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
}
.badge.first {
  background: var(--accent);
  color: var(--accent-ink);
}
.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--sunken);
  font-size: 14px;
  font-weight: 600;
}
.chip.first {
  background: var(--accent);
  color: var(--accent-ink);
}
.chip.good {
  background: var(--good-bg);
  color: var(--good-ink);
}
.chip.warn {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

/* Login */

.login {
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
}
.login-art {
  flex: 1 1 420px;
  min-height: 280px;
  background: #1b1a17;
  padding: 40px;
  position: relative;
  overflow: hidden;
}
.login-art .brand {
  color: #f2efe8;
}
.login-art svg.art {
  position: absolute;
  right: -120px;
  bottom: -120px;
  width: 520px;
  height: 520px;
}
.login-form {
  flex: 1 1 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.login-form form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* New game */

.order-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.order-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-radius: var(--radius);
  background: var(--ground);
}
.order-list .name {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
}

/* Game */

/* The game screen fills the window: header, players, status, then the keypad
   takes all the height that is left. */
.game-screen {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
  /* No double-tap zoom, no text selection or callouts on long presses. */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.game-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-inline: -16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.game-top a.back {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.game-top form {
  display: flex;
}
.game-top .button {
  min-height: 44px;
}
.game-top .button[data-key="sound"][aria-pressed="false"] {
  color: var(--muted);
}
.scoreboard {
  display: grid;
  grid-template-columns: repeat(var(--players), minmax(0, 1fr));
  gap: 12px;
}
.player-card {
  min-width: 0;
  background: var(--surface);
  border: 3px solid transparent;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.player-card[aria-current] {
  border-color: #e0493e;
}
.player-card.done {
  opacity: 0.55;
}
.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.player-name {
  font-size: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-card .left {
  font-size: clamp(48px, 7vw, 88px);
  line-height: 1;
}
.slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.slot {
  height: 36px;
  border-radius: 8px;
  border: 1px dashed var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--numbers);
  font-size: 18px;
  font-weight: 700;
}
.slot.filled {
  border: 0;
  background: var(--ink);
  color: var(--ground);
}
.slots.bust .slot.filled {
  background: var(--warn-ink);
}
.status {
  min-height: 24px;
  text-align: center;
  color: var(--muted);
}
.status.checkout {
  color: var(--good-ink);
  font-weight: 600;
}
.status.bust {
  color: var(--warn-ink);
  font-weight: 600;
}
.status.bad {
  color: var(--bad-ink);
  font-weight: 600;
}
/* Landscape: 1 to 10, 11 to 20, then D, T, 25, 0 and delete at double width. */
.keypad {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-auto-rows: minmax(56px, 1fr);
  gap: 8px;
}
.keypad button {
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--numbers);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 600;
  cursor: pointer;
  transition: transform 60ms, filter 60ms;
}
.keypad .modifier,
.keypad [data-key="25"] {
  grid-column: span 2;
}
.keypad button.modifier {
  background: var(--sunken);
}
.keypad button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--ground);
}
.keypad button.pressed {
  transform: scale(0.95);
  filter: brightness(1.4);
}
.keypad button:disabled {
  opacity: 0.3;
}
@media (orientation: portrait) {
  .keypad {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .keypad .modifier,
  .keypad [data-key="25"] {
    grid-column: auto;
  }
}
.board {
  width: 100%;
  max-width: 520px;
  height: auto;
  display: block;
  margin: 0 auto;
}
[hidden] {
  display: none !important;
}
/* Bars on the player page */

.bar-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 120px;
  align-items: center;
  gap: 16px;
}
.bar-track {
  position: relative;
  height: 24px;
  border-radius: 8px;
  background: var(--sunken);
}
.bar-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--line-strong);
}
.bar-fill.strong {
  background: #1e7a4c;
}
.bar-fill.accent {
  background: var(--accent);
}
.bar-mark {
  position: absolute;
  left: 50%;
  top: -4px;
  bottom: -4px;
  border-left: 2px dashed var(--ink);
}
.places {
  display: flex;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
}
.places span {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.tile {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--ground);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi {
  font-size: 40px;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
summary.button {
  list-style: none;
}
summary.button::-webkit-details-marker {
  display: none;
}
