/*
 * One small stylesheet. Plain white, system fonts, mobile first.
 * Phones get the base styles; wider screens only add room.
 */

:root {
  --ink: #1f1f1f;
  --muted: #9a9a9a;
  --line: #e6e6e6;
  --ok: #1e7b34;
  --wrong: #b3261e;
  --gutter: 16px;
}

* { box-sizing: border-box; }

/* Type scale: everything below is in rem, so this one line sizes the app. */
html { font-size: 20px; }
@media (min-width: 601px) { html { font-size: 21px; } }

body {
  margin: 0;
  padding: 0 0 calc(24px + env(safe-area-inset-bottom));
  font: 1rem/1.5 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #fff;
  -webkit-text-size-adjust: 100%;
}

main { max-width: 760px; margin: 0 auto; padding: 0 max(var(--gutter), env(safe-area-inset-left)); }

a { color: inherit; }

h1 { font-size: 1.3rem; font-weight: 600; margin: 0 0 4px; line-height: 1.25; }

.site-header {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 12px;
}
.site-name { display: inline-block; margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; text-decoration: none; }
.site-name a { text-decoration: none; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand .tagline { margin: 4px 0 0; }
.brand .logo { flex: none; width: 96px; height: 96px; }
@media (min-width: 601px) { .brand .logo { width: 128px; height: 128px; } }

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

/* Buttons and answer choices: big tap targets, no hover-only behaviour. */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:hover, .button:hover { border-color: var(--ink); }
.button.primary, button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }

input, select, textarea { font: inherit; font-size: max(16px, 1em); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; list-style: none; }
.choices.stacked { grid-template-columns: 1fr; }
.choices button { width: 100%; justify-content: flex-start; text-align: left; }
.choices .correct { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.choices .wrong { border-color: var(--wrong); color: var(--wrong); }

/* Rikishi photos keep their own shape; cap the height so the answers still fit. */
/* Technique clips: 16:9 player behind a white curtain outside the window. */
.clip { margin: 0 0 12px; }
.stage { position: relative; aspect-ratio: 16 / 9; background: #f4f4f4; }
.stage > div, .stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.curtain { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid #eee; }
.curtain[hidden] { display: none; }
.clip-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.clip-controls button[aria-pressed="true"] { border-color: var(--ink); font-weight: 600; }
.portrait { margin: 0 0 12px; }
.portrait img { display: block; height: auto; max-height: 38vh; width: auto; max-width: 100%; margin: 0 auto; background: #f4f4f4; }

.reveal { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Media goes edge to edge on phones. */
.stage { position: relative; aspect-ratio: 16 / 9; background: #f4f4f4; margin: 0 calc(-1 * var(--gutter)); }

@media (min-width: 601px) {
  body { padding-top: 24px; }
  .stage { margin: 0; }
}

/* Start screen */
.modes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.modes-label { margin: 2rem 0 .5rem; font-weight: 600; }
.modes form, .modes button { width: 100%; }
.modes button { justify-content: space-between; }
.modes .count { opacity: .7; font-size: .88rem; }
.modes button:disabled { opacity: .35; cursor: default; }
.name-field { display: flex; flex-direction: column; gap: 6px; margin-top: 2rem; font-weight: 600; }
.name-field input { padding: 10px 12px; border: 1px solid #ccc; border-radius: 4px; font-weight: normal; }
.greeting { display: flex; align-items: baseline; gap: 12px; margin-top: 2rem; }
.greeting p { margin: 0; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--muted); font-size: .85rem; text-decoration: underline; }

/* Results */
.result-actions { display: flex; gap: 8px; margin: 16px 0 0; }
.result-actions > * { flex: 1; }
.result-actions form, .result-actions button, .result-actions .button { width: 100%; }

/* One leaderboard per game mode */
.leaderboard { margin-top: 28px; }
.leaderboard h2 { font-size: 1.1rem; margin: 0 0 8px; }
.leaderboard table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.leaderboard th, .leaderboard td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.leaderboard th { font-weight: 600; color: var(--muted); font-size: .78rem; }
.leaderboard .number { text-align: right; font-variant-numeric: tabular-nums; }
.leaderboard tr.you td { font-weight: 600; }

/* Question screen */
.progress { margin: 0 0 8px; }
.question { margin: 0 0 16px; }
.choices span.button { width: 100%; justify-content: flex-start; cursor: default; }
.result { font-weight: 600; margin: 0 0 8px; }
.result.correct { color: var(--ok); }
.result.wrong { color: var(--wrong); }
.next { width: 100%; margin-top: 8px; }
.notice { color: var(--wrong); }
.credit { font-size: .75rem; color: var(--muted); }

/* Admin */
.actions { display: flex; gap: 8px; margin-top: 12px; }
.credit a { color: inherit; }
