: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;
  --red: #e0443a;
  --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;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--blue); color: #fff; font-weight: 800; font-size: 15px;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.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 .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(210px, 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-card p strong, .tip-card p strong { color: var(--navy); }
.term-icon { font-size: 18px; }

/* ---------- STEP1 重ね図解 ---------- */
.anat-stack {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 26px 18px;
}
.anat-sheet {
  position: relative; width: 130px; height: 90px; border-radius: 8px;
  background: rgba(255,255,255,.75); border: 1.5px solid #bcd2e4;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--navy);
  box-shadow: 0 6px 14px rgba(0,40,80,.12);
}
.anat-sheet.s1 { transform: rotate(-3deg); }
.anat-sheet.s2 { transform: rotate(2deg) translateX(-18px); }
.anat-sheet.s3 { transform: rotate(-1deg) translateX(-36px); }
.anat-tag {
  position: absolute; top: -10px; right: -8px; font-size: 10px; font-weight: 800;
  background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 8px;
}
.anat-tag.bg { position: static; background: var(--green); }
.anat-eye { font-size: 13px; font-weight: 700; color: var(--gray); }
.anat-resultwrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.anat-result {
  position: relative; width: 150px; height: 104px; border-radius: 10px; overflow: hidden;
  border: 1.5px solid var(--navy); box-shadow: 0 6px 14px rgba(0,40,80,.15);
}
.ar-bg { position: absolute; inset: 0; background: linear-gradient(160deg,#9ed8f5 0%,#d6effb 60%,#eaf7fd 100%); }
/* 地面 */
.ar-bg::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 28px; background: #8fce8f; }
.ar-person { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); font-size: 38px; line-height: 1; }
.ar-title {
  position: absolute; top: 10px; left: 0; right: 0; text-align: center;
  font-family: 'Inter',sans-serif; font-weight: 800; color: #fff; font-size: 18px; letter-spacing: .04em;
  text-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.anat-caption {
  font-size: 11px; font-weight: 800; color: #fff; background: var(--green);
  border-radius: 999px; padding: 3px 12px;
}

/* ---------- レイヤーステージ(STEP2/3共通) ---------- */
.order-area { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.order-stage-wrap { flex: 0 0 auto; }
.order-stage {
  position: relative; width: 260px; height: 200px; border-radius: 10px; overflow: hidden;
  border: 1.5px solid var(--line); background:
    repeating-conic-gradient(#eef2f5 0% 25%, #fff 0% 50%) 50% / 22px 22px;
}
.order-caption { text-align: center; font-size: 12px; color: var(--gray); font-weight: 700; margin-top: 6px; }
.order-stage-wrap.ref .order-stage { border-color: var(--green); }

/* レイヤーの絵(重ね順パズル:背景/円/帯/文字) */
.ly { position: absolute; inset: 0; }
.ly-bg-s { background: linear-gradient(135deg,#bfe3f7,#eaf6fd); }
.ly-circle-s::after { content: ''; position: absolute; left: 50%; top: 50%; width: 130px; height: 130px; transform: translate(-50%,-50%); border-radius: 50%; background: radial-gradient(circle at 38% 34%, #4cc2f5, #0077c2); }
.ly-band-s::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 48px; transform: translateY(-50%); background: linear-gradient(90deg,#ff9a3d,#ff7a45); }
.ly-title::after { content: 'LOGO'; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-family: 'Inter',sans-serif; font-weight: 800; font-size: 40px; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.35); letter-spacing: .06em; }

/* りんご(STEP3) */
.ly-bg2 { background: repeating-linear-gradient(45deg,#fff7ec,#fff7ec 14px,#fdefd8 14px,#fdefd8 28px); }
.ly-sketch2::after { content: ''; position: absolute; left: 50%; top: 50%; width: 96px; height: 92px; transform: translate(-46%,-44%); border: 3px dashed #b9b1a6; border-radius: 50% 50% 48% 48%; }
.ly-color2::after { content: ''; position: absolute; left: 50%; top: 50%; width: 96px; height: 92px; transform: translate(-50%,-46%); background: radial-gradient(circle at 38% 34%, #ff7d7d, #e23b3b); border-radius: 50% 50% 48% 48%; }
.ly-line2::after { content: ''; position: absolute; left: 50%; top: 50%; width: 100px; height: 96px; transform: translate(-50%,-46%); border: 3px solid #6e2b1f; border-radius: 50% 50% 48% 48%; }
.ly-line2::before { content: '🍃'; position: absolute; left: 54%; top: 26px; font-size: 22px; z-index: 2; }

/* ---------- レイヤーパネル ---------- */
.order-panel-wrap { flex: 1; min-width: 240px; }
.order-panel-wrap.wide { min-width: 300px; }
.lp-head {
  background: #e8edf1; border: 1px solid var(--line); border-bottom: none;
  border-radius: 8px 8px 0 0; padding: 7px 14px; font-size: 12px; font-weight: 800; color: var(--navy);
}
.layer-panel { border: 1px solid var(--line); border-radius: 0 0 8px 8px; overflow: hidden; background: #fff; }
.lp-hint { font-size: 11.5px; color: var(--gray); margin: 7px 2px 0; }

.lrow {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fff;
  font-size: 13px; font-weight: 700; color: var(--ink);
}
.lrow:last-child { border-bottom: none; }
.lrow.dragging { opacity: .5; background: var(--blue-soft); }
.lrow.drop-target { box-shadow: inset 0 2px 0 var(--blue); }
.lrow .lr-handle { cursor: grab; color: #9fb0bd; font-size: 16px; touch-action: none; }
.lrow .lr-swatch { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line); flex-shrink: 0; }
.lrow .lr-name { flex: 1; }
.lrow .lr-btn {
  border: none; background: none; cursor: pointer; font-size: 16px; line-height: 1;
  padding: 3px; border-radius: 5px; opacity: .85;
}
.lrow .lr-btn:hover { background: var(--bg); opacity: 1; }
.lrow .lr-btn.off { opacity: .3; }
.lrow.is-locked { background: #f4f6f8; }
.lrow input[type="range"] { width: 78px; accent-color: var(--blue); }
.lrow .lr-op { font-size: 11px; color: var(--gray); width: 34px; text-align: right; font-family: 'Inter',sans-serif; }

/* ---------- ミッション ---------- */
.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); }

/* ---------- STEP4 クリッピング ---------- */
.clip-demo { display: flex; gap: 18px; align-items: stretch; flex-wrap: wrap; }
.clip-stage {
  flex: 1; min-width: 280px; min-height: 220px; border-radius: 12px;
  border: 1.5px solid var(--line); background:
    repeating-conic-gradient(#eef2f5 0% 25%, #fff 0% 50%) 50% / 22px 22px;
  display: flex; align-items: center; justify-content: center; position: relative; padding: 20px;
}
.clip-off, .clip-on { position: relative; width: 100%; height: 180px; display: flex; align-items: center; justify-content: center; }
.clip-off[hidden], .clip-on[hidden] { display: none; }
.clip-photo {
  position: absolute; width: 240px; height: 110px; border-radius: 8px;
  background: linear-gradient(120deg,#ff9a3d,#ff5d8f 40%,#8a5cff 75%,#2ec5ff);
}
.clip-shape-text {
  position: relative; font-family: 'Inter',sans-serif; font-weight: 800; font-size: 84px;
  color: transparent; -webkit-text-stroke: 2px #003a73; text-stroke: 2px #003a73;
}
.clip-clipped {
  font-family: 'Inter',sans-serif; font-weight: 800; font-size: 84px;
  background: linear-gradient(120deg,#ff9a3d,#ff5d8f 40%,#8a5cff 75%,#2ec5ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.clip-label {
  position: absolute; bottom: -2px; left: 0; right: 0; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--gray);
}
.clip-side { flex: 0 0 250px; display: flex; flex-direction: column; gap: 12px; }
.clip-layers { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.clip-layer { padding: 12px 14px; font-size: 13px; font-weight: 700; color: var(--ink); }
.clip-layer small { display: block; font-size: 11px; font-weight: 500; color: var(--gray); }
.clip-layer.top { background: #fff; border-bottom: 1px solid var(--line); }
.clip-layer.bottom { background: var(--bg); }
.clip-note { font-size: 13px; color: var(--gray); margin: 0; line-height: 1.7; }

/* ---------- toolbar / result / kbd / table / note(共通) ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.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-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #e8642f; border-color: #e8642f; 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; max-width: 90vw; text-align: center;
}
.toast[hidden] { display: none; }

.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; }

/* ---------- ページ送りナビ ---------- */
.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%; }
}

@media (max-width: 700px) {
  .hero h1 { font-size: 27px; }
  .lesson { padding: 24px 18px; }
  .header-inner { flex-direction: column; height: auto; padding: 10px 20px; gap: 4px; }
  .status { margin-left: 0; width: 100%; }
  .order-area { flex-direction: column; }
  .order-stage, .order-stage-wrap { width: 100%; }
  .order-stage { width: 100%; }
  .clip-side { flex-basis: 100%; }
}
