/* Mobile-first: one column, big tap targets, actions within thumb reach. */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b6860;
  --border: #e2dfd8;
  --accent: #2b59c3;
  --go: #1f7a4d;
  --stop: #b3261e;
  --warn-bg: #fff4d6;
  --warn-text: #6b4e00;
  --chip-on: #1c1b19;
  --chip-on-text: #ffffff;
  --radius: 14px;
  --tap: 48px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141412;
    --surface: #1f1e1b;
    --text: #efede8;
    --muted: #a3a097;
    --border: #34322d;
    --accent: #8fb0ff;
    --go: #3fae74;
    --stop: #e5645b;
    --warn-bg: #3a3014;
    --warn-text: #f3d98b;
    --chip-on: #efede8;
    --chip-on-text: #141412;
  }
}

:root[data-theme="dark"] {
  --bg: #141412;
  --surface: #1f1e1b;
  --text: #efede8;
  --muted: #a3a097;
  --border: #34322d;
  --accent: #8fb0ff;
  --go: #3fae74;
  --stop: #e5645b;
  --warn-bg: #3a3014;
  --warn-text: #f3d98b;
  --chip-on: #efede8;
  --chip-on-text: #141412;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

main { max-width: 560px; margin: 0 auto; padding: 8px 16px 24px; }
h1 { font-size: 1.35rem; margin: 0.25rem 0; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 0.5rem; }
a { color: var(--accent); }
.muted { color: var(--muted); margin: 0.25rem 0 0.5rem; }
.center { text-align: center; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 8px 16px;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.icon-btn {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.2rem;
}

.flash {
  max-width: 528px; margin: 0 auto 8px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); font-weight: 600;
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; overflow-wrap: anywhere;
}
.card.compact h2 { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.empty { text-align: center; padding: 32px 16px; }

.hero, .player { width: 100%; border-radius: 10px; display: block; background: #000; }
.hero { aspect-ratio: 1; object-fit: cover; margin-bottom: 12px; }
.player { aspect-ratio: 9 / 16; max-height: 70vh; margin-bottom: 12px; }
.player.missing { display: grid; place-items: center; color: #ccc; aspect-ratio: 16 / 9; }
.overlay { font-style: italic; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.stats > div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.stats dt { font-size: 0.8rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.15rem; font-weight: 700; }
.stats.small dd { font-size: 1rem; }
.bad { color: var(--stop); }

.pairs { margin: 8px 0; }
.pairs > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.pairs dt { color: var(--muted); }
.pairs dd { margin: 0; font-weight: 600; text-align: right; }

details { margin-top: 12px; }
summary { font-weight: 600; min-height: var(--tap); display: flex; align-items: center; cursor: pointer; }

.breakdown ul { list-style: none; padding: 0; margin: 8px 0; }
.breakdown ul.warn, .breakdown ul.checks { list-style: disc; padding-left: 28px; }
.breakdown ul.warn { padding: 8px 12px 8px 28px; }
.components li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.component-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.component-head .muted { font-weight: 400; font-size: 0.85rem; }
.component-head .unknown { color: var(--muted); font-weight: 400; }
.bar { height: 6px; border-radius: 3px; background: var(--bg); margin: 6px 0 2px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.reason { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }
.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag { background: var(--warn-bg); color: var(--warn-text); border-radius: 999px; padding: 2px 10px; font-size: 0.85rem; }
.checks li { margin: 4px 0; }
.warn { background: var(--warn-bg); color: var(--warn-text); padding: 8px 12px; border-radius: 10px; }
.warn.licensed { border: 2px solid var(--warn-text); font-size: 1.05em; }
.video .verdict { font-weight: 600; margin: 8px 0; }
.rows { margin: 8px 0; }
.rows > div { padding: 6px 0; border-bottom: 1px solid var(--border); }
.rows dt { font-size: 0.8rem; color: var(--muted); }
.rows dd { margin: 0; }
.rows dd.unknown { color: var(--muted); }
.moments li { padding: 4px 0; }
.at { font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 8px; }
.error { color: var(--stop); font-weight: 600; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; min-height: 88px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.tile.action { border-color: var(--accent); }
.grid2 > :last-child:nth-child(odd) { grid-column: 1 / -1; }  /* an odd last tile takes the full row */
.tile .num { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.tile .label { color: var(--muted); font-size: 0.9rem; }

.switch {
  border-radius: var(--radius); padding: 16px; margin: 4px 0 16px; text-align: center;
  border: 2px solid var(--go); background: var(--surface);
}
.switch.is-paused { border-color: var(--stop); }
.switch-state { margin: 0 0 10px; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.row { display: flex; gap: 8px; }
.row form { flex: 1; }
.row .btn { width: 100%; }
.problems-link { display: block; font-weight: 600; text-decoration: none; margin-bottom: 12px; }
.btn.big { min-height: 60px; width: 100%; font-size: 1.1rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.go { background: var(--go); border-color: var(--go); color: #fff; }
.btn.stop { background: var(--stop); border-color: var(--stop); color: #fff; }
.btn.link { border: 0; background: none; color: var(--muted); text-decoration: underline; }

input[type="password"], input[type="text"], input[type="url"], textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.login { margin-top: 15vh; }
.fields { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.fields label { font-weight: 600; }
.fields .check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 400; }
.fields .check input { width: 22px; height: 22px; flex: none; }

.chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { padding: 0; margin-bottom: 8px; font-weight: 600; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
.chip input:checked + span { background: var(--chip-on); color: var(--chip-on-text); border-color: var(--chip-on); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Approve and Reject stay under the thumb while scrolling the card. */
.decide .actions {
  position: sticky; bottom: calc(64px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 8px 0; background: var(--bg);
}

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
/* Five tabs fit a 390px phone: smaller text, and a long label wraps onto two lines. */
.tabs a {
  min-height: 60px; display: grid; place-items: center; padding: 0 2px;
  color: var(--muted); text-decoration: none; font-weight: 600;
  font-size: 0.85rem; line-height: 1.15; text-align: center;
}
.tabs a[aria-current="page"] { color: var(--text); box-shadow: inset 0 3px 0 var(--accent); }
