:root {
  --bg: #0f1115;
  --fg: #e2e8f0;
  --dim: #718096;
  --accent: #9f7aea;
  --err: #fc8181;
  --warn: #f6e05e;
  --border: #2d3748;
  --sel: #1a202c;
  --pink: #f687b3;
  --sans: system-ui, -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); }
body { min-height: 100dvh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:active { transform: scale(0.98); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app { width: min(520px, 100%); margin: 0 auto; padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }
.flow { min-height: calc(100dvh - 44px); display: flex; flex-direction: column; }
.push { margin-top: auto; }
.center { min-height: calc(100dvh - 44px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
h1 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -0.03em; }
.brand { margin: 0; font-size: 40px; font-weight: 700; letter-spacing: -0.04em; }
.ver, .sub, .cap { color: var(--dim); }
.ver { margin: 4px 0 0; font-size: 20px; font-weight: 600; }
.sub, .cap { margin: 6px 0 0; font-size: 14px; line-height: 1.45; }
.rule { height: 1px; background: var(--border); border: 0; margin: 12px 0; }
.back, .textbtn { background: none; border: 0; padding: 0 0 8px; color: var(--dim); font-size: 20px; font-weight: 600; }
.home { color: var(--dim); font-size: 14px; text-decoration: none; }
.home:hover { color: var(--accent); }
.wheel { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--accent); border-right-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
button.item, button.opt, button.mode {
  display: flex; width: 100%; text-align: left; align-items: center; gap: 12px;
  background: transparent; border: 0; border-radius: 8px; padding: 12px 16px;
}
button.item { color: var(--dim); font-size: 20px; font-weight: 600; padding: 14px 16px; }
button.item.on { background: var(--sel); color: var(--fg); }
button.item i, .dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--border); background: transparent; flex: none; }
button.item i { width: 4px; height: 4px; border-radius: 0; border: 0; background: transparent; }
button.item.on i { background: var(--accent); }
button.opt.on { background: var(--sel); }
button.opt.on .dot { background: var(--accent); border: 0; }
button.opt .lab { font-size: 20px; font-weight: 600; }
button.opt.on .lab { color: var(--accent); }
button.opt .side { margin-left: auto; color: var(--dim); font-size: 14px; font-weight: 400; }
button.mode { display: block; margin: 0 0 20px; background: rgba(45, 55, 72, 0.1); border-radius: 0; }
button.mode b { display: block; font-size: 20px; }
button.mode > span { display: block; margin-top: 4px; color: var(--dim); font-size: 14px; font-weight: 400; line-height: 1.4; }
.center .brand { font-size: 64px; }
input[data-bind] {
  width: 100%;
  background: rgba(45, 55, 72, 0.2);
  border: 0;
  border-radius: 8px;
  padding: 12px;
}
.field input[data-bind] { width: auto; background: transparent; border-radius: 0; padding: 8px 0; }
button.mode .go { float: right; color: var(--dim); font-weight: 400; }
button.mode.accent { border: 1px solid rgba(159, 122, 234, 0.3); }
button.mode.accent b { color: var(--accent); }
button.mode.warn { border: 1px solid rgba(246, 224, 94, 0.3); }
button.mode.warn b { color: var(--warn); }
button.mode.pink { border: 1px solid rgba(246, 135, 179, 0.3); }
button.mode.pink b { color: var(--pink); }
.kicker { display: flex; justify-content: space-between; color: var(--dim); font-size: 20px; font-weight: 600; }
.kicker em { font-style: normal; font-size: 14px; font-weight: 400; color: var(--accent); }
.kicker em.bad { color: var(--err); }
.step, .toggle { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 600; color: var(--dim); }
.step b, .toggle b { color: var(--accent); font-weight: 600; min-width: 1.5ch; text-align: center; }
.step span:first-child, .toggle span:first-child { margin-right: auto; }
.step button, .mini {
  background: none; border: 0; color: var(--fg); font-size: 22px; font-weight: 600; padding: 4px 8px;
}
.step button.off { color: var(--dim); }
.wide {
  display: block; width: 100%; margin-top: 12px; border: 0; padding: 18px 12px;
  font-size: 20px; font-weight: 600; background: var(--accent); color: var(--bg);
}
.wide.fg { background: var(--fg); }
.wide.dim { background: var(--dim); }
.wide.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--border); }
.wide:disabled { opacity: 0.45; }
.err { color: var(--err); font-size: 14px; margin: 8px 0; }
.field { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding: 8px 8px 8px 16px; background: rgba(45, 55, 72, 0.3); border-radius: 8px; border: 1px solid transparent; }
.field:focus-within { border-color: var(--accent); }
.field input, .block input {
  flex: 1; min-width: 0; background: transparent; border: 0; padding: 8px 0; font-size: 20px; font-weight: 600; outline: none;
}
.field button, .mini {
  background: var(--fg); color: var(--bg); border: 0; padding: 12px 20px; font-size: 20px; font-weight: 600;
}
.row { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 20px; font-weight: 600; }
button.row { width: 100%; background: none; border: 0; color: inherit; text-align: left; }
.hintrow { display: flex; gap: 8px; align-items: center; }
.hintrow input { flex: 1; min-width: 0; }
.row .n, .row .who { color: var(--dim); }
.row .gone { margin-left: auto; background: none; border: 0; color: var(--err); font-size: 20px; font-weight: 600; padding: 0; }
.row .mark { width: 16px; flex: none; color: var(--dim); font-size: 14px; }
.row .now { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.row .wait { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--border); flex: none; }
.row em { color: var(--accent); font-weight: 400; }
.big { margin: 0; font-size: 40px; font-weight: 700; color: var(--accent); letter-spacing: -0.04em; }
.pick { font-size: 20px; font-weight: 600; }
.pick.on { background: var(--sel); color: var(--accent); }
.pick i { width: 4px; height: 4px; background: transparent; display: block; }
.pick.on i { background: var(--accent); }
.prog { display: flex; gap: 4px; margin-top: 20px; }
.prog i { flex: 1; height: 2px; background: var(--border); }
.prog i.on { background: var(--accent); }
.prog i.hot { background: var(--fg); }
.role {
  position: relative; width: min(360px, 100%); aspect-ratio: 1 / 1.38;
  max-height: calc(100dvh - 230px); margin: 8px 0 4px;
  border-radius: 14px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.face {
  position: absolute; inset: 0; border-radius: 14px; box-shadow: 0 8px 12px rgba(0, 0, 0, 0.35); overflow: auto;
}
.role .rear {
  display: flex; flex-direction: column; align-items: center; padding: 28px 16px 20px; text-align: center;
  background: linear-gradient(135deg, rgba(45, 55, 72, 0.35), var(--bg));
  border: 2px solid var(--border);
  transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s;
}
.role.open .rear { transform: rotateY(90deg); opacity: 0; }
.eye { color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: 6px; margin: 0; }
.gem { margin: 18px 0; color: rgba(159, 122, 234, 0.6); font-size: 28px; }
.who-name { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.holdhint { margin-top: auto; color: var(--dim); font-size: 10px; font-weight: 600; letter-spacing: 2px; }
.role .front {
  display: none; background: var(--bg); border: 2px solid rgba(159, 122, 234, 0.5); padding: 18px;
}
.role.open .front { display: block; }
.status { margin: 0 0 10px; font-size: 16px; white-space: pre-line; }
.status.err { color: var(--err); font-size: 16px; }
.status.accent { color: var(--accent); }
.wordline, .hintline { margin: 8px 0; }
.k { display: block; color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.wordline b, .hintline b { font-family: var(--mono); font-weight: 700; }
.wordline b { font-size: 22px; }
.hintline b { color: var(--accent); font-size: 17px; }
.front .dim { color: var(--dim); font-size: 20px; font-weight: 600; }
.block {
  background: rgba(45, 55, 72, 0.2); border-radius: 8px; padding: 12px; margin: 8px 0 12px;
}
.topic { justify-content: space-between; }
.topic .meta { color: var(--dim); font-size: 14px; font-weight: 400; }
.badge { color: var(--dim); font-size: 14px; font-weight: 400; }
.add { background: none; border: 0; color: var(--accent); font-size: 20px; font-weight: 600; padding: 14px 0; }
.block input { background: rgba(45, 55, 72, 0.2); border-radius: 8px; padding: 12px; margin: 4px 0; }
.out { font-size: 32px; font-weight: 700; margin: 8px 0; letter-spacing: -0.03em; }
.out.bad { color: var(--err); }
.out.good { color: var(--accent); }
.out.pink { color: var(--pink); }
.out.warn { color: var(--warn); font-size: 20px; }
.tally { font-size: 16px; }
.tally div { display: flex; gap: 8px; padding: 2px 0; }
.tally b { margin-left: auto; color: var(--accent); font-weight: 400; font-family: var(--mono); }
.words { display: flex; gap: 20px; flex-wrap: wrap; }
.words b { display: block; font-size: 20px; }
.words .real { color: var(--accent); }
.words .fake { color: var(--err); }
.hide { display: none; }
.box { padding: 8px; margin-top: 8px; background: rgba(45, 55, 72, 0.15); border: 1px solid rgba(45, 55, 72, 0.3); border-radius: 12px; }
.indent { padding-left: 12px; }
@media (prefers-reduced-motion: reduce) {
  .wheel, .role .rear { animation: none; transition: none; }
}
