:root {
  /* Construction Site (Denkou2 default) — industrial amber + helmet grey */
  --bg: oklch(98% 0.012 80);
  --bg-soft: oklch(96% 0.025 80);
  --card: #ffffff;
  --ink: oklch(20% 0.02 80);
  --ink-soft: oklch(42% 0.02 80);
  --ink-mute: oklch(62% 0.015 80);
  --line: oklch(92% 0.02 80);
  --line-soft: oklch(95% 0.012 80);
  --accent: oklch(72% 0.16 75);             /* industrial amber */
  --accent-ink: oklch(18% 0.02 80);          /* dark text on amber (high-contrast like caution sign) */
  --accent-soft: oklch(95% 0.08 80);
  --accent-deep: oklch(50% 0.14 60);         /* deep brown-amber for headings */
  --warn: oklch(68% 0.16 55);
  --wrong: oklch(62% 0.2 25);
  --wrong-soft: oklch(95% 0.05 25);
  --correct: oklch(62% 0.15 150);
  --correct-soft: oklch(94% 0.08 150);
  --shadow-sm: 0 1px 2px oklch(40% 0.05 60 / 0.06), 0 2px 8px oklch(40% 0.05 60 / 0.05);
  --shadow-md: 0 4px 12px oklch(40% 0.05 60 / 0.08), 0 2px 4px oklch(40% 0.05 60 / 0.05);
  --shadow-lg: 0 12px 40px oklch(40% 0.05 60 / 0.12), 0 4px 12px oklch(40% 0.05 60 / 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  /* 注意標識風の黒×アンバー縞模様 (見出し・タグなどの装飾用) */
  --caution-stripe: repeating-linear-gradient(135deg,
    oklch(18% 0.02 80) 0 10px,
    oklch(72% 0.16 75) 10px 20px);
}
[data-theme="mint"] {
  --bg: oklch(98% 0.015 175);
  --bg-soft: oklch(96% 0.025 175);
  --accent: oklch(62% 0.14 175);
  --accent-soft: oklch(92% 0.08 175);
  --accent-deep: oklch(42% 0.13 175);
  --correct: oklch(62% 0.14 175);
  --correct-soft: oklch(94% 0.08 175);
  --ink: oklch(22% 0.03 175);
  --ink-soft: oklch(42% 0.02 175);
  --ink-mute: oklch(62% 0.01 175);
  --line: oklch(92% 0.015 175);
  --line-soft: oklch(95% 0.01 175);
}
[data-theme="forest"] {
  --bg: oklch(97% 0.015 140);
  --bg-soft: oklch(94% 0.02 140);
  --accent: oklch(45% 0.13 140);
  --accent-soft: oklch(88% 0.06 140);
  --accent-deep: oklch(32% 0.12 140);
  --correct: oklch(45% 0.13 140);
  --correct-soft: oklch(92% 0.06 140);
  --ink: oklch(20% 0.03 140);
  --ink-soft: oklch(40% 0.02 140);
  --ink-mute: oklch(58% 0.015 140);
  --line: oklch(90% 0.02 140);
  --line-soft: oklch(94% 0.015 140);
}
[data-theme="indigo"] {
  --bg: oklch(98% 0.01 265);
  --bg-soft: oklch(96% 0.02 265);
  --accent: oklch(55% 0.16 265);
  --accent-soft: oklch(93% 0.06 265);
  --accent-deep: oklch(38% 0.15 265);
  --correct: oklch(62% 0.15 150);
  --correct-soft: oklch(94% 0.08 150);
  --ink: oklch(22% 0.03 265);
  --ink-soft: oklch(42% 0.02 265);
  --ink-mute: oklch(62% 0.01 265);
  --line: oklch(92% 0.015 265);
  --line-soft: oklch(95% 0.01 265);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Noto Sans JP", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt";
}
button { font-family: inherit; cursor: pointer; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* --- Top bar --- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1160px; margin: 0 auto;
  padding: 16px 24px;
  display: flex; align-items: center; gap: 16px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18px; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
}
.logo-mark {
  width: 36px; height: 32px;
  background: var(--accent);
  border-radius: 8px 8px 4px 4px;       /* ヘルメット型: 上が丸く、下が直線寄り */
  border: 2px solid oklch(18% 0.02 80);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-ink);
  font-weight: 900; font-size: 14px;
  box-shadow: 2px 2px 0 oklch(18% 0.02 80);
  font-family: "JetBrains Mono", monospace;
  letter-spacing: -0.05em;
}
.logo-sub { color: var(--ink-mute); font-weight: 500; font-size: 13px; margin-left: 4px; }
.topbar-spacer { flex: 1; }
.streak-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft);
}
.streak-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 15%, transparent);
}

/* --- Back link (exam pages → index) --- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--ink-soft); text-decoration: none;
  transition: all 140ms;
  white-space: nowrap;
}
.back-link:hover { color: var(--ink); border-color: var(--ink-mute); background: var(--bg-soft); }

/* --- Layout --- */
.container { max-width: 1160px; margin: 0 auto; padding: 40px 24px 80px; }

