:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,0.10);
  --series-1: #2a78d6; --series-2: #eb6834; --series-1-wash: rgba(42,120,214,0.10);
  --good: #006300;
  --brand: #ec6320; --brand-ink: #151b22; --brand-text: #b8410f;
  --radius: 12px; --gap: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-1-wash: rgba(57,135,229,0.12);
    --good: #0ca30c; --brand-text: #ec6320;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --series-1: #3987e5; --series-2: #d95926; --series-1-wash: rgba(57,135,229,0.12);
  --good: #0ca30c; --brand-text: #ec6320;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body { min-height: 100dvh; display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; text-decoration: none; letter-spacing: 0.01em; }
.top nav { display: flex; gap: 10px; font-size: 13.5px; white-space: nowrap; }
.top nav a { text-decoration: none; color: var(--ink-2); }
.top nav a.active { color: var(--ink); font-weight: 600; }

main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 16px; padding-bottom: 40px; }
.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }

h1 { font-size: 22px; margin: 4px 0 6px; font-weight: 650; }
h2 { font-size: 17px; margin: 22px 0 8px; font-weight: 600; }
h3 { font-size: 14px; margin: 14px 0 6px; font-weight: 600; color: var(--ink-2); }
p { margin: 6px 0 10px; line-height: 1.45; }
.lede { color: var(--ink-2); }
.small { font-size: 13px; color: var(--ink-2); }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card.link { display: block; text-decoration: none; }
.card.link:active { transform: scale(0.995); }
.row { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; }

