[hidden] { display: none !important; }
body { margin: 0; }
/* Layout: one "official form" sheet, centered, one screen at a time. Official-looking chrome, love-letter content. */
:root {
  --bg: #e9efe6;
  --paper: #fffef9;
  --ink: #1f2e27;
  --muted: #6c8176;
  --line: #d3e5da;
  --accent: #3d8a68;
  --accent-ink: #ffffff;
  --accent-soft: #dff0e7;
  --note: #f0ebf9;
  --hand: #8a6dc9;
  --sun: #b9a3e6;
  --good: #2f8a62;
  --bad: #bf5f78;
  --shadow: 0 1px 0 rgba(31, 46, 39, .04), 0 18px 40px -22px rgba(40, 80, 60, .35);
  --f-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --f-hand: "Gochi Hand", "Marker Felt", "Comic Sans MS", cursive;
  --f-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2a3d33; --paper: #33493d; --ink: #edf4ef; --muted: #a9bfb1; --line: #46604f;
    --accent: #7fd0a8; --accent-ink: #12241a; --accent-soft: #3b5a49; --note: #3e3758; --hand: #c4b2f2;
    --sun: #c4b2f2; --good: #86dcb1; --bad: #f29ab0; --shadow: 0 18px 40px -22px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #2a3d33; --paper: #33493d; --ink: #edf4ef; --muted: #a9bfb1; --line: #46604f;
  --accent: #7fd0a8; --accent-ink: #12241a; --accent-soft: #3b5a49; --note: #3e3758; --hand: #c4b2f2;
  --sun: #c4b2f2; --good: #86dcb1; --bad: #f29ab0; --shadow: 0 18px 40px -22px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-display);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
.wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding-block: 20px 28px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}
.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px dashed var(--line);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.screen { padding: 26px 22px 26px; display: grid; gap: 18px; }
.screen[hidden] { display: none !important; }
.enter { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: .001; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
h1, h2 { margin: 0; text-wrap: balance; font-weight: 800; letter-spacing: -.02em; }
h1 { font-size: clamp(34px, 9vw, 46px); line-height: 1.02; font-variation-settings: "opsz" 96; }
h2 { font-size: clamp(24px, 6.4vw, 30px); line-height: 1.12; font-variation-settings: "opsz" 48; }
p { margin: 0; }
.muted { color: var(--muted); }
.hand { font-family: var(--f-hand); font-size: 22px; line-height: 1.2; color: var(--hand); }

.fields { display: grid; gap: 8px; margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; }
.field { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.field dt { font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-top: 2px; }
.field dd { margin: 0; text-align: right; font-weight: 600; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 15px 22px;
  font: 700 17px/1 var(--f-display);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
  width: 100%;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn:focus-visible, .opt:focus-visible, .link:focus-visible, summary:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.btn-row { display: grid; gap: 10px; }

/* Progress: one heart per question */
.hearts { display: flex; flex-wrap: wrap; gap: 6px; }
.hearts svg { width: 18px; height: 18px; }
.hearts path { fill: var(--line); transition: fill .3s ease, transform .3s ease; transform-origin: center; }
.hearts .on path { fill: var(--accent); }
.hearts .now path { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.6; }

.qnum { font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.opts { display: grid; gap: 10px; }
.opt {
  appearance: none;
  text-align: left;
  font: 600 17px/1.3 var(--f-display);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.opt:hover { border-color: var(--accent); }
.opt:active { transform: scale(.985); }
.opt .box {
  flex: none;
  width: 22px; height: 22px;
  border: 1.5px solid var(--muted);
  border-radius: 6px;
  display: grid; place-items: center;
  font-family: var(--f-hand); font-size: 22px; color: var(--accent);
}
.opt.picked { border-color: var(--accent); background: var(--accent-soft); }
.opt.picked .box { border-color: var(--accent); }
.opts.locked .opt:not(.picked) { opacity: .45; }
.opts.locked .opt { cursor: default; }

.reaction {
  min-height: 30px;
  font-family: var(--f-hand);
  font-size: 24px;
  line-height: 1.15;
  color: var(--hand);
  transform: rotate(-1.5deg);
}
.reaction.pop { animation: pop .35s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { opacity: .001; transform: rotate(-1.5deg) scale(.7); } to { opacity: 1; transform: rotate(-1.5deg) scale(1); } }

/* Processing log */
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-family: var(--f-mono); font-size: 14px; }
.log li { display: flex; gap: 10px; align-items: baseline; animation: rise .35s ease both; }
.log .tick { color: var(--good); width: 1.2em; flex: none; }
.log .pending .tick { color: var(--muted); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* Score */
.score-block { display: grid; justify-items: center; gap: 6px; padding: 8px 0 4px; position: relative; }
.score {
  font-weight: 800;
  font-size: clamp(88px, 30vw, 132px);
  line-height: .9;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  font-variation-settings: "opsz" 96;
}
.score small { font-size: .42em; letter-spacing: -.02em; vertical-align: .9em; margin-left: .04em; }
.score.bad { color: var(--bad); }
.score.good { color: var(--good); }
.score.shake { animation: shake .5s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.score-label { font-family: var(--f-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.stamp {
  justify-self: center;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 3px double currentColor;
  border-radius: 8px;
  transform: rotate(-7deg);
  opacity: .9;
}
.stamp.bad { color: var(--bad); }
.stamp.good { color: var(--good); }
.stamp.slam { animation: slam .32s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes slam { from { opacity: .001; transform: rotate(-7deg) scale(2.2); } to { opacity: .9; transform: rotate(-7deg) scale(1); } }

.note {
  background: var(--note);
  border-radius: 12px;
  padding: 16px 18px;
  font-family: var(--f-hand);
  font-size: 23px;
  line-height: 1.25;
  color: var(--ink);
}
.note .sig { display: block; text-align: right; margin-top: 8px; color: var(--hand); }

.case-btn { appearance: none; background: none; border: 0; padding: 0; margin: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: default; }
.fine { border-top: 1px dashed var(--line); padding: 14px 22px 18px; font-size: 12px; line-height: 1.4; display: grid; gap: 8px; color: var(--muted); }
.fine-title { font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.fine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fine-list li { display: grid; grid-template-columns: 1.4em 1fr; gap: 6px; }
.fine-list .mark { font-family: var(--f-hand); font-size: 16px; line-height: 1; }
.fine-list .mark.y { color: var(--good); }
.fine-list .mark.n { color: var(--bad); }
.fine-list .q { font-weight: 600; color: var(--ink); }
.fine-list .a { color: var(--muted); }

/* Scratch card */
.scratch {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  min-height: 190px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.prize { padding: 22px 20px; display: grid; gap: 8px; align-content: center; min-height: 190px; box-sizing: border-box; background: var(--paper); }
.prize .big { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; text-wrap: balance; }
.prize .line { font-size: 16px; color: var(--muted); }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; transition: opacity .6s ease; }
.scratch.done canvas { opacity: 0; pointer-events: none; }
.link { appearance: none; background: none; border: 0; padding: 4px 0; font: 500 14px var(--f-mono); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; justify-self: center; }

.picks { display: grid; gap: 16px; }
.slot { display: grid; gap: 8px; }
.other-input { font: 600 16px var(--f-display); color: var(--ink); background: var(--paper); border: 1.5px solid var(--accent); border-radius: 12px; padding: 11px 14px; width: 100%; box-sizing: border-box; }
.other-input::placeholder { color: var(--muted); font-weight: 500; }
.other-input:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.plan-label { display: block; font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--hand); margin-bottom: 6px; }
.slot-label { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { appearance: none; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 10px 14px; font: 600 15px/1.2 var(--f-display); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.chip-btn:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
#s-reward { user-select: none; -webkit-user-select: none; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* Owner-only responses viewer */
.owner-btn {
  position: fixed;
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  font: 500 12px var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: 999px; padding: 10px 14px; cursor: pointer;
}
.panel {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in srgb, var(--ink) 40%, transparent);
  display: grid; place-items: end center;
}
.panel-card {
  width: 100%; max-width: 560px; max-height: 85%;
  overflow: auto;
  background: var(--paper);
  border-radius: 16px 16px 0 0;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  display: grid; gap: 14px;
}
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-top h2 { font-size: 22px; }
.run { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; font-size: 14px; }
.run-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.chip { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.chip.test { background: var(--line); color: var(--muted); }
.chip.done { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.run ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.small-btn { appearance: none; border: 1.5px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 8px 12px; font: 500 12px var(--f-mono); cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Entry-code gate */
.gate { display: grid; gap: 10px; }
.gate-label { font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.gate-input {
  appearance: none; width: 100%; box-sizing: border-box;
  border: 1.5px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink);
  padding: 14px 16px; font: 500 18px var(--f-mono); letter-spacing: .06em;
}
.gate-input:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-color: transparent; }
.gate-msg { min-height: 1.45em; margin: 0; font-size: 15px; color: var(--muted); }
.gate-msg.bad { color: var(--bad); }
.btn:disabled { opacity: .6; cursor: default; }

