/* =========================================================================
   国試ドリル 共通スタイル  drill/style.css（社会福祉士・公認心理師で共用。色は各アプリの theme.css で上書き可）
   外部フォント・外部リソースなし。ライト／ダーク両対応。
   ========================================================================= */
:root{
  --bg:#f6f4ef; --bg2:#efece5; --surface:#ffffff; --surface2:#faf8f4;
  --ink:#1d2127; --ink2:#454c57; --mute:#6b7280; --line:#e2ddd2; --line2:#d3ccbe;
  --accent:#2f56c8; --accent-ink:#2447ad; --accent-soft:#e8eeff; --on-accent:#ffffff;
  --ok:#17804f; --ok-bg:#e6f5ec; --ok-line:#9fd3b6;
  --ng:#c43d33; --ng-bg:#fcebe9; --ng-line:#efb1aa;
  --warn:#9a6a00; --warn-bg:#fff4d6; --warn-line:#f0d48a;
  --flag:#d99a12; --mark:#ffe58a;
  --shadow:0 1px 2px rgba(30,25,15,.06), 0 4px 16px rgba(30,25,15,.05);
  --radius:14px; --radius-s:10px;
  --fs:16px;
  --font:"Hiragino Sans","Hiragino Kaku Gothic ProN","Noto Sans JP","Noto Sans CJK JP","Yu Gothic UI","Yu Gothic","Meiryo",system-ui,sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#14161a; --bg2:#1a1d22; --surface:#1d2026; --surface2:#23272e;
    --ink:#e9ebee; --ink2:#c3c8cf; --mute:#98a0ab; --line:#2f343c; --line2:#3b414b;
    --accent:#8aa6ff; --accent-ink:#a9bdff; --accent-soft:#232c45; --on-accent:#0d1325;
    --ok:#5fcf93; --ok-bg:#16291f; --ok-line:#2c5a40;
    --ng:#ff8b80; --ng-bg:#2e1b1a; --ng-line:#6a3330;
    --warn:#f0c062; --warn-bg:#2d2615; --warn-line:#5f4d22;
    --flag:#f2b937; --mark:#6b5a12;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#14161a; --bg2:#1a1d22; --surface:#1d2026; --surface2:#23272e;
  --ink:#e9ebee; --ink2:#c3c8cf; --mute:#98a0ab; --line:#2f343c; --line2:#3b414b;
  --accent:#8aa6ff; --accent-ink:#a9bdff; --accent-soft:#232c45; --on-accent:#0d1325;
  --ok:#5fcf93; --ok-bg:#16291f; --ok-line:#2c5a40;
  --ng:#ff8b80; --ng-bg:#2e1b1a; --ng-line:#6a3330;
  --warn:#f0c062; --warn-bg:#2d2615; --warn-line:#5f4d22;
  --flag:#f2b937; --mark:#6b5a12;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme:dark;
}
:root[data-font="s"]{--fs:14.5px;}
:root[data-font="l"]{--fs:18px;}
:root[data-font="xl"]{--fs:20px;}

*{box-sizing:border-box;}
html{-webkit-text-size-adjust:100%; text-size-adjust:100%;}
html,body{margin:0; padding:0;}
body{
  background:var(--bg); color:var(--ink); font-family:var(--font); font-size:var(--fs);
  line-height:1.75; -webkit-font-smoothing:antialiased; min-height:100vh;
  padding-bottom:calc(64px + env(safe-area-inset-bottom));
}
@media (min-width:900px){ body{padding-bottom:0;} }
a{color:var(--accent-ink);}
button{font-family:inherit; font-size:inherit; color:inherit;}
input,select,textarea{font-family:inherit; font-size:16px; color:var(--ink);}
:focus-visible{outline:3px solid var(--accent); outline-offset:2px; border-radius:6px;}
.skip{position:absolute; left:-9999px; top:0; background:var(--accent); color:var(--on-accent); padding:8px 14px; z-index:100;}
.skip:focus{left:8px; top:8px;}
.sr{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap;}
mark{background:var(--mark); color:inherit; border-radius:3px; padding:0 1px;}
[hidden]{display:none !important;}

