/* Game of Power admin dashboard. No build step: served as-is by FastAPI. */

:root {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-sunken: #f6f8fb;
  --surface-hover: #eef2f7;
  --border: #e0e5ec;
  --border-strong: #c9d0da;
  --text: #121821;
  --muted: #5c6878;
  --accent: #0b5ed7;
  --accent-hover: #094db1;
  --accent-soft: #e6effd;
  --on-accent: #ffffff;
  --ink: #0e1a2b;
  --ink-2: #16294a;
  --ink-text: #eef3fa;
  --ink-muted: #a3b3c9;
  --ink-line: rgb(255 255 255 / 10%);
  --pin: #8a5a00;
  --pin-soft: #fff3d6;
  --danger: #c0262d;
  --danger-soft: #fdeceb;
  --success: #15764a;
  --success-soft: #e3f5ec;
  /* Medals keep the same colours in both themes. */
  --gold: #573b00;
  --gold-bg: linear-gradient(135deg, #ffe39a, #f5b82e);
  --silver: #333c47;
  --silver-bg: linear-gradient(135deg, #f1f4f7, #c3cbd5);
  --bronze: #512705;
  --bronze-bg: linear-gradient(135deg, #f6cfa8, #d48a4c);
  --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 1px 3px rgb(16 24 40 / 7%);
  --shadow-lg: 0 10px 30px rgb(16 24 40 / 12%);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1015;
    --surface: #151a21;
    --surface-sunken: #11151b;
    --surface-hover: #1c222b;
    --border: #262d37;
    --border-strong: #37404c;
    --text: #e8ecf1;
    --muted: #97a2b0;
    --accent: #5b9bff;
    --accent-hover: #7cb0ff;
    --accent-soft: #172a45;
    --on-accent: #0a1120;
    --ink: #0a0e13;
    --ink-2: #111a28;
    --ink-text: #e8ecf1;
    --ink-muted: #8d9aab;
    --ink-line: rgb(255 255 255 / 8%);
    --pin: #f0bf5a;
    --pin-soft: #30250f;
    --danger: #ff7b76;
    --danger-soft: #3a1b1b;
    --success: #5fd49a;
    --success-soft: #11301f;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 50%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c1015;
  --surface: #151a21;
  --surface-sunken: #11151b;
  --surface-hover: #1c222b;
  --border: #262d37;
  --border-strong: #37404c;
  --text: #e8ecf1;
  --muted: #97a2b0;
  --accent: #5b9bff;
  --accent-hover: #7cb0ff;
  --accent-soft: #172a45;
  --on-accent: #0a1120;
  --ink: #0a0e13;
  --ink-2: #111a28;
  --ink-text: #e8ecf1;
  --ink-muted: #8d9aab;
  --ink-line: rgb(255 255 255 / 8%);
  --pin: #f0bf5a;
  --pin-soft: #30250f;
  --danger: #ff7b76;
  --danger-soft: #3a1b1b;
  --success: #5fd49a;
  --success-soft: #11301f;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 50%);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

p {
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.num {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Brand ------------------------------------------------------------- */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.1px;
}

.brand p {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #3d8bff, #0b4fc0);
  color: #fff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 25%), 0 2px 8px rgb(11 94 215 / 35%);
}

.brand-mark-lg {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

/* --- Buttons & fields -------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.btn:hover {
  background: var(--surface-hover);
}

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn-sm {
  min-height: 28px;
  padding: 0 9px;
  font-size: 13px;
}

.btn-lg {
  min-height: 42px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-on-dark {
  border-color: var(--ink-line);
  background: rgb(255 255 255 / 6%);
  color: var(--ink-text);
}

.btn-on-dark:hover {
  background: rgb(255 255 255 / 12%);
}

.btn-icon {
  min-height: 30px;
  width: 30px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-icon:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.field {
  display: grid;
  gap: 5px;
}

.field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.field em {
  font-style: normal;
  font-weight: 400;
}

input,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
}

input:disabled {
  background: var(--surface-sunken);
  color: var(--muted);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: end;
  min-height: 36px;
  cursor: pointer;
}

.check input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
  box-shadow: none;
}

.form-error {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 550;
}

/* --- Sign in ----------------------------------------------------------- */

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}

.login-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 56px;
  background:
    radial-gradient(circle at 20% 15%, rgb(61 139 255 / 35%), transparent 45%),
    linear-gradient(160deg, var(--ink-2), var(--ink));
  color: var(--ink-text);
}

.login-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  max-width: 440px;
}

.login-hero h2 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.05;
}

.login-hero p {
  color: var(--ink-muted);
  font-size: 16px;
}

/* Diagonal streaks: a nod to the race without any image to load. */
.speed-lines {
  position: absolute;
  inset: -20%;
  background: repeating-linear-gradient(
    -24deg,
    transparent 0 46px,
    rgb(255 255 255 / 4%) 46px 48px,
    transparent 48px 110px,
    rgb(91 155 255 / 9%) 110px 113px
  );
}

.login-side {
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-card {
  width: min(360px, 100%);
  display: grid;
  gap: 20px;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}

/* --- Top bar & tabs ---------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(90deg, var(--ink), var(--ink-2));
  color: var(--ink-text);
  border-bottom: 1px solid var(--ink-line);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-muted);
  font: inherit;
  font-weight: 580;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}

.tab:hover {
  color: var(--ink-text);
  background: rgb(255 255 255 / 6%);
}

.tab[aria-selected="true"] {
  color: #fff;
  background: rgb(255 255 255 / 12%);
  box-shadow: inset 0 -2px 0 #5b9bff;
}

.tab-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgb(255 255 255 / 10%);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tab-count:empty {
  display: none;
}

/* --- Layout ------------------------------------------------------------ */

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.stat-value {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.5px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value small {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel {
  display: grid;
  /* minmax(0, ...) lets wide tables scroll in their wrapper instead of widening the page. */
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h2 {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.panel-head p {
  max-width: 72ch;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-end {
  margin-left: auto;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.inline-form input {
  width: 76px;
}

.search {
  position: relative;
  flex: 1 1 280px;
  max-width: 420px;
}

.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search input {
  padding-left: 34px;
}

.note {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--pin) 25%, transparent);
  background: var(--pin-soft);
  color: var(--text);
  font-size: 13px;
}

.note::before {
  content: "i";
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--pin);
  color: var(--surface);
  font: 700 11px/1 var(--font);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* --- Tables ------------------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 9px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table th {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-sunken);
  white-space: nowrap;
}

.table td {
  white-space: nowrap;
}

.table tbody tr:not(.divider):hover td {
  background: var(--surface-sunken);
}

.table .col-rank {
  width: 72px;
}

.table .col-id {
  width: 48px;
}

.table .col-time {
  width: 130px;
}

.table .col-actions {
  width: 1%;
  text-align: right;
}

.table input {
  min-width: 150px;
  min-height: 30px;
  padding: 4px 8px;
  border-color: transparent;
  background: transparent;
}

.table input:hover {
  border-color: var(--border-strong);
}

.table input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.table input.time-input {
  min-width: 0;
  width: 110px;
  font-variant-numeric: tabular-nums;
}

.table tr.saving {
  opacity: 0.6;
}

.table tr.hidden-row td {
  color: var(--muted);
}

.table tr.divider td {
  padding: 7px 14px;
  background: repeating-linear-gradient(-45deg, var(--surface-sunken) 0 8px, var(--surface) 8px 16px);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  text-align: center;
  white-space: normal;
}

.shown-as {
  color: var(--muted);
}

.rank {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border-radius: 15px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rank.pinned {
  background: var(--pin-soft);
  border-color: transparent;
  color: var(--pin);
}

.rank.medal-1,
.rank.medal-2,
.rank.medal-3 {
  border: 0;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 55%), 0 1px 3px rgb(0 0 0 / 18%);
}

.rank.medal-1 {
  background: var(--gold-bg);
  color: var(--gold);
}

.rank.medal-2 {
  background: var(--silver-bg);
  color: var(--silver);
}

.rank.medal-3 {
  background: var(--bronze-bg);
  color: var(--bronze);
}

.locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.locked svg {
  color: var(--pin);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip.pin {
  background: var(--pin-soft);
  color: var(--pin);
}

.chip.plain {
  background: var(--surface-sunken);
  color: var(--muted);
  border: 1px solid var(--border);
}

.chip.good {
  background: var(--success-soft);
  color: var(--success);
}

.gift {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.gift img,
.gift .gift-dot {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-sunken);
  object-fit: contain;
}

.person {
  font-weight: 600;
}

.address {
  max-width: 280px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.time-cell {
  font-weight: 650;
}

.time-cell small {
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

.when small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  padding: 40px 16px !important;
  text-align: center !important;
  color: var(--muted);
  white-space: normal !important;
}

.empty strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 2px;
}

.table tbody tr:hover td.empty {
  background: none;
}

/* --- Prize cards ------------------------------------------------------- */

.prize-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.prize-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

.prize-card:hover {
  box-shadow: var(--shadow-lg);
}

.prize-card.editing {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.prize-card.saving {
  opacity: 0.6;
}

.prize-media {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 40%, var(--surface) 0, transparent 70%),
    var(--surface-sunken);
  border-bottom: 1px solid var(--border);
}

.prize-media img {
  position: absolute;
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgb(0 0 0 / 14%));
}

.prize-media .rank {
  position: absolute;
  top: 10px;
  left: 10px;
}

.prize-placeholder {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.prize-placeholder svg {
  opacity: 0.6;
}

.drop-hint {
  position: absolute;
  inset: 8px;
  display: none;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  color: var(--accent);
  font-weight: 700;
}

.prize-card.drag-over .drop-hint {
  display: grid;
}

.prize-body {
  display: grid;
  gap: 10px;
  align-content: start;
  flex: 1;
  padding: 14px 16px;
}

.prize-body h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.1px;
  overflow-wrap: anywhere;
}

.prize-desc {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.prize-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}

.prize-meta div {
  min-width: 0;
}

.prize-meta dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
}

.prize-meta dd {
  margin: 0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.prize-meta .span-all {
  grid-column: 1 / -1;
}

.prize-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
}

.prize-actions > div {
  display: flex;
  gap: 6px;
}

.add-card {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 240px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.add-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.add-card span:first-child {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
}

.prize-empty {
  grid-column: 1 / -1;
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.prize-empty strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

/* --- Prize form -------------------------------------------------------- */

.prize-form {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border-top: 3px solid var(--accent);
}

.prize-form h3 {
  font-size: 16px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.span-all {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- Toast ------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ink-text);
  border: 1px solid var(--ink-line);
  box-shadow: var(--shadow-lg);
  font-weight: 560;
  animation: toast-in 0.18s ease-out;
}

.toast::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #4cd08a;
}

.toast.error {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
  border-radius: var(--radius);
}

.toast.error::before {
  background: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* --- Medium screens ---------------------------------------------------- */

@media (max-width: 960px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  .login-hero {
    padding: 28px 20px;
  }

  .login-hero h2 {
    font-size: 28px;
  }

  .login-hero p {
    font-size: 14px;
  }

  .login-side {
    place-items: start center;
    padding-top: 36px;
  }
}

/* --- Small screens ----------------------------------------------------- */

@media (max-width: 720px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding-bottom: 6px;
  }

  .tabs {
    order: 3;
    flex-basis: 100%;
    margin: 0 -4px;
  }

  #logout {
    margin-left: auto;
  }

  .main {
    gap: 18px;
    padding-top: 16px;
  }

  .stats {
    gap: 8px;
  }

  .stat {
    padding: 10px 12px;
  }

  .stat-value {
    font-size: 21px;
  }

  .panel-head {
    flex-direction: column;
  }

  .panel-head h2 {
    font-size: 19px;
  }

  .inline-form,
  .toolbar-end {
    margin-left: 0;
  }

  .search {
    max-width: none;
    flex-basis: 100%;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Tables become one card per row. */
  .table-wrap {
    overflow: visible;
  }

  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
  }

  .table td {
    border: 0;
    padding: 0;
    white-space: normal;
  }

  .table tbody tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }

  .table tbody tr:last-child {
    border-bottom: 0;
  }

  .table tbody tr:hover td {
    background: none;
  }

  .table tr.divider {
    padding: 0;
  }

  .table tr.divider td {
    padding: 8px 14px;
  }

  #board-table tbody tr:not(.divider):not(.empty-row) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "rank name actions"
      "rank shown shown"
      "rank time source";
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
  }

  #board-table .c-rank {
    grid-area: rank;
    align-self: start;
    padding-top: 2px;
  }

  #board-table .c-name {
    grid-area: name;
  }

  #board-table .c-shown {
    grid-area: shown;
    padding-left: 9px;
    font-size: 12px;
  }

  #board-table .c-shown::before {
    content: "Shown as ";
  }

  #board-table .c-time {
    grid-area: time;
  }

  #board-table .c-source {
    grid-area: source;
    justify-self: end;
    min-width: 0;
  }

  #board-table .c-actions {
    grid-area: actions;
    justify-self: end;
    width: auto;
  }

  #board-table .chip {
    max-width: 150px;
  }

  .table input {
    min-width: 0;
  }

  #gifts-table tbody tr:not(.empty-row) {
    display: grid;
    gap: 4px;
  }

  #gifts-table td[data-label] {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
  }

  #gifts-table td[data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--muted);
  }

  #gifts-table .address {
    max-width: none;
  }
}

@media (max-width: 420px) {
  .brand p {
    display: none;
  }

  .prize-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
