/* Name 100 Challenge — shared styles
   Identity: "arcade sticker" — cool lavender paper, deep-violet ink, candy-pink
   accent, chunky radii (10–14px), 2px ink outlines with hard offset shadows.
   Per-variant accent from variants.json overrides --accent on <body>. */

@font-face {
  font-family: "Outfit";
  src: url("/fonts/outfit-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --accent: #ff3e8a;          /* candy pink default; variant pages override */
  --accent-dark: #8c224c;     /* darkened accent for small-button bg / text */
  --on-accent: #ffffff;       /* text color on large accent surfaces */
  --paper: #f4f3fa;           /* cool lavender-white */
  --ink: #201a33;             /* deep violet ink */
  --muted: rgba(32, 26, 51, 0.68);
  --soft: rgba(32, 26, 51, 0.82);
  --card: #ffffff;
  --line: var(--ink);         /* outlines are solid ink, not hairlines */
  --link: #c2155f;
  --ok: #18794a;
  --err: #c0392b;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 8px;
  --wrap: 760px;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- header: solid ink bar + accent strip ---------- */

.site-header {
  background: var(--ink);
  border-bottom: 4px solid var(--accent);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 60px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: #ffffff; text-decoration: none;
  font-weight: 800; font-size: 17px; letter-spacing: 0.2px;
}
.logo svg { display: block; }
.site-nav { display: flex; align-items: center; }
.site-nav a {
  margin-left: 20px; color: rgba(255, 255, 255, 0.85); text-decoration: none;
  font-size: 15px; font-weight: 700;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: #ffffff; border-bottom-color: var(--accent); }

/* ---------- hero: big solid display type + marker highlight ---------- */

.hero {
  text-align: center;
  padding: 34px 0 20px;
  background-image: radial-gradient(circle, rgba(32, 26, 51, 0.09) 1.5px, transparent 1.6px);
  background-size: 22px 22px;
}
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.5rem, 9vw, 4.2rem);
  font-weight: 800; line-height: 1.04; letter-spacing: -0.03em;
  color: var(--ink);
}
.hero .hl {
  display: inline-block;
  background: var(--accent); color: var(--on-accent);
  padding: 0 0.16em;
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-2deg);
}
.hero p.lede, .page .lede {
  font-size: clamp(1.02rem, 2.6vw, 1.18rem);
  color: var(--muted); max-width: 34em; margin: 0 auto;
}

/* ---------- cards: white sticker tiles ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin: 26px 0 36px; }
.card {
  display: block; background: var(--card);
  border: 2px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; text-decoration: none; color: var(--ink);
  box-shadow: 5px 5px 0 rgba(32, 26, 51, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--accent);
}
.card .tag {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--ink); border-radius: 4px;
  transform: rotate(-6deg); margin-bottom: 10px;
}
.card h2 { font-size: 1.12rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- sections / prose ---------- */

section { margin: 48px 0; }
section > h2 { font-size: clamp(1.35rem, 3.4vw, 1.6rem); letter-spacing: -0.01em; margin: 0 0 16px; }
.page { padding: 44px 0 0; }
.page h1 { margin-top: 0; font-size: clamp(2rem, 6vw, 2.9rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.prose p { max-width: 38em; color: var(--soft); }
.prose strong { color: var(--ink); }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li {
  counter-increment: step; position: relative; padding: 14px 16px 14px 62px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 12px; box-shadow: 4px 4px 0 rgba(32, 26, 51, 0.16);
}
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 50%; transform: translateY(-50%) rotate(-3deg);
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--on-accent);
  border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}
.steps li strong { display: block; }
.steps li span { color: var(--muted); font-size: 0.95rem; }

.rules-list {
  background: var(--card); border: 2px solid var(--line);
  border-radius: var(--r-lg); padding: 8px 26px;
  box-shadow: 4px 4px 0 rgba(32, 26, 51, 0.16);
}
.rules-list li { margin: 8px 0; color: var(--soft); }
.rules-list strong { color: var(--ink); }
.note {
  background: #fde7f0; border: 2px solid #e59ab9;
  border-radius: var(--r-lg); padding: 14px 20px; color: #6f1240;
}

