:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #1d1b18;
  --muted: #6d675e;
  --border: #e3ded4;
  --accent: #1f7a5a;
  --accent-text: #ffffff;
  --wild: #b4478f;
  --fave: #2b6cb0;
  --error-bg: #fbe9e7;
  --error: #9b2c1f;
  --notice-bg: #e6f3ec;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1e1c1a;
    --text: #efebe4;
    --muted: #a39d93;
    --border: #34312c;
    --accent: #3fb68a;
    --accent-text: #0d1a14;
    --wild: #e07cc0;
    --fave: #7fb3ec;
    --error-bg: #3a1f1b;
    --error: #f2a397;
    --notice-bg: #1b2e25;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.9rem; margin: 0.2rem 0 0.4rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 0 0 0.2rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.9rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
nav { display: flex; gap: 1.2rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

.flash { padding: 0.7rem 1rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.flash-error { background: var(--error-bg); color: var(--error); border-color: transparent; }
.flash-notice { background: var(--notice-bg); border-color: transparent; }

button, .button {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-block; text-decoration: none;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 999px; padding: 0.5rem 1.1rem;
}
button.secondary, .button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button:disabled { opacity: 0.55; cursor: default; }
button.link { background: none; color: var(--muted); padding: 0; font-weight: 400; text-decoration: underline; }
select, input, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.35rem 0.5rem;
}
.busy { color: var(--muted); font-size: 0.9rem; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; color: var(--muted); margin: 0; }
.week-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.generate { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.generate label { display: flex; align-items: center; gap: 0.4rem; }
.check { font-size: 0.9rem; color: var(--muted); }
.wildcard-cta {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem;
  padding: 0.7rem 1rem; border: 1px dashed var(--wild); border-radius: var(--radius);
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card.wild { border-color: var(--wild); }
.cover { position: relative; aspect-ratio: 1; background: var(--border); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute; top: 0.7rem; left: 0.7rem; background: var(--wild); color: #fff;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem; border-radius: 999px;
}
.badge.inline { position: static; margin-left: 0.4rem; }
.body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.artist { margin: 0; color: var(--muted); }
.reason { margin: 0.2rem 0; }
.spotify { font-weight: 600; font-size: 0.9rem; }

.raters { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.4rem; }
.locked { margin: 0; padding: 0.45rem 0.7rem; border-radius: 8px; background: var(--notice-bg); font-size: 0.9rem; }
.rate { border: 1px solid var(--border); border-radius: 8px; padding: 0.45rem 0.7rem; }
.rate summary { cursor: pointer; font-weight: 600; }
.rate form { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.7rem; }
.rate label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.rate input[type=number] { width: 5rem; }
.skip { margin-top: 0.2rem; }

.reveal { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.5rem; }
.verdict { background: var(--bg); border-radius: 10px; padding: 0.6rem 0.7rem; display: flex; flex-direction: column; }
.who { font-size: 0.8rem; color: var(--muted); }
.score { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.score small { font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.verdict q { font-size: 0.88rem; margin-top: 0.3rem; }
.gap { margin: 0.2rem 0 0; font-size: 0.9rem; font-weight: 600; }
.gap.split { color: var(--wild); }
.gap.sync { color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.8rem; margin: 1rem 0 2rem; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; display: flex; flex-direction: column; }
.num { font-size: 1.7rem; font-weight: 700; }
.label { color: var(--muted); font-size: 0.85rem; }
.history-week { margin-bottom: 2rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
tr.skipped { opacity: 0.55; }
.take { font-size: 0.85rem; color: var(--muted); max-width: 22rem; }

.accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.account { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; }
code { font-size: 0.9em; }

.welcome { max-width: 36rem; margin: 3rem auto; display: flex; flex-direction: column; gap: 0.8rem; align-items: flex-start; }
.members { margin: 0.4rem 0 0; padding-left: 1.2rem; color: var(--muted); }
.waiting a { word-break: break-all; }
.card.fave { border-color: var(--fave); }
.badge.fave-badge { background: var(--fave); text-transform: none; letter-spacing: 0; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.2rem; }
.card-actions form { display: flex; align-items: center; gap: 0.5rem; }
.small-button { font-size: 0.85rem; padding: 0.3rem 0.8rem; }
.unfinished { margin-top: 2.5rem; }
.unfinished h2 { font-size: 1.3rem; }
.from-week { display: flex; flex-direction: column; gap: 0.3rem; }
