/* Riso, matching User Manual of Me: fluoro inks on off-white paper, overprinted with multiply,
   halftone dots, 3px ink rules, hard offset shadows and heavy grotesque type. System fonts only. */
:root {
  --paper: #F5F0E4;
  --card: #FFFDF7;
  --ink: #1D1D3B;
  --muted: #4E4E6A;
  --soft: rgba(29, 29, 59, 0.14);
  --pink: #FF48B0;
  --blue: #0078BF;
  --yellow: #FFE800;
  --green: #00A95C;
  --orange: #FF6C2F;
  --sky: #CFE6F5;
  --grot: "Helvetica Neue", "Arial Black", Inter, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 500 16px/1.45 var(--grot);
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(29, 29, 59, 0.07) 1px, transparent 1.4px);
  background-size: 6px 6px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 0.4em; font-weight: 900; text-transform: uppercase; letter-spacing: -0.03em; line-height: 0.95; }
h2 { font-size: 1.15rem; letter-spacing: 0; line-height: 1.1; }
h3 { font-size: 0.95rem; letter-spacing: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.mul { mix-blend-mode: multiply; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 28px;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}
.brand { font-weight: 900; font-size: 1rem; text-transform: uppercase; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-mark { width: 28px; height: 28px; border: 2px solid var(--ink); flex: none; }
.pill { font: 700 0.68rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; background: var(--ink); color: var(--yellow); padding: 2px 7px; }

/* ---------- Layout ---------- */
.app { max-width: 1100px; margin: 0 auto; padding: 28px 28px 72px; overflow-x: clip; }
.eyebrow {
  display: inline-block; margin: 0 0 12px; padding: 2px 8px;
  font: 700 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--pink); color: var(--ink);
}
.lede { font-size: 1.12rem; font-weight: 700; max-width: 52ch; margin: 0 auto; }
.hint { color: var(--muted); font-size: 0.9rem; font-weight: 600; margin: 0; }
.panel { position: relative; background: var(--card); border: 3px solid var(--ink); padding: 24px; box-shadow: 10px 10px 0 var(--blue); min-width: 0; }
.setup-panel { box-shadow: 10px 10px 0 var(--pink); }
.grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 32px; align-items: start; }
.actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.actions.small { margin-top: 14px; gap: 6px; }

.hero { position: relative; isolation: isolate; text-align: center; margin: 4px auto 34px; padding: 18px 0 6px; }
.hero::before { content: ""; position: absolute; z-index: -1; right: 4%; top: -16px; width: 190px; height: 190px; border-radius: 50%; background: var(--pink); mix-blend-mode: multiply; opacity: 0.85; }
.hero::after { content: ""; position: absolute; z-index: -1; left: 5%; top: 24px; width: 0; height: 0; border-left: 84px solid transparent; border-right: 84px solid transparent; border-bottom: 146px solid var(--yellow); mix-blend-mode: multiply; }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); color: var(--blue); mix-blend-mode: multiply; text-shadow: 5px 4px 0 rgba(255, 72, 176, 0.85); max-width: 14ch; margin: 0 auto 0.3em; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px;
  border: 3px solid var(--ink); border-radius: 0; padding: 8px 16px;
  font-weight: 900; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.01em;
  cursor: pointer; background: var(--card);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.btn:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); background: var(--yellow); }
.btn:active:not(:disabled) { transform: none; box-shadow: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--yellow); box-shadow: 6px 6px 0 var(--pink); }
.btn.primary:hover:not(:disabled) { background: var(--ink); box-shadow: 8px 8px 0 var(--pink); }
.btn.primary:disabled { box-shadow: none; }
.btn.big { font-size: 1.25rem; padding: 14px 34px; min-width: 200px; }
.btn.small { font-size: 0.78rem; padding: 6px 10px; border-width: 2px; }
.btn.link { border-color: transparent; background: none; font: 700 0.8rem var(--mono); text-decoration: underline; padding: 6px 10px; }
.btn.link:hover:not(:disabled) { box-shadow: none; transform: none; background: var(--yellow); }