/* --- Menu hero --- */
.hero { margin-bottom: 36px; }
.hero h1 {
  font-size: 40px; font-weight: 800; letter-spacing: -0.02em;
  margin: 0 0 10px; line-height: 1.15;
}
.hero h1 .accent { color: var(--accent-deep); }
.hero p { color: var(--ink-soft); font-size: 16px; margin: 0; max-width: 720px; line-height: 1.8; }
.hero p strong { color: var(--ink); font-weight: 700; }

/* --- Features (USP) --- */
.features { margin: 8px 0 44px; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.feature-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 200ms, box-shadow 200ms, border-color 200ms;
}
.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-soft);
  box-shadow: 0 8px 24px -12px oklch(60% 0.05 150 / 0.25);
}
.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.feature-icon svg {
  width: 22px;
  height: 22px;
}
.feature-card h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 4px 0 0;
  line-height: 1.4;
  color: var(--ink);
}
.feature-card p {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0;
}
@media (max-width: 600px) {
  .features-grid { grid-template-columns: 1fr; gap: 12px; }
  .feature-card { padding: 18px 18px 20px; }
}

/* --- Section label --- */
.section-label {
  display: flex; align-items: center; gap: 12px;
  margin: 36px 0 18px;
}
.section-label .pip {
  width: 28px; height: 8px; border-radius: 2px;
  background: var(--caution-stripe);
  border: 1px solid oklch(18% 0.02 80);
}
.section-label h2 {
  font-size: 14px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0;
}
.section-label .count {
  color: var(--ink-mute); font-size: 13px; font-weight: 500;
}

/* --- Exam cards grid --- */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
/* <a> wrapper for index page cards */
.exam-card-link { text-decoration: none; color: inherit; display: block; }
.exam-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all 200ms ease;
  text-align: left;
  position: relative;
  overflow: hidden;
  width: 100%;
}
.exam-card::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 50%);
  opacity: 0; transition: opacity 200ms;
  pointer-events: none;
}
.exam-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in oklab, var(--accent) 30%, var(--line)); }
.exam-card:hover::before { opacity: 0.4; }
.exam-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow-md);
}
.exam-card.active::before { opacity: 0; }
.exam-head {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 14px;
}
.exam-badge {
  width: 52px; height: 52px;
  border-radius: 8px;
  background: var(--accent);
  color: oklch(18% 0.02 80);
  border: 2px solid oklch(18% 0.02 80);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  position: relative; z-index: 1;
  font-family: "BIZ UDPGothic", "Noto Sans JP", sans-serif;
  box-shadow: 2px 2px 0 oklch(18% 0.02 80 / 0.8);
}
.exam-card.active .exam-badge {
  background: var(--accent); color: var(--accent-ink);
}
.exam-card-link:hover .exam-badge {
  background: var(--accent); color: var(--accent-ink);
}
.exam-title { flex: 1; position: relative; z-index: 1; }
.exam-title h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.exam-level {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.exam-desc {
  color: var(--ink-soft); font-size: 13px; line-height: 1.6;
  margin: 0 0 14px; position: relative; z-index: 1;
  text-wrap: pretty;
}
.exam-stats {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--ink-mute);
  position: relative; z-index: 1;
}
.exam-stats .stat { display: flex; align-items: center; gap: 5px; }
.exam-stats svg { width: 14px; height: 14px; opacity: 0.7; }

