/*
 * aux: one column, lots of air, one accent.
 * Buttons are ink; orange marks points, focus and the winner.
 */

:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --text: #16151a;
  --muted: #6b6772;
  --line: #e9e6e1;
  --ink: #16151a;
  --ink-text: #ffffff;
  --accent: #e8501a;
  --accent-soft: #fdeee7;
  --warn: #b4321b;
  --ok: #2f7d4f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(22 21 26 / 0.04), 0 6px 24px rgb(22 21 26 / 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e11;
    --surface: #18171b;
    --text: #f2f0f4;
    --muted: #9b97a3;
    --line: #2a282e;
    --ink: #f2f0f4;
    --ink-text: #16151a;
    --accent: #ff7043;
    --accent-soft: #2b1b15;
    --warn: #ff8a73;
    --ok: #6fcf97;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: 1.75rem; font-weight: 750; }
h2 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Layout ------------------------------------------------------------------ */

.masthead,
.page {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding-inline: 16px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 20px 8px;
}

.wordmark {
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.wordmark-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--accent);
}

.masthead-nav { display: flex; gap: 16px; font-size: 0.9rem; color: var(--muted); }
.masthead-nav a { text-decoration: none; }
.masthead-nav a:hover { color: var(--text); }

.page { display: flex; flex-direction: column; gap: 24px; padding-block: 16px 96px; }

