:root { font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif; color: #17364e; --blue: #2f5fb7; --good: #17835f; --bad: #c2405a; --line: #c3d2e0; }
* { box-sizing: border-box; }
body { margin: 0; background: linear-gradient(#f2f8ff, #fff 42%); }
.lab { width: min(100%, 720px); margin: auto; padding: 12px max(12px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.eyebrow { margin: 0 0 3px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
h1 { margin: 0 0 6px; font-size: 21px; }
.lead { margin: 0 0 10px; color: #5a6b83; font-size: 13px; line-height: 1.55; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1 1 0; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: #17364e; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.tabs button.active { border-color: var(--blue); color: #fff; background: var(--blue); }

.panel { display: grid; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.panel label { display: grid; gap: 4px; color: #61728a; font-size: 12px; font-weight: 700; }
.panel output { color: var(--blue); font-size: 15px; font-weight: 800; }
.panel select { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: #17364e; font: inherit; font-weight: 700; }
input[type="range"] { width: 100%; min-height: 44px; background: transparent; -webkit-appearance: none; appearance: none; accent-color: var(--blue); touch-action: manipulation; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: #dbe5f2; }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: #dbe5f2; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -11px; border: 3px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 1px 4px #17384b55; cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 3px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 1px 4px #17384b55; cursor: pointer; }

.formula { margin: 2px 0 0; font-size: 24px; font-weight: 800; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; }
.stage { margin-top: 10px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.stage svg { display: block; width: 100%; height: auto; }
.axis { stroke: #17364e; stroke-width: 2; }
.tick { stroke: #9fb0c6; stroke-width: 1.5; }
.tick-label { fill: #61728a; font-size: 13px; font-weight: 700; text-anchor: middle; }
.band { fill: #2f5fb7; opacity: .22; }
.band.second { fill: #17835f; }
.endpoint { stroke-width: 3; }
.endpoint.closed { fill: var(--blue); stroke: var(--blue); }
.endpoint.open { fill: #fff; stroke: var(--blue); }
.endpoint.second.closed { fill: var(--good); stroke: var(--good); }
.endpoint.second.open { fill: #fff; stroke: var(--good); }
.caption { fill: #17364e; font-size: 13px; font-weight: 800; text-anchor: middle; }
.empty-note { margin: 0; padding: 10px; border-radius: 9px; background: #fdeef1; color: #8e2438; font-size: 13px; font-weight: 700; text-align: center; }

.result { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.value-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 5px 0; border-bottom: 1px dashed #e2e9f2; }
.value-row:last-of-type { border-bottom: 0; }
.value-row span { min-width: 104px; color: #61728a; font-size: 12px; font-weight: 700; }
.value-row b { font-size: 17px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.value-row b.answer { color: var(--blue); font-size: 21px; }
.steps { margin: 6px 0 0; padding-left: 1.1em; color: #55657d; font-size: 13px; line-height: 1.85; }
.steps b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.note { margin: 8px 0 0; color: #55657d; font-size: 12.5px; line-height: 1.7; }
.note.hint { padding: 8px 10px; border-radius: 9px; background: #fff6e2; color: #7a5a12; }

@media (max-width: 420px) {
  h1 { font-size: 19px; }
  .formula { font-size: 20px; }
  .value-row b.answer { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