/* --- Category panel --- */
.category-panel {
  margin-top: 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: slideDown 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
.category-panel.no-anim { animation: none; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.category-panel-head {
  padding: 24px 28px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--card) 100%);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
}
.category-panel-head .exam-badge { width: 44px; height: 44px; font-size: 13px; }
.category-panel-head h3 {
  margin: 0 0 2px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
}
.category-panel-head .sub { color: var(--ink-soft); font-size: 13px; }
.category-panel-body { padding: 20px 28px 28px; }
.category-panel-body h4 {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-mute);
  margin: 0 0 14px;
}
.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
/* 基本情報技術者: 1行に最大4つ表示（A/Bが並ぶように） */
.year-grid-4col {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 720px) {
  .year-grid-4col { grid-template-columns: repeat(2, 1fr); }
}
.year-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);   /* 配電盤のラベル風 左端カラーバー */
  border-radius: 4px var(--radius-sm) var(--radius-sm) 4px;
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  transition: all 160ms ease;
  display: flex; align-items: center; gap: 14px;
}
.year-card:hover {
  background: color-mix(in oklab, var(--accent) 6%, var(--card));
  border-color: var(--accent);
  border-left-color: oklch(18% 0.02 80);  /* hover時は左端が黒に */
  transform: translateX(2px);
}
.year-card .year-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 20px; font-weight: 600;
  color: var(--accent-deep);
  letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 6px;
}
/* 基本情報技術者: 「2025」の下に「科目A」を縦並び表示 */
.year-card-stacked .year-num {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.year-season {
  font-family: inherit;
  font-size: 11px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 4px; padding: 1px 5px;
  letter-spacing: 0;
}
.year-card .year-meta {
  flex: 1;
  font-size: 12px; color: var(--ink-mute);
}
.year-card .year-meta strong { display: block; color: var(--ink); font-weight: 600; font-size: 13px; margin-bottom: 1px; }
.year-card .chev { color: var(--ink-mute); transition: transform 160ms; }
.year-card:hover .chev { transform: translateX(3px); color: var(--accent-deep); }

/* --- 分野別カード --- */
.field-card { flex-direction: row; align-items: stretch; }
.field-card-title {
  font-family: "BIZ UDPGothic", "Noto Sans JP", sans-serif;
  font-size: 14px; font-weight: 700; color: var(--ink);
  margin-bottom: 4px;
}
.field-card-desc {
  font-size: 11px; color: var(--ink-mute);
  margin-bottom: 6px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.field-card-meta {
  display: flex; gap: 4px; flex-wrap: wrap;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px; color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.field-pct-good { color: oklch(55% 0.15 150); font-weight: 700; }
.field-pct-mid  { color: oklch(60% 0.15 70);  font-weight: 700; }
.field-pct-low  { color: oklch(60% 0.18 25);  font-weight: 700; }

/* --- 苦手復習パネル --- */
.review-panel {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 8px;
}
.review-summary { text-align: center; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.review-summary-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 36px; font-weight: 700; color: var(--accent-deep);
  letter-spacing: -0.03em;
}
.review-summary-num span { font-size: 14px; color: var(--ink-mute); font-weight: 500; margin-left: 4px; }
.review-summary-lab { font-size: 12px; color: var(--ink-mute); margin-top: 4px; }
.review-fields { display: flex; flex-direction: column; gap: 6px; }
.review-field-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; background: var(--card); border-radius: 6px;
  font-size: 12px;
}
.review-field-label { color: var(--ink); font-weight: 500; }
.review-field-count {
  font-family: "JetBrains Mono", monospace;
  color: var(--ink-mute); font-size: 11px; font-weight: 600;
}
.review-empty {
  background: var(--bg-soft);
  border: 1px dashed var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 24px; text-align: center;
  font-size: 13px; color: var(--ink);
}

/* --- Question count selector --- */
.count-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.count-btn {
  flex: 1;
  min-width: 56px;
  padding: 10px 4px;
  background: var(--bg-soft);
  border: 2px solid var(--line-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-mute);
  transition: all 160ms ease;
  text-align: center;
  line-height: 1.1;
}
.count-btn .count-unit {
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  display: block;
  margin-top: 2px;
  color: inherit;
}
.count-btn:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: var(--accent-soft);
}
.count-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}
.count-btn.active .count-unit {
  color: var(--accent-ink);
  opacity: 0.85;
}

/* --- Test screen --- */
.test-topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.test-topbar-inner {
  max-width: 820px; margin: 0 auto;
  padding: 16px 24px;
  display: flex; align-items: center; gap: 16px;
}
.test-topbar .back-btn {
  background: transparent; border: none; padding: 6px 10px 6px 6px;
  color: var(--ink-soft); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  border-radius: 8px;
}
.test-topbar .back-btn:hover { background: var(--bg-soft); color: var(--ink); }
.test-topbar h1 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.005em; }
.test-topbar .meta { color: var(--ink-mute); font-size: 13px; }

.progress-bar {
  height: 4px; width: 100%;
  background: var(--line-soft);
}
.progress-bar .fill {
  height: 100%; background: var(--accent);
  transition: width 320ms cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 0 2px 2px 0;
}

.test-container { max-width: 820px; margin: 0 auto; padding: 40px 24px 120px; }
.q-counter {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.q-counter .label {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px; color: var(--ink-mute); font-weight: 600;
  letter-spacing: 0.04em;
}
.q-counter .label .current { color: var(--accent-deep); font-size: 16px; }
.dots {
  display: grid;
  grid-template-columns: repeat(20, 18px);
  gap: 4px;
  max-width: 60%;
  justify-content: end;
}
.dot-cell {
  width: 18px; height: 6px; border-radius: 3px;
  background: var(--line);
  transition: all 180ms;
}
.dot-cell.answered { background: var(--accent); }
.dot-cell.current { background: var(--ink); transform: scaleY(1.6); }
/* スマホ：QUESTION ラベルとドットが衝突するため縦並びに切替え */
@media (max-width: 600px) {
  .q-counter {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .dots {
    max-width: 100%;
    justify-content: start;
    grid-template-columns: repeat(10, 18px);
  }
}

.question-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-sm);
  animation: fadeSlide 280ms ease;
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.question-box .q-tag {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; font-weight: 700;
  color: oklch(18% 0.02 80);
  background: var(--accent);
  padding: 4px 12px;
  border: 2px solid oklch(18% 0.02 80);
  border-radius: 4px;
  margin-bottom: 16px; letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 2px 2px 0 oklch(18% 0.02 80);
}
.question-box .q-head-row {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 12px; margin-bottom: 16px;
}
.question-box .q-head-row .q-tag { margin-bottom: 0; }
.question-box .q-origin {
  font-size: 11px; color: var(--ink-mute);
  font-family: "BIZ UDPGothic", "Noto Sans JP", sans-serif;
  letter-spacing: 0.01em;
}
.question-box .q-text {
  font-family: "Shippori Mincho", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 15px; line-height: 1.6; font-weight: 700;
  margin: 0 0 28px; letter-spacing: -0.005em;
  text-wrap: pretty;
}

/* --- 問題文内 枠線ボックス（:::〜:::） --- */
.q-figure {
  margin: 16px 0;
}
.q-figure-body {
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 14px 18px;
}
.q-figcaption {
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  margin-top: 8px;
  color: var(--ink);
}

/* --- 画像拡大表示（問31〜50 用、問題文側のみ） --- */
.zoomable-images .q-text img.q-image {
  cursor: zoom-in;
  transition: transform 120ms;
}
.zoomable-images .q-text img.q-image:hover {
  transform: scale(1.02);
}
.image-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
  animation: zoomFade 180ms ease;
}
/* フィット表示: ビューポートに収まるサイズ。画像クリックで等倍に切替 */
.image-zoom-overlay.fit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.image-zoom-overlay.fit img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
}
/* 等倍表示: 画像本来のサイズでスクロール可能。画像クリックで1.5倍へ */
.image-zoom-overlay.actual {
  overflow: auto;
  padding: 32px;
  display: block;
  text-align: center;
}
.image-zoom-overlay.actual img {
  max-width: none;
  max-height: none;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
  /* 画像をデフォルト中央寄せ (block + text-align だけだと不確定なので margin で補強) */
  margin: 0 auto;
}
/* 1.5倍表示: 元サイズの1.5倍でスクロール可能。画像クリックでフィットに戻る */
.image-zoom-overlay.x15 {
  overflow: auto;
  padding: 32px;
  display: block;
  text-align: center;
}
.image-zoom-overlay.x15 img {
  max-width: none;
  max-height: none;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
  margin: 0 auto;
  /* width/height は JS で naturalWidth * 1.5 を指定 */
}
/* 現在の拡大状態を示すヒント */
.image-zoom-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
  font-family: "BIZ UDPGothic", "Noto Sans JP", sans-serif;
}
.image-zoom-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 120ms;
}
.image-zoom-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
@keyframes zoomFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- 問題文内 太字（**...**） ---
   Mincho フォントは 700 と 800 の差が視覚的に小さいため、
   下線も併用して強調を明確にする。 */
