:root {
  --bg: #F4EEE8;
  --ink: #3A2E28;
  --muted: #8C7D73;
  --paper: #FBF8F3;
  --line: #D9CEC4;
  --soft: #E9E0D7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1614;
    --ink: #E8DFD6;
    --muted: #9A8D83;
    --paper: #2A2421;
    --line: #463B35;
    --soft: #2F2825;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
button { font: inherit; color: inherit; }

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 16px 24px;
}

.screen {
  width: 100%;
  max-width: 34rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.line { font-size: 1.4rem; line-height: 1.4; margin: 0; }
.sub { font-size: 1rem; line-height: 1.5; margin: 0; }
.echo { margin: 0 0 -0.75rem; font-size: 0.95rem; color: var(--muted); text-transform: lowercase; }

/* × wipe */
.wipe {
  position: fixed; top: 10px; left: 10px;
  width: 40px; height: 40px;
  border: 0; background: none;
  font-size: 1.5rem; line-height: 1;
  color: var(--muted); cursor: pointer;
}

/* quiet links */
.skip, .quiet {
  border: 0; background: none; padding: 8px 12px;
  color: var(--muted); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
.skip { font-size: 0.9rem; }

.primary {
  border: 1px solid var(--line); background: var(--paper);
  border-radius: 999px; padding: 10px 28px; cursor: pointer;
}

/* 1–5 scale */
.scale { display: flex; gap: 12px; justify-content: center; }
.scale-item { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 52px; }
.circle {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--soft);
  cursor: pointer; font-size: 1.05rem;
}
.circle[aria-pressed="true"] { background: var(--paper); border-color: var(--muted); }
.scale-cap { font-size: 0.75rem; color: var(--muted); white-space: nowrap; min-height: 1em; }
.helpline-note { font-size: 0.95rem; line-height: 1.5; color: var(--muted); margin: 0; max-width: 26rem; }

/* name chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  border: 1px solid var(--line); background: var(--soft);
  border-radius: 999px; padding: 9px 18px; cursor: pointer;
}

/* paper */
.paper {
  width: 100%;
  position: relative;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.4 0 0 0 0 0.3 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 6px 18px rgba(60,40,30,0.08);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.paper textarea {
  display: block; width: 100%; min-height: 15rem;
  border: 0; outline: none; resize: none;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 1.1rem; line-height: 1.7;
  padding: 1.25rem 1.25rem;
  text-align: left;
}
.paper textarea::placeholder { color: var(--muted); opacity: 0.8; }
body[data-state="crumple"] .paper { cursor: pointer; }
body[data-state="crumple"] .paper textarea { pointer-events: none; }

/* throw (step 1 placeholder shapes) */
.throw-area {
  position: relative; width: 100%; height: 50vh; min-height: 280px;
}
.ball {
  position: absolute; left: 50%; top: 12%;
  width: 64px; height: 64px; margin-left: -32px;
  border-radius: 50%; background: var(--paper);
  box-shadow: 0 4px 10px rgba(60,40,30,0.18);
}
.target {
  position: absolute; left: 50%; bottom: 0;
  width: 110px; height: 120px; margin-left: -55px;
  border: 1px solid var(--line); background: var(--soft);
  border-radius: 6px 6px 14px 14px; cursor: pointer;
}

.options { display: flex; gap: 4px; align-items: center; color: var(--muted); margin: 0.5rem 0 0; }
.test-code { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; color: var(--muted); margin: 0; }

/* footer */
.footer {
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  text-align: center; font-size: 0.75rem; line-height: 1.5; color: var(--muted);
}
.footer p { margin: 2px 0; }
