:root {
  --bg: #f3f6f7;
  --panel: #ffffff;
  --panel-2: #eef2f4;
  --line: #dde4e8;
  --text: #17202a;
  --muted: #64707d;
  --accent: #0d9488;
  --accent-2: #4f46e5;
  --grad: linear-gradient(135deg, #0d9488, #2563eb 55%, #4f46e5);
  --ok: #059669;
  --ok-bg: #e7f8f1;
  --ng: #dc2626;
  --ng-bg: #fdecec;
  --warn: #b45309;
  --warn-bg: #fef3e2;
  --mask: #cfd8de;
  --shadow: 0 1px 2px rgba(15, 40, 60, .06), 0 6px 20px rgba(15, 40, 60, .06);
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --panel: #182026;
    --panel-2: #212b33;
    --line: #2c3842;
    --text: #e8eef2;
    --muted: #93a1ad;
    --accent: #2dd4bf;
    --accent-2: #818cf8;
    --ok: #34d399;
    --ok-bg: #0f2e25;
    --ng: #f87171;
    --ng-bg: #3a1717;
    --warn: #fbbf24;
    --warn-bg: #3a2c0f;
    --mask: #33414c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px; line-height: 1.65; -webkit-tap-highlight-color: transparent;
}
button, a { touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
b { font-weight: 700; }

/* ヘッダー */
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 8px) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .02em; }
.brand img { border-radius: 7px; }
.brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 18px; }
.crumb { flex: 1; min-width: 0; display: flex; justify-content: flex-end; color: var(--muted); font-size: 14px; }
.crumb b { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main { max-width: 860px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }

/* ホーム */
h2 { font-size: 15px; color: var(--muted); font-weight: 700; margin: 24px 4px 10px; }
h2:first-child { margin-top: 4px; }
.years { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card { display: block; background: var(--panel); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.card:active { transform: scale(.99); }
.card .t { display: flex; justify-content: space-between; align-items: baseline; }
.card .t b { font-size: 17px; }
.card .meta { display: flex; gap: 12px; color: var(--muted); font-size: 13px; margin-top: 8px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.bar3 { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--panel-2); margin-top: 10px; }
.bar3 i { display: block; }
.bar3 .o { background: var(--ok); }
.bar3 .x { background: var(--ng); }
.katas { display: flex; flex-wrap: wrap; gap: 8px; }
.kchip {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px;
  background: var(--panel); box-shadow: var(--shadow); font-size: 14px; font-weight: 600;
}
.kchip small { color: #fff; background: var(--accent-2); border-radius: 999px; padding: 0 7px; font-size: 12px; font-variant-numeric: tabular-nums; }
.kchip.one { opacity: .75; font-weight: 400; }
.kchip.one small { background: var(--muted); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 26px; }
.btn-s { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 14px; font-size: 14px; }
.btn-s.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.foot { margin-top: 24px; color: var(--muted); font-size: 12px; text-align: center; }

/* 一覧の上の操作 */
.ctl {
  position: sticky; top: calc(env(safe-area-inset-top) + 51px); z-index: 5;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: -6px -4px 12px; padding: 8px 4px; background: var(--bg);
}
.ctl .ttl { font-weight: 800; font-size: 17px; margin-right: auto; min-width: 0; }
.ctl .ttl small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

/* 問の見出し */
.qh { margin: 22px 2px 10px; font-weight: 800; font-size: 16px; color: var(--accent); }
.qh:first-of-type { margin-top: 4px; }
.qh small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }

/* 設問ブロック */
.blk { background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; border-left: 4px solid transparent; }
.blk.o { border-left-color: var(--ok); }
.blk.x { border-left-color: var(--ng); }
.blk .hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.blk .sub { font-weight: 800; }
.blk .src { color: var(--muted); font-size: 12px; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.tag.kohyo { background: var(--warn-bg); color: var(--warn); }
.tag.cls { background: var(--panel-2); color: var(--muted); }
.lbl { color: var(--muted); font-size: 13px; font-weight: 700; margin-right: 4px; }
.gaiyo { margin: 4px 0 10px; }
.ans { font-size: 17px; font-weight: 700; color: var(--accent-2); }
.basis { color: var(--text); font-size: 14.5px; }
.point { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; }
.point div + div { margin-top: 4px; }
.meta2 { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; }
.meta2 span b { color: var(--muted); font-weight: 700; margin-right: 4px; }
.row { margin-top: 10px; }

/* マスク */
.mask { position: relative; margin-top: 8px; }
.mask .cover {
  display: none; width: 100%; border: 0; border-radius: 12px; padding: 18px 12px;
  background: repeating-linear-gradient(-45deg, var(--mask) 0 10px, color-mix(in srgb, var(--mask) 70%, transparent) 10px 20px);
  font-weight: 800; color: var(--text); font-size: 16px;
}
.mask .cover span { background: var(--panel); padding: 8px 16px; border-radius: 999px; box-shadow: var(--shadow); }
.mask.hidden .cover { display: block; }
.mask.hidden .body { display: none; }
.foot2 { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.foot2 .grow { flex: 1; }
.self { min-width: 92px; height: 40px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel); font-weight: 700; font-size: 14px; }
.self.o.sel { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.self.x.sel { background: var(--ng-bg); border-color: var(--ng); color: var(--ng); }
.hide { border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; padding: 6px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

@media (max-width: 520px) {
  .self { min-width: 76px; }
  .ans { font-size: 16px; }
}
