/* 子ども1人、育てるといくら？ 進路すごろく（色はCSS変数のみ） */
:root {
  --kh-k: #f6c56b;
  --kh-e: #8fc9a4;
  --kh-j: #8fb3e6;
  --kh-h: #c9a3e6;
  --kh-start: #e2ddd3;
  --kh-cell-text: #1d1b18;
  --kh-road: #d9d2c4;
  --kh-done-op: .55;
  --kh-piece: #e4572e;
  --kh-bag: #b23a1c;
  --kh-skin: #ffd9b8;
  --kh-eye: #1d1b18;
  --kh-school: #4f8f6a;
  --kh-juku: #3f72c9;
  --kh-narai: #e39b2d;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --kh-k: #b48a3c; --kh-e: #4f8a63; --kh-j: #4f72a6; --kh-h: #8a62a8; --kh-start: #38342b; --kh-cell-text: #f1ede4; --kh-road: #38342b; --kh-piece: #ff7a50; --kh-bag: #d6553a; --kh-school: #5fb383; --kh-juku: #6b9cf0; --kh-narai: #f0b14a; }
}
:root[data-theme="dark"] { --kh-k: #b48a3c; --kh-e: #4f8a63; --kh-j: #4f72a6; --kh-h: #8a62a8; --kh-start: #38342b; --kh-cell-text: #f1ede4; --kh-road: #38342b; --kh-piece: #ff7a50; --kh-bag: #d6553a; --kh-school: #5fb383; --kh-juku: #6b9cf0; --kh-narai: #f0b14a; }

.kh-hero { padding: 12px 0 4px; }
.kh-hero h1 em { font-style: normal; color: var(--accent); }
.kh-start { margin: 12px 0 16px; }
.kh-list { margin: 6px 0 0; padding-left: 1.2em; }
.kh-list li + li { margin-top: 4px; }
.kh-friend { border-color: var(--accent); background: var(--accent-soft); }
.kh-daily .btn { white-space: normal; }
.kh-disclaimer { font-size: 11px; color: var(--text-sub); background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; margin: 16px 0 0; line-height: 1.6; }

/* すごろく盤 */
.kh-board-wrap { margin: 8px 0; }
.kh-board { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; }
.kh-road { stroke: var(--kh-road); stroke-width: 10; stroke-linejoin: round; stroke-linecap: round; }
.kh-cell rect { stroke: var(--surface); stroke-width: 2; transition: opacity .4s; }
.kh-cell text { font-size: 10px; font-weight: 800; fill: var(--kh-cell-text); }
.kh-cell text.kh-start-label { font-size: 7px; }
.kh-st-start rect, .kh-st-goal rect { fill: var(--kh-start); }
.kh-st-k rect { fill: var(--kh-k); }
.kh-st-e rect { fill: var(--kh-e); }
.kh-st-j rect { fill: var(--kh-j); }
.kh-st-h rect { fill: var(--kh-h); }
.kh-cell.is-done rect { opacity: var(--kh-done-op); }
.kh-cell.is-here rect { stroke: var(--accent); stroke-width: 3; }
.kh-piece { transition: transform .45s cubic-bezier(.3, 1.4, .5, 1); }
.kh-piece-shadow { fill: var(--text); opacity: .18; }
.kh-piece-body { fill: var(--kh-piece); }
.kh-piece-bag { fill: var(--kh-bag); }
.kh-piece-head { fill: var(--kh-skin); stroke: var(--kh-bag); stroke-width: 1; }
.kh-piece-eye { fill: var(--kh-eye); }

/* プレイ */
.kh-dash { margin-top: 10px; position: relative; }
.kh-money { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kh-money-num { font-size: clamp(30px, 9vw, 40px); font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.kh-money-unit { font-weight: 800; margin-left: 2px; }
.kh-target { font-weight: 800; color: var(--info); }
.kh-qcard { border: 2px solid var(--accent); }
.kh-q { font-size: 19px; margin: 4px 0 8px; }
.kh-choice small, .kh-level small { margin-top: 2px; }
.kh-levels { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kh-level { min-height: 64px; padding: 10px 12px; }
.kh-yearlist { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.kh-yearlist li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); }
.kh-yearlist b { font-variant-numeric: tabular-nums; }
.kh-stage-sum { margin-top: 10px; font-size: 15px; text-align: right; }
.kh-stage-sum b { font-size: 20px; color: var(--accent); }
.kh-fact { margin-top: 10px; }

/* 結果 */
.kh-big { font-size: clamp(48px, 15vw, 76px); font-weight: 900; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; margin: 4px 0; }
.kh-big span { font-size: .4em; margin-left: 4px; color: var(--text); }
.kh-line1 { font-weight: 800; font-size: 16px; margin: 8px 0; }
.kh-stack { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin-top: 10px; }
.kh-stack i { display: block; height: 100%; }
.kh-seg-school { background: var(--kh-school); }
.kh-seg-juku { background: var(--kh-juku); }
.kh-seg-narai { background: var(--kh-narai); }
.kh-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; margin-top: 6px; color: var(--text-sub); }
.kh-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.kh-bars { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; }
.kh-bar { fill: var(--text-sub); opacity: .55; }
.kh-bar.is-me { fill: var(--accent); opacity: 1; }
.kh-bar-label, .kh-bar-val { font-size: 11px; fill: var(--text-sub); }
.kh-bar-label.is-me, .kh-bar-val.is-me { fill: var(--accent); font-weight: 800; }
.kh-again { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 16px; }
.kh-again .btn { padding: 10px 12px; font-size: 14px; white-space: normal; line-height: 1.35; }
.kh-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.kh-table th, .kh-table td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
.kh-table td:last-child { white-space: nowrap; text-align: right; font-weight: 700; }
.kh-dist { margin-top: 10px; display: grid; gap: 4px; }
.kh-dist-row { display: grid; grid-template-columns: 10.5em 1fr 3em; gap: 6px; align-items: center; font-size: 12px; }
.kh-dist-bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.kh-dist-bar i { display: block; height: 100%; background: var(--text-sub); border-radius: 999px; }
.kh-dist-row.is-me { font-weight: 800; color: var(--accent); }
.kh-dist-row.is-me .kh-dist-bar i { background: var(--accent); }
.kh-dist-pct { text-align: right; font-variant-numeric: tabular-nums; }
.kh-sources ul { padding-left: 1.2em; margin: 8px 0; }
.kh-sources li + li { margin-top: 6px; }
.kh-info p { font-size: 13px; }

/* 図鑑 */
.kh-zukan { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.kh-zukan-item { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 6px; text-align: center; font-size: 12px; line-height: 1.35; display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: .6; }
.kh-zukan-item.on { opacity: 1; background: var(--surface); border: 1px solid var(--line); }
.kh-zukan-emoji { font-size: 26px; }

/* 静的解説 */
.kh-about h2 { font-size: 18px; margin-top: 8px; }
.kh-about p, .kh-about li { font-size: 14px; }
.kh-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.kh-about table { width: 100%; border-collapse: collapse; font-size: 12px; }
.kh-about th, .kh-about td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
.kh-about a { word-break: break-all; }
@media (max-width: 380px) { .kh-levels { grid-template-columns: 1fr; } .kh-dist-row { grid-template-columns: 8.5em 1fr 2.6em; } }