/* ---------- app bar ---------- */
.appbar{position:sticky; top:0; z-index:30; background:color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter:saturate(1.4) blur(10px); -webkit-backdrop-filter:saturate(1.4) blur(10px); border-bottom:1px solid var(--line);}
.appbar-in{max-width:1080px; margin:0 auto; display:flex; align-items:center; gap:12px; padding:10px 16px; padding-top:calc(10px + env(safe-area-inset-top));}
.brand{display:flex; align-items:center; gap:9px; text-decoration:none; color:var(--ink); min-width:0;}
.brand-mark{width:28px; height:28px; color:var(--accent); flex:0 0 28px;}
.brand-t{font-size:15px; white-space:nowrap; letter-spacing:.02em;}
.brand-t b{font-weight:800;}
.topnav{display:none; margin-left:auto; gap:2px;}
.topnav a{color:var(--ink2); text-decoration:none; font-size:14px; padding:7px 11px; border-radius:9px; white-space:nowrap;}
.topnav a:hover{background:var(--bg2); color:var(--ink);}
.topnav a.on{background:var(--accent-soft); color:var(--accent-ink); font-weight:700;}
.iconbtn{display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:10px; border:1px solid var(--line); background:var(--surface); cursor:pointer; color:var(--ink2); flex:0 0 38px;}
.iconbtn:hover{border-color:var(--line2); color:var(--ink);}
.iconbtn svg{width:18px; height:18px;}
.theme-toggle{margin-left:auto;}
@media (min-width:900px){ .topnav{display:flex;} .theme-toggle{margin-left:8px;} }

/* ---------- bottom tab bar (mobile) ---------- */
.tabbar{position:fixed; left:0; right:0; bottom:0; z-index:30; display:grid; grid-template-columns:repeat(5,1fr); background:var(--surface); border-top:1px solid var(--line); padding-bottom:env(safe-area-inset-bottom);}
.tabbar a{display:flex; flex-direction:column; align-items:center; gap:2px; padding:8px 0 7px; text-decoration:none; color:var(--mute); font-size:11px;}
.tabbar svg{width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round;}
.tabbar a.on{color:var(--accent-ink); font-weight:700;}
@media (min-width:900px){ .tabbar{display:none;} }
body.focus .tabbar, body.focus .topnav{display:none;}
body.focus .theme-toggle{margin-left:auto;}

/* ---------- layout ---------- */
.view{max-width:1080px; margin:0 auto; padding:20px 16px 48px;}
.wrap{max-width:820px; margin:0 auto;}
.narrow{max-width:760px; margin:0 auto;}
h1.page{font-size:1.45em; line-height:1.4; margin:6px 0 4px; letter-spacing:.01em;}
p.lead{color:var(--ink2); margin:0 0 18px; font-size:.94em;}
h2.sec{font-size:1.05em; margin:28px 0 12px; display:flex; align-items:center; gap:8px;}
h2.sec .sub{font-size:.8em; color:var(--mute); font-weight:400;}
.card{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow);}
.card + .card{margin-top:14px;}
.card h3{margin:0 0 10px; font-size:1em;}
.grid{display:grid; gap:12px;}
.g2{grid-template-columns:repeat(2,minmax(0,1fr));}
.g3{grid-template-columns:repeat(3,minmax(0,1fr));}
.g4{grid-template-columns:repeat(4,minmax(0,1fr));}
@media (max-width:720px){ .g3,.g4{grid-template-columns:repeat(2,minmax(0,1fr));} }
@media (max-width:420px){ .g2.stack-s{grid-template-columns:1fr;} }
.row{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
.row.end{justify-content:flex-end;}
.row.between{justify-content:space-between;}
.muted{color:var(--mute);}
.small{font-size:.86em;}
.tiny{font-size:.78em;}
.num{font-variant-numeric:tabular-nums;}
.spacer{flex:1;}
hr.sep{border:0; border-top:1px solid var(--line); margin:18px 0;}

/* ---------- buttons ---------- */
.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:10px 18px; border-radius:11px; border:1px solid var(--line2); background:var(--surface); color:var(--ink); font-weight:700; font-size:.95em; cursor:pointer; text-decoration:none; transition:background .12s, border-color .12s, transform .06s; -webkit-tap-highlight-color:transparent;}
.btn:hover{border-color:var(--accent);}
.btn:active{transform:translateY(1px);}
.btn.primary{background:var(--accent); border-color:var(--accent); color:var(--on-accent);}
.btn.primary:hover{filter:brightness(1.07);}
.btn.ghost{background:transparent;}
.btn.danger{color:var(--ng); border-color:var(--ng-line);}
.btn.small{min-height:36px; padding:6px 12px; font-size:.86em; border-radius:9px;}
.btn.block{width:100%;}
.btn[disabled]{opacity:.45; cursor:not-allowed; transform:none;}
.btn svg{width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;}
.linkbtn{background:none; border:0; padding:0; color:var(--accent-ink); cursor:pointer; text-decoration:underline; font-size:.9em;}

