:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent2: #f59e0b;
  --ok: #22c55e;
  --ng: #ef4444;
  --warn: #f59e0b;
  --line: #2d3a4f;
  --radius: 12px;
  --gap-page-x: 14px;
  --gap-page-b: 40px;
  --gap-section: 12px;
  --gap-block: 8px;
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--gap-section) var(--gap-page-x) var(--gap-page-b);
}

body.has-mobile-dock .wrap {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

body.has-mobile-dock .rescue-widget {
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

header.site {
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 25, 0.95);
  backdrop-filter: blur(8px);
}

#site-header {
  position: sticky;
  top: 0;
  z-index: 10;
}

header.site .wrap,
header.site .header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.nav-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-scroll::-webkit-scrollbar {
  display: none;
}

nav.top {
  flex-shrink: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

nav.top a {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 0;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

nav.top a.active { color: var(--accent); font-weight: 700; }

.brand {
  font-weight: 800;
  font-size: clamp(0.65rem, 2.8vw, 0.92rem);
  color: var(--text);
  line-height: 1.25;
  max-width: min(52vw, 280px);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent2);
}

.nav-return-bar {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(26, 35, 50, 0.98);
  backdrop-filter: blur(8px);
}

.nav-return-bar .wrap {
  padding-top: 8px;
  padding-bottom: 8px;
}

.nav-return-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-return-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-return-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.nav-return-depth {
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}

h1 { font-size: 1.35rem; margin: var(--gap-section) 0 var(--gap-block); }
h2 { font-size: 1.05rem; margin: var(--gap-section) 0 var(--gap-block); color: var(--accent2); }
.sub { color: var(--muted); font-size: 0.88rem; margin: 0 0 var(--gap-section); line-height: 1.45; }

.card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s;
}

.card:hover { border-color: var(--accent); }

.card .icon { font-size: 1.5rem; margin-bottom: 8px; }
.card .title { font-weight: 700; margin-bottom: 4px; }
.card .desc { font-size: 0.8rem; color: var(--muted); }

.chip {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  margin-right: 6px;
}

.chip.rank { background: #1e3a5f; color: #93c5fd; }
.chip.wrong { background: #451a1a; color: #fca5a5; }
.chip.cat { background: #312e1e; color: #fcd34d; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: white;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--surface2); color: var(--text); }
.btn.warn { background: var(--warn); color: #111; }

.flashcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 180px;
  cursor: pointer;
  user-select: none;
}

.flashcard .term { font-size: 1.4rem; font-weight: 800; }
.flashcard .reading { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.flashcard .def { margin-top: 16px; color: var(--text); }
.flashcard .flash-hint { color: var(--muted); font-size: 0.8rem; margin-top: 40px; }
.flashcard.mode-reverse .term-side .term {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
}
.flashcard.mode-reverse .def-side .term {
  font-size: 1.5rem;
}
.flashcard.flipped .term-side { display: none; }
.flashcard:not(.flipped) .def-side { display: none; }

.list-item-reverse {
  line-height: 1.45;
}

.quiz-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.quiz-prompt { font-size: 1.05rem; font-weight: 600; margin-bottom: 16px; }

.choices { display: grid; gap: 8px; }

.choice {
  text-align: left;
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
}

.choice:hover { border-color: var(--accent); }
.choice.selected { border-color: var(--accent); background: #1e3a5f; }
.choice.correct { border-color: var(--ok); background: #14532d; }
.choice.incorrect { border-color: var(--ng); background: #450a0a; }

.result-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface2);
}

.result-box.ok { border-left: 4px solid var(--ok); }
.result-box.ng { border-left: 4px solid var(--ng); }

.completion-next,
.completion-next-wrap .completion-next {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--accent2);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(56, 120, 190, 0.12), rgba(56, 120, 190, 0.04));
}

.completion-next-kicker {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ok);
  text-transform: none;
}

.completion-next-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
}

.completion-next-desc {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.completion-next-why {
  margin: 0 0 12px;
  font-size: 0.75rem;
  color: var(--accent2);
}

.completion-next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.completion-next-btn {
  flex: 1 1 auto;
  min-width: 140px;
}

.completion-next-host {
  margin: var(--gap-section) 0;
}

.ref-done-bar {
  margin: 16px 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.ref-done-bar .btn {
  width: 100%;
  max-width: 360px;
}

.guide-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  scroll-margin-top: 80px;
}

.guide-section h2 { margin-top: 0; }
.guide-body { font-size: 0.92rem; }

details.guide-chapter {
  margin-bottom: 12px;
}

details.guide-chapter > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.45;
}

details.guide-chapter > summary::-webkit-details-marker {
  display: none;
}

details.guide-chapter > summary::before {
  content: '▶ ';
  color: var(--accent);
  font-size: 0.75rem;
}

details.guide-chapter[open] > summary::before {
  content: '▼ ';
}

.guide-chapter-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
}
.guide-body .md { white-space: normal; }
.guide-body table,
.md table,
.ref-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  white-space: normal;
}
.guide-body th, .guide-body td,
.md th, .md td,
.ref-table th, .ref-table td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.ref-table td strong { color: var(--ok); }

