/* やわらかい背景に白い丸角カード。分野ごとに色のしるしを付け、結果は淡い緑の箱で大きく見せる。 */
:root{
  --bg:#f4f7f9; --card:#ffffff; --ink:#1d2b3a; --mute:#607080; --line:#e2e8ee;
  --accent:#0d8f70; --accent-ink:#ffffff; --soft:#e2f5ef; --mark:#ffef9e;
  --b-s:75%; --b-l:92%; --f-s:55%; --f-l:30%;
  --shadow:0 1px 2px rgba(20,40,60,.06), 0 6px 18px rgba(20,40,60,.06);
  --f-display:"Zen Maru Gothic","Hiragino Maru Gothic ProN","Yu Gothic",sans-serif;
  --f-body:"Zen Kaku Gothic New","Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0f171d; --card:#18232c; --ink:#e9eef2; --mute:#9fb0bd; --line:#2a3a46;
    --accent:#3fd0a8; --accent-ink:#04261d; --soft:#12332b; --mark:#5b5200;
    --b-s:35%; --b-l:22%; --f-s:70%; --f-l:80%;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#0f171d; --card:#18232c; --ink:#e9eef2; --mute:#9fb0bd; --line:#2a3a46;
  --accent:#3fd0a8; --accent-ink:#04261d; --soft:#12332b; --mark:#5b5200;
  --b-s:35%; --b-l:22%; --f-s:70%; --f-l:80%;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
  color-scheme:dark;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
@media (prefers-reduced-motion: reduce){html{scroll-behavior:auto} *{transition:none !important}}
body{margin:0; background:var(--bg); color:var(--ink); font-family:var(--f-body); font-size:16px; line-height:1.75}
a{color:var(--accent)}
a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible{outline:3px solid var(--accent); outline-offset:2px; border-radius:6px}

.top{background:var(--card); border-bottom:1px solid var(--line)}
.top-in{max-width:760px; margin:0 auto; padding:12px 16px; display:flex; align-items:center; justify-content:space-between; gap:12px}
.logo{display:flex; align-items:center; gap:8px; text-decoration:none; color:var(--ink); font-family:var(--f-display); font-weight:900; font-size:1.05rem}
.logo i{display:grid; place-items:center; width:30px; height:30px; border-radius:10px; background:var(--accent); color:var(--accent-ink); font-style:normal; font-size:.95rem}
.top a.all{font-size:.85rem; font-weight:700; text-decoration:none; white-space:nowrap}

.wrap{max-width:760px; margin:0 auto; padding:20px 16px 48px; display:flex; flex-direction:column; gap:18px}
h1{font-family:var(--f-display); font-weight:900; font-size:1.6rem; line-height:1.35; margin:0; text-wrap:balance}
.lead{margin:0; color:var(--mute)}
.crumb{font-size:.8rem; color:var(--mute); margin:0}
.crumb a{color:var(--mute)}

.badge{display:inline-grid; place-items:center; width:34px; height:34px; flex:none; border-radius:12px; font-family:var(--f-display); font-weight:900; font-size:1rem;
  background:hsl(var(--h) var(--b-s) var(--b-l)); color:hsl(var(--h) var(--f-s) var(--f-l))}

/* トップページ */
.search{display:flex; align-items:center; gap:8px; background:var(--card); border:1.5px solid var(--line); border-radius:999px; padding:4px 16px; box-shadow:var(--shadow)}
.search input{flex:1; min-width:0; border:0; background:transparent; color:var(--ink); font:inherit; padding:10px 0}
.search input:focus-visible{outline:none}
.search:focus-within{border-color:var(--accent)}
.chips{display:flex; flex-wrap:wrap; gap:8px}
.chips a{display:flex; align-items:center; gap:6px; text-decoration:none; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:999px; padding:5px 14px 5px 6px; font-weight:700; font-size:.88rem}
.chips .badge{width:26px; height:26px; border-radius:50%; font-size:.8rem}
.cat-h{display:flex; align-items:center; gap:10px; font-family:var(--f-display); font-weight:700; font-size:1.15rem; margin:10px 0 0; scroll-margin-top:12px}
.list{display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:10px; margin:0; padding:0; list-style:none}
.list a{display:flex; flex-direction:column; gap:2px; height:100%; text-decoration:none; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:16px; padding:14px 16px; box-shadow:var(--shadow); transition:transform .12s ease, border-color .12s ease}
.list a:hover{transform:translateY(-2px); border-color:var(--accent)}
.list b{font-family:var(--f-display); font-size:1rem; line-height:1.45}
.list span{font-size:.8rem; color:var(--mute); line-height:1.55}
.none{margin:0; color:var(--mute)}
[hidden]{display:none !important}

/* 計算カード */
.card{background:var(--card); border:1px solid var(--line); border-radius:20px; padding:20px 16px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:16px}
.fields{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px 12px; align-items:start}
.field{display:flex; flex-direction:column; gap:5px}
.field label{font-size:.84rem; font-weight:700}
.inp{display:flex; align-items:center; border:1.5px solid var(--line); border-radius:12px; background:var(--bg); overflow:hidden; transition:border-color .12s ease}
.inp:focus-within{border-color:var(--accent)}
.inp input,.inp select{flex:1; min-width:0; border:0; background:transparent; color:var(--ink); font:inherit; font-size:1.08rem; padding:11px 12px; font-variant-numeric:tabular-nums}
.inp input:focus-visible,.inp select:focus-visible{outline:none}
.inp span{padding:0 12px 0 2px; color:var(--mute); font-size:.85rem; white-space:nowrap}
.src{margin:0; font-size:.74rem; line-height:1.5; color:var(--mute); overflow-wrap:anywhere}
.src a{font-weight:700}
.src .tag{display:inline-block; background:var(--bg); border:1px solid var(--line); border-radius:999px; padding:0 7px; margin-right:4px; font-weight:700; font-size:.68rem}
.result{background:var(--soft); border-radius:16px; padding:16px; display:flex; flex-direction:column; gap:8px}
.result .cap{font-size:.86rem; font-weight:700}
.big{font-family:var(--f-display); font-weight:900; font-size:2.4rem; line-height:1.2; font-variant-numeric:tabular-nums; overflow-wrap:anywhere}
.big b{background:linear-gradient(transparent 60%,var(--mark) 60%); padding:0 4px; font-weight:900}
.big small{font-size:1rem; font-weight:700; margin-left:4px}
.rows{margin:4px 0 0; display:grid; gap:4px}
.rows div{display:flex; justify-content:space-between; gap:12px; font-size:.92rem; border-top:1px solid var(--line); padding-top:4px}
.rows dt{color:var(--mute)}
.rows dd{margin:0; font-weight:700; font-variant-numeric:tabular-nums; text-align:right}
.basis-h{font-size:.84rem; font-weight:700; margin:0}
.basis{font-size:.84rem; color:var(--mute); margin:0; padding-left:1.2em}
.basis li{margin:3px 0}
.cta{border-top:1px dashed var(--line); padding-top:14px; display:flex; flex-direction:column; gap:8px}
.cta-pre{margin:0; font-size:.86rem; color:var(--mute)}
.cta-btn{font:inherit; font-weight:700; font-size:1rem; line-height:1.5; text-align:left; cursor:pointer; background:var(--accent); color:var(--accent-ink); border:0; border-radius:16px; padding:13px 18px; display:flex; align-items:center; justify-content:space-between; gap:10px; text-decoration:none; transition:transform .12s ease}
.cta-btn:hover{transform:translateY(-1px)}
.cta-btn .ad-label{flex:none; font-size:.72rem; font-weight:700; border:1.5px solid currentColor; border-radius:999px; padding:0 8px}
.cta-note{margin:0; font-size:.82rem; color:var(--mute)}

.ad{border:1.5px dashed var(--line); border-radius:16px; padding:14px; display:flex; flex-direction:column; gap:4px; min-height:100px; justify-content:center; color:var(--mute)}
.ad .ad-tag{align-self:flex-start; font-size:.7rem; font-weight:700; border:1px solid var(--mute); border-radius:999px; padding:0 8px}
.ad .ad-t{font-weight:700; font-size:.92rem; color:var(--ink)}
.ad .ad-s{font-size:.78rem}

/* 解説 */
.doc{background:var(--card); border:1px solid var(--line); border-radius:20px; padding:20px 16px; box-shadow:var(--shadow)}
.doc h2{font-family:var(--f-display); font-weight:700; font-size:1.08rem; margin:18px 0 6px}
.doc h2:first-child{margin-top:0}
.doc p{margin:0 0 8px; max-width:38em}
.doc ul{margin:0; padding-left:1.2em; max-width:38em}
.doc li{margin:4px 0}
.ex{background:var(--bg); border-radius:12px; padding:12px 14px}
.ex p{margin:0}
.rel-h{font-family:var(--f-display); font-weight:700; font-size:1.05rem; margin:6px 0 0}

footer{border-top:1px solid var(--line); background:var(--card)}
.foot{max-width:760px; margin:0 auto; padding:18px 16px 28px; font-size:.8rem; color:var(--mute); display:flex; flex-direction:column; gap:8px}
.foot p{margin:0}
.foot nav{display:flex; flex-wrap:wrap; gap:4px 14px; justify-content:flex-end; font-size:.75rem}
.foot nav a{color:var(--mute)}

/* ---- 絵と図 ---- */
.badge svg{width:62%; height:62%}
.hero{background:var(--accent); color:var(--accent-ink); border-radius:24px; padding:20px 20px 0; display:flex; flex-direction:column; gap:8px; overflow:hidden; box-shadow:var(--shadow)}
.hero h1{font-size:1.75rem}
.hero .lead{color:inherit; opacity:.92}
.hero svg{display:block; width:58%; max-width:220px; height:auto; margin:2px 0 0 auto}
.hero .w{fill:var(--accent-ink)} .hero .o{fill:var(--accent-ink); opacity:.28} .hero .y{fill:var(--mark)}
.hero .s{fill:none; stroke:var(--accent-ink); stroke-width:3; stroke-linecap:round; stroke-linejoin:round}
.hero .a{fill:var(--accent)}
.banner{display:flex; align-items:center; gap:14px; background:hsl(var(--h) var(--b-s) var(--b-l)); border-radius:24px; padding:18px 16px}
.banner .badge{width:64px; height:64px; border-radius:20px; background:var(--card)}
.banner h1{font-size:1.4rem}
.cat-band{display:flex; align-items:center; gap:10px; background:hsl(var(--h) var(--b-s) var(--b-l)); border-radius:16px; padding:8px 12px; font-family:var(--f-display); font-weight:700; font-size:1.12rem; margin:10px 0 0; scroll-margin-top:12px}
.cat-band .badge{background:var(--card)}
.cat-band small{margin-left:auto; font-size:.78rem; font-weight:700; color:hsl(var(--h) var(--f-s) var(--f-l))}
.list a{flex-direction:row; align-items:flex-start; gap:12px}
.list a > div{display:flex; flex-direction:column; gap:2px; min-width:0}
.list .badge{margin-top:2px}

.vz{margin:8px 0 0; padding:12px 0 0; border-top:1px solid var(--line); display:flex; flex-direction:column; gap:8px}
.vz-t{font-size:.82rem; font-weight:700; color:var(--mute)}
.vz-n,.vz-c{margin:0; font-size:.78rem; color:var(--mute)}
.vz-svg{display:block; width:100%; height:auto; max-width:420px}
.t0{background:hsl(var(--h,160) 62% 46%)} .t1{background:var(--ink); opacity:.55} .t2{background:var(--mute); opacity:.4}
.bars{display:grid; gap:8px}
.bar-row{display:grid; grid-template-columns:minmax(4.5em,auto) 1fr auto; align-items:center; gap:8px; font-size:.86rem}
.bar-l{font-weight:700; max-width:9em}
.bar-tr{display:block; height:18px; border-radius:999px; background:var(--card); overflow:hidden}
.bar-f{display:block; height:100%; border-radius:999px; transition:width .25s ease}
.bar-v{font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap}
.stack-tr{display:flex; gap:3px; height:22px; border-radius:999px; overflow:hidden; background:var(--card)}
.stack-s{display:block; height:100%; transition:flex-grow .25s ease}
.stack-lg{list-style:none; margin:8px 0 0; padding:0; display:flex; flex-wrap:wrap; gap:4px 14px; font-size:.82rem}
.stack-lg li{display:flex; align-items:center; gap:6px}
.dot{display:inline-block; width:12px; height:12px; border-radius:4px; flex:none}
.dot.dash{background:none; border-top:2px dashed var(--ink); height:0; border-radius:0; width:16px}
.vz-svg .ax{stroke:var(--mute); stroke-width:1.5; opacity:.5}
.vz-svg .ar{fill:hsl(var(--h,160) 62% 46%); opacity:.18}
.vz-svg .ln{fill:none; stroke:hsl(var(--h,160) 62% 46%); stroke-width:3; stroke-linecap:round; stroke-linejoin:round}
.vz-svg .tg{stroke:var(--ink); stroke-width:1.5; stroke-dasharray:5 4}
.vz-svg .mk{stroke:var(--ink); stroke-width:1; stroke-dasharray:2 3; opacity:.6}
.vz-svg .pt{fill:var(--mark); stroke:var(--ink); stroke-width:2}
.vz-svg .tx{font-family:var(--f-body); font-size:11px; fill:var(--mute)}
.vz-svg .tx.b{font-weight:700; fill:var(--ink)}
.vz-svg .c0{fill:hsl(var(--h,160) 62% 46%); opacity:.85} .vz-svg .c1{fill:hsl(var(--h,160) 62% 46%); opacity:.55}
.vz-svg .f0{fill:hsl(var(--h,160) 40% 62%)} .vz-svg .f1{fill:hsl(var(--h,160) 62% 42%)} .vz-svg .f2{fill:var(--ink); opacity:.75}
.vz-svg .body{fill:none; stroke:var(--ink); stroke-width:9; stroke-linecap:round; stroke-linejoin:round; opacity:.75}
.vz-svg .leg{stroke:hsl(var(--h,160) 40% 50%); stroke-width:5; stroke-linecap:round}
.vz-svg .dim{stroke:var(--ink); stroke-width:1.5} .vz-svg .dim.thin{stroke-width:1; stroke-dasharray:2 3; opacity:.6}
.count{display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end}
.gl{display:block; background:hsl(var(--h,160) 62% 46%); position:relative}
.gl.can{width:26px; height:32px; border-radius:5px 5px 7px 7px; border-top:6px solid var(--ink)}
.gl.bag{width:30px; height:36px; border-radius:9px 9px 6px 6px; border-top:5px dashed var(--card)}
.gl.roll{width:34px; height:34px; border-radius:50%; border:9px solid hsl(var(--h,160) 62% 46%); background:var(--card)}
.count .more{font-size:.82rem; font-weight:700; color:var(--mute)}

.gl.post{width:10px; height:44px; border-radius:4px 4px 2px 2px}