.q-bold {
  font-weight: 800;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1.0px;
  text-underline-offset: 4px;
}

/* --- 問題文内数式（$...$） --- */
.q-math {
  font-family: "Cambria Math", "Latin Modern Math", "Times New Roman", serif;
  font-style: italic;
}
.q-math sub,
.q-math sup {
  font-style: italic;
  font-size: 0.75em;
}
/* 分数（\frac{a}{b}） */
.q-frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  margin: 0 0.15em;
  line-height: 1.15;
  font-size: 0.95em;
}
.q-frac-num {
  border-bottom: 1px solid currentColor;
  padding: 0 0.35em 0.05em;
}
.q-frac-den {
  padding: 0.05em 0.35em 0;
}
/* \overline{...} 上線（ド・モルガンの否定など） */
.q-overline {
  display: inline-block;
  border-top: 1.5px solid currentColor;
  padding: 1px 0.05em 0;
  line-height: 1.1;
}
/* \sqrt{...} 平方根 */
.q-sqrt {
  display: inline-flex;
  align-items: flex-start;
  vertical-align: middle;
  line-height: 1.1;
}
.q-sqrt-radical {
  font-size: 1.15em;
  line-height: 1;
  margin-right: -0.1em;
}
.q-sqrt-inner {
  display: inline-block;
  border-top: 1.5px solid currentColor;
  padding: 1px 0.1em 0;
  margin-top: 0.05em;
}
/* \left( ... \right) 等の自動サイズ区切り */
.q-delim-pair {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.q-delim-pair .q-delim {
  font-family: inherit;
  font-style: normal;
  font-size: 1.6em;
  line-height: 1;
  margin: 0 0.05em;
  display: inline-flex;
  align-items: center;
}
.q-delim-pair .q-delim-inner {
  display: inline-flex;
  align-items: center;
}

/* --- 問題文・選択肢内画像 ---
   inline-block: テキスト中の小さい記号画像はインラインで流れ、
   大きい画像 (max-width: 100%) は自動的に独立行に折り返される。 */
.q-image {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
}
/* 選択肢内の画像は前後の余白を削除 (画像はセルを満たす扱い) */
.choice .q-image,
.choice-text .q-image {
  margin: 0;
}

/* --- 問題文内テーブル --- */
.q-table-wrap {
  margin: 12px 0;
}
.q-table {
  border-collapse: collapse;
  font-size: 15px;
  font-weight: 500;
  max-width: 100%;
  table-layout: auto;
}
.q-table th,
.q-table td {
  border: 1px solid #000;
  padding: 8px 14px;
  text-align: left;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  background: #fff;
}
.q-table th {
  font-weight: inherit;
}
.q-table tr:nth-child(even) td {
}
.choices { display: flex; flex-direction: column; gap: 10px; }
/* 短いテキスト選択肢用: 4列1行 (狭い画面では2列2行に折り返し) */
.choices.row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.choices.row-4 .choice { justify-content: flex-start; text-align: left; }
@media (max-width: 640px) {
  .choices.row-4 { grid-template-columns: repeat(2, 1fr); }
}
/* 画像選択肢用: 2列2行 (極狭画面では1列に折り返し) */
.choices.grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 420px) {
  .choices.grid-2x2 { grid-template-columns: 1fr; }
}
.choice {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--bg-soft);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500; color: var(--ink);
  cursor: pointer;
  transition: all 140ms ease;
  text-align: left;
  line-height: 1.5;
}
.choice:hover {
  border-color: color-mix(in oklab, var(--accent) 30%, var(--line));
  background: var(--card);
}
.choice.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.choice .choice-letter {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700; font-size: 13px;
  color: var(--ink-soft);
  flex-shrink: 0;
  transition: all 140ms;
}
.choice.selected .choice-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.choice-text {
  flex: 1;
  text-wrap: pretty;
  font-family: "Shippori Mincho", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
}