/* ---------- chips / segmented ---------- */
.chip{display:inline-flex; align-items:center; gap:4px; font-size:.76em; line-height:1.4; padding:2px 9px; border-radius:99px; background:var(--bg2); color:var(--ink2); border:1px solid var(--line); white-space:nowrap;}
.chip.acc{background:var(--accent-soft); color:var(--accent-ink); border-color:transparent;}
.chip.ok{background:var(--ok-bg); color:var(--ok); border-color:var(--ok-line);}
.chip.ng{background:var(--ng-bg); color:var(--ng); border-color:var(--ng-line);}
.chip.warn{background:var(--warn-bg); color:var(--warn); border-color:var(--warn-line);}
.chip.flag{background:var(--warn-bg); color:var(--flag); border-color:var(--warn-line);}
.seg{display:inline-flex; flex-wrap:wrap; gap:6px;}
.seg button{min-height:40px; padding:6px 14px; border-radius:99px; border:1px solid var(--line2); background:var(--surface); cursor:pointer; font-size:.9em;}
.seg button[aria-pressed="true"]{background:var(--accent); border-color:var(--accent); color:var(--on-accent); font-weight:700;}
.field{margin:0 0 18px;}
.field > .lab{display:block; font-size:.85em; color:var(--mute); margin:0 0 8px; font-weight:700; letter-spacing:.04em;}
.inp, select.inp, textarea.inp{width:100%; padding:10px 12px; border-radius:10px; border:1px solid var(--line2); background:var(--surface); min-height:44px;}
textarea.inp{min-height:96px; line-height:1.6; resize:vertical;}
.switch{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); cursor:pointer;}
.switch:last-child{border-bottom:0;}
.switch .t{font-weight:700; font-size:.95em;}
.switch .d{font-size:.8em; color:var(--mute); line-height:1.5;}
.switch input{appearance:none; -webkit-appearance:none; width:46px; height:28px; border-radius:99px; background:var(--line2); position:relative; flex:0 0 46px; cursor:pointer; transition:background .15s;}
.switch input::after{content:""; position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.25); transition:left .15s;}
.switch input:checked{background:var(--accent);}
.switch input:checked::after{left:21px;}

