/* My Shout design system. Mobile first, warm and Kiwi. One file, no build.
   Tokens on :root, dark via prefers-color-scheme, big touch targets, safe
   areas for iOS. Brand colours from docs/brand/SHONA.md. */

:root {
  color-scheme: light dark;

  --coral: #ff5a36;
  --coral-deep: #e0431f;
  --sun: #ffc83d;
  --navy: #14213d;
  --cream: #fff8f0;

  --bg: var(--cream);
  --surface: #ffffff;
  --surface-2: #fff1e4;
  --text: var(--navy);
  --muted: #5b6478;
  --line: #ecdfd0;
  --accent: var(--coral);
  --accent-text: #ffffff;
  --highlight: var(--sun);
  --highlight-text: var(--navy);
  --ok: #1f8a4c;
  --warn: #b26a00;
  --danger: #c62828;
  --focus: #1f6feb;
  --shadow: 0 2px 10px rgba(20, 33, 61, 0.08);

  --radius: 16px;
  --radius-sm: 10px;
  --gap: 16px;
  --tap: 48px;
  --tap-big: 60px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --font-display: var(--font);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172c;
    --surface: #1a2440;
    --surface-2: #232f50;
    --text: #fff3e6;
    --muted: #a6afc4;
    --line: #2d3958;
    --accent: var(--coral);
    --accent-text: #ffffff;
    --focus: #8ab4ff;
    --ok: #4ccb7f;
    --warn: #ffb547;
    --danger: #ff6b6b;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  }
}

/* Reset, the short version */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  min-height: 100dvh;
  padding-bottom: var(--safe-bottom);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.9rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 700; }
p + p { margin-top: 0.6em; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--coral-deep); }
button { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.tiny { font-size: 0.8rem; }
.center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* Focus: always visible, never removed */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }

/* Layout */
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--gap) calc(var(--gap) + var(--safe-right)) calc(var(--gap) * 2 + var(--safe-bottom)) calc(var(--gap) + var(--safe-left));
  display: grid;
  gap: var(--gap);
}
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding: calc(10px + var(--safe-top)) calc(var(--gap) + var(--safe-right)) 10px calc(var(--gap) + var(--safe-left));
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.15rem; min-height: var(--tap); white-space: nowrap; flex: none; }
.logo svg { width: 30px; height: 30px; flex: none; }
.topbar .region-pill { margin-left: auto; min-width: 0; flex: 0 1 auto; }
.topbar .btn { flex: none; white-space: nowrap; padding-left: 12px; padding-right: 12px; }

/* Pills and badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 14px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 0.95rem; text-decoration: none;
  max-width: 100%;
}
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill:hover { border-color: var(--accent); color: var(--text); }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  background: var(--surface-2); color: var(--muted);
}
.badge-dry { background: var(--highlight); color: var(--highlight-text); }
.badge-live { background: var(--accent); color: var(--accent-text); }
.badge-ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }

/* Buttons: 48px minimum, 60px for the big two */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px;
  border-radius: var(--radius-sm); border: 2px solid transparent;
  background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: transform 80ms ease, background 120ms ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { color: var(--text); }
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--coral-deep); color: var(--accent-text); }
.btn-sun { background: var(--highlight); color: var(--highlight-text); }
.btn-outline { background: transparent; border-color: var(--line); }
.btn-outline:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-big { min-height: var(--tap-big); font-size: 1.15rem; border-radius: var(--radius); width: 100%; flex-direction: column; gap: 2px; padding: 12px 20px; }
.btn-block { width: 100%; }
.btn .sub { display: block; font-weight: 500; font-size: 0.85rem; opacity: 0.85; }
.btn-stack { display: grid; gap: 10px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-warm { background: var(--surface-2); }
.card-hero {
  background: linear-gradient(160deg, var(--navy) 0%, #23325c 100%);
  color: #fff8f0; border: none;
}
.card-hero .muted { color: #c9d0e3; }
.card-hero a { color: var(--sun); }
.card h2 { margin-bottom: 10px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.card-hero .stat { background: rgba(255, 255, 255, 0.1); }
.stat-num { font-size: 1.8rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.card-hero .stat-label { color: #c9d0e3; }

/* Countdown */
.countdown {
  display: flex; align-items: baseline; gap: 6px;
  font-variant-numeric: tabular-nums; font-weight: 800; line-height: 1;
}
.countdown-num { font-size: 2.6rem; letter-spacing: -0.02em; }
.countdown-unit { font-size: 0.9rem; font-weight: 600; opacity: 0.8; margin-right: 6px; }
.countdown-label { font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; }
.card-hero .countdown-label { color: #c9d0e3; }
.countdown.live .countdown-num { color: var(--sun); }
.live-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--coral); margin-right: 6px; vertical-align: middle;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }

/* Lists: prizes, regions, leaderboard */
.list { list-style: none; display: grid; gap: 8px; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 10px 12px;
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.list-row .grow strong { display: block; }
.list-row .grow .muted { font-size: 0.85rem; }
.prize-icon {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: var(--highlight); color: var(--navy); font-weight: 800;
}

/* Leaderboard row: rank, name, score. Top three get the sun. */
.lb-row {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px;
  min-height: var(--tap); padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.lb-row.me { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.lb-rank { font-weight: 800; color: var(--muted); text-align: center; }
.lb-row:nth-child(-n+3) .lb-rank { color: var(--navy); background: var(--highlight); border-radius: 50%; width: 30px; height: 30px; line-height: 30px; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-score { font-weight: 800; }

/* Region picker */
.region-group { margin-top: 6px; }
.region-group h3 { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 14px 0 8px; }
.region-option {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 56px; padding: 10px 14px; text-align: left;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer;
}
.region-option:hover { border-color: var(--accent); }
.region-option[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.region-option .tick { margin-left: auto; color: var(--accent); font-weight: 800; visibility: hidden; }
.region-option[aria-pressed="true"] .tick { visibility: visible; }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: 6px; }
.input, input[type="text"], input[type="tel"], input[type="email"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px;
  font: inherit; color: var(--text); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius-sm);
}
.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; }
.field + .field { margin-top: 12px; }
.help { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.95rem; }
.notice-ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.notice-warn { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); }
.notice-danger { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }

/* Details: how the draw works */
details { border-top: 1px solid var(--line); }
summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 700; padding: 6px 0; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; color: var(--muted); }
details[open] summary::after { content: "\2212"; }
details .body { padding: 0 0 14px; }
details .body p + p { margin-top: 0.7em; }

/* Music widget slot: hidden until the content workstream fills it */
#music-widget:empty { display: none; }
#music-widget iframe { width: 100%; border: 0; border-radius: var(--radius-sm); aspect-ratio: 16 / 9; }

/* Footer */
.footer { color: var(--muted); font-size: 0.85rem; text-align: center; padding-top: 8px; }
.footer a { color: inherit; margin: 0 6px; }

/* Skeleton while loading */
.skeleton { background: var(--surface-2); border-radius: 8px; color: transparent; animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Motion off when asked */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Wider than a phone: more air, same layout */
@media (min-width: 600px) {
  body { font-size: 18px; }
  .page { padding-top: 24px; }
}