#content > section,
.guide-section {
  scroll-margin-top: 80px;
}

.ref-table-banner {
  margin: 12px 0;
  padding: 10px 14px;
  background: #1a3a2a;
  border: 1px solid var(--ok);
  border-radius: var(--radius);
}

.ref-table-banner a { font-weight: 700; }

.list-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.progress {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
}

.progress > div {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
  align-items: center;
}

.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

.md h2 { font-size: 1rem; margin: 12px 0 6px; }
.md ul { margin: 6px 0; padding-left: 20px; }

.meta-panel {
  background: #1e2a3a;
  border: 1px solid #3b5998;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0 16px;
  font-size: 0.88rem;
}

.meta-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.meta-label {
  display: block;
  font-size: 0.7rem;
  color: var(--accent2);
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-item p { margin: 0; color: var(--text); line-height: 1.5; }
.meta-traps ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.meta-action { margin: 10px 0 0; font-size: 0.85rem; }

.urgency-critical { border-left: 4px solid var(--ng); }
.urgency-high { border-left: 4px solid var(--warn); }
.urgency-medium { border-left: 4px solid var(--accent); }
.urgency-low { border-left: 4px solid var(--line); }

.plan-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.plan-step-num {
  background: var(--accent);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.exam-banner {
  background: #1a3a2a;
  border: 1px solid var(--ok);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.highlight-row td {
  background: rgba(56, 189, 120, 0.08);
}

.step-card h3 {
  font-size: 1.05rem;
}

.check-section {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.check-section:last-child {
  border-bottom: none;
}

.check-section h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  color: var(--text);
}

.check-section-note {
  margin: 0 0 8px;
  font-size: 0.82rem;
}

.check-section-must h3 { color: var(--warn); }
.check-section-mock h3 { color: var(--ok); }

.self-check-subject-block {
  margin-bottom: 28px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}

.self-check-subject-block:last-child {
  border-bottom: none;
}

.self-check-subject-heading {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.45;
}

.check-list li:first-child {
  border-top: none;
}

.check-list input[type="checkbox"] {
  margin: 3px 0 0;
  flex-shrink: 0;
}

.check-list li span {
  flex: 1;
  min-width: 0;
}

.check-list li a {
  flex-shrink: 0;
  font-size: 0.85rem;
  white-space: nowrap;
}

.week-card {
  margin-bottom: 12px;
}

.stuck-card {
  margin-bottom: 10px;
}

.stuck-card summary {
  cursor: pointer;
  font-size: 0.95rem;
}

.glossary-term {
  display: inline;
  padding: 0 2px;
  margin: 0 1px;
  border: none;
  border-bottom: 1px dashed var(--accent);
  background: rgba(96, 165, 250, 0.12);
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 2px;
}

.glossary-term:hover,
.glossary-term:focus {
  background: rgba(96, 165, 250, 0.25);
  outline: none;
}

.glossary-popup {
  position: absolute;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.glossary-popup[hidden] {
  display: none !important;
}

.glossary-popup:not([hidden]) {
  pointer-events: auto;
}

.glossary-popup-card {
  position: absolute;
  max-width: min(320px, calc(100vw - 16px));
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.glossary-popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.glossary-popup-term {
  font-weight: 800;
  font-size: 1.05rem;
  padding-right: 20px;
}

.glossary-popup-reading {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.glossary-popup-def {
  margin-top: 10px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.glossary-popup-meta {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.glossary-popup-vocab {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.85rem;
}

.glossary-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.urgency-high.exam-banner {
  border-color: var(--warn);
  background: #3a2a1a;
}

.subject-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 var(--gap-section);
}

.subject-tab {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.subject-tab:hover { border-color: var(--accent); color: var(--text); }
.subject-tab.active {
  border-color: var(--accent);
  background: #1e3a5f;
  color: #93c5fd;
}

.subject-hub-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.subject-hub-card { min-height: 140px; display: flex; flex-direction: column; }
.subject-hub-card .subject-hub-main {
  display: block;
  color: inherit;
  text-decoration: none;
  flex: 1;
}
.subject-hub-card .subject-hub-main:hover .title { color: var(--accent); }
.subject-hub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
}
.subject-hub-links a { color: var(--accent2); text-decoration: none; }
.subject-hub-links a:hover { text-decoration: underline; }
.subject-hub-card.subject-law { border-color: #1e3a5f; }
.subject-hub-card.subject-physics_chem { border-color: #312e81; }
.subject-hub-card.subject-properties_fire { border-color: #451a1a; }

.hub-tools { margin-bottom: 24px; }

/* 情報階層 — いまこれやれ */
.focus-hero {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(234, 88, 12, 0.12));
  border-bottom: 2px solid var(--warn);
}

.focus-hero-inner {
  padding: 12px var(--gap-page-x) 14px;
  text-align: center;
}

.focus-hero-kicker {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
}

.focus-hero-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
}

.focus-hero-desc {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.focus-hero-principle {
  margin: 0 0 12px;
  font-size: 0.78rem;
  color: var(--accent2);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.focus-hero-here {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--ok);
}

.focus-hero-btn {
  font-size: 1.05rem;
  padding: 12px 28px;
  font-weight: 800;
}

.focus-muted {
  color: var(--muted) !important;
  font-size: 0.85rem;
}

.spotlight-section {
  margin: var(--gap-section) 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.spotlight-heading {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.spotlight-kicker {
  margin: 0 0 10px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent2);
}

.spotlight-loading {
  margin: 0;
}

.spotlight-empty {
  margin: 0;
  line-height: 1.45;
}

.spotlight-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spotlight-card {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
}

.spotlight-card-head {
  margin-bottom: 4px;
  line-height: 1.35;
}

.spotlight-card.urgency-high {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: inset 3px 0 0 var(--ng);
}

.spotlight-card.urgency-medium {
  border-color: rgba(245, 158, 11, 0.35);
}

#tier-self-check[open] > summary {
  color: var(--ok);
}

.detail-tier[open] .detail-tier-body {
  animation: tierReveal 0.18s ease-out;
}

@keyframes tierReveal {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.detail-tier {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.detail-tier > summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
  list-style: none;
}

.detail-tier > summary::-webkit-details-marker {
  display: none;
}

.detail-tier > summary::before {
  content: '▸ ';
  color: var(--accent2);
}

.detail-tier[open] > summary::before {
  content: '▾ ';
}

.detail-tier[open] > summary {
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.detail-tier-body {
  padding: 12px 14px 14px;
}

.detail-tier-inline {
  margin: 10px 0;
  font-size: 0.88rem;
}

.detail-tier-inline > summary {
  cursor: pointer;
  color: var(--muted);
}

.list-item-compact {
  padding: 10px 12px;
  margin-bottom: 8px;
}

.pri-reason {
  margin: 8px 0 4px;
  line-height: 1.45;
}

.pri-actions {
  margin: 8px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.week-card-compact {
  margin-bottom: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.week-card-compact > summary {
  cursor: pointer;
  font-weight: 600;
}

.study-loop-subjects.hidden {
  display: none;
}

.study-loop-mini {
  font-size: 0.75rem;
  color: var(--accent2);
  letter-spacing: 0.04em;
}

.daily-time-badge {
  font-size: 0.72rem;
  color: var(--accent2);
  white-space: nowrap;
  flex-shrink: 0;
}

.tired-mode-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.tired-mode-btn:hover,
.tired-mode-btn.active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
}

.tired-mode-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.25s ease;
  border-top: 1px solid var(--line);
  background: rgba(30, 27, 75, 0.95);
}

.tired-mode-panel.open {
  max-height: 480px;
  opacity: 1;
  overflow: auto;
}

.tired-mode-inner {
  padding: 10px 16px 14px;
}

.tired-mode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.tired-mode-head strong {
  color: #c7d2fe;
  font-size: 0.9rem;
}

.tired-mode-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}

.tired-mode-quote {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.tired-mode-list {
  display: grid;
  gap: 6px;
}

.tired-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
}

.tired-card:hover {
  border-color: #818cf8;
  text-decoration: none;
}

.tired-card-primary {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.15);
}

.tired-card-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.tired-card-desc {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.tired-mode-pick {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

/* 閉じる前レスキュー */
.rescue-widget {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}

.rescue-widget > * {
  pointer-events: auto;
}

.rescue-fab {
  appearance: none;
  border: 2px solid var(--accent2);
  background: linear-gradient(135deg, #3a2a1a, #1a2332);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1.25;
  padding: 12px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.rescue-fab:hover {
  transform: scale(1.04);
  border-color: var(--warn);
  box-shadow: 0 10px 32px rgba(245, 158, 11, 0.25);
}

.rescue-fab.active {
  border-color: var(--ok);
  background: linear-gradient(135deg, #1a3a2a, #1a2332);
}

.rescue-fab-sub {
  display: block;
  color: var(--accent2);
  font-size: 0.95rem;
}

.rescue-panel {
  width: min(400px, calc(100vw - 24px));
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.92) translateY(12px);
  transition:
    max-height 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease,
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.rescue-panel.open {
  max-height: min(78vh, 640px);
  opacity: 1;
  transform: scale(1) translateY(0);
  overflow: auto;
}

.rescue-panel-inner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.rescue-close {
  float: right;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 8px 8px;
}

.rescue-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--accent2);
}

.rescue-time {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--ok);
}

.rescue-quote {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
}

.rescue-subhead {
  margin: 14px 0 8px;
  font-size: 0.88rem;
  color: var(--muted);
}

.rescue-primary,
.rescue-alts {
  display: grid;
  gap: 8px;
}

.rescue-card {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.rescue-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateX(-2px);
}

.rescue-card-primary {
  border-color: var(--warn);
  background: rgba(245, 158, 11, 0.1);
}

.rescue-card-alt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.rescue-card-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.rescue-card-label {
  display: block;
  font-size: 0.72rem;
  color: var(--accent2);
  margin-bottom: 2px;
}

.rescue-card-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.rescue-stuck {
  margin-top: 14px;
  font-size: 0.85rem;
}

.rescue-stuck summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.rescue-stuck-list {
  margin: 8px 0;
  padding-left: 20px;
}

.rescue-stuck-list a {
  color: var(--text);
}

@media (max-width: 480px) {
  nav.top a {
    font-size: 0.72rem;
    padding: 8px 8px;
  }
  header.site .wrap,
  header.site .header-row {
    flex-wrap: wrap;
  }
  .tired-mode-btn {
    order: 4;
    font-size: 0.68rem;
    padding: 8px 10px;
    min-height: 36px;
  }
  .daily-time-badge {
    width: 100%;
    text-align: right;
    order: 5;
  }
  .rescue-fab {
    font-size: 0.75rem;
    padding: 10px 14px;
  }
}

/* ここがやばい */
.yabai-btn {
  appearance: none;
  border: 1px solid #7f1d1d;
  background: rgba(127, 29, 29, 0.35);
  color: #fca5a5;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.yabai-btn:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.25);
  transform: scale(1.02);
}

.yabai-btn.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.chapter-yabai-row {
  margin-bottom: 10px;
}

.check-list-item {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}

.check-list-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.check-yabai {
  margin-top: 6px;
  margin-left: 28px;
}

.yabai-detail-panel {
  margin-top: 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition:
    max-height 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease,
    transform 0.4s ease;
}

.yabai-detail-panel.open {
  max-height: 2000px;
  opacity: 1;
  transform: translateY(0);
  overflow: visible;
}

.yabai-detail-inner {
  border: 1px solid #7f1d1d;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(69, 10, 10, 0.45), var(--surface));
  padding: 12px 14px;
}

.yabai-detail-head {
  margin-bottom: 8px;
}

.yabai-detail-title {
  font-weight: 700;
  margin: 0 0 8px;
}

.yabai-detail-summary {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 10px;
}

.yabai-detail-section {
  margin: 10px 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.yabai-detail-section h4 {
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: var(--accent2);
}

.yabai-trap-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.88rem;
}

.yabai-trap-list li {
  margin-bottom: 4px;
}

.yabai-detail-links {
  margin-top: 12px;
  font-size: 0.85rem;
}

.yabai-md .md {
  font-size: 0.88rem;
}

.yabai-list-item {
  margin-bottom: 16px;
}

/* 推奨勉強順（フォーカスヒーロー下・畳みデフォ） */
.study-loop-dock {
  border-bottom: 1px solid var(--line);
  background: rgba(20, 28, 40, 0.96);
}

.study-loop-inner {
  padding-top: 6px;
  padding-bottom: 8px;
}

.study-loop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.study-loop-title {
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1;
  min-width: 120px;
}

.study-loop-mini {
  font-size: 0.72rem;
  color: var(--accent2);
  letter-spacing: 0.02em;
  flex: 1 1 100%;
}

.study-loop-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.study-loop-subject {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 36px;
}

.study-loop-subject.active {
  border-color: var(--accent);
  background: #1e3a5f;
  color: #93c5fd;
}

.study-loop-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 32px;
}

.study-loop-toggle:hover {
  border-color: var(--accent);
}

.study-loop-track {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.study-loop-track::-webkit-scrollbar {
  display: none;
}

.study-loop-track.collapsed {
  display: none;
}

.study-loop-step {
  flex: 0 0 auto;
}

.study-loop-step-link {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  line-height: 1.3;
  min-width: 148px;
  max-width: 200px;
  min-height: 56px;
}

.study-loop-step-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.study-loop-step-current .study-loop-step-link {
  border-color: var(--ok);
  background: rgba(34, 197, 94, 0.1);
}

.study-loop-num {
  background: var(--accent);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.study-loop-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.study-loop-name {
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.25;
}

.study-loop-principle {
  font-size: 0.65rem;
  color: var(--accent2);
  line-height: 1.2;
}

.study-loop-dur {
  font-size: 0.68rem;
  color: var(--muted);
}

.study-loop-chevron {
  color: var(--muted);
  font-size: 1.1rem;
  padding: 0 2px;
  align-self: center;
  flex-shrink: 0;
  opacity: 0.7;
}

/* 合格ルート全体像 */
.journey-map-host {
  margin: 0 0 var(--gap-section);
}

.journey-map {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.journey-map-lead {
  margin: 0 0 var(--gap-block);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.journey-steps {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: var(--gap-block);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.journey-steps::-webkit-scrollbar {
  display: none;
}

.journey-step-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 0 0 auto;
  width: min(210px, 68vw);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
  scroll-snap-align: start;
  transition: border-color 0.15s, background 0.15s;
}

.journey-step-card:hover {
  text-decoration: none;
  border-color: var(--accent);
}

.journey-step-current {
  border-color: var(--warn);
  background: rgba(245, 158, 11, 0.12);
  box-shadow: inset 3px 0 0 var(--warn);
}

.journey-step-done {
  opacity: 0.88;
  border-color: rgba(34, 197, 94, 0.35);
}

.journey-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: var(--line);
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.journey-step-current .journey-step-num {
  background: var(--warn);
  color: #1a1208;
}

.journey-step-done .journey-step-num {
  background: rgba(34, 197, 94, 0.25);
  color: var(--ok);
}

.journey-step-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.journey-step-label {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.25;
}

.journey-step-hint {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

.journey-step-principle {
  font-size: 0.65rem;
  color: var(--accent2);
  line-height: 1.25;
  margin-top: 2px;
}

.journey-step-now {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--warn);
  margin-top: 2px;
}

/* 学習計画ページ: 合格ルート・勉強順は中身と被るので非表示 */
body.page-study .journey-map-host,
body.page-study .study-loop-dock {
  display: none !important;
}

.mobile-lead {
  font-size: 0.88rem;
  line-height: 1.5;
}

/* モバイル固定ドック */
.mobile-bottom-dock {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 20, 25, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  gap: 8px;
  align-items: stretch;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.mobile-dock-primary {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #b45309, #92400e);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  text-decoration: none;
  line-height: 1.25;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-dock-primary:hover {
  text-decoration: none;
  filter: brightness(1.08);
}

.mobile-dock-lost {
  appearance: none;
  border: 1px solid #6366f1;
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  font: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 12px 12px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
}

.mobile-dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  font-size: 1.2rem;
  text-decoration: none;
}

.mobile-lost-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.mobile-lost-sheet.open {
  pointer-events: auto;
}

.mobile-lost-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-lost-sheet.open .mobile-lost-backdrop {
  opacity: 1;
}

.mobile-lost-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  overflow: auto;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-lost-sheet.open .mobile-lost-panel {
  transform: translateY(0);
}

.mobile-lost-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--line);
}

.mobile-lost-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.mobile-lost-body {
  padding: 12px 16px 20px;
}

.mobile-lost-primary {
  display: block;
  padding: 14px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  border: 2px solid var(--warn);
  background: rgba(245, 158, 11, 0.12);
  color: var(--text);
  text-decoration: none;
}

.mobile-lost-primary:hover {
  text-decoration: none;
}

.mobile-lost-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent2);
  margin-bottom: 4px;
}

.mobile-lost-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.mobile-lost-section {
  margin: 12px 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.mobile-lost-journey-host .journey-map {
  border: none;
  padding: 0;
  background: transparent;
}

.mobile-lost-journey-host .journey-map-lead {
  display: none;
}

.mobile-lost-journey-host .journey-step-card {
  padding: 10px 12px;
}

.mobile-lost-journey-host .journey-step-label {
  font-size: 0.85rem;
}

.mobile-lost-list {
  display: grid;
  gap: 6px;
}

.mobile-lost-item {
  display: block;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}

.mobile-lost-rescue {
  margin: 16px 0 0;
  text-align: center;
}

.mobile-lost-rescue-btn {
  width: 100%;
  min-height: 44px;
}

@media (max-width: 768px) {
  .mobile-bottom-dock {
    display: flex;
  }

  /* モバイルは分野別勉強順ドック非表示（ホームの合格ルートで足りる） */
  body:not(.page-study) .study-loop-dock {
    display: none !important;
  }

  nav.top a[data-page="yabai"] {
    display: none;
  }

  h1 {
    font-size: 1.2rem;
    line-height: 1.35;
    margin-top: 16px;
  }

  #page-sub.sub {
    margin-bottom: 12px;
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .journey-map {
    padding: 12px 10px;
  }

  .journey-map-lead {
    font-size: 0.78rem;
    margin-bottom: 10px;
  }

  .journey-steps {
    gap: 6px;
  }

  .journey-step-card {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 10px;
  }

  .journey-step-num {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.78rem;
    border-radius: 8px;
  }

  .journey-step-label {
    font-size: 0.88rem;
  }

  .journey-step-hint {
    font-size: 0.72rem;
  }

  .journey-step-now {
    font-size: 0.62rem;
  }

  .rescue-fab {
    font-size: 0.72rem;
    padding: 10px 12px;
    max-width: 148px;
  }

  .focus-hero-inner {
    padding: 14px 12px 16px;
  }

  .focus-hero-title {
    font-size: 1.05rem;
  }

  .focus-hero-kicker {
    font-size: 0.72rem;
  }

  .focus-hero-btn {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 14px 16px;
  }

  .btn, .choice {
    min-height: 44px;
  }

  .subject-tabs {
    gap: 6px;
  }

  .subject-tab {
    font-size: 0.72rem;
    padding: 10px 10px;
  }

  .detail-tier > summary {
    font-size: 0.88rem;
    padding: 12px 12px;
  }
}

@media (max-width: 380px) {
  .mobile-dock-lost {
    font-size: 0.72rem;
    padding: 12px 8px;
  }

  nav.top a {
    font-size: 0.68rem;
    padding: 8px 6px;
  }
}

/* ===== 全ページ共通レイアウト ===== */

.page-stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap-section);
}

.page-stack > h1,
.page-stack > h2 {
  margin: 0;
}

.page-stack > .sub {
  margin: 0;
}

.section-label {
  margin: 0 0 var(--gap-block);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
}

.home-block {
  margin: 0;
}

.home-quick-links {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0 4px;
}

.home-quick-links::-webkit-scrollbar {
  display: none;
}

.quick-link {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.quick-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.home-footnote {
  margin: 0;
  font-size: 0.8rem;
}

.mode-badge {
  margin: 0;
  align-self: flex-start;
}

.detail-tier-compact {
  margin: 0;
}

.detail-tier-compact > summary {
  font-size: 0.85rem;
  padding: 10px 12px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--gap-block) 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--surface2);
  color: var(--accent2);
  font-size: 0.75rem;
}

.data-table tr.highlight-row td {
  background: rgba(245, 158, 11, 0.08);
}

.list-item {
  padding: 12px;
  margin-bottom: var(--gap-block);
}

.empty {
  padding: 24px 12px;
}

.toolbar {
  margin: var(--gap-block) 0;
}

.stats {
  margin: var(--gap-block) 0;
}

.card-grid {
  gap: var(--gap-block);
}

.subject-hub-grid {
  grid-template-columns: 1fr;
}

@media (min-width: 520px) {
  .subject-hub-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.subject-hub-card {
  min-height: 0;
  padding: 12px;
}

.subject-hub-links {
  margin-top: 8px;
  padding-top: 8px;
  gap: 6px;
}

.check-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}

.check-list-main {
  flex: 1 1 200px;
  min-width: 0;
}

.check-yabai {
  margin: 0 0 0 auto;
  flex-shrink: 0;
}

.check-section h3 {
  margin: var(--gap-section) 0 var(--gap-block);
  font-size: 0.92rem;
}

.check-section-note {
  margin: 0 0 var(--gap-block) !important;
}

.guide-section {
  margin-bottom: var(--gap-block);
}

.guide-chapter > summary {
  padding: 10px 12px;
}

.quiz-box {
  margin-top: 0;
}

body.page-quiz .focus-hero-host,
body.page-drill .focus-hero-host,
body.page-guide .focus-hero-host,
body.page-vocab .focus-hero-host,
body.page-reference .focus-hero-host {
  display: none;
}

@media (max-width: 768px) {
  body.has-mobile-dock .rescue-widget {
    display: none !important;
  }

  .brand {
    max-width: 42vw;
    font-size: 0.62rem;
  }
}

/* --- 試験日カウントダウン（第2弾 2026-07-09） --- */

.exam-countdown-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--accent2);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.exam-countdown-btn:hover {
  border-color: var(--accent2);
  background: rgba(245, 158, 11, 0.15);
}

.exam-countdown-btn.urgent {
  border-color: var(--ng);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
}

.exam-date-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  border-top: 1px solid var(--line);
  background: rgba(30, 27, 75, 0.95);
}

.exam-date-panel.open {
  max-height: 320px;
  opacity: 1;
  overflow: auto;
}

.exam-date-inner {
  padding: 10px 16px 14px;
}

.exam-date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.exam-date-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
}

.exam-date-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
}

.exam-date-form input[type="date"] {
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit;
}

/* --- 合格可能性メーター --- */

.readiness-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 8px 0 16px;
}

.readiness-box.readiness-danger { border-left: 5px solid var(--ng); }
.readiness-box.readiness-border { border-left: 5px solid var(--warn); }
.readiness-box.readiness-safe { border-left: 5px solid var(--ok); }

.readiness-headline {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.readiness-danger .readiness-headline strong { color: #fca5a5; }
.readiness-border .readiness-headline strong { color: #fcd34d; }
.readiness-safe .readiness-headline strong { color: #86efac; }

.readiness-subject-row {
  padding: 6px 0;
  border-top: 1px dashed var(--line);
  font-size: 0.9rem;
}

.readiness-subject-row:first-child { border-top: none; }

.readiness-note { margin: 2px 0 0; }

.chip.readiness-chip-danger { background: #451a1a; color: #fca5a5; }
.chip.readiness-chip-border { background: #453a1a; color: #fcd34d; }
.chip.readiness-chip-safe { background: #14351f; color: #86efac; }
.chip.readiness-chip-neutral { background: var(--surface2); color: var(--muted); }

.readiness-overall {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.readiness-actions-head {
  margin: 10px 0 4px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent2);
}

.readiness-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.readiness-action {
  display: block;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
}

.readiness-action:hover { border-color: var(--accent); }

/* --- 単語帳の復習ボタン + 復習が来た単語 --- */

.vocab-review-bar {
  margin-top: 10px;
  align-items: center;
}

.vocab-review-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.vocab-due-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent2);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.vocab-due-box .vocab-due-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.vocab-due-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.vocab-due-chip:hover { border-color: var(--accent2); }

@media (max-width: 640px) {
  .exam-countdown-btn {
    order: 3;
    font-size: 0.68rem;
    padding: 8px 10px;
    min-height: 36px;
  }
}