/* ---------- faq ---------- */

details.faq {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg);
  padding: 4px 20px; margin-bottom: 12px;
  box-shadow: 4px 4px 0 rgba(32, 26, 51, 0.12);
}
details.faq[open] { box-shadow: 4px 4px 0 var(--accent); }
details.faq summary { cursor: pointer; font-weight: 700; padding: 13px 0; list-style: none; }
details.faq summary::after { content: "+"; float: right; color: var(--accent-dark); font-weight: 800; }
details.faq[open] summary::after { content: "–"; }
details.faq p { margin: 0 0 14px; color: var(--muted); }

/* ---------- buttons: chunky sticker style ---------- */

.cta-row { text-align: center; margin: 36px 0; }
.btn {
  display: inline-block; cursor: pointer;
  background: var(--ink); color: #ffffff;
  border: 2px solid var(--ink); border-radius: var(--r-md);
  font-family: var(--font); font-weight: 800; text-decoration: none;
  padding: 13px 28px; font-size: 1.05rem;
  box-shadow: 4px 4px 0 rgba(32, 26, 51, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(32, 26, 51, 0.4); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 rgba(32, 26, 51, 0); }
.btn-big { font-size: 1.2rem; padding: 16px 40px; }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-secondary {
  background: var(--card); color: var(--ink);
  box-shadow: 4px 4px 0 rgba(32, 26, 51, 0.18);
}
.btn-ghost {
  background: transparent; color: var(--muted);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--card); color: var(--ink); }

/* ---------- footer: ink bar bookend ---------- */

.site-footer {
  background: var(--ink); color: rgba(255, 255, 255, 0.75);
  margin-top: 72px; padding: 30px 0 40px;
}
.footer-inner { display: flex; flex-direction: column; gap: 14px; }
.footer-series { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; }
.footer-series-label {
  font-size: 11px; font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent);
}
.footer-series a, .footer-nav a {
  color: rgba(255, 255, 255, 0.82); text-decoration: none; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.footer-series a:hover, .footer-nav a:hover { color: #ffffff; border-bottom-color: var(--accent); }
.footer-copy { margin: 0; font-size: 13px; color: rgba(255, 255, 255, 0.55); max-width: 640px; }

/* ============ game page ============ */

.play { padding: 30px 0 20px; }
.play-head { text-align: center; }
.play-head h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.play-head .rule-line { color: var(--muted); margin: 0; }
.play-links { font-size: 0.9rem; margin-top: 8px; }
.play-links a { color: var(--muted); }
.play-links a:hover { color: var(--link); }

.game-panel {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg);
  padding: 22px 22px 18px; margin-top: 22px;
  box-shadow: 6px 6px 0 rgba(32, 26, 51, 0.16);
}

.hud { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 2px 0 12px; }
.timer {
  font-size: clamp(2.6rem, 9vw, 4rem); font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1;
}
.timer.low { color: #d63031; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0.45; } }
.score-chip {
  text-align: right; font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums;
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--r-md);
  padding: 8px 14px;
}
.score-chip small { display: block; color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; }

.progress {
  height: 14px; background: var(--paper);
  border: 2px solid var(--line); border-radius: var(--r-sm);
  overflow: hidden; margin-bottom: 18px;
}
.progress > div { height: 100%; width: 0%; background: var(--accent); transition: width 0.25s ease; }

.entry-form { display: flex; gap: 10px; margin-bottom: 6px; }
.entry-form input {
  flex: 1; font-family: var(--font); font-size: 1.1rem; padding: 12px 16px;
  border: 2px solid var(--line); border-radius: var(--r-md);
  background: var(--card); color: var(--ink);
}
.entry-form input:focus { outline: none; box-shadow: 4px 4px 0 var(--accent); }
.entry-form .btn { padding: 12px 24px; background: var(--accent-dark); }
.feedback { min-height: 1.5em; font-weight: 600; font-size: 0.95rem; margin: 2px 4px 10px; }
.feedback.ok { color: var(--ok); }
.feedback.err { color: var(--err); }
.feedback.hint { color: var(--muted); font-weight: 500; }

.entries {
  list-style: none; padding: 12px 16px; margin: 0 0 18px; max-height: 300px; overflow-y: auto;
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--r-md);
  columns: 2; column-gap: 24px;
}
.entries li { padding: 3px 6px; break-inside: avoid; font-size: 0.98rem; }
.entries li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.entries:empty::after { content: "Your names will appear here…"; color: var(--muted); font-style: italic; }