input[type="text"] {
  width: 100%; min-height: 44px; border: 3px solid var(--ink); border-radius: 0; padding: 9px 12px; background: var(--card);
  font-weight: 700; transition: box-shadow 0.12s, background 0.12s;
}
input[type="text"]:focus { outline: none; background: #FFF9C2; box-shadow: 4px 4px 0 var(--blue); }
input[type="text"]:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
input::placeholder { color: var(--muted); font-weight: 600; }

.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field > span:first-child { font: 700 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; }
.add-row { display: flex; gap: 10px; }
.add-row input { flex: 1; min-width: 0; }
.add-form .field { margin-bottom: 10px; }
.form-error { margin: 0 0 12px; padding: 8px 12px; border: 3px solid var(--ink); background: var(--pink); font-weight: 900; }

/* ---------- Names ---------- */
.names-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; }
.count { font: 700 0.85rem var(--mono); background: var(--blue); color: var(--card); padding: 2px 8px; }
.names { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.name-row { display: flex; gap: 8px; align-items: center; }
.name-row input[type="text"] { flex: 1; min-width: 0; border-width: 2px; text-transform: uppercase; font-weight: 900; }
.names.out .name-row { border: 2px dashed var(--ink); padding: 6px 6px 6px 12px; }
.name-static { flex: 1; min-width: 0; font-weight: 900; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.out-block { margin-top: 22px; }

/* ---------- Wheel ---------- */
.wheel-panel { text-align: center; }
.wheel-wrap { max-width: 460px; margin: 0 auto; }
.wheel { display: block; width: 100%; height: auto; overflow: visible; }
.wheel-shadow { fill: var(--ink); }
.wheel-base { fill: var(--card); }
.wheel-rim { fill: none; stroke: var(--ink); stroke-width: 3.5; }
.wheel-misreg { fill: none; stroke: var(--blue); stroke-width: 2.2; mix-blend-mode: multiply; }
.seg-fill { mix-blend-mode: multiply; }
.seg-dots { fill: url(#dots); opacity: 0.16; }
.seg-line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.seg-label { font-family: var(--grot); font-weight: 900; text-transform: uppercase; letter-spacing: -0.01em; fill: var(--ink); }
.seg-label.on-dark { fill: var(--card); }
.seg { transition: opacity 0.3s; }
.seg.dim { opacity: 0.3; }
.seg.win .seg-line { stroke-width: 4; }
.seg-empty { fill: var(--card); stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 6 5; }
.empty-label { font: 900 20px var(--grot); text-transform: uppercase; fill: var(--muted); }
.hub-base { fill: var(--yellow); stroke: var(--ink); stroke-width: 3; }
.hub-dot { fill: var(--pink); }
.pointer-ink { fill: var(--pink); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.pointer-misreg { fill: var(--blue); mix-blend-mode: multiply; }
.spin-row { display: grid; justify-items: center; gap: 10px; margin-top: 26px; }

/* ---------- Result ---------- */
.result {
  position: relative; overflow: hidden; isolation: isolate;
  margin: 24px auto 0; max-width: 440px; text-align: left;
  border: 3px solid var(--ink); background: color-mix(in srgb, var(--yellow) 40%, var(--card));
  padding: 16px 18px 18px; box-shadow: 8px 8px 0 var(--ink);
  animation: stamp 0.45s cubic-bezier(0.2, 0.8, 0.2, 1.2);
}
.result::after { content: ""; position: absolute; z-index: -1; right: -42px; top: -48px; width: 150px; height: 150px; border-radius: 50%; background: var(--pink); mix-blend-mode: multiply; }
.result-kicker { margin: 0; font: 700 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.14em; }
.result-name {
  margin: 4px 0 8px; font-weight: 900; text-transform: uppercase; letter-spacing: -0.04em; line-height: 0.95;
  font-size: clamp(2.2rem, 7vw, 3.4rem); color: var(--blue); mix-blend-mode: multiply;
  text-shadow: 4px 3px 0 rgba(255, 72, 176, 0.85); overflow-wrap: anywhere;
}
.result-task { display: inline-block; margin: 0; padding: 3px 10px; background: var(--ink); color: var(--yellow); font-weight: 900; text-transform: uppercase; transform: rotate(-1.5deg); overflow-wrap: anywhere; }
.result .actions { margin-top: 16px; }
@keyframes stamp { from { opacity: 0; transform: scale(1.12) rotate(-2deg); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; gap: 28px; }
  .topbar { padding: 8px 16px; }
  .app { padding: 18px 16px 48px; }
  .panel { padding: 18px; box-shadow: 7px 7px 0 var(--blue); }
  .setup-panel { box-shadow: 7px 7px 0 var(--pink); }
  .hero { margin-bottom: 24px; }
  .hero::before { width: 120px; height: 120px; }
  .hero::after { border-left-width: 52px; border-right-width: 52px; border-bottom-width: 90px; }
  .btn.big { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.btn.primary[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
