:root {
  --navy: #0d47a1;
  --navy-dark: #071e3d;
  --blue: #1565c0;
  --blue-light: #e3f2fd;
  --bg: #eef1f5;
  --card: #ffffff;
  --ink: #16243b;
  --muted: #647189;
  --line: #d7dee8;
  --green: #2e7d32;
  --green-light: #e8f5e9;
  --red: #c62828;
  --red-light: #ffebee;
  --orange: #e0820a;
  --amber: #fb8c00;
  --shadow: 0 2px 10px rgba(13, 43, 94, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ===== Buttons ===== */
.btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #0b3c88; }
.btn-outline { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover { background: var(--blue-light); }
.btn-ghost { background: #eef2f7; color: #3a4a63; }
.btn-ghost:hover { background: #e2e8f1; }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-finish { background: var(--red); color: #fff; }
.btn-finish:hover { background: #a91d1d; }
.btn-lg { font-size: 17px; padding: 15px 28px; }
.btn-block { width: 100%; }

/* ===== Intro ===== */
#screen-intro {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
  background: linear-gradient(160deg, #0a1a33 0%, #123a72 100%);
}
.intro-card {
  background: var(--card);
  max-width: 680px; width: 100%;
  border-radius: 20px;
  padding: 36px 34px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}
.intro-badge {
  display: inline-block;
  background: var(--blue-light); color: var(--navy);
  font-size: 12px; font-weight: 700;
  padding: 5px 12px; border-radius: 20px; margin-bottom: 14px;
}
.intro-title { font-size: 30px; font-weight: 800; letter-spacing: 1px; }
.intro-sub { color: var(--muted); margin-top: 8px; font-size: 15px; }
.intro-spec {
  display: flex; align-items: stretch; justify-content: space-around;
  background: #f6f8fb; border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 8px; margin: 24px 0;
}
.spec-item { display: flex; flex-direction: column; align-items: center; flex: 1; }
.spec-num { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.spec-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.spec-sep { width: 1px; background: var(--line); }
.intro-notes h2 { font-size: 15px; color: var(--navy); margin-bottom: 10px; }
.intro-notes ul { list-style: none; }
.intro-notes li {
  position: relative; padding-left: 22px; margin-bottom: 9px;
  font-size: 13.5px; color: #37474f;
}
.intro-notes li::before {
  content: ""; position: absolute; left: 4px; top: 9px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--blue);
}
.intro-disclaimer { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.7; }
#btn-start { width: 100%; margin-top: 24px; }
.intro-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }

/* ===== Exam ===== */
#screen-exam { display: flex; flex-direction: column; height: 100vh; }
.exam-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy-dark); color: #fff;
  padding: 0 18px; height: 58px; flex-shrink: 0;
}
.exam-name { font-size: 14px; font-weight: 700; opacity: 0.95; }
.exam-header-left, .exam-header-right { flex: 1; }
.exam-header-right { text-align: right; }
.exam-progress { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.exam-timer {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.12); padding: 6px 16px; border-radius: 10px;
}
.timer-label { font-size: 11px; opacity: 0.8; }
.timer-value {
  font-size: 20px; font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
}
.exam-timer.warn { background: rgba(198, 40, 40, 0.9); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.75; } }

.exam-main { flex: 1; overflow-y: auto; padding: 22px 18px 30px; }
.q-wrap { max-width: 760px; margin: 0 auto; }
.q-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.q-no { font-size: 15px; font-weight: 800; color: var(--navy); }
.q-cat {
  font-size: 12px; color: var(--navy); background: var(--blue-light);
  padding: 3px 10px; border-radius: 20px; font-weight: 600;
}
.q-text {
  background: #fff; border-radius: 14px; padding: 20px;
  font-size: 16.5px; font-weight: 500; line-height: 1.8;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.options { list-style: none; }
.option {
  display: flex; align-items: flex-start; gap: 13px;
  background: #fff; border: 2px solid var(--line); border-radius: 12px;
  padding: 15px 16px; margin-bottom: 11px; cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.option:hover { border-color: #9db6d6; }
.option.selected { border-color: var(--navy); background: var(--blue-light); }
.option-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: #eef2f7; color: #546e7a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.option.selected .option-num { background: var(--navy); color: #fff; }
.option-text { font-size: 14.5px; line-height: 1.65; padding-top: 2px; }

.exam-footer {
  flex-shrink: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 12px 18px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.flag-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.flag-toggle input { display: none; }
.flag-box {
  width: 20px; height: 20px; border: 2px solid #b0bcca; border-radius: 5px;
  display: inline-block; position: relative; transition: all 0.12s;
}
.flag-toggle input:checked + .flag-box { background: var(--amber); border-color: var(--amber); }
.flag-toggle input:checked + .flag-box::after {
  content: "✓"; color: #fff; font-size: 14px; font-weight: 900;
  position: absolute; left: 3px; top: -2px;
}
.flag-label { font-size: 13px; color: #4a5a70; font-weight: 600; }
.footer-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.lbl-short { display: none; }

/* ===== Overlays ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 22, 40, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 16px;
}
.overlay-panel {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 86vh; display: flex; flex-direction: column; overflow: hidden;
}
.overlay-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.overlay-head h2 { font-size: 17px; }
.icon-btn {
  border: none; background: #eef2f7; width: 32px; height: 32px; border-radius: 8px;
  font-size: 20px; cursor: pointer; color: #546e7a; line-height: 1;
}
.nav-legend {
  display: flex; flex-wrap: wrap; gap: 14px; padding: 12px 20px;
  font-size: 12px; color: var(--muted);
}
.nav-legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.dot-answered { background: var(--navy); }
.dot-unanswered { background: #eceff3; border: 1px solid var(--line); }
.dot-flag { background: #fff; border: 2px solid var(--amber); }
.dot-current { background: #fff; border: 2px solid var(--green); }
.nav-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px;
  padding: 8px 20px 16px; overflow-y: auto;
}
.nav-cell {
  aspect-ratio: 1; border-radius: 8px; border: none; cursor: pointer;
  background: #eceff3; color: #546e7a; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.nav-cell.answered { background: var(--navy); color: #fff; }
.nav-cell.flag { box-shadow: inset 0 0 0 2.5px var(--amber); }
.nav-cell.current { box-shadow: inset 0 0 0 2.5px var(--green); }
.nav-cell.answered.flag { box-shadow: inset 0 0 0 2.5px var(--amber); }
.overlay-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--line); gap: 12px;
}
.nav-summary { font-size: 13px; color: var(--muted); }

.modal {
  background: #fff; border-radius: 16px; padding: 26px; max-width: 420px; width: 100%;
}
.modal h2 { font-size: 19px; margin-bottom: 10px; }
.modal p { color: #37474f; font-size: 14px; margin-bottom: 20px; line-height: 1.7; }
.modal-btns { display: flex; gap: 12px; }
.modal-btns .btn { flex: 1; }

/* ===== Result ===== */
#screen-result { padding: 28px 16px 50px; }
.result-wrap { max-width: 700px; margin: 0 auto; }
.result-card {
  background: #fff; border-radius: 20px; padding: 30px 24px; text-align: center;
  box-shadow: var(--shadow);
}
.result-badge {
  display: inline-block; padding: 6px 22px; border-radius: 30px;
  font-weight: 800; font-size: 15px; margin-bottom: 14px;
}
.result-card.pass .result-badge { background: var(--green-light); color: var(--green); }
.result-card.fail .result-badge { background: var(--red-light); color: var(--red); }
.result-score { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.score-num { font-size: 68px; font-weight: 800; line-height: 1; }
.result-card.pass .score-num { color: var(--green); }
.result-card.fail .score-num { color: var(--red); }
.score-unit { font-size: 22px; font-weight: 700; color: var(--muted); }
.score-detail { color: var(--muted); margin-top: 8px; font-size: 15px; }
.score-bar {
  position: relative; height: 16px; background: #e6e9ef; border-radius: 8px;
  margin: 20px 0 6px; overflow: visible;
}
.score-bar-fill { height: 100%; border-radius: 8px; transition: width 0.6s ease; }
.result-card.pass .score-bar-fill { background: var(--green); }
.result-card.fail .score-bar-fill { background: var(--red); }
.score-bar-line {
  position: absolute; top: -3px; bottom: -3px; left: 60%; width: 2px; background: var(--navy);
}
.score-line-label { font-size: 11px; color: var(--navy); text-align: right; margin-right: 38%; }
.result-time { font-size: 13px; color: var(--muted); margin-top: 12px; }

.result-cats {
  background: #fff; border-radius: 16px; padding: 18px 20px; margin-top: 16px;
  box-shadow: var(--shadow);
}
.result-cats h3 { font-size: 15px; color: var(--navy); margin-bottom: 14px; }
.cat-row { margin-bottom: 12px; }
.cat-row-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.cat-bar { height: 8px; background: #e6e9ef; border-radius: 4px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 4px; }

.result-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }

.review-list { margin-top: 18px; }
.review-item {
  background: #fff; border-radius: 14px; padding: 16px 18px; margin-bottom: 12px;
  box-shadow: var(--shadow); border-left: 5px solid var(--green);
}
.review-item.wrong { border-left-color: var(--red); }
.review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.review-badge { font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 6px; }
.review-badge.ok { background: var(--green-light); color: var(--green); }
.review-badge.ng { background: var(--red-light); color: var(--red); }
.review-cat { font-size: 11px; color: var(--muted); }
.review-q { font-size: 14.5px; font-weight: 600; line-height: 1.7; margin-bottom: 10px; }
.review-opt {
  font-size: 13.5px; line-height: 1.6; padding: 7px 10px; border-radius: 8px;
  margin-bottom: 6px; display: flex; gap: 8px;
}
.review-opt.correct { background: var(--green-light); }
.review-opt.your-wrong { background: var(--red-light); }
.review-opt .mark { font-weight: 800; flex-shrink: 0; }
.review-exp {
  font-size: 12.5px; line-height: 1.7; color: #37474f; background: #f6f8fb;
  border-radius: 10px; padding: 12px; margin-top: 8px;
}
.review-exp .exp-line { margin-bottom: 6px; }
.review-src { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

@media (max-width: 560px) {
  .exam-name { display: none; }
  .exam-header-left { flex: 0; }
  .nav-grid { grid-template-columns: repeat(6, 1fr); }
  .exam-footer { padding: 10px 12px; gap: 8px; }
  .footer-btns { width: 100%; gap: 7px; }
  .footer-btns .btn { flex: 1; padding: 12px 4px; font-size: 14px; white-space: nowrap; }
  .lbl-full { display: none; }
  .lbl-short { display: inline; }
  .intro-card { padding: 26px 20px; }
  .score-line-label { margin-right: 34%; }
  .level-cards { grid-template-columns: 1fr !important; }
}

/* ===== ドローンLP（資格選択） ===== */
.intro-wide { max-width: 760px; }
.lp-points { margin: 22px 0 8px; display: flex; flex-direction: column; gap: 10px; }
.lp-point {
  display: flex; align-items: flex-start; gap: 12px;
  background: #f6f8fb; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 13.5px; color: #37474f; line-height: 1.6;
}
.lp-ico { font-size: 20px; line-height: 1.3; }
.lp-choose { font-size: 15px; color: var(--navy); margin-top: 24px; margin-bottom: 12px; }
.level-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.level-card {
  font-family: inherit; text-align: left; cursor: pointer;
  background: #fff; border: 2px solid var(--line); border-radius: 16px;
  padding: 18px 18px 16px; transition: border-color 0.15s, transform 0.05s, box-shadow 0.15s;
}
.level-card:hover { border-color: var(--navy); box-shadow: 0 6px 18px rgba(13,71,161,0.12); }
.level-card:active { transform: translateY(1px); }
.level-name { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.level-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.level-spec { font-size: 13.5px; color: var(--ink); margin-top: 12px; }
.level-spec b { color: var(--navy); }
.level-go { font-size: 12.5px; font-weight: 700; color: var(--blue); margin-top: 12px; }

/* ===== 合言葉ゲート ===== */
#screen-gate {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px; background: linear-gradient(160deg, #0a1a33 0%, #123a72 100%);
}
.gate-card {
  background: var(--card); max-width: 420px; width: 100%;
  border-radius: 20px; padding: 34px 30px; text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}
.gate-title { font-size: 26px; font-weight: 800; letter-spacing: 1px; margin-top: 12px; }
.gate-sub { color: var(--muted); margin-top: 8px; font-size: 13.5px; }
.gate-form { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.gate-label { text-align: left; font-size: 13px; font-weight: 700; color: var(--navy); }
.gate-input {
  font-family: inherit; font-size: 16px; padding: 13px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; outline: none; transition: border-color 0.15s;
}
.gate-input:focus { border-color: var(--navy); }
.gate-error { color: var(--red); font-size: 13px; font-weight: 700; margin: 2px 0 0; }
.gate-note { margin-top: 18px; font-size: 11.5px; color: var(--muted); line-height: 1.7; }

/* ===== 直前ポイント ===== */
.points-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.points-btn { width: 100%; }
#screen-points { min-height: 100vh; }
.points-header {
  display: flex; align-items: center; gap: 10px;
  background: var(--navy-dark); color: #fff; padding: 0 16px; height: 56px;
  position: sticky; top: 0; z-index: 10;
}
.points-title { font-size: 16px; font-weight: 700; }
.points-header .icon-btn { background: rgba(255,255,255,0.14); color: #fff; }
.points-main { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; }
.points-lead { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 16px; }
.point-card {
  background: #fff; border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.point-cat {
  font-size: 15px; color: var(--navy); font-weight: 800; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 2px solid var(--blue-light);
}
.point-sub { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 10px 0 6px; }
.point-trap {
  font-size: 13px; color: #37474f; line-height: 1.6; padding-left: 20px; position: relative; margin-bottom: 5px;
}
.point-trap::before { content: "⚠"; position: absolute; left: 0; color: var(--orange); font-size: 12px; }
.point-nums { display: flex; flex-wrap: wrap; gap: 6px; }
.point-num {
  font-size: 12px; color: var(--navy); background: var(--blue-light);
  border-radius: 8px; padding: 4px 9px; line-height: 1.5;
}
.points-foot { text-align: center; font-size: 11px; color: var(--muted); margin-top: 8px; }

@media (max-width: 560px) {
  .points-btns { grid-template-columns: 1fr; }
}

/* ===== 分野別練習 ===== */
.practice-cats { display: flex; flex-direction: column; gap: 10px; }
.practice-tile {
  font-family: inherit; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 15px 16px; transition: border-color 0.15s, box-shadow 0.15s;
}
.practice-tile:hover { border-color: var(--navy); box-shadow: 0 4px 14px rgba(13,71,161,0.1); }
.pt-label { flex: 1; font-size: 15px; font-weight: 700; color: var(--ink); }
.pt-count { font-size: 12.5px; color: var(--muted); }
.pt-go { color: var(--blue); font-weight: 800; }
.option.answered { cursor: default; }
.option.opt-correct { border-color: var(--green) !important; background: var(--green-light) !important; }
.option.opt-correct .option-num { background: var(--green); color: #fff; }
.option.opt-wrong { border-color: var(--red) !important; background: var(--red-light) !important; }
.option.opt-wrong .option-num { background: var(--red); color: #fff; }
.p-explain {
  margin-top: 6px; background: #f6f8fb; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.p-verdict { font-size: 15px; font-weight: 800; margin-bottom: 8px; }
.p-verdict.ok { color: var(--green); }
.p-verdict.ng { color: var(--red); }
.p-exp-title { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.p-exp-line { font-size: 12.5px; line-height: 1.7; color: #37474f; margin-bottom: 6px; display: flex; gap: 6px; }
.p-exp-line.c { color: var(--green); font-weight: 600; }
.p-exp-line b { flex-shrink: 0; }
.p-src { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