/* Buttons */
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button, .btn { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 12px 16px; cursor: pointer; min-height: 44px; }
button.primary, .btn.primary { background: var(--ink); color: var(--page); border-color: var(--ink); font-weight: 600; }
button.ghost { background: transparent; }
button.danger { color: #d03b3b; border-color: rgba(208,59,59,0.35); }
button:disabled { opacity: 0.45; cursor: default; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.actions .grow { flex: 1; }

/* Chip groups (single select or multi) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 9px 14px; min-height: 40px; font-size: 15px; }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--page); border-color: var(--ink); }
.field { margin: 14px 0; }
.field label, .field .q { display: block; font-weight: 600; margin-bottom: 8px; }
.field .hint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: -4px; margin-bottom: 8px; }
input[type="text"], input[type="email"] { font: inherit; width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink); min-height: 44px; }

/* 0–5 rating */
.rating { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.rating button { padding: 0; min-height: 44px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.rating button[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.rating-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.item { margin: 16px 0; }
.item .name { font-weight: 600; }
.item .stem { color: var(--ink-2); margin: 2px 0 8px; }

/* Readout */
.numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stat .label { font-size: 13px; color: var(--ink-2); }
.stat .value { font-size: 34px; font-weight: 600; line-height: 1.1; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart.radar { max-width: 360px; margin: 0 auto; }
.chart .grid { stroke: var(--grid); stroke-width: 1; fill: none; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .series-fill { fill: var(--series-1-wash); }
.chart .series-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-line.series-2 { stroke: var(--series-2); }
.chart .series-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 1.5; fill-opacity: 0.85; }
.chart .trend { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-opacity: 0.35; stroke-linejoin: round; stroke-linecap: round; }
.chart .trend.series-2 { stroke: var(--series-2); }
.chart .series-dot.series-2 { fill: var(--series-2); }
.chart .series-dot.lowest { r: 7; }
.chart .bar { fill: var(--series-1); }
.chart .label { font-size: 12px; fill: var(--ink-2); }
.chart .label.lowest { fill: var(--ink); font-weight: 600; }
.chart .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .value { font-size: 12px; fill: var(--ink); font-weight: 600; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); margin: 6px 0; }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; background: var(--series-1); }
.legend .key.series-2 { background: var(--series-2); }

.notice { border-left: 3px solid var(--axis); padding: 6px 12px; color: var(--ink-2); font-size: 14px; }
.error { color: #d03b3b; font-size: 14px; }
.ok { color: var(--good); font-size: 14px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.list li .t { font-size: 12px; color: var(--muted); }
.saved-scene { text-align: left; }
.saved-scene .name { font-weight: 600; }
.saved-scene .meta { font-size: 12px; color: var(--muted); }
details summary { cursor: pointer; color: var(--ink-2); font-size: 14px; }
.sr { position: absolute; left: -9999px; }

/* ---- v0.2 layout pass */
main { padding: 20px 18px 48px; }
h2 { margin-top: 0; }
.card { padding: 20px; margin: 16px 0; border-radius: 16px; }
.card p { margin: 8px 0 0; }
.card .actions { margin-top: 18px; }
.card.tool h2 { font-size: 19px; }
.center { text-align: center; }
.mt { margin-top: 10px; }
.hero { display: flex; align-items: center; gap: 16px; padding: 10px 0 18px; font-size: 16px; font-weight: 400; line-height: 1.3; }
.hero .mark { width: 56px; height: 56px; flex: none; fill: var(--ink); }
.hero .tagline { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.1; }
.hero .tagline-sub { color: var(--ink-2); margin-top: 3px; font-style: italic; }
.reading { font-size: 18px; line-height: 1.4; margin: 18px 4px 6px; }
.reading.muted { font-size: 16px; }
.stat .value { font-size: 36px; }
.item { margin: 22px 0; }
.item .stem { margin-bottom: 10px; }
.item.safe { padding-top: 14px; border-top: 1px solid var(--border); }

/* three-stop scale */
.scale3 { padding: 6px 4px 0; }
.scale3 .track { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; height: 44px; }
.scale3 .track::before { content: ""; position: absolute; left: 16.6%; right: 16.6%; top: 50%; height: 2px; background: var(--axis); transform: translateY(-50%); }
.scale3 .stop { background: none; border: 0; padding: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; position: relative; }
.scale3 .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--axis); box-sizing: border-box; transition: transform .12s; }
.scale3 .stop.on .dot { background: var(--ink); border-color: var(--ink); transform: scale(1.35); }
.scale3 .stop-labels { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; font-size: 13px; color: var(--muted); margin-top: 4px; }
.scale3 .stop-labels .on { color: var(--ink); font-weight: 600; }

/* decline options */
button.option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 14px; }
button.option .name { font-weight: 600; }
button.option .hint { font-size: 13px; color: var(--ink-2); }
button.option[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
button.option[aria-pressed="true"] .hint { color: var(--page); opacity: .8; }
.field.choose { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.field.choose .q { margin-bottom: 12px; }
.stack button { width: 100%; }

.ok.big { font-size: 16px; padding: 10px 12px; border-left: 3px solid var(--good); }
button.ghost.danger { border-color: transparent; }

.chart .threat.low { fill: var(--grid); }
.chart .threat.medium { fill: var(--axis); }
.chart .threat.high { fill: var(--muted); }
.legend .key.low { background: var(--grid); } .legend .key.medium { background: var(--axis); } .legend .key.high { background: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand svg { width: 20px; height: 20px; fill: var(--brand); }
.brand { gap: 6px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row .label { font-weight: 600; }
.switch-row .info { border: 1px solid var(--border); background: transparent; border-radius: 50%; width: 28px; height: 28px; min-height: 28px; padding: 0; font-size: 14px; color: var(--ink-2); margin-left: 8px; vertical-align: middle; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--axis); border: 0; padding: 0; min-height: 32px; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); transition: left .15s; }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"]::after { left: 23px; }

/* ---- brand */
.brand .wordmark { height: 22px; width: auto; display: block; }
.brand .wordmark.dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand .wordmark.light { display: none; } :root:not([data-theme="light"]) .brand .wordmark.dark { display: block; } }
:root[data-theme="dark"] .brand .wordmark.light { display: none; } :root[data-theme="dark"] .brand .wordmark.dark { display: block; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.top nav a.active { color: var(--brand-text); }
main a:not(.btn) { color: var(--brand-text); }
.switch[aria-checked="true"] { background: var(--brand); }
.chip[aria-pressed="true"], .chip.on, .rating button[aria-pressed="true"], button.option[aria-pressed="true"], .scale3 .stop.on .dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.hero .mark { fill: var(--brand); }
.about-mark { height: 40px; width: auto; display: block; margin: 8px 0 18px; }
.about-mark.dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .about-mark.light { display: none; } :root:not([data-theme="light"]) .about-mark.dark { display: block; } }
:root[data-theme="dark"] .about-mark.light { display: none; } :root[data-theme="dark"] .about-mark.dark { display: block; }
.hidden { display: none; }
input.code { font-size: 24px; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; margin-top: 8px; }

.row-wrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0 4px; }
input[type="time"] { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink); min-height: 44px; }

.saved-row { display: flex; gap: 8px; align-items: stretch; } .saved-row .saved-scene { flex: 1; min-width: 0; } .saved-row .small-btn { flex: 0 0 auto; width: auto; padding: 8px 14px; font-size: 14px; min-height: 0; align-self: center; }

.chart.radar.quality .series-line { stroke: var(--series-2); } .chart.radar.quality .series-dot { fill: var(--series-2); } .chart.radar.quality .series-fill { fill: rgba(235,104,52,0.10); }

.made-by { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.made-by .wordmark { height: 14px; width: auto; display: block; opacity: .8; }
.made-by .wordmark.dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .made-by .wordmark.light { display: none; } :root:not([data-theme="light"]) .made-by .wordmark.dark { display: block; } }
:root[data-theme="dark"] .made-by .wordmark.light { display: none; } :root[data-theme="dark"] .made-by .wordmark.dark { display: block; }
.foot { display: flex; flex-direction: column; align-items: center; }
