:root {
  --bg: #f6f2ec;
  --fg: #1f1b22;
  --muted: #6b6470;
  --card: #fffdf9;
  --line: #ddd5ca;
  --accent: #c8322c;
  --accent-fg: #fff;
  --err: #b3261e;
  --beard-a: #e8705a; --beard-b: #f3a593;
  --hat-a: #1f9e96;   --hat-b: #86cfc8;
  --clothes-a: #7c5cc4; --clothes-b: #b8a2ea;
  --pointer: #1f1b22;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17151b; --fg: #f1ece6; --muted: #a39ba8; --card: #211e26; --line: #36313d;
    --accent: #e0453d; --err: #ff8a80;
    --beard-a: #c9563f; --beard-b: #e98a74;
    --hat-a: #17807a;   --hat-b: #4fb1a9;
    --clothes-a: #5f43a6; --clothes-b: #937bd6;
    --pointer: #f1ece6;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
a { color: inherit; }
.app, .narrow { max-width: 760px; margin: 0 auto; padding: 16px 14px 40px; }
.top { text-align: center; margin: 8px 0 18px; }
h1 { font-size: clamp(1.35rem, 5vw, 2rem); margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
.tagline, .muted, .hint { color: var(--muted); margin: 0; }
.hint { text-align: center; }
.small { font-size: 0.85rem; color: var(--muted); }
.banner { background: var(--fg); color: var(--bg); text-align: center; padding: 8px 12px; font-size: 0.9rem; }

/* wheels */
.wheels { display: flex; justify-content: center; gap: clamp(8px, 3vw, 28px); margin: 6px 0 18px; }
.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(30vw, 210px); }
.wheel-box { position: relative; width: 100%; aspect-ratio: 1; }
.pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent;
  border-top: 16px solid var(--pointer);
}
.wheel {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--fg);
  transition: transform 0s;
  will-change: transform;
}
.wheel::after { /* hub */
  content: ""; position: absolute; left: 50%; top: 50%; width: 16%; height: 16%;
  transform: translate(-50%, -50%); border-radius: 50%; background: var(--fg);
}
.wheel .ico {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
}
.wheel .ico i {
  position: absolute; transform: translate(-50%, -50%);
  font-size: clamp(14px, 4.4vw, 30px); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.wheel-label { font-weight: 600; font-size: 0.9rem; }

/* panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.actions { display: flex; gap: 10px; justify-content: center; margin: 14px 0 6px; }
.actions.wrap { flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--fg); background: transparent; color: var(--fg); text-decoration: none;
  min-height: 44px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.big { font-size: 1.15rem; padding: 12px 34px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible { outline: 3px solid var(--hat-a); outline-offset: 2px; }

.reveal { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; min-height: 0; }
.reveal li { display: flex; gap: 10px; align-items: flex-start; opacity: 0; transform: translateY(4px); transition: opacity .35s, transform .35s; }
.reveal li.on { opacity: 1; transform: none; }
.reveal .tag { flex: none; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 6px; color: #fff; margin-top: 1px; }
.tag.beard { background: var(--beard-a); } .tag.hat { background: var(--hat-a); } .tag.clothes { background: var(--clothes-a); }
.jackpot-hit { text-align: center; font-weight: 700; font-size: 1.1rem; margin: 12px 0 0; color: var(--accent); }

/* upload */
.field { margin: 14px 0; }
.pick { display: flex; gap: 10px; flex-wrap: wrap; }
.preview { display: block; max-width: 180px; max-height: 220px; margin-top: 10px; border-radius: 10px; border: 1px solid var(--line); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.error { color: var(--err); font-size: 0.9rem; margin: 6px 0 0; min-height: 0; }
.error:empty { display: none; }

/* progress */
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; justify-content: center; flex-wrap: wrap; }
.steps li { padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.steps li.active { border-color: var(--fg); color: var(--fg); }
.steps li.done { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.progress-line { text-align: center; min-height: 1.5em; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .6s ease; }

/* result */
.result-img { display: block; width: 100%; max-width: 520px; margin: 0 auto 12px; border-radius: 12px; }
.combo { list-style: none; padding: 0; margin: 0 auto; max-width: 520px; display: grid; gap: 8px; }
.combo li { display: flex; gap: 10px; align-items: center; }
.combo i { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 20px; }
.combo .w-beard i { background: var(--beard-a); } .combo .w-hat i { background: var(--hat-a); } .combo .w-clothes i { background: var(--clothes-a); }
.location { text-align: center; color: var(--muted); }
.delete-note { text-align: center; word-break: break-all; }

/* jackpots */
.jackpots h2 { text-align: center; font-size: 1rem; color: var(--muted); }
.jackpots ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.jackpots li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; }
.jackpots li i { font-size: 22px; color: var(--muted); }
.jackpots .locked span { filter: blur(5px); user-select: none; color: var(--muted); }
.jackpots .found { border-style: solid; border-color: var(--accent); }
.jackpots .found i { color: var(--accent); }
.foot { text-align: center; margin-top: 24px; }

/* server-rendered pages */
.page main h1 { text-align: center; }
.prose p, .prose h2 { max-width: 62ch; }
.result-page p { text-align: center; }

@media (prefers-reduced-motion: reduce) { .reveal li { transition: none; } }