/* ---------- home ---------- */
.hero{display:grid; grid-template-columns:1.3fr 1fr; gap:14px; margin-bottom:6px;}
@media (max-width:760px){ .hero{grid-template-columns:1fr;} }
.count-card{background:linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #6a3fd0) 100%); color:var(--on-accent); border:0; position:relative; overflow:hidden;}
.count-card .k{font-size:.82em; opacity:.9; letter-spacing:.06em;}
.count-card .big{font-size:2.8em; font-weight:800; line-height:1.15; letter-spacing:.01em;}
.count-card .big small{font-size:.38em; font-weight:700; margin-left:4px;}
.count-card .d{font-size:.85em; opacity:.92;}
.count-card::after{content:""; position:absolute; right:-40px; top:-40px; width:180px; height:180px; border-radius:50%; background:rgba(255,255,255,.08);}
.today .bar{height:10px; border-radius:99px; background:var(--bg2); overflow:hidden; margin:8px 0 6px;}
.today .bar i{display:block; height:100%; background:var(--ok); border-radius:99px; transition:width .4s;}
.kpis{display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:10px;}
.kpi{background:var(--surface2); border:1px solid var(--line); border-radius:10px; padding:8px 10px;}
.kpi .k{font-size:.72em; color:var(--mute);}
.kpi .v{font-size:1.25em; font-weight:800; line-height:1.3;}
.kpi .v small{font-size:.6em; font-weight:600; color:var(--mute); margin-left:2px;}
.banner{display:flex; gap:12px; align-items:center; padding:12px 16px; border-radius:var(--radius); border:1px solid var(--warn-line); background:var(--warn-bg); color:var(--ink); margin:0 0 14px; font-size:.9em;}
.banner.info{border-color:var(--line2); background:var(--surface2);}
.banner .spacer{flex:1;}
.banner .bi{flex:0 0 22px; color:var(--warn); display:flex;}
.banner.info .bi{color:var(--accent-ink);}
.banner .bi svg{width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round;}
.modes{display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px;}
@media (max-width:760px){ .modes{grid-template-columns:repeat(2,minmax(0,1fr));} }
.mode{display:flex; flex-direction:column; gap:4px; text-align:left; padding:16px; border-radius:var(--radius); border:1px solid var(--line); background:var(--surface); box-shadow:var(--shadow); cursor:pointer; text-decoration:none; color:var(--ink); transition:border-color .12s, transform .08s; min-height:118px;}
.mode:hover{border-color:var(--accent); transform:translateY(-1px);}
.mode .ic{width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center; background:var(--accent-soft); color:var(--accent-ink); margin-bottom:4px;}
.mode .ic svg{width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;}
.mode .t{font-weight:800; font-size:1em;}
.mode .d{font-size:.8em; color:var(--mute); line-height:1.55;}
.mode .n{margin-top:auto; padding-top:6px; font-size:.78em; color:var(--accent-ink); font-weight:700;}
.mode.hot{border-color:var(--accent); background:linear-gradient(180deg, var(--accent-soft), var(--surface));}

/* subject progress table */
.subj-table{width:100%; border-collapse:collapse; font-size:.88em;}
.subj-table th,.subj-table td{padding:8px 6px; border-bottom:1px solid var(--line); text-align:left; vertical-align:middle;}
.subj-table th{font-size:.82em; color:var(--mute); font-weight:700;}
.subj-table td.r, .subj-table th.r{text-align:right; white-space:nowrap;}
.subj-table tr.grp td{background:var(--bg2); font-size:.8em; font-weight:700; color:var(--ink2); padding:5px 8px;}
.subj-table a{color:var(--ink); text-decoration:none;}
.subj-table a:hover{color:var(--accent-ink); text-decoration:underline;}
.meter{position:relative; height:8px; background:var(--bg2); border-radius:99px; overflow:hidden; min-width:60px;}
.meter i{position:absolute; left:0; top:0; bottom:0; border-radius:99px; background:var(--accent);}
.meter i.ok{background:var(--ok);} .meter i.ng{background:var(--ng);} .meter i.warn{background:var(--flag);}
.meter .line60{position:absolute; top:-2px; bottom:-2px; left:60%; width:2px; background:var(--ink2); opacity:.35;}

/* ---------- setup ---------- */
.subj-pick{display:grid; gap:10px;}
.grp-box{border:1px solid var(--line); border-radius:12px; overflow:hidden; background:var(--surface);}
.grp-head{display:flex; align-items:center; gap:10px; padding:9px 12px; background:var(--bg2); font-size:.86em; font-weight:700;}
.grp-head .spacer{flex:1;}
.grp-items{display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr));}
.chk{display:flex; align-items:center; gap:10px; padding:10px 12px; border-top:1px solid var(--line); cursor:pointer; font-size:.9em; min-height:44px;}
.chk input{width:20px; height:20px; accent-color:var(--accent); flex:0 0 20px;}
.chk .c{margin-left:auto; color:var(--mute); font-size:.82em; white-space:nowrap;}
.sticky-go{position:sticky; bottom:calc(68px + env(safe-area-inset-bottom)); margin-top:18px; z-index:5; display:flex; gap:10px; align-items:center; padding:12px 14px; background:var(--surface); border:1px solid var(--line2); border-radius:var(--radius); box-shadow:0 6px 24px rgba(0,0,0,.12);}
@media (min-width:900px){ .sticky-go{bottom:12px;} }
.sticky-go .info{font-size:.88em; line-height:1.4;}
.sticky-go .info b{font-size:1.25em;}

