:root {
  --navy: #003a73;
  --navy-dark: #002a54;
  --blue: #009fe6;
  --blue-soft: #e3f4fd;
  --ink: #1c2b36;
  --gray: #5b6b78;
  --line: #dde5ec;
  --bg: #f5f8fa;
  --white: #ffffff;
  --accent: #ff7a45;
  --green: #2bb673;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0, 42, 84, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.8;
}

.container { max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* ---------- header / hero(シリーズ共通) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--navy);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.header-inner {
  max-width: 980px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  height: 58px;
}
.logo { color: #fff; font-weight: 900; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; border-radius: 8px; padding: 0 5px;
  background: var(--blue); color: #fff; font-weight: 800; font-size: 12px;
  font-family: 'Inter', sans-serif;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: #cfe3f5; text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; transition: .15s;
}
.nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.nav { align-items: center; }
.nav .nav-home { background: rgba(255,255,255,.14); color: #fff; font-weight: 700; border: 1px solid rgba(255,255,255,.25); }
.nav .nav-home:hover { background: var(--blue); border-color: var(--blue); }

.hero {
  background: linear-gradient(135deg, var(--navy) 0%, #00518f 70%, #0070b8 100%);
  color: #fff; padding: 64px 0 56px;
}
.hero-eyebrow {
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 12px;
  letter-spacing: .22em; color: #7fd0f5; margin: 0 0 10px;
}
.hero h1 { font-size: 40px; font-weight: 900; margin: 0 0 16px; letter-spacing: .02em; }
.hero-lead { font-size: 15px; color: #d7e7f5; margin: 0 0 28px; }
.hero-lead strong { color: #fff; }
.hero-steps { display: flex; gap: 10px; flex-wrap: wrap; }
.step-chip {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3);
  color: #fff; text-decoration: none; font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: 999px; transition: .15s;
}
.step-chip:hover { background: var(--blue); border-color: var(--blue); }

/* ---------- lesson(共通) ---------- */
.lesson {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 36px 36px 32px; margin: 36px 0;
}
.lesson-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.step-badge {
  background: var(--blue); color: #fff;
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: 12px;
  letter-spacing: .08em; padding: 4px 12px; border-radius: 999px;
}
.lesson h2 { font-size: 24px; font-weight: 900; color: var(--navy); margin: 0; }
.lesson-desc { color: var(--gray); font-size: 14.5px; margin: 10px 0 20px; }
.lesson-desc strong { color: var(--navy); }
.sub-head { color: var(--navy); font-size: 17px; margin: 32px 0 12px; }

.term-grid, .tips-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin-top: 20px;
}
.term-card, .tip-card {
  background: var(--bg); border-radius: 10px; padding: 18px 18px 14px;
  border: 1px solid var(--line);
}
.term-card h3, .tip-card h3 { font-size: 14.5px; color: var(--navy); margin: 6px 0 6px; }
.term-card p, .tip-card p { font-size: 13px; color: var(--gray); margin: 0; line-height: 1.7; }
.term-icon { font-size: 18px; }

/* ---------- STEP1 ファイル名図解 ---------- */
.filename-diagram {
  display: flex; align-items: flex-start; justify-content: center; gap: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 44px 16px 56px; flex-wrap: wrap;
}
.fn-part {
  position: relative; font-family: 'Inter', 'Noto Sans JP', sans-serif;
  font-size: 26px; font-weight: 700; padding: 8px 14px; border-radius: 8px;
}
.fn-name { background: #fff; border: 2px solid var(--line); color: var(--ink); }
.fn-dot { color: var(--gray); padding: 8px 2px; }
.fn-ext { background: #fdf0ed; border: 2px solid #d9534a; color: #d9534a; }
.fn-label {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(100% + 8px);
  font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--gray);
}
.fn-ext .fn-label { color: #d9534a; }
.fn-dot .fn-label { top: auto; bottom: calc(100% + 8px); }

.ext-table .ext-chip {
  display: inline-block; background: var(--navy); color: #fff;
  font-family: 'Inter', sans-serif; font-weight: 700; font-size: 12px;
  border-radius: 6px; padding: 1px 8px; margin: 2px 4px 2px 8px;
}
.ext-table .ext-chip:first-child { margin-left: 0; }

/* ---------- STEP1 マッチングゲーム ---------- */
.chip-tray {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: var(--bg); border: 1px dashed var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 14px; min-height: 64px;
}
.drag-chip {
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: 16px;
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 7px 20px; cursor: grab; user-select: none; -webkit-user-select: none;
  box-shadow: 0 3px 8px rgba(232,100,47,.3); touch-action: none;
}
.drag-chip.is-used { display: none; }
.match-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.match-card {
  border: 2px dashed var(--line); border-radius: 12px; padding: 16px 10px 14px;
  text-align: center; transition: .15s; background: #fff;
}
.match-card .m-icon { font-size: 40px; line-height: 1.2; }
.match-card .m-label { font-size: 12.5px; font-weight: 700; color: var(--gray); margin-top: 4px; }
.match-card .m-ext {
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: 14px;
  color: #c3ced6; margin-top: 6px; min-height: 22px;
}
.match-card.is-over { border-color: var(--accent); background: #fff4ec; }
.match-card.is-done { border: 2px solid var(--green); background: #f2fbf6; }
.match-card.is-done .m-ext { color: #1d7a4d; }
.drag-ghost {
  position: fixed; z-index: 999; pointer-events: none; opacity: .85;
  transform: translate(-50%, -50%);
}

.practice-done {
  margin-top: 16px; background: #f2fbf6; border: 1.5px solid var(--green);
  border-radius: 10px; padding: 14px 20px; font-size: 14.5px; font-weight: 700; color: #1d7a4d;
}
.practice-done[hidden] { display: none; }

/* ---------- STEP2 容量ラダー ---------- */
.size-ladder {
  display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.size-rung {
  flex: 1; min-width: 130px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: #fff; text-align: center;
}
.size-rung .size-unit {
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: 22px;
  background: var(--navy); color: #fff; padding: 6px 0;
}
.size-rung:nth-child(3) .size-unit { background: #00518f; }
.size-rung:nth-child(5) .size-unit { background: #0070b8; }
.size-rung:nth-child(7) .size-unit { background: var(--blue); }
.size-rung .size-ex { font-size: 12px; color: var(--gray); padding: 10px 6px; line-height: 1.7; }
.size-x {
  font-size: 11px; font-weight: 800; color: var(--accent);
  align-self: center; white-space: nowrap;
}

/* ---------- クイズ共通 ---------- */
.quiz-box {
  border: 2px solid var(--line); border-radius: 14px; background: #fff;
  padding: 26px 28px;
}
.quiz-progress {
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 13px; color: var(--gray);
  margin-bottom: 12px;
}
.quiz-q { font-size: 17px; font-weight: 900; color: var(--navy); margin-bottom: 16px; line-height: 1.7; }
.quiz-q .q-icon { font-size: 26px; margin-right: 6px; }
.quiz-opts { display: flex; flex-direction: column; gap: 9px; }
.quiz-opt {
  text-align: left; font-family: inherit; font-size: 14.5px; font-weight: 700;
  background: var(--bg); color: var(--ink);
  border: 2px solid var(--line); border-radius: 10px; padding: 11px 18px;
  cursor: pointer; transition: .12s;
}
.quiz-opt:hover { border-color: var(--blue); background: var(--blue-soft); }
.quiz-opt.is-correct { border-color: var(--green); background: #f2fbf6; color: #1d7a4d; }
.quiz-opt.is-wrong { border-color: #e0443a; background: #fdf0ef; color: #b3372f; }
.quiz-opt:disabled { cursor: default; }
.quiz-opt .opt-file { font-family: 'Inter', 'Noto Sans JP', sans-serif; }
.quiz-note {
  margin-top: 14px; background: var(--blue-soft); border-radius: 10px;
  padding: 12px 16px; font-size: 13.5px; color: var(--navy); font-weight: 500;
}
.quiz-note[hidden] { display: none; }
.quiz-next { margin-top: 14px; }
.quiz-final { text-align: center; padding: 10px 0; }
.quiz-final .qf-score {
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: 50px; color: var(--navy);
}
.quiz-final .qf-score small { font-size: 18px; }
.quiz-final p { margin: 6px 0 14px; font-weight: 900; color: var(--navy); }

/* ---------- STEP4 zipシミュレーター ---------- */
.mission-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.mission {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; font-weight: 500; color: var(--gray);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px;
}
.mission.is-done { color: #1d7a4d; background: #f2fbf6; border-color: #bfe8d2; }
.mission.is-current { border-color: var(--blue); background: var(--blue-soft); color: var(--navy); font-weight: 700; }
.mission-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--line); color: #fff; font-size: 12px; font-weight: 800;
  font-family: 'Inter', sans-serif;
}
.mission.is-current .mission-num { background: var(--blue); }
.mission.is-done .mission-num { background: var(--green); }

.sim {
  border-radius: 12px; overflow: hidden; border: 1px solid var(--line);
  background: linear-gradient(160deg, #7db8e8 0%, #a8cef0 55%, #d6e7f7 100%);
  padding: 18px;
}
.sim-window {
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,30,60,.25);
}
.sim-titlebar {
  display: flex; align-items: center; gap: 7px;
  background: #e8e8e8; padding: 8px 12px; font-size: 12.5px;
}
.tl-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.tl-dot.red { background: #ff5f57; } .tl-dot.yellow { background: #febc2e; } .tl-dot.green { background: #28c840; }
.tl-title { font-weight: 700; color: #444; margin-left: 6px; }
.sim-action {
  margin-left: auto; border: none; background: var(--navy); color: #fff;
  border-radius: 6px; font-size: 12px; font-weight: 700; padding: 4px 12px; cursor: pointer;
}
.sim-action:hover { background: var(--navy-dark); }
.sim-action:disabled { background: #c3ced6; cursor: default; }
.sim-body {
  min-height: 250px; padding: 16px;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px;
  user-select: none; -webkit-user-select: none;
}
.file-icon {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 104px; padding: 10px 4px 7px; border-radius: 10px;
  font-size: 38px; line-height: 1.1; text-align: center;
  cursor: default; border: 2px solid transparent;
}
.file-icon span {
  font-size: 11.5px; font-weight: 500; color: var(--ink);
  line-height: 1.4; border-radius: 4px; padding: 0 5px; word-break: break-all;
}
.file-icon.is-selected { background: var(--blue-soft); border-color: var(--blue); }
.file-icon.is-selected span { background: var(--blue); color: #fff; }
.file-icon.pop { animation: pop .3s; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ---------- toolbar / result / table / note(共通) ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  padding: 9px 18px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--navy); transition: .15s;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); color: #fff; }
.btn-ghost { border-color: transparent; color: var(--gray); }
.status { font-size: 13px; color: var(--gray); margin-left: auto; }

.result[hidden] { display: none; }
.result {
  margin-top: 16px; display: flex; align-items: center; gap: 24px;
  background: #f2fbf6; border: 1.5px solid var(--green);
  border-radius: var(--radius); padding: 20px 28px;
}
.result-body p { margin: 0; font-weight: 900; color: var(--navy); font-size: 17px; }
.result-detail { font-size: 13px !important; color: var(--gray) !important; margin-top: 4px !important; font-weight: 500 !important; }

.kbd {
  display: inline-block; background: var(--navy); color: #fff;
  font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 6px; white-space: nowrap;
}
.shortcut-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.shortcut-table th, .shortcut-table td {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.shortcut-table th { background: var(--bg); color: var(--navy); font-size: 12.5px; }

.note {
  margin-top: 18px; background: #fff8f0; border: 1px solid #ffd9bd;
  border-radius: 10px; padding: 16px 20px; font-size: 13.5px; color: #6b4a2f;
}

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--navy); color: #fff; font-size: 13.5px; font-weight: 700;
  padding: 10px 22px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  z-index: 1000; transition: opacity .3s;
}
.toast[hidden] { display: none; }
.ctx-menu {
  position: fixed; z-index: 1001; min-width: 180px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 5px;
}
.ctx-menu[hidden] { display: none; }
.ctx-item {
  display: block; width: 100%; text-align: left; border: none; background: none;
  font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 5px; cursor: pointer;
}
.ctx-item:hover { background: var(--blue); color: #fff; }

.site-footer {
  background: var(--navy); color: #9fc0dd; text-align: center;
  padding: 24px 20px; font-size: 12.5px; margin-top: 48px;
}
.site-footer p { margin: 0; }

@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .lesson { padding: 24px 18px; }
  .header-inner { flex-direction: column; height: auto; padding: 10px 20px; gap: 4px; }
  .status { margin-left: 0; width: 100%; }
  .fn-part { font-size: 16px; }
  .filename-diagram { padding-bottom: 70px; }
  .size-x { width: 100%; text-align: center; }
  .file-icon { width: 88px; font-size: 32px; }
}

/* ---------- ページ送りナビ ---------- */
.page-nav { display: flex; gap: 12px; align-items: stretch; margin: 44px auto 0; }
.pgnav { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 3px;
  text-decoration: none; background: #fff; border: 1.5px solid #dde5ec;
  border-radius: 12px; padding: 14px 18px; transition: .15s; box-shadow: 0 2px 12px rgba(0,42,84,.08); }
.pgnav:hover { border-color: #009fe6; transform: translateY(-2px); }
.pgnav.prev { text-align: left; }
.pgnav.next { text-align: right; }
.pgnav.top { flex: 0 0 130px; text-align: center; background: #003a73; border-color: #003a73; }
.pgnav.top .pgnav-dir, .pgnav.top .pgnav-name { color: #fff; }
.pgnav.top:hover { background: #002a54; border-color: #002a54; }
.pgnav-dir { font-size: 12px; font-weight: 700; color: #ff7a45; }
.pgnav-name { font-size: 14px; font-weight: 900; color: #003a73; }
.pgnav.is-disabled { visibility: hidden; }
@media (max-width: 560px) {
  .page-nav { flex-wrap: wrap; }
  .pgnav.top { order: -1; flex-basis: 100%; }
}
