:root {
  color-scheme: light;
  --bg: #f3f1eb;
  --ink: #202a28;
  --muted: #626861;
  --card: #fffdf8;
  --line: #cdd1c7;
  --accent: #9b432c;
  --button-ink: #ffffff;
  --good: #236347;
  --warn: #795210;
  --bad: #a33531;
  --soft: #e5e8de;
  --trace: #b13c29;
  --point-hit: #efb491;
  --point-edge: #f5d9c4;
  --point-line: #9b705c;
  --review: rgba(255, 253, 248, 0.98);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131d1b;
  --ink: #eef0e9;
  --muted: #b4bfb6;
  --card: #1e2a26;
  --line: #516158;
  --accent: #edaf8a;
  --button-ink: #202a28;
  --good: #8bd2a6;
  --warn: #f3c67a;
  --bad: #ffaaa0;
  --soft: #33433b;
  --trace: #ffb497;
  --point-hit: #865b43;
  --point-edge: #524538;
  --point-line: #d4a184;
  --review: rgba(30, 42, 38, 0.98);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

button, input, select { font: inherit; }

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible, a:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.app {
  width: min(520px, 100%);
  max-width: 100%;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(18px + env(safe-area-inset-top))
    16px
    calc(18px + env(safe-area-inset-bottom));
}

body.is-testing {
  overflow: hidden;
}

body.is-testing .app {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.screen {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.screen > * {
  min-width: 0;
  max-width: 100%;
}

.screen[hidden] { display: none; }

#intro,
#summary,
#chart { overflow: auto; }

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 6px 0 12px;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.lead,
.reading,
.note,
.fine {
  color: var(--muted);
}

.lead {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
}

.shape-order {
  list-style: none;
  display: flex;
  gap: 10px;
  margin: 20px 0 4px;
  padding: 0;
}

.shape-order li {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.shape-order svg {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 6px;
}

.shape-order path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.steps {
  margin: 16px 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.steps li { padding-left: 4px; }

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 16px;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.btn {
  appearance: none;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--button-ink);
  font-size: 18px;
  font-weight: 650;
  cursor: pointer;
}

.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#summary .actions { margin-top: 16px; }

.text-btn {
  appearance: none;
  align-self: flex-start;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.frames {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 4px 0 14px;
}

#methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#methods button { min-height: 44px; }

.frames button {
  appearance: none;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.frames button.is-on {
  background: var(--ink);
  color: var(--bg);
}

.chart-card {
  background: var(--card);
  border-radius: 18px;
  padding: 8px 6px 10px;
}

#chartSvg {
  display: block;
  width: 100%;
  height: auto;
}

#chartSvg[hidden] { display: none; }

.chart-caption,
.chart-focus {
  margin: 8px 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.chart-focus {
  margin-top: 12px;
  color: var(--ink);
  font-weight: 650;
}

.chart-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.chart-list li { border-top: 1px solid var(--line); }

.chart-list button {
  appearance: none;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 2px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.chart-list button.is-pick { font-weight: 680; }

.fine,
.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

#test {
  gap: 10px;
  user-select: none;
  -webkit-user-select: none;
}

.top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.shape-name {
  margin: 0;
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.step {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.meters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.meters div {
  background: var(--card);
  border-radius: 12px;
  padding: 7px 10px 6px;
}

.meters span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.meters strong {
  display: block;
  margin-top: 1px;
  font-size: clamp(16px, 4.6vw, 20px);
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.meters div.is-bad strong { color: var(--bad); }

.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.dots span {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--line);
}

.dots span.is-now {
  background: var(--accent);
  transform: scale(1.2);
}

.dots span.is-done { background: var(--good); }

.hint {
  margin: 0;
  min-height: 2.8em;
  line-height: 1.4;
  text-align: center;
  font-size: 18px;
  font-weight: 680;
}

.hint.is-go { color: var(--good); }
.hint.is-bad { color: var(--bad); }

.stage {
  position: relative;
  flex: 1;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 10px 36px rgba(40, 30, 20, 0.08);
  overflow: hidden;
}

#sheet {
  display: block;
  touch-action: none;
}

.review {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 16px 16px 14px;
  border-radius: 18px;
  background: var(--review);
  box-shadow: 0 12px 40px rgba(40, 30, 20, 0.16);
}

.review[hidden] { display: none; }

.review-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-score {
  margin: 2px 0 0;
  font-size: 56px;
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.review-status {
  margin: 6px 0 0;
  font-size: 16px;
}

.review-detail {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.score {
  margin: 8px 0 0;
  font-size: 84px;
  line-height: 0.9;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.band {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.score-sharp,
.band-sharp { color: var(--good); }
.score-low,
.band-low { color: var(--warn); }
.score-slow,
.band-slow { color: var(--bad); }

.reading {
  margin: 10px 0 0;
  font-size: 16px;
  line-height: 1.4;
}

.gauge {
  position: relative;
  display: grid;
  grid-template-columns: 50fr 20fr 15fr 15fr;
  height: 10px;
  margin-top: 16px;
}

.gauge span { height: 10px; }
.gauge span:nth-child(1) { background: #e7b8b2; border-radius: 99px 0 0 99px; }
.gauge span:nth-child(2) { background: #efd3a4; }
.gauge span:nth-child(3) { background: #ddd6cc; }
.gauge span:nth-child(4) { background: #b7d8c6; border-radius: 0 99px 99px 0; }

.gauge i {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 18px;
  margin-left: -1.5px;
  background: var(--ink);
  border-radius: 2px;
}

.subhead {
  margin: 20px 0 0;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
}

.bar-top span:last-child { font-variant-numeric: tabular-nums; }

.bar-track {
  height: 8px;
  margin-top: 4px;
  border-radius: 99px;
  background: var(--soft);
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--good);
}

.bar-track span.is-mid { background: var(--warn); }
.bar-track span.is-low { background: var(--bad); }

.shape-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.shape-results li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.sr-name { font-size: 17px; }
.sr-score {
  font-size: 20px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}
.sr-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 14px;
}

.compare {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card);
}


@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
}

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 34px; }
.wordmark { display: inline-flex; gap: 8px; align-items: center; color: var(--ink); font-size: 23px; font-weight: 750; letter-spacing: -0.06em; text-decoration: none; }
.wordmark span { color: var(--accent); }
.theme-toggle { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); cursor: pointer; }
.theme-toggle:hover { background: var(--soft); }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
body.is-testing .site-header { margin-bottom: 10px; }

.app { width: min(1000px, 100%); padding: calc(24px + env(safe-area-inset-top)) 24px calc(20px + env(safe-area-inset-bottom)); }
.content { display: flex; flex: 1; flex-direction: column; min-height: 0; min-width: 0; }
.screen:not(#intro) { max-width: 520px; align-self: center; }
body.is-testing .app { width: min(560px, 100%); padding-top: calc(10px + env(safe-area-inset-top)); }
body.is-testing .site-footer { display: none; }
h2 { font-size: 26px; line-height: 1.18; letter-spacing: -0.035em; margin: 10px 0 16px; }
p { text-wrap: pretty; }
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 50px; align-items: center; padding: 28px 0 56px; }
.hero h1 { font-size: clamp(44px, 6.2vw, 72px); line-height: 1.02; margin: 18px 0 22px; letter-spacing: -0.065em; }
.hero h1 span { color: var(--accent); }
.hero .lead { max-width: 460px; font-size: 17px; line-height: 1.6; }
.hero-actions { margin: 26px 0 14px; flex-direction: row; }
.hero-actions .btn { font-size: 16px; border-radius: 10px; }
.hero-actions .btn span { margin-left: 12px; }
.switch { min-height: 44px; margin: 0; font-size: 14px; color: var(--muted); cursor: pointer; }
.hero-note { margin-top: 2px; font-size: 12px; }
.shape-preview { background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 24px; min-height: 320px; display: flex; flex-direction: column; justify-content: space-between; }
.preview-caption { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.shape-order { margin: 24px 0; gap: 20px; align-items: center; }
.shape-order svg { width: 76px; height: 92px; margin-bottom: 12px; }
.shape-order li { font-size: 11px; }
.shape-order li:nth-child(2) { transform: translateY(18px); }
.shape-order li:nth-child(3) { transform: translateY(-8px); }
.shape-order path { stroke-width: 2.5; }
.preview-foot { margin: 26px 0 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.signal-dot { display: inline-block; flex: 0 0 7px; width: 7px; height: 7px; background: var(--good); border-radius: 50%; }
.how-section, .meaning-section, .faq-section { padding: 38px 0; border-top: 1px solid var(--line); }
.how-section .steps { list-style: decimal-leading-zero; display: grid; grid-template-columns: repeat(3, 1fr); padding-left: 24px; gap: 40px; margin: 28px 0 20px; }
.steps li::marker { color: var(--accent); font-size: 13px; font-weight: 600; }
.steps strong, .steps span { display: block; }
.steps strong { font-size: 16px; margin-bottom: 8px; }
.steps span { color: var(--muted); font-size: 14px; line-height: 1.6; }
.meaning-section { max-width: 100%; }
.meaning-section > p:not(.eyebrow) { max-width: 720px; line-height: 1.65; }
.faq-section { padding-bottom: 30px; }
details { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; padding: 17px 2px; font-weight: 600; line-height: 1.4; }
details p { font-size: 15px; line-height: 1.65; color: var(--muted); max-width: 740px; margin: 0 0 20px; }
.install-section { background: var(--soft); border-radius: 22px; padding: 30px; margin: 8px 0 30px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; }
.install-section p { font-size: 14px; line-height: 1.55; }
.install-section .fine { font-size: 12px; }
.install-actions { min-width: 0; }
.install-actions summary { font-size: 14px; }
.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 24px 0 6px; color: var(--muted); font-size: 12px; }
.site-footer a { color: inherit; text-underline-offset: 4px; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 20; padding: 12px 18px; color: var(--button-ink); background: var(--accent); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.frames button, .text-btn { min-height: 44px; }
[hidden] { display: none !important; }
@media (max-width: 700px) {
  .app { padding-left: 18px; padding-right: 18px; }
  .site-header { margin-bottom: 12px; }

  .hero { grid-template-columns: 1fr; gap: 28px; padding: 20px 0 34px; }
  .hero h1 { font-size: clamp(44px, 11.7vw, 66px); }
  .hero .lead { font-size: 16px; }
  .hero-actions { gap: 8px; }
  .hero-actions .btn { font-size: 15px; }
  .shape-preview { min-height: 240px; padding: 20px; }
  .shape-order { margin: 12px 0; }
  .shape-order svg { width: 66px; height: 72px; }
  .preview-foot { margin-top: 12px; }
  .how-section, .meaning-section, .faq-section { padding: 28px 0; }
  .how-section .steps { grid-template-columns: 1fr; gap: 22px; }
  .install-section { grid-template-columns: 1fr; gap: 12px; padding: 22px; }
  .site-footer span:nth-child(2) { display: none; }
}
@media (max-height: 580px) and (orientation: landscape) {
  body.is-testing .site-header { display: none; }
  body.is-testing .app { padding-top: 4px; padding-bottom: 4px; }
  body.is-testing .meters div { padding: 4px 8px; }
  body.is-testing .hint { font-size: 14px; }
  body.is-testing #test { gap: 4px; }
  body.is-testing .top { gap: 3px; }
}