/* ---------- player ---------- */
.player{max-width:820px; margin:0 auto;}
.ptop{display:flex; align-items:center; gap:10px; margin:0 0 12px; flex-wrap:wrap;}
.ptop .title{font-weight:800; font-size:.92em; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1;}
.timer{font-variant-numeric:tabular-nums; font-weight:700; font-size:.92em; padding:4px 10px; border-radius:8px; background:var(--bg2);}
.timer.low{background:var(--ng-bg); color:var(--ng);}
.progress{height:6px; background:var(--bg2); border-radius:99px; overflow:hidden; margin:0 0 16px;}
.progress i{display:block; height:100%; background:var(--accent); transition:width .25s;}
.qcard{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:20px 20px 16px; box-shadow:var(--shadow);}
@media (max-width:560px){ .qcard{padding:16px 14px 12px; border-radius:12px;} .view{padding-left:12px; padding-right:12px;} }
.qmeta{display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin:0 0 10px;}
.qno{font-weight:800; font-size:.9em; color:var(--accent-ink); margin-right:4px;}
.qtext{font-size:1.04em; margin:0 0 12px; white-space:pre-wrap; word-break:break-word;}
.qcase{background:var(--surface2); border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:8px; padding:12px 14px; margin:0 0 14px; white-space:pre-wrap; font-size:.96em;}
.qcase .k{display:block; font-size:.78em; font-weight:800; color:var(--accent-ink); letter-spacing:.08em; margin-bottom:2px;}
.qtext .key{font-weight:800; text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:3px; text-decoration-color:var(--flag);}
.opts{list-style:none; margin:0; padding:0; display:grid; gap:8px;}
.opt{display:flex; align-items:stretch; gap:0; border:1.5px solid var(--line2); border-radius:12px; background:var(--surface); overflow:hidden; transition:border-color .12s, background .12s;}
.opt-main{flex:1; display:flex; gap:12px; align-items:flex-start; text-align:left; padding:12px 12px 12px 12px; background:none; border:0; cursor:pointer; min-height:52px; width:100%; line-height:1.65;}
.opt-main:disabled{cursor:default;}
.opt .n{flex:0 0 28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:.88em; border:1.5px solid var(--line2); color:var(--ink2); background:var(--surface2);}
.opt .tx{flex:1; padding-top:1px; word-break:break-word;}
.opt-x{flex:0 0 44px; border:0; border-left:1px solid var(--line); background:transparent; cursor:pointer; color:var(--mute); display:flex; align-items:center; justify-content:center;}
.opt-x svg{width:16px; height:16px; stroke:currentColor; stroke-width:2.2; fill:none; stroke-linecap:round;}
.opt-x:hover{color:var(--ng); background:var(--ng-bg);}
.opt:hover:not(.done){border-color:var(--accent);}
.opt.sel{border-color:var(--accent); background:var(--accent-soft);}
.opt.sel .n{background:var(--accent); border-color:var(--accent); color:var(--on-accent);}
.opt.struck .tx{text-decoration:line-through; color:var(--mute);}
.opt.struck .n{opacity:.45;}
.opt.struck .opt-x{color:var(--ng);}
.opt.correct{border-color:var(--ok); background:var(--ok-bg);}
.opt.correct .n{background:var(--ok); border-color:var(--ok); color:#fff;}
.opt.wrong{border-color:var(--ng); background:var(--ng-bg);}
.opt.wrong .n{background:var(--ng); border-color:var(--ng); color:#fff;}
.opt .badge{flex:0 0 auto; font-size:.74em; font-weight:800; padding:1px 8px; border-radius:99px; margin-left:6px; align-self:center;}
.opt.correct .badge{background:var(--ok); color:#fff;}
.opt.wrong .badge{background:var(--ng); color:#fff;}
.multi-hint{font-size:.82em; color:var(--warn); background:var(--warn-bg); border:1px solid var(--warn-line); border-radius:8px; padding:4px 10px; display:inline-block; margin:0 0 10px;}
.qtools{display:flex; flex-wrap:wrap; gap:6px; margin:14px 0 0; padding-top:12px; border-top:1px dashed var(--line);}
.tool{display:inline-flex; align-items:center; gap:6px; min-height:36px; padding:5px 11px; border-radius:9px; border:1px solid var(--line); background:var(--surface); cursor:pointer; font-size:.82em; color:var(--ink2);}
.tool svg{width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;}
.tool:hover{border-color:var(--line2); color:var(--ink);}
.tool[aria-pressed="true"]{border-color:var(--flag); color:var(--flag); background:var(--warn-bg);}
.tool[aria-pressed="true"] svg{fill:currentColor;}
.tool.review[aria-pressed="true"]{border-color:var(--accent); color:var(--accent-ink); background:var(--accent-soft);}
.result-box{margin:16px 0 0; border-radius:12px; padding:14px 16px; border:1.5px solid;}
.result-box:focus{outline:none;}
.result-box.ok{border-color:var(--ok-line); background:var(--ok-bg);}
.result-box.ng{border-color:var(--ng-line); background:var(--ng-bg);}
.result-box .verdict{display:flex; align-items:center; gap:10px; font-weight:800; font-size:1.15em;}
.result-box.ok .verdict{color:var(--ok);} .result-box.ng .verdict{color:var(--ng);}
.verdict .mk{width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:1.05em; color:#fff;}
.result-box.ok .mk{background:var(--ok);} .result-box.ng .mk{background:var(--ng);}
.verdict .ans{font-size:.8em; color:var(--ink); font-weight:700; margin-left:auto;}
.conf{display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin:10px 0 0; font-size:.84em;}
.conf .lab{color:var(--ink2);}
.conf button{min-height:34px; padding:3px 12px; border-radius:99px; border:1px solid var(--line2); background:var(--surface); cursor:pointer; font-size:.95em;}
.conf button[aria-pressed="true"]{background:var(--ink); color:var(--surface); border-color:var(--ink); font-weight:700;}
.exp{margin:14px 0 0;}
.exp h4{font-size:.86em; margin:0 0 6px; color:var(--ink2); letter-spacing:.06em;}
.exp .point{background:var(--surface2); border:1px solid var(--line); border-radius:10px; padding:12px 14px; white-space:pre-wrap; font-size:.95em;}
.oe{list-style:none; margin:10px 0 0; padding:0; display:grid; gap:6px;}
.oe li{display:flex; gap:10px; padding:10px 12px; border-radius:10px; background:var(--surface2); border:1px solid var(--line); font-size:.92em;}
.oe .tf{flex:0 0 26px; height:26px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:.85em; color:#fff;}
.oe .tf.t{background:var(--ok);} .oe .tf.f{background:var(--ng);} .oe .tf.n{background:var(--line2); color:var(--ink2);}
.oe .b{flex:1; min-width:0;}
.oe .b .o{font-weight:700; display:block; margin-bottom:2px;}
.oe li.is-ans{border-color:var(--ok-line);}
.qhist{margin:12px 0 0; font-size:.8em; color:var(--mute); display:flex; gap:12px; flex-wrap:wrap;}
.dots{display:inline-flex; gap:3px; align-items:center;}
.dots i{width:9px; height:9px; border-radius:50%; display:inline-block;}
.dots i.o{background:var(--ok);} .dots i.x{background:var(--ng);}
.note-box{margin:12px 0 0;}
.note-box textarea{min-height:70px;}
.pnav{display:flex; gap:10px; margin:16px 0 0; align-items:center;}
.pnav .btn{flex:1;}
.pnav .btn.prev{flex:0 0 auto;}
.kbd-hint{font-size:.76em; color:var(--mute); text-align:center; margin:10px 0 0;}
kbd{font-family:inherit; font-size:.9em; border:1px solid var(--line2); border-bottom-width:2px; border-radius:5px; padding:0 5px; background:var(--surface);}

/* palette */
.palette{display:grid; grid-template-columns:repeat(auto-fill,minmax(42px,1fr)); gap:6px;}
.palette button{height:42px; border-radius:9px; border:1.5px solid var(--line2); background:var(--surface); cursor:pointer; font-weight:700; font-size:.85em; position:relative; font-variant-numeric:tabular-nums;}
.palette button.ans{background:var(--accent-soft); border-color:var(--accent);}
.palette button.o{background:var(--ok-bg); border-color:var(--ok); color:var(--ok);}
.palette button.x{background:var(--ng-bg); border-color:var(--ng); color:var(--ng);}
.palette button.cur{outline:3px solid var(--ink); outline-offset:1px;}
.palette button.rev::after{content:""; position:absolute; top:3px; right:3px; width:8px; height:8px; border-radius:50%; background:var(--flag);}
.palette-legend{display:flex; gap:12px; flex-wrap:wrap; font-size:.76em; color:var(--mute); margin:0 0 10px;}
.palette-legend span::before{content:""; display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:4px; vertical-align:-1px; border:1.5px solid var(--line2);}
.palette-legend .l-ans::before{background:var(--accent-soft); border-color:var(--accent);}
.palette-legend .l-rev::before{background:var(--flag); border-color:var(--flag); border-radius:50%;}
.palette-legend .l-o::before{background:var(--ok-bg); border-color:var(--ok);}
.palette-legend .l-x::before{background:var(--ng-bg); border-color:var(--ng);}

/* ---------- OX ---------- */
.oxcard{text-align:left;}
.oxcard .stmt{font-size:1.12em; line-height:1.8; margin:6px 0 18px; white-space:pre-wrap;}
.oxbtns{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
.oxbtn{min-height:84px; border-radius:16px; border:2px solid var(--line2); background:var(--surface); cursor:pointer; display:flex; align-items:center; justify-content:center; gap:10px; font-size:1.1em; font-weight:800;}
.oxbtn .sym{font-size:2em; line-height:1;}
.oxbtn.o{color:var(--ok);} .oxbtn.x{color:var(--ng);}
.oxbtn.o:hover{border-color:var(--ok); background:var(--ok-bg);}
.oxbtn.x:hover{border-color:var(--ng); background:var(--ng-bg);}
.oxbtn.picked{outline:3px solid var(--ink); outline-offset:2px;}
.oxbtn:disabled{cursor:default; opacity:.55;}
.oxbtn.truth{opacity:1; border-width:3px;}
.oxbtn.o.truth{border-color:var(--ok); background:var(--ok-bg);}
.oxbtn.x.truth{border-color:var(--ng); background:var(--ng-bg);}

/* ---------- result ---------- */
.score-hero{display:grid; grid-template-columns:auto 1fr; gap:22px; align-items:center;}
@media (max-width:560px){ .score-hero{grid-template-columns:1fr; text-align:center;} .score-hero .ring{margin:0 auto;} }
.ring{width:150px; height:150px; position:relative;}
.ring svg{width:100%; height:100%; transform:rotate(-90deg);}
.ring circle{fill:none; stroke-width:12;}
.ring .bgc{stroke:var(--bg2);}
.ring .fgc{stroke:var(--accent); stroke-linecap:round; transition:stroke-dashoffset .8s ease;}
.ring .lbl{position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;}
.ring .lbl b{font-size:2em; line-height:1.1;}
.ring .lbl span{font-size:.78em; color:var(--mute);}
.judge{display:inline-flex; align-items:center; gap:8px; padding:6px 14px; border-radius:99px; font-weight:800; margin:4px 0 8px;}
.judge.pass{background:var(--ok-bg); color:var(--ok); border:1px solid var(--ok-line);}
.judge.border{background:var(--warn-bg); color:var(--warn); border:1px solid var(--warn-line);}
.judge.fail{background:var(--ng-bg); color:var(--ng); border:1px solid var(--ng-line);}
.groups{display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px;}
@media (max-width:640px){ .groups{grid-template-columns:repeat(3,minmax(0,1fr));} }
.gbox{border:1px solid var(--line); border-radius:10px; padding:8px 10px; background:var(--surface2); text-align:center;}
.gbox .k{font-size:.74em; color:var(--mute);}
.gbox .v{font-weight:800; font-size:1.1em;}
.gbox.zero{border-color:var(--ng); background:var(--ng-bg); color:var(--ng);}
.rlist{list-style:none; margin:0; padding:0;}
.rlist li{display:flex; gap:10px; align-items:flex-start; padding:10px 4px; border-bottom:1px solid var(--line); font-size:.9em;}
.rlist .mk{flex:0 0 24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:.8em; font-weight:800; color:#fff; margin-top:2px;}
.rlist .mk.o{background:var(--ok);} .rlist .mk.x{background:var(--ng);} .rlist .mk.n{background:var(--mute);}
.rlist .b{flex:1; min-width:0;}
.rlist .b .t{display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;}
.rlist button.b{background:none; border:0; padding:0; text-align:left; cursor:pointer;}
.rlist button.b:hover .t{color:var(--accent-ink); text-decoration:underline;}

/* ---------- list/search ---------- */
.searchbar{display:flex; gap:8px; margin:0 0 12px;}
.searchbar .inp{flex:1;}
.filters{display:flex; flex-wrap:wrap; gap:8px; margin:0 0 12px;}
.filters select{width:auto; min-width:150px; flex:1 1 150px;}
.qlist{list-style:none; margin:0; padding:0; display:grid; gap:8px;}
.qitem{display:flex; gap:12px; align-items:flex-start; padding:12px 14px; border:1px solid var(--line); border-radius:12px; background:var(--surface); cursor:pointer; text-align:left; width:100%;}
.qitem:hover{border-color:var(--accent);}
.qitem .st{flex:0 0 26px; height:26px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:.78em; font-weight:800; border:1.5px solid var(--line2); color:var(--mute); margin-top:2px;}
.qitem .st.o{background:var(--ok); border-color:var(--ok); color:#fff;}
.qitem .st.x{background:var(--ng); border-color:var(--ng); color:#fff;}
.qitem .b{flex:1; min-width:0;}
.qitem .t{font-size:.92em; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;}
.qitem .m{display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; align-items:center;}
.qitem .snip{font-size:.8em; color:var(--mute); margin-top:4px;}
.empty{text-align:center; color:var(--mute); padding:36px 12px; border:1px dashed var(--line2); border-radius:var(--radius);}

/* ---------- stats ---------- */
.bars{display:grid; gap:7px;}
.brow{display:grid; grid-template-columns:minmax(120px,190px) 1fr 74px; gap:10px; align-items:center; font-size:.84em;}
@media (max-width:560px){ .brow{grid-template-columns:96px 1fr 62px; font-size:.78em;} }
.brow .lab{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.brow .val{text-align:right; font-variant-numeric:tabular-nums; font-weight:700;}
.brow .meter{height:14px;}
.daychart{display:flex; align-items:flex-end; gap:3px; height:120px; padding:4px 0 0; border-bottom:1px solid var(--line);}
.daychart .d{flex:1; display:flex; flex-direction:column; justify-content:flex-end; height:100%; position:relative;}
.daychart .d i{display:block; background:var(--accent); border-radius:3px 3px 0 0; min-height:0;}
.daychart .d i.c{background:var(--ok);}
.daychart .d:hover::after{content:attr(data-tip); position:absolute; bottom:100%; left:50%; transform:translateX(-50%); background:var(--ink); color:var(--surface); font-size:11px; padding:3px 7px; border-radius:6px; white-space:nowrap; z-index:2;}
.dayaxis{display:flex; justify-content:space-between; font-size:.72em; color:var(--mute); margin-top:4px;}
.heat{display:grid; grid-auto-flow:column; grid-template-rows:repeat(7,12px); gap:3px; overflow-x:auto; padding-bottom:4px;}
.heat i{width:12px; height:12px; border-radius:3px; background:var(--bg2); display:block;}
.heat i.l1{background:color-mix(in srgb, var(--ok) 30%, var(--bg2));}
.heat i.l2{background:color-mix(in srgb, var(--ok) 55%, var(--bg2));}
.heat i.l3{background:color-mix(in srgb, var(--ok) 80%, var(--bg2));}
.heat i.l4{background:var(--ok);}
.legend{display:flex; gap:14px; flex-wrap:wrap; font-size:.76em; color:var(--mute); margin-top:6px;}
.legend span::before{content:""; display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:5px; vertical-align:-1px; background:var(--k);}
table.tbl{width:100%; border-collapse:collapse; font-size:.86em;}
table.tbl th, table.tbl td{padding:8px 6px; border-bottom:1px solid var(--line); text-align:left;}
table.tbl th{color:var(--mute); font-size:.85em;}
table.tbl td.r, table.tbl th.r{text-align:right;}

/* ---------- misc ---------- */
.notice{background:var(--surface2); border:1px solid var(--line); border-left:4px solid var(--flag); border-radius:10px; padding:12px 14px; font-size:.86em; color:var(--ink2);}
.notice + .notice{margin-top:10px;}
.notice strong{color:var(--ink);}
.prose{font-size:.94em;}
.prose h3{font-size:1.02em; margin:22px 0 8px;}
.prose ul, .prose ol{padding-left:1.4em;}
.prose li{margin:3px 0;}
.prose code{font-size:.9em; background:var(--bg2); padding:1px 5px; border-radius:5px;}
pre.code{background:var(--bg2); border:1px solid var(--line); border-radius:10px; padding:12px; font-size:.8em; overflow:auto; line-height:1.5; white-space:pre;}
.morelist{list-style:none; padding:0; margin:0; display:grid; gap:8px;}
.morelist a{display:flex; align-items:center; gap:12px; padding:14px 16px; background:var(--surface); border:1px solid var(--line); border-radius:12px; text-decoration:none; color:var(--ink); font-weight:700;}
.morelist a span.d{display:block; font-weight:400; font-size:.8em; color:var(--mute);}
.morelist .ic{width:36px; height:36px; flex:0 0 36px; border-radius:10px; display:flex; align-items:center; justify-content:center; background:var(--accent-soft); color:var(--accent-ink);}
.morelist .ic svg{width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;}
.footer{margin:40px 0 0; padding:18px 0 0; border-top:1px solid var(--line); font-size:.78em; color:var(--mute); text-align:center; line-height:1.8;}
.footer a{color:var(--mute);}

/* modal & toast */
.modal{position:fixed; inset:0; z-index:60; display:flex; align-items:center; justify-content:center; padding:16px;}
.modal-back{position:absolute; inset:0; background:rgba(10,12,16,.5);}
.modal-card{position:relative; background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:20px; width:100%; max-width:520px; max-height:86vh; overflow:auto; box-shadow:0 20px 60px rgba(0,0,0,.3);}
.modal-card h2{font-size:1.1em; margin:0 0 10px;}
.modal-actions{display:flex; gap:10px; justify-content:flex-end; margin-top:18px; flex-wrap:wrap;}
.toast{position:fixed; left:50%; bottom:calc(84px + env(safe-area-inset-bottom)); transform:translateX(-50%); background:var(--ink); color:var(--surface); padding:10px 18px; border-radius:99px; font-size:.88em; z-index:70; box-shadow:0 6px 20px rgba(0,0,0,.25); max-width:calc(100% - 32px); text-align:center;}
@media (min-width:900px){ .toast{bottom:28px;} }

/* print */
.print-area{display:none;}
@media print{
  body{background:#fff; color:#000; padding:0; font-size:11pt;}
  .appbar,.tabbar,#main,.toast,.modal,.skip{display:none !important;}
  .print-area{display:block !important;}
  .print-area h1{font-size:14pt; margin:0 0 4pt;}
  .print-area .pq{break-inside:avoid; margin:0 0 12pt; padding:0 0 8pt; border-bottom:1px solid #ccc;}
  .print-area .pq .h{font-weight:bold;}
  .print-area ol.po{margin:4pt 0 0; padding-left:1.6em;}
  .print-area .pcase{border-left:3px solid #999; padding-left:8pt; margin:4pt 0;}
  .print-area .pans{break-before:page;}
  .print-area .pans .pa{break-inside:avoid; margin:0 0 8pt; font-size:10pt;}
}
@media (prefers-reduced-motion: reduce){ *{transition:none !important; animation:none !important;} }