.giveup-row { text-align: center; }

/* end screen */
.end-screen { display: none; text-align: center; padding: 30px 0; }
.end-screen.show { display: block; }
.end-score { font-size: clamp(3rem, 12vw, 5rem); font-weight: 800; line-height: 1; margin: 8px 0; }
.end-score span { font-size: 0.45em; color: var(--muted); }
.end-meta { color: var(--muted); margin-bottom: 6px; }
.end-best { font-weight: 700; margin-bottom: 20px; }
.share-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 22px; }
.hidden { display: none !important; }

@media (max-width: 560px) {
  .entries { columns: 1; }
  .entry-form { flex-direction: column; }
  .hud { flex-direction: column-reverse; align-items: center; gap: 8px; }
  .score-chip { text-align: center; }
  .site-nav a { margin-left: 14px; }
}

/* ---------- play-first homepage: variant chips ---------- */

.home-play { margin: 6px 0 10px; }
.variant-chips {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px; margin: 0 0 14px;
}
.chip {
  cursor: pointer;
  background: var(--card); color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--r-md);
  font-family: var(--font); font-weight: 700; font-size: 0.92rem;
  padding: 8px 14px;
  box-shadow: 3px 3px 0 rgba(32, 26, 51, 0.16);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.chip:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(32, 26, 51, 0.22); }
.chip.on {
  background: var(--accent); color: var(--on-accent);
  box-shadow: 3px 3px 0 var(--ink);
}

/* ---------- legends panel (UGC: client-injected only, never in static HTML) ---------- */

.legends[hidden] { display: none; }
.legends {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px 10px; margin-top: 16px;
  box-shadow: 5px 5px 0 rgba(32, 26, 51, 0.16);
}
.legends-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.legends-title { font-weight: 800; font-size: 1.02rem; letter-spacing: -0.01em; }
.legends-title::before { content: "🏆 "; }
.legends-tabs { display: inline-flex; gap: 6px; }
.legends-tab {
  cursor: pointer;
  background: transparent; color: var(--muted);
  border: 2px solid var(--line); border-radius: var(--r-sm);
  font-family: var(--font); font-weight: 700; font-size: 0.8rem;
  padding: 5px 10px;
}
.legends-tab.on { background: var(--ink); color: #fff; }
.legends-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 320px; overflow-y: auto;
}
.legends-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px; font-size: 0.95rem;
}
.legends-list li:nth-child(odd) { background: var(--paper); border-radius: var(--r-sm); }
.legends-rank {
  flex: none; width: 30px; text-align: right;
  font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums;
}
.legends-list li:nth-child(1) .legends-rank,
.legends-list li:nth-child(2) .legends-rank,
.legends-list li:nth-child(3) .legends-rank { color: var(--accent-dark); }
.legends-flag { flex: none; }
.legends-score { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.legends-empty { color: var(--muted); font-style: italic; }

/* ---------- friend challenge (?beat=N) ---------- */

.beat-banner[hidden] { display: none; }
.beat-banner {
  background: var(--accent); color: var(--on-accent);
  border: 2px solid var(--line); border-radius: var(--r-md);
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-0.6deg);
  font-weight: 800; text-align: center;
  padding: 10px 16px; margin: 16px 0 0;
}
.end-compare { font-weight: 800; margin: 0 0 18px; color: var(--accent-dark); }
.end-compare:empty { display: none; }
