:root {
  --bg: #FFF8F0;
  --bg-sun: #FFF1CC;
  --paper: #FFFFFF;
  --ink: #1C1917;
  --muted: #5C534A;
  --line: #E8DCCE;
  --orange: #B25A00;
  --orange-hover: #934A00;
  --orange-press: #7A3E00;
  --orange-soft: #FDE8CC;
  --orange-line: #E8C48A;
  --sky: #E7F4FB;
  --sky-ink: #1A4A62;
  --ok: #1E5E4A;
  --ok-soft: #E6F3EE;
  --warn-bg: #FFF4E5;
  --warn-line: #E8C48A;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(80, 50, 20, 0.07);
  --header-h: 56px;
  --sticky-h: 64px;
  --focus: #B25A00;
  --chart: #E08920;
  --chart-dim: #F3D7A8;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Noto Sans CJK JP", "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", YuGothic, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  letter-spacing: 0.02em;
  font-size: 17px;
}
body.has-sticky {
  padding-bottom: calc(var(--sticky-h) + env(safe-area-inset-bottom, 0px));
}
a { color: var(--orange-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--paper); padding: 8px 12px; z-index: 40;
}
.skip:focus { left: 8px; }
header {
  background: rgba(255, 248, 240, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  min-height: var(--header-h);
}
.brand {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.12rem;
  letter-spacing: 0.08em; text-decoration: none; color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}
.logo span { white-space: nowrap; }
.logo svg { display: block; }
.logo em { font-style: normal; color: var(--orange); }
.nav { display: flex; gap: 12px 16px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { text-decoration: none; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.nav a:hover { color: var(--orange-hover); }
.wrap { width: min(1040px, 100%); margin: 0 auto; padding: 0 20px; }
.hero {
  background:
    radial-gradient(1200px 320px at 80% -10%, #FFE7A3 0%, transparent 55%),
    radial-gradient(800px 280px at 0% 100%, #FDE8CC 0%, transparent 50%),
    var(--bg);
  padding: 36px 0 16px;
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  font-size: clamp(1.5rem, 4.5vw, 2.15rem);
  line-height: 1.35;
  margin: 0 0 12px;
  letter-spacing: 0.03em;
}
.lead { font-size: 1.05rem; color: var(--muted); margin: 0 0 16px; max-width: 40em; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pills li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--orange-press);
}
.sim-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 24px 0 8px;
}
@media (min-width: 880px) {
  .sim-grid { grid-template-columns: 340px 1fr; align-items: start; }
  .panel-inputs { position: sticky; top: calc(var(--header-h) + 12px); }
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 1.15rem; }
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 6px;
}
.field .hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; }
select, input[type="number"], input[type="range"] + .val {
  font: inherit;
}
select, input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FFFcf7;
  color: var(--ink);
  font-size: 1rem;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--orange);
}
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type="range"] { flex: 1; }
.range-row .val {
  min-width: 5.5em;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dirs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.dirs label {
  display: flex; align-items: center; justify-content: center;
  margin: 0; font-weight: 700; font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 4px;
  background: #FFFcf7;
  cursor: pointer;
}
.dirs input { position: absolute; opacity: 0; pointer-events: none; }
.dirs label:has(input:checked) {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
.dirs label:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.result-hero {
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF 100%);
  text-align: left;
}
.kicker {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--orange);
  margin: 0 0 4px;
}
.big {
  font-size: clamp(2.1rem, 7vw, 3.1rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.big small { font-size: 0.42em; font-weight: 700; margin-left: 4px; }
.subnum { color: var(--muted); margin: 6px 0 0; font-size: 0.95rem; }
.metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 20px 0 0;
}
@media (min-width: 560px) {
  .metrics { grid-template-columns: 1fr 1fr 1fr; }
}
.metric {
  background: var(--ok-soft);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid #CDE4DB;
}
.metric.alt { background: var(--sky); border-color: #C5DDE8; }
.metric.sum { background: var(--orange-soft); border-color: var(--orange-line); }
.metric dt { font-size: 0.78rem; font-weight: 700; color: var(--muted); margin: 0 0 2px; }
.metric dd { margin: 0; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.metric dd small { font-size: 0.7em; font-weight: 700; }
.disclaimer {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 18px 0 0;
  font-size: 0.92rem;
}
.disclaimer strong { color: var(--orange-press); }
.chart { margin-top: 22px; }
.chart h3 { font-size: 1rem; margin: 0 0 10px; }
.bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  align-items: end;
  height: 160px;
  padding: 8px 0 0;
  border-bottom: 2px solid var(--line);
}
.bar {
  background: var(--chart);
  border-radius: 6px 6px 0 0;
  min-height: 2px;
  width: 100%;
  position: relative;
}
.bar-lab {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  padding: 7px 6px;
  text-align: right;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.assumptions {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--muted);
}
.assumptions summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}
.assumptions ul { margin: 8px 0 0; padding-left: 1.2em; }
.next-step {
  margin: 8px 0 24px;
  padding: 22px 20px;
  background: var(--paper);
  border: 2px dashed var(--orange-line);
  border-radius: var(--radius);
}
.next-step h2 { margin: 0 0 8px; font-size: 1.15rem; }
.next-step .note { font-size: 0.9rem; color: var(--muted); }
.btn {
  display: inline-block;
  background: var(--orange);
  color: #fff !important;
  text-decoration: none;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--orange-hover); }
.btn[disabled], .btn.is-disabled {
  background: #C4B8A8;
  color: #fff !important;
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: var(--orange-hover) !important;
  border: 1px solid var(--orange-line);
}
.sticky-result {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(28, 25, 23, 0.94);
  color: #fff;
  z-index: 25;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sticky-result .s-lab { font-size: 0.75rem; opacity: 0.8; }
.sticky-result .s-num { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.sticky-result a { color: #FFE7A3; font-weight: 700; font-size: 0.88rem; }
.section { padding: 12px 0 28px; }
.section h2 { font-size: 1.25rem; margin: 24px 0 10px; }
.pref-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pref-list a {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
}
.pref-list a:hover { border-color: var(--orange); color: var(--orange-hover); }
.pref-list a small { display: block; font-weight: 400; color: var(--muted); font-size: 0.75rem; }
footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  font-size: 0.88rem;
  color: var(--muted);
  background: #F6EEE4;
}
footer nav { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
footer a { color: var(--muted); }
.source-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--muted);
}
.prose { max-width: 42em; }
.prose h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); line-height: 1.35; }
.prose h2 { font-size: 1.2rem; margin-top: 1.8em; }
.prose code { font-size: 0.88em; background: var(--orange-soft); padding: 0 4px; border-radius: 4px; }
.badge-warn {
  display: inline-block;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--orange-press);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
}
.callout {
  background: var(--sky);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid #C5DDE8;
  margin: 16px 0;
}
@media (max-width: 559px) {
  body { font-size: 16px; }
  .dirs { grid-template-columns: repeat(4, 1fr); }
  table.data { font-size: 0.8rem; }
}