.narrow { max-width: 400px; width: 100%; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { justify-content: space-between; flex-wrap: nowrap; }
.spread > :first-child { min-width: 0; }
.spread > .pill { flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.section { display: flex; flex-direction: column; gap: 8px; }
.section-title { font-size: 0.8rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.warn { color: var(--warn); }
.hint { font-size: 0.85rem; color: var(--muted); }

/* Type -------------------------------------------------------------------- */

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow a { text-decoration: none; }
.eyebrow a:hover { color: var(--text); }

.theme { font-size: clamp(2rem, 7vw, 2.6rem); font-weight: 800; letter-spacing: -0.035em; text-wrap: balance; }
.description { font-size: 1.05rem; color: var(--muted); text-wrap: pretty; }
.round-head { display: flex; flex-direction: column; gap: 10px; }
.note { font-style: italic; color: var(--muted); }

/* Controls ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ink-text);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.btn-block { width: 100%; }
.stack > .btn:not(.btn-block) { align-self: flex-start; }
.btn-small { min-height: 34px; padding: 0 14px; font-size: 0.875rem; }
.btn-ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.btn-danger { color: var(--warn); }
.button_to, form.button_to { display: inline; }

.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 0; }
.input-lg { min-height: 56px; font-size: 1.1rem; padding-inline: 18px; border-radius: var(--radius); }
.input-small { min-height: 34px; padding: 4px 10px; font-size: 0.875rem; width: auto; flex: 1; }
input[type="search"]::-webkit-search-cancel-button { display: none; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; color: var(--muted); }
.field .input { color: var(--text); font-size: 1rem; }
.check { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Two big buttons for Spotify / YouTube Music, built from radios. */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; border: 0; }
.choice legend { grid-column: 1 / -1; margin-bottom: 6px; font-size: 0.875rem; color: var(--muted); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 600;
  cursor: pointer;
}
.choice input:checked + label { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  white-space: nowrap;
}
.pill-submitting, .pill-voting { background: var(--accent-soft); color: var(--accent); }
.pill-matched { color: var(--ok); }
.pill-missing { color: var(--warn); }

.flash {
  max-width: 568px;
  margin: 8px auto 0;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  font-size: 0.9rem;
  width: calc(100% - 32px);
}
.flash-alert { color: var(--warn); }

.errors { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--warn); font-size: 0.9rem; }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--line); align-self: flex-start; }
.tabs a { padding: 6px 14px; border-radius: 999px; font-size: 0.875rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.tabs a.is-current { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.invite { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.invite code { padding: 6px 10px; border-radius: 8px; background: var(--line); font-size: 0.8rem; word-break: break-all; }

/* Cards and lists --------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}
.card-link { text-decoration: none; transition: transform 0.12s ease; }
.card-link:hover { transform: translateY(-1px); }
.card-link .btn { align-self: flex-start; margin-top: 4px; }
.card .theme { font-size: clamp(1.6rem, 6vw, 2rem); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list-row { padding: 12px 0; }
.list-link { display: block; padding: 14px 0; text-decoration: none; font-weight: 600; }
.list-link:hover { color: var(--accent); }
.past-round { display: flex; flex-direction: column; gap: 2px; }
.past-round .small { font-weight: 400; }

.empty { align-items: flex-start; padding-block: 24px; }

/* Tracks ------------------------------------------------------------------ */

.track { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.art { flex: none; border-radius: 8px; object-fit: cover; background: var(--line); }
.art-blank { display: block; background: linear-gradient(135deg, var(--accent-soft), var(--line)); }
.track-text { display: flex; flex-direction: column; min-width: 0; }
.track-title, .track-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-title { font-weight: 650; text-decoration: none; }
a.track-title:hover { text-decoration: underline; }
.track-artist { color: var(--muted); font-size: 0.9rem; }

.search { position: sticky; top: 0; z-index: 2; padding-block: 4px; background: var(--bg); }
.picks .pick { display: block; padding: 10px 8px; margin-inline: -8px; border-radius: var(--radius-sm); text-decoration: none; }
.picks .pick:hover { background: var(--surface); }
.picks > li { border: 0; }
turbo-frame[busy] .picks { opacity: 0.5; transition: opacity 0.2s 0.15s; }

.my-picks > li { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; }
.my-picks > li.is-replacing { opacity: 0.45; }
.pick-actions { flex: none; flex-wrap: nowrap; }

.confirm { padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); }

/* Ballot ------------------------------------------------------------------ */

.ballot { list-style: none; margin: 12px 0 0; padding: 0; }
.ballot-row { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ballot-row.is-own { opacity: 0.55; }
.ballot-row.has-points .art { box-shadow: 0 0 0 2px var(--accent); }
.ballot-main { display: flex; align-items: center; gap: 12px; }

.stepper { display: flex; align-items: center; flex: none; gap: 2px; }
.stepper input {
  width: 38px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: center;
  -moz-appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.has-points .stepper input { color: var(--accent); }
.step {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--line);
  color: var(--text);
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.step:hover { background: var(--accent-soft); color: var(--accent); }

.comment summary { display: inline; font-size: 0.85rem; color: var(--muted); cursor: pointer; list-style: none; }
.comment summary::-webkit-details-marker { display: none; }
.comment summary::before { content: "+ "; }
.comment[open] summary::before { content: "− "; }
.comment .input { margin-top: 8px; font-size: 0.95rem; }

.ballot-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}
.ballot-left { font-weight: 650; font-variant-numeric: tabular-nums; }

/* Results and standings --------------------------------------------------- */

.results, .standings { list-style: none; margin: 0; padding: 0; }
.result { display: flex; flex-direction: column; gap: 8px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.result-head { display: flex; align-items: center; gap: 12px; }
.result-body { display: flex; flex-direction: column; gap: 6px; padding-left: 40px; }
.rank { flex: none; width: 28px; font-size: 1.1rem; font-weight: 800; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.is-winner .rank { color: var(--accent); }
.score { flex: none; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.score small { margin-left: 2px; font-size: 0.7rem; font-weight: 600; color: var(--muted); }
.votes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.pts { display: inline-block; min-width: 26px; color: var(--accent); font-weight: 750; font-variant-numeric: tabular-nums; }
.vote-comment { color: var(--muted); }
.vote-comment::before { content: "· "; }

.standing { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.standing:first-child .rank { color: var(--accent); }
.standing-name { flex: 1; font-weight: 650; }
.standing.is-you .standing-name::after { content: " (you)"; font-weight: 400; color: var(--muted); }

/* Admin ------------------------------------------------------------------- */

.admin-round { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; }
.matches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.matches li { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.matches .pill { align-self: flex-start; }
.add-round { padding-top: 12px; }
.add-member { flex-wrap: nowrap; }
.add-member select { min-width: 0; }

@media (max-width: 420px) {
  .grid-2 { grid-template-columns: 1fr; }
  .result-body { padding-left: 0; }
}