.test-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 15;
}
.test-footer-inner {
  max-width: 820px; margin: 0 auto;
  padding: 16px 24px;
  display: flex; align-items: center; gap: 12px;
}
.btn {
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
  transition: all 140ms;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  border: 2px solid oklch(18% 0.02 80);
  font-weight: 700;
  box-shadow: 2px 2px 0 oklch(18% 0.02 80);
}
.btn-primary:hover:not(:disabled) {
  background: oklch(78% 0.16 75);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 oklch(18% 0.02 80);
}
.btn-primary:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 oklch(18% 0.02 80);
}
.btn-primary:disabled { background: var(--line); color: var(--ink-mute); border-color: var(--line); box-shadow: none; cursor: not-allowed; }
.btn-ghost {
  background: transparent; border-color: var(--line);
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--card); color: var(--ink); border-color: var(--ink-mute); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Result screen --- */
.result-wrap { max-width: 860px; margin: 0 auto; padding: 40px 24px 80px; }
.result-hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  text-align: center;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.result-hero .confetti {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.result-hero .confetti i {
  position: absolute;
  width: 8px; height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti 1600ms ease-out forwards;
}
@keyframes confetti {
  0% { transform: translateY(-10px) rotate(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(320px) rotate(720deg); opacity: 0; }
}
.result-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-mute);
  margin-bottom: 10px;
}
.result-hero h2 {
  font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
  margin: 0 0 28px;
}
.result-score {
  display: flex; align-items: center; justify-content: center; gap: 40px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.result-ring-wrap {
  position: relative;
  width: 180px; height: 180px;
}
.result-ring { transform: rotate(-90deg); }
.result-ring .track { stroke: var(--line); }
.result-ring .fill { stroke: var(--accent); transition: stroke-dashoffset 1200ms cubic-bezier(0.16, 1, 0.3, 1); }
.result-ring-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.result-ring-label .pct {
  font-size: 46px; font-weight: 800; letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.result-ring-label .pct-unit { font-size: 18px; color: var(--ink-mute); margin-left: 2px; font-weight: 600; }
.result-ring-label .ratio {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px; color: var(--ink-mute);
  margin-top: 2px;
}
.result-stats {
  display: flex; flex-direction: column; gap: 12px;
  text-align: left;
  min-width: 220px;
}
.result-stat {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
}
.result-stat .ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.result-stat .ico.ok { background: var(--correct-soft); color: var(--correct); }
.result-stat .ico.ng { background: var(--wrong-soft); color: var(--wrong); }
.result-stat .ico.rate { background: var(--accent-soft); color: var(--accent-deep); }
.result-stat .num { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.result-stat .lab { font-size: 12px; color: var(--ink-mute); font-weight: 500; }
.result-grade {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 700; font-size: 14px;
}
.result-grade.good { background: var(--correct-soft); color: var(--correct); }
.result-grade.mid { background: color-mix(in oklab, var(--warn) 15%, var(--card)); color: oklch(45% 0.15 55); }
.result-grade.low { background: var(--wrong-soft); color: var(--wrong); }

.result-actions {
  display: flex; gap: 12px; justify-content: center; margin-top: 28px;
  flex-wrap: wrap;
}

/* 分野別の正答率セクション */
.field-stats-section { margin-top: 48px; }
.field-stats-section h3 {
  margin: 0 0 18px;
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
}
.field-stats-list { display: flex; flex-direction: column; gap: 16px; }
.field-stat-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.field-stat-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.field-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.field-meta { display: inline-flex; align-items: baseline; gap: 10px; }
.field-ratio { font-size: 12px; color: var(--ink-mute); font-family: "JetBrains Mono", monospace; }
.field-pct { font-size: 18px; font-weight: 800; color: var(--ink); font-family: "JetBrains Mono", monospace; letter-spacing: -0.02em; }
.field-bar {
  height: 8px; background: var(--bg-soft);
  border-radius: 999px; overflow: hidden;
  margin-bottom: 14px;
}
.field-bar-fill {
  height: 100%; border-radius: 999px;
  background: var(--accent);
  transition: width 600ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.field-stat-block.mid .field-bar-fill { background: oklch(72% 0.15 75); }
.field-stat-block.low .field-bar-fill { background: oklch(65% 0.20 25); }
.field-categories { display: flex; flex-direction: column; gap: 8px; }
.cat-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) 60px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.cat-name { color: var(--ink); }
.cat-ratio { color: var(--ink-mute); font-family: "JetBrains Mono", monospace; font-size: 11px; text-align: right; }
.cat-bar {
  height: 6px; background: var(--bg-soft);
  border-radius: 999px; overflow: hidden;
}
.cat-bar-fill {
  height: 100%; border-radius: 999px;
  background: var(--accent);
  transition: width 600ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cat-row.mid .cat-bar-fill { background: oklch(72% 0.15 75); }
.cat-row.low .cat-bar-fill { background: oklch(65% 0.20 25); }
.cat-pct { font-family: "JetBrains Mono", monospace; font-weight: 700; text-align: right; color: var(--ink); }
.cat-row.mid .cat-pct { color: oklch(55% 0.15 75); }
.cat-row.low .cat-pct { color: oklch(50% 0.20 25); }
@media (max-width: 600px) {
  .cat-row {
    grid-template-columns: 1fr 50px 40px;
    grid-template-rows: auto auto;
    row-gap: 4px;
  }
  .cat-name { grid-column: 1 / -1; font-weight: 600; }
  .cat-bar { grid-column: 1 / 2; }
  .cat-ratio { grid-column: 2 / 3; }
  .cat-pct { grid-column: 3 / 4; }
}

/* 学習履歴ページ */
.history-wrap { max-width: 900px; margin: 0 auto; padding: 36px 24px 100px; }
.history-wrap .hero { margin-bottom: 32px; }
.history-wrap .hero h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
.history-wrap .hero p { color: var(--ink-mute); margin: 0; font-size: 14px; }
.history-empty {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 56px 24px; text-align: center;
}
.history-empty p { margin: 4px 0; color: var(--ink); font-size: 15px; }
.hist-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 24px;
}
.hist-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.hist-card-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -0.02em;
  line-height: 1;
}
.hist-card-lab { font-size: 12px; color: var(--ink-mute); margin-top: 8px; letter-spacing: 0.04em; }
.hist-card.hist-card-pct { background: var(--accent-soft); border-color: var(--accent); }
.hist-card.hist-card-pct .hist-card-num { color: var(--accent-deep); }
@media (max-width: 600px) {
  .hist-summary { grid-template-columns: repeat(2, 1fr); }
}
.hist-filter {
  display: flex; gap: 4px; flex-wrap: wrap;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  padding: 4px; border-radius: 10px; margin-bottom: 16px;
}
.hist-filter button {
  background: transparent; border: 0;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink-mute);
  cursor: pointer; transition: all 140ms;
}
.hist-filter button:hover { color: var(--ink); }
.hist-filter button.on {
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.hist-section h3 {
  margin: 0 0 16px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
}
.hist-list { display: flex; flex-direction: column; gap: 10px; }
.hist-rec {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.hist-rec-head {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px;
}
.hist-rec-exam {
  display: inline-block;
  background: var(--accent-soft); color: var(--accent-deep);
  padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  margin-right: 8px;
}
.hist-rec-year { font-size: 14px; color: var(--ink); font-weight: 600; }
.hist-rec-mode {
  display: inline-block; margin-left: 8px;
  background: var(--bg-soft); color: var(--ink-mute);
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.hist-rec-date { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--ink-mute); }
.hist-rec-stat {
  display: grid; grid-template-columns: 70px 110px 1fr; gap: 14px; align-items: center;
}
.hist-rec-pct {
  font-family: "JetBrains Mono", monospace;
  font-size: 22px; font-weight: 800; color: var(--ink);
}
.hist-rec.good .hist-rec-pct { color: var(--accent-deep); }
.hist-rec.mid .hist-rec-pct { color: oklch(55% 0.15 75); }
.hist-rec.low .hist-rec-pct { color: oklch(50% 0.20 25); }
.hist-rec-ratio { font-size: 13px; color: var(--ink-mute); font-family: "JetBrains Mono", monospace; }
.hist-rec-bar {
  height: 6px; background: var(--bg-soft);
  border-radius: 999px; overflow: hidden;
}
.hist-rec-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 600ms; }
.hist-rec.mid .hist-rec-bar-fill { background: oklch(72% 0.15 75); }
.hist-rec.low .hist-rec-bar-fill { background: oklch(65% 0.20 25); }
@media (max-width: 600px) {
  .hist-rec-stat { grid-template-columns: 60px 1fr; row-gap: 6px; }
  .hist-rec-bar { grid-column: 1 / -1; }
}
.weak-list { display: flex; flex-direction: column; gap: 6px; }
.weak-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px;
  display: grid; grid-template-columns: 50px 100px 60px 1fr 110px; gap: 12px;
  align-items: center; font-size: 13px;
}
.weak-tag {
  background: var(--accent-soft); color: var(--accent-deep);
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; text-align: center;
}
.weak-year { font-size: 12px; color: var(--ink-mute); }
.weak-q { font-weight: 700; color: var(--ink); }
.weak-cat { color: var(--ink-soft); font-size: 12px; }
.weak-rate { font-family: "JetBrains Mono", monospace; font-size: 12px; color: oklch(50% 0.20 25); font-weight: 600; text-align: right; }
@media (max-width: 600px) {
  .weak-item {
    grid-template-columns: 50px 100px 60px;
    grid-template-rows: auto auto;
    row-gap: 4px;
  }
  .weak-cat { grid-column: 1 / -1; font-size: 11px; }
  .weak-rate { grid-column: 1 / -1; text-align: left; }
}
.hist-actions {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px;
}
.hist-actions h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.hist-actions p { margin: 0 0 12px; }

.review-head { margin: 48px 0 18px; display: flex; align-items: center; justify-content: space-between; }
.review-head h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.review-head .filter-toggle {
  display: flex; gap: 4px;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  padding: 4px; border-radius: 10px;
}
.filter-toggle button {
  background: transparent; border: none; padding: 6px 14px;
  border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.filter-toggle button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

.review-list { display: flex; flex-direction: column; gap: 10px; }
.review-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  transition: all 140ms;
}
.review-item.open { box-shadow: var(--shadow-sm); }
.review-item-head {
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
}
.review-idx {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.review-idx.ok { background: var(--correct-soft); color: var(--correct); }
.review-idx.ng { background: var(--wrong-soft); color: var(--wrong); }
.review-text { flex: 1; font-size: 14px; font-weight: 500; line-height: 1.5; color: var(--ink); text-wrap: pretty; }
.review-status {
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  flex-shrink: 0;
}
.review-status.ok { background: var(--correct-soft); color: var(--correct); }
.review-status.ng { background: var(--wrong-soft); color: var(--wrong); }
.review-caret { color: var(--ink-mute); transition: transform 200ms; }
.review-item.open .review-caret { transform: rotate(180deg); }

.review-body {
  margin-top: 16px; padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: grid; gap: 12px;
}
.review-question {
  font-size: 14px; line-height: 1.6; color: var(--ink);
  display: flex; flex-direction: column; gap: 4px;
}
.review-choices { display: flex; flex-direction: column; gap: 8px; }
.review-choice {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 13px; line-height: 1.5;
  background: var(--bg-soft);
  border: 1px solid transparent;
}
.review-choice.correct {
  background: var(--correct-soft);
  border-color: color-mix(in oklab, var(--correct) 40%, transparent);
  color: var(--correct);
  font-weight: 600;
}
.review-choice.user-wrong {
  background: var(--wrong-soft);
  border-color: color-mix(in oklab, var(--wrong) 40%, transparent);
  color: var(--wrong);
  font-weight: 600;
  text-decoration: line-through;
  text-decoration-color: color-mix(in oklab, var(--wrong) 50%, transparent);
}
.review-choice .rc-letter {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.review-choice .rc-mark {
  margin-left: auto;
  font-size: 15px; font-weight: 700;
}
.explanation {
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: "Shippori Mincho", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 13px; line-height: 1.7; color: var(--ink-soft);
}
.explanation strong { color: var(--accent-deep); font-weight: 700; display: block; margin-bottom: 4px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }

/* --- Start confirm card --- */
.start-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 500px;
  margin: 80px auto;
  overflow: hidden;
  position: relative;
}
/* 上端に注意標識風の黒×アンバー縞模様 */
.start-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 8px;
  background: var(--caution-stripe);
}
.start-card-head {
  padding: 36px 36px 20px;
  background: linear-gradient(135deg, var(--accent-soft), var(--card));
}
.start-card-head .exam-badge { width: 56px; height: 56px; font-size: 15px; margin-bottom: 18px; }
.start-card-head h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -0.015em; }
.start-card-head p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.start-card-body { padding: 24px 36px 32px; }
.start-info { display: flex; gap: 24px; margin-bottom: 24px; }
.start-info-item { flex: 1; }
.start-info-item .lab { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); font-weight: 700; margin-bottom: 4px; }
.start-info-item .val { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }

/* --- Tweaks panel --- */
.tweaks-panel {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  min-width: 240px;
  display: none;
}
.tweaks-panel.visible { display: block; }
.tweaks-panel h4 {
  margin: 0 0 14px; font-size: 12px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute);
  display: flex; align-items: center; gap: 8px;
}
.tweaks-panel h4 .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.tweak-row { display: flex; flex-direction: column; gap: 8px; }
.tweak-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.theme-swatch {
  background: var(--card); border: 2px solid var(--line);
  border-radius: 10px; padding: 10px;
  cursor: pointer; text-align: left;
  transition: all 140ms;
}
.theme-swatch:hover { border-color: var(--ink-mute); }
.theme-swatch.on { border-color: var(--ink); }
.theme-swatch .sw { display: flex; gap: 3px; margin-bottom: 6px; }
.theme-swatch .sw span { width: 16px; height: 16px; border-radius: 4px; }
.theme-swatch .name { font-size: 11px; font-weight: 700; color: var(--ink); }

/* --- Breadcrumb --- */
.breadcrumb {
  color: var(--ink-mute); font-size: 13px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.breadcrumb .crumb { color: var(--ink-soft); }
.breadcrumb .sep { opacity: 0.5; }

/* --- Mode selector (menu) --- */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mode-btn {
  background: var(--bg-soft);
  border: 2px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: all 160ms ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mode-btn:hover {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 5%, var(--card));
}
.mode-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.mode-btn-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.mode-btn.active .mode-btn-label { color: var(--accent-deep); }
.mode-btn-desc {
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.5;
}

/* --- Flash mode (一問一答) feedback --- */
.flash-feedback {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
  animation: fadeSlide 280ms ease;
}
.flash-verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.flash-verdict.ok { background: var(--correct-soft); color: var(--correct); }
.flash-verdict.ng { background: var(--wrong-soft);   color: var(--wrong);   }

.choices.flash-revealed .choice { pointer-events: none; }
.choices.flash-revealed .choice:not(.flash-correct):not(.flash-wrong) { opacity: 0.4; }

.choice.flash-correct {
  background: var(--correct-soft);
  border-color: var(--correct);
}
.choice.flash-correct .choice-letter {
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
}
.choice.flash-wrong {
  background: var(--wrong-soft);
  border-color: var(--wrong);
  text-decoration: line-through;
  text-decoration-color: color-mix(in oklab, var(--wrong) 50%, transparent);
}
.choice.flash-wrong .choice-letter {
  background: var(--wrong);
  border-color: var(--wrong);
  color: #fff;
}

/* --- Site footer --- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 12px;
  line-height: 1.9;
}
.site-footer .footer-inner {
  max-width: 1160px;
  margin: 0 auto;
}
.site-footer a {
  color: var(--ink-mute);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--ink-soft);
  text-decoration: underline;
}

/* --- Utility --- */
@media (max-width: 600px) {
  .hero h1 { font-size: 30px; }
  .container, .result-wrap, .test-container { padding: 24px 16px 100px; }
  .topbar-inner, .test-topbar-inner { padding: 14px 16px; }
  .question-box { padding: 24px 20px; }
  .result-score { gap: 24px; flex-direction: column; }
  .result-hero { padding: 32px 24px; }
}

/* --- Guide pages (ip-guide.html etc.) --- */
.guide-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.guide-breadcrumb {
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 16px;
}
.guide-breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
}
.guide-breadcrumb a:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}
.guide-hero {
  margin-bottom: 28px;
}
.guide-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}
.guide-hero h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  line-height: 1.25;
}
.guide-hero .lead {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.85;
  margin: 0;
}
.guide-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 16px;
}
.guide-section h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.guide-section h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}
.guide-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-deep);
  margin: 20px 0 8px;
  letter-spacing: 0.01em;
}
.guide-section h3:first-of-type {
  margin-top: 4px;
}
.guide-section p {
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-soft);
  margin: 0 0 10px;
  text-wrap: pretty;
}
.guide-section p:last-child {
  margin-bottom: 0;
}
.guide-section ul {
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-soft);
  margin: 0 0 10px;
  padding-left: 20px;
}
.guide-section ul li {
  margin-bottom: 4px;
}
.guide-section a {
  color: var(--accent-deep);
  text-decoration: none;
}
.guide-section a:hover {
  text-decoration: underline;
}
.guide-section .note {
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.75;
  margin-top: 12px;
}
.guide-meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0;
}
.guide-meta-table th,
.guide-meta-table td {
  border: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
  line-height: 1.7;
  vertical-align: top;
}
.guide-meta-table th {
  font-weight: 600;
  color: var(--ink);
  background: var(--bg-soft);
  width: 30%;
  white-space: nowrap;
  font-size: 13px;
}
.guide-meta-table td {
  color: var(--ink-soft);
}
.guide-cta {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 24px;
  text-align: center;
}
.guide-cta h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--ink);
}
.guide-cta p {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.7;
}
.guide-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 200ms, box-shadow 200ms;
}
.guide-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px var(--accent-deep);
  color: var(--accent-ink);
  text-decoration: none;
}
.guide-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* --- Pass rate chart (guide pages) --- */
.rate-scale {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  margin: 8px 0 6px;
}
.rate-scale-empty { content: ""; }
.rate-scale-ticks {
  position: relative;
  height: 14px;
}
.rate-scale-ticks span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px;
  font-family: "JetBrains Mono", monospace;
  color: var(--ink-mute);
  line-height: 1;
}
.rate-chart {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 4px;
}
.rate-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  gap: 14px;
}
.rate-label {
  font-size: 11.5px;
  text-align: right;
  color: var(--ink-soft);
  line-height: 1.35;
}
.rate-label .year-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--ink-mute);
  display: block;
  margin-top: 1px;
}
.rate-bar-wrap {
  position: relative;
  background: var(--bg-soft);
  height: 26px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
}
.rate-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 5px 0 0 5px;
}
.rate-bar.season-spring { background: var(--accent); }
.rate-bar.season-autumn { background: var(--accent-deep); }
.rate-bar.legacy { background: oklch(72% 0.06 145); }
.rate-value {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  pointer-events: none;
}
.rate-chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-soft);
}
.rate-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rate-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
.rate-legend-swatch.season-spring { background: var(--accent); }
.rate-legend-swatch.season-autumn { background: var(--accent-deep); }
.rate-legend-swatch.legacy { background: oklch(72% 0.06 145); }
@media (max-width: 600px) {
  .rate-row, .rate-scale {
    grid-template-columns: 78px 1fr;
    gap: 10px;
  }
  .rate-label { font-size: 11px; }
  .rate-value { font-size: 11px; right: 8px; }
  .rate-bar-wrap { height: 24px; }
}
@media (max-width: 600px) {
  .guide-wrap { padding: 24px 16px 80px; }
  .guide-hero h1 { font-size: 24px; }
  .guide-section { padding: 20px 18px; }
  .guide-meta-table { font-size: 13px; }
  .guide-meta-table th { width: 38%; font-size: 12px; }
  .guide-meta-table th, .guide-meta-table td { padding: 8px 10px; }
  .guide-cta { padding: 22px 18px; }
  .guide-cta-btn { font-size: 14px; padding: 11px 22px; }
}
