:root {
  --bg: #f5f7fb; --surface: #ffffff; --ink: #1b2240; --muted: #5d6488; --line: #dfe4f0;
  --navy: #1e2761; --navy-2: #2f3d8f; --accent: #ffc533; --pale: #eef2fc;
  --ok: #1f8a4c; --ok-bg: #e6f5ec; --ng: #c62f2f; --ng-bg: #fdecec; --warn: #a86400;
  --radius: 12px; --shadow: 0 1px 2px rgba(20, 30, 70, .06), 0 4px 16px rgba(20, 30, 70, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11152b; --surface: #1a1f3b; --ink: #e8ebf7; --muted: #a3a9c9; --line: #2c335c;
    --navy: #9fb0ff; --navy-2: #c3cdff; --pale: #232a52; --ok: #5fd08f; --ok-bg: #173327;
    --ng: #ff8a8a; --ng-bg: #3a1d24; --warn: #ffc56a; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); line-height: 1.75;
  font-family: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; font-size: 16px;
}
a { color: var(--navy-2); }
button { font: inherit; color: inherit; }

/* ヘッダー */
.top {
  position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; }
.mark { background: #1e2761; color: #ffc533; border-radius: 8px; padding: 2px 7px; font-size: 13px; letter-spacing: .02em; }
.brand-text { font-size: 15px; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; font-weight: 500; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink); padding: 6px 12px; border-radius: 8px; font-size: 15px; }
.nav a.on { background: var(--pale); color: var(--navy-2); font-weight: 700; }

main { max-width: 860px; margin: 0 auto; padding: 20px 16px 48px; outline: none; }
h1 { font-size: 24px; margin: 8px 0 12px; line-height: 1.4; word-break: auto-phrase; }
h2 { font-size: 19px; margin: 28px 0 10px; }
h3 { font-size: 16px; margin: 18px 0 6px; }
.lead { color: var(--muted); margin-top: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 10px; padding: 10px 16px; cursor: pointer; text-decoration: none; color: var(--ink); min-height: 44px;
}
.btn.primary { background: #1e2761; border-color: #1e2761; color: #fff; font-weight: 700; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

/* ホーム */
.hero { background: #1e2761; color: #fff; border-radius: var(--radius); padding: 22px; }
.hero h1 { color: #fff; margin-top: 0; }
.hero .count { font-size: 15px; white-space: nowrap; }
.hero .count b { color: #ffc533; font-size: 34px; margin: 0 4px; }
.hero .btn { border-color: transparent; }
.hero .btn.primary { background: #ffc533; color: #1e2761; }
.subj { display: block; text-decoration: none; color: var(--ink); }
.subj .name { font-weight: 700; }
.bar { height: 8px; background: var(--pale); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--navy-2); border-radius: 99px; }
.stat { font-size: 26px; font-weight: 700; }

/* 問題 */
.qhead { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 1px 10px; background: var(--surface); }
.chip.s { background: var(--pale); border-color: transparent; color: var(--navy-2); font-weight: 700; }
.stem { white-space: pre-wrap; font-size: 17px; margin: 0 0 14px; }
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%; border: 1px solid var(--line);
  background: var(--surface); border-radius: 10px; padding: 12px 14px; cursor: pointer; min-height: 48px;
}
.choice:hover:not(:disabled) { border-color: var(--navy-2); }
.choice .no { flex: none; font-weight: 700; color: var(--navy-2); min-width: 1.4em; }
.choice.sel { border-color: var(--navy-2); box-shadow: inset 0 0 0 1px var(--navy-2); }
.choice.ok { background: var(--ok-bg); border-color: var(--ok); }
.choice.ng { background: var(--ng-bg); border-color: var(--ng); }
.choice:disabled { cursor: default; }
.note { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }
.verdict { font-weight: 700; font-size: 18px; margin: 16px 0 6px; }
.verdict.ok { color: var(--ok); }
.verdict.ng { color: var(--ng); }
.expl { background: var(--pale); border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.src { font-size: 14px; margin: 10px 0 0; padding-left: 18px; }
.qfoot { margin-top: 16px; }
.filters { display: grid; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 14px; cursor: pointer; min-height: 38px; }
.seg button.on { background: #1e2761; border-color: #1e2761; color: #fff; }

/* 模試 */
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.navgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.navgrid button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 0; cursor: pointer; font-size: 14px; position: relative; }
.navgrid button.done { background: var(--pale); }
.navgrid button.cur { outline: 2px solid var(--navy-2); }
.navgrid button.flag::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; background: var(--warn); border-radius: 50%; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.note-box { border-left: 4px solid var(--accent); background: var(--surface); padding: 10px 14px; border-radius: 6px; }
.ad-slot { margin-top: 28px; border: 1px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

.foot { max-width: 860px; margin: 0 auto; padding: 18px 16px 36px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.foot .links { display: flex; gap: 14px; flex-wrap: wrap; }

@media (max-width: 560px) {
  .brand-text { font-size: 14px; }
  .nav { width: 100%; justify-content: space-between; }
  .nav a { padding: 6px 8px; }
  h1 { font-size: 21px; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .card { padding: 14px; }
  .stat { font-size: 22px; }
}

/* 検定アプリ内のサブメニュー */
.subnav { display: flex; gap: 4px; overflow-x: auto; padding: 6px 16px; background: var(--pale); border-bottom: 1px solid var(--line); }
.subnav a { white-space: nowrap; text-decoration: none; color: var(--ink); padding: 4px 10px; border-radius: 8px; font-size: 14px; }
.subnav a.on { background: var(--surface); color: var(--navy-2); font-weight: 700; }

/* 記事 */
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.crumbs a { color: var(--muted); }
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.article { font-size: 17px; }
.article h2 { border-left: 4px solid var(--accent); padding-left: 10px; }
.article p { margin: 0 0 1em; }
.article ul, .article ol { padding-left: 1.4em; }
.article table { margin: 8px 0 18px; }
.article blockquote { margin: 0 0 1em; padding: 10px 14px; background: var(--pale); border-radius: 8px; }
.sources { font-size: 14px; }
.sources li { margin-bottom: 4px; }
.post-list { display: grid; gap: 10px; padding: 0; list-style: none; margin: 0; }
.post-list a { display: block; text-decoration: none; color: var(--ink); }
.post-list .t { font-weight: 700; display: block; }
.post-list .d { font-size: 13px; color: var(--muted); }
.post-list .s { font-size: 14px; color: var(--muted); display: block; margin-top: 2px; }
.pillars { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.pillars a { text-decoration: none; color: var(--ink); }
.pillars .name { font-weight: 700; display: block; margin-bottom: 4px; }
.empty { color: var(--muted); font-size: 14px; }

/* サイト名の副題と、検定対策の非公式表示 */
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 500; }
.unofficial { margin: 0; padding: 6px 16px; font-size: 12px; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--line); text-align: center; }
@media (max-width: 560px) { .brand-sub { display: none; } }
