/* ============================================================
   lesson.css — ドット絵こうざ 共通スタイル
   小学2〜3年生向け：大きなフォント・広い余白・楽しいデザイン
   ============================================================ */

/* ── リセット & ベース ──────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --accent:   #4f46e5;
  --yellow:   #f59e0b;
  --green:    #10b981;
  --red:      #ef4444;
  --orange:   #f97316;
  --pink:     #ec4899;

  --dark:     #0f172a;
  --guide-bg: #f0f4ff;
  --card:     #ffffff;
  --border:   #dde4f5;
  --text:     #1e293b;
  --muted:    #5a6a8a;

  --font-px:  'Press Start 2P', monospace;
  --font-bd:  'Zen Kaku Gothic New', 'M PLUS Rounded 1c', sans-serif;
  --font-tx:  'Zen Kaku Gothic New', 'M PLUS Rounded 1c', sans-serif;

  /* セクションアイコン：基調インディゴで統一（多色をやめ視覚ノイズを減らす） */
  --c1: #6366f1;
  --c2: #6366f1;
  --c3: #6366f1;
  --c4: #6366f1;
  --c5: #6366f1;
  --c6: #6366f1;
  --c7: #6366f1;
  --c8: #6366f1;
  --cbonus: #8b5cf6;  /* チャレンジだけ少しだけ差し色 */
}

body {
  font-family: var(--font-bd);
  background: var(--dark);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  font-size: 16px; /* ベースフォントを大きく */
}

/* ── トップバー ─────────────────────────── */
.topbar {
  height: 56px;
  background: linear-gradient(90deg, #1e1b4b 0%, #312e81 100%);
  border-bottom: 3px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  position: relative;
  z-index: 200;
  flex-shrink: 0;
}
.tb-badge {
  font-family: var(--font-px);
  font-size: 7px;
  color: #a5b4fc;
  background: rgba(79,70,229,.35);
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid rgba(165,180,252,.2);
  white-space: nowrap;
}
.tb-title {
  font-weight: 900;
  font-size: 17px;
  color: #fff;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* スター */
.tb-stars { display: flex; gap: 3px; align-items: center; }
.star {
  font-size: 20px;
  color: #475569;
  transition: color .3s, transform .3s, filter .3s;
  line-height: 1;
  user-select: none;
}
.star.lit {
  color: var(--yellow);
  filter: drop-shadow(0 0 6px rgba(245,158,11,1));
}
@keyframes starPop {
  0%   { transform: scale(0) rotate(-40deg); }
  60%  { transform: scale(1.6) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}
.star.popping { animation: starPop .45s ease forwards; }

/* タイマー */
.tb-timer {
  font-family: var(--font-px);
  font-size: 13px;
  color: #4ade80;
  background: rgba(0,0,0,.4);
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid rgba(74,222,128,.3);
  min-width: 88px;
  text-align: center;
  transition: color .3s, border-color .3s;
}
.tb-timer.warn  { color: #fbbf24; border-color: rgba(251,191,36,.3); }
.tb-timer.alert { color: #f87171; border-color: rgba(248,113,113,.3); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .5; } }

/* ナビ */
.tb-nav { display: flex; gap: 5px; }
.tb-nav-btn {
  font-family: var(--font-px);
  font-size: 7px;
  padding: 4px 9px;
  border-radius: 4px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.5);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.1);
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.tb-nav-btn:hover  { background: rgba(255,255,255,.2); color: #fff; }
.tb-nav-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── メインレイアウト ───────────────────── */
.layout {
  display: flex;
  height: calc(100vh - 56px);
}

/* エディタパネル */
.editor-panel {
  flex: 0 0 0%;          /* 初期状態：幅0（非表示）*/
  width: 0;
  background: #0a0f1e;
  overflow: hidden;
  position: relative;
  transition: flex-basis .4s cubic-bezier(.4,0,.2,1),
              width .4s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}
.editor-panel.is-open {
  flex: 0 0 68%;         /* 開いた状態：68%（ガイドを狭めて作業域を広く） */
  width: auto;
}
.editor-panel iframe {
  width: 100%; height: 100%;
  border: none; display: block;
  opacity: 0;
  transition: opacity .3s .2s; /* 少し遅れてフェードイン */
}
.editor-panel.is-open iframe {
  opacity: 1;
}
.editor-label {
  position: absolute;
  top: 8px; left: 8px;
  font-family: var(--font-px);
  font-size: 7px;
  color: rgba(255,255,255,.35);
  pointer-events: none;
}

/* リサイザー：エディタが閉じているときは非表示 */
#resizer {
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
#resizer.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ガイドパネル */
.guide-panel {
  flex: 1;
  background: var(--guide-bg);
  display: flex;
  flex-direction: column;
  border-left: 4px solid var(--accent);
  overflow: hidden;
  min-width: 300px;
  transition: padding .4s cubic-bezier(.4,0,.2,1);
  position: relative;
}

/* エディタが閉じているとき：コンテンツを中央寄せ・最大幅制限 */
.editor-closed .guide-panel {
  border-left: none;
  background: var(--guide-bg);
  align-items: stretch;  /* 子要素はstretched、中央寄せはmargin:autoで */
}

.editor-closed .guide-sticky {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  border-radius: 0 0 14px 14px;
  border: 1px solid var(--border);
  border-top: none;
  box-sizing: border-box;
}

.editor-closed .guide-scroll {
  width: 100%;
}

.editor-closed .guide-content {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 32px;
  box-sizing: border-box;
}

/* エディタ閉じ時：完了ボタンの横幅を制限 */
.editor-closed .btn-wrap {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

/* エディタ閉じ時：背景を少し落ち着いたトーンに */
.editor-closed {
  background: #e8edf8;
}

/* ── プログレスバー sticky ──────────────── */
.guide-sticky {
  background: white;
  border-bottom: 2px solid var(--border);
  padding: 10px 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79,70,229,.08);
  position: relative;
  z-index: 100;
}
.prog-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 900;
  color: var(--muted);
  margin-bottom: 6px;
}
.prog-row .pct { color: var(--accent); }
.progbar { height: 10px; background: #dde4f5; border-radius: 99px; overflow: hidden; }
.progfill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6, #ec4899);
  border-radius: 99px;
  width: 0%;
  transition: width .6s cubic-bezier(.34,1.56,.64,1);
}

/* ── 進捗バーヘッダー（ハンバーガー＋進捗） ──── */
.prog-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sec-menu-btn {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.sec-menu-btn:hover { background: #eef2ff; transform: translateY(-1px); }
.prog-main { flex: 1; min-width: 0; }

/* ── セクションドロワー（もくじ） ───────────── */
.sec-drawer {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.22);
  border: 1px solid var(--border);
  z-index: 200;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.sec-drawer.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.sec-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.15);
  z-index: 199;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.sec-drawer-overlay.show { opacity: 1; pointer-events: auto; }
.sec-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  font-size: 14px; font-weight: 900; color: var(--text);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; border-radius: 16px 16px 0 0;
}
.sec-drawer-head i { color: var(--accent); margin-right: 6px; }
.sec-drawer-close {
  width: 28px; height: 28px; border-radius: 8px; border: none;
  background: #f1f5f9; color: #64748b; font-size: 17px; cursor: pointer;
}
.sec-drawer-list { padding: 8px; }
.sec-link {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: none; background: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
  opacity: .55;
}
.sec-link:hover { background: #f5f7ff; }
.sec-link-ico {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 8px;
  background: #eef2ff;
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.sec-link-label { flex: 1; font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; }
.sec-link-time {
  flex-shrink: 0; font-size: 11px; color: var(--muted); font-weight: 700;
  white-space: nowrap;
}
.sec-link-time i { margin-right: 2px; }
.sec-link-check { flex-shrink: 0; color: var(--green); font-size: 15px; opacity: 0; }
/* 完了したセクション */
.sec-link.done { opacity: 1; }
.sec-link.done .sec-link-ico { background: #f0fdf4; color: var(--green); }
.sec-link.done .sec-link-check { opacity: 1; }
/* 現在地 */
.sec-link.current { opacity: 1; background: #eef2ff; }
.sec-link.current .sec-link-ico { background: var(--accent); color: #fff; }

/* ── 常時表示ミニレーダー ─────────────────── */
.mini-skill {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: #fff;
}
.mini-skill-toggle {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  background: #f8faff;
  border: none;
  cursor: pointer;
  font-family: var(--font-bd);
  font-weight: 900; font-size: 13px; color: var(--text);
}
.mini-skill-toggle > i:first-child { color: var(--accent); }
.mini-skill-caret { margin-left: auto; color: var(--muted); font-size: 11px; transition: transform .2s; }
.mini-skill-body {
  max-height: 200px;
  overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
  display: flex; justify-content: center;
  padding: 4px 0 8px;
}
.mini-skill-body.collapsed { max-height: 0; padding: 0; }
.mini-radar { width: 200px; height: auto; }

/* ── スクロールコンテンツ ───────────────── */
.guide-scroll { overflow-y: auto; flex: 1; }
.guide-scroll::-webkit-scrollbar { width: 6px; }
.guide-scroll::-webkit-scrollbar-track { background: var(--guide-bg); }
.guide-scroll::-webkit-scrollbar-thumb { background: #bcc8e8; border-radius: 99px; }
.guide-content { padding: 18px 16px; }

/* ── イントロブロック ───────────────────── */
.intro-block {
  background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 100%);
  border-radius: 20px;
  padding: 22px 20px;
  margin-bottom: 20px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(79,70,229,.35);
}
.intro-block::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  pointer-events: none;
}
.intro-block::after {
  content: '';
  position: absolute;
  bottom: -50px; left: -20px;
  width: 140px; height: 140px;
  background: rgba(255,255,255,.03);
  border-radius: 50%;
  pointer-events: none;
}
.intro-tag {
  font-family: var(--font-px);
  font-size: 7px;
  background: rgba(255,255,255,.18);
  border-radius: 6px;
  padding: 4px 10px;
  display: inline-block;
  margin-bottom: 10px;
  letter-spacing: .05em;
}
.intro-h {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 12px;
  line-height: 1.4;
}
.intro-p {
  font-size: 16px;
  line-height: 2;
  opacity: .95;
}
.intro-p strong { color: #fde68a; }

/* ── クイズ ─────────────────────────────── */
.quiz-box {
  background: rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 18px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.15);
}
.quiz-q    { font-weight: 900; font-size: 17px; margin-bottom: 14px; line-height: 1.6; }
.quiz-opts { display: flex; gap: 10px; flex-wrap: wrap; }
.quiz-btn {
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 12px;
  padding: 10px 20px;
  color: white;
  font-family: var(--font-bd);
  font-weight: 900;
  font-size: 18px;
  cursor: pointer;
  transition: transform .15s, background .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.quiz-btn:hover  { background: rgba(255,255,255,.3); transform: scale(1.06) translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.quiz-btn:disabled { cursor: default; }
.quiz-btn.correct { background: #10b981; border-color: #10b981; box-shadow: 0 4px 12px rgba(16,185,129,.5); }
.quiz-btn.wrong   { background: #ef4444; border-color: #ef4444; }
.quiz-result { margin-top: 12px; font-weight: 900; font-size: 16px; line-height: 1.6; }

/* ── セクション枠 ───────────────────────── */
.sec-wrap {
  background: var(--card);
  border-radius: 20px;
  margin-bottom: 18px;
  overflow: hidden;
  border: 2px solid var(--border);
  transition: border-color .4s, box-shadow .4s, opacity .4s, filter .4s;
  box-shadow: 0 2px 10px rgba(79,70,229,.06);
  /* 未完はわずかにトーンを落として「これから感」を出す */
  opacity: .66;
  filter: saturate(.7);
}
/* 現在見ている／到達済みのセクションは通常表示 */
.sec-wrap.active,
.sec-wrap.done {
  opacity: 1;
  filter: none;
}
.sec-wrap.active {
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(79,70,229,.14);
}
.sec-wrap.done {
  border-color: var(--green);
  box-shadow: 0 2px 12px rgba(16,185,129,.15);
}

.sec-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(90deg, #eef2ff, #f5f3ff);
  border-bottom: 2px solid var(--border);
}
.sec-header.bonus-hd { background: linear-gradient(90deg,#fefce8,#fff7ed); }

.sec-ico {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
}
.sec-ico.c1 { background: var(--c1); }
.sec-ico.c2 { background: var(--c2); }
.sec-ico.c3 { background: var(--c3); }
.sec-ico.c4 { background: var(--c4); }
.sec-ico.c5 { background: var(--c5); }
.sec-ico.c6 { background: var(--c6); }
.sec-ico.c7 { background: var(--c7); }
.sec-ico.c8 { background: var(--c8); }
.sec-ico.cbonus { background: var(--cbonus); }

.sec-txt    { flex: 1; min-width: 0; }
.sec-lbl    { font-family: var(--font-px); font-size: 7px; color: var(--muted); margin-bottom: 4px; }
.sec-nm     { font-weight: 900; font-size: 17px; line-height: 1.4; color: var(--text); }
.sec-min    { font-size: 13px; color: var(--muted); white-space: nowrap; margin-top: 2px; }

.sec-badge {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: #ccc;
  font-size: 16px;
  transition: all .3s;
  flex-shrink: 0;
}
.sec-badge.ok { background: var(--green); border-color: var(--green); color: white; box-shadow: 0 2px 8px rgba(16,185,129,.4); }
@keyframes badgePop { 0%{transform:scale(0)} 60%{transform:scale(1.5)} 100%{transform:scale(1)} }
.sec-badge.popping { animation: badgePop .4s cubic-bezier(.34,1.56,.64,1) forwards; }

/* ── ステップカード ─────────────────────── */
.step-card {
  padding: 20px 18px;
  border-bottom: 2px dashed #e8edfa;
  position: relative;
}
.step-card:last-of-type { border-bottom: none; }

.step-h { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.step-num {
  width: 28px; height: 28px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-px);
  font-size: 8px;
  flex-shrink: 0;
  margin-top: 3px;
  box-shadow: 0 2px 6px rgba(79,70,229,.4);
}
.step-title { font-weight: 900; font-size: 17px; line-height: 1.5; color: var(--text); }
.step-desc  { font-size: 15px; color: var(--muted); line-height: 2; margin: 8px 0 12px; }

/* サブステップ */
.substeps {
  border: 2px solid #dde4f5;
  border-radius: 16px;
  overflow: hidden;
  margin: 12px 0;
  background: #f8faff;
}
.substep {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 2px dashed #e8edfa;
  transition: background .2s;
}
.substep:hover { background: #eef2ff; }
.substep:last-child { border-bottom: none; }

.ss-num {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 900;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 2px 6px rgba(79,70,229,.35);
}
.ss-num.done-num { background: var(--green); box-shadow: 0 2px 6px rgba(16,185,129,.35); }
.ss-body  { flex: 1; }
.ss-title { font-weight: 900; font-size: 15px; margin-bottom: 5px; line-height: 1.6; color: var(--text); }
.ss-desc  { font-size: 14px; color: var(--muted); line-height: 1.8; }

/* ── ノート・ヒント ─────────────────────── */
.note {
  border-left: 5px solid #3b82f6;
  background: linear-gradient(135deg,#eff6ff,#eef2ff);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  font-size: 15px;
  color: #1e40af;
  line-height: 1.9;
  margin: 12px 0;
}
.tip {
  border-left: 5px solid var(--yellow);
  background: linear-gradient(135deg,#fefce8,#fff7ed);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  font-size: 15px;
  color: #78350f;
  line-height: 1.9;
  margin: 12px 0;
}

/* ── 画像プレースホルダー ───────────────── */
.img-ph {
  background: linear-gradient(135deg,#f1f5f9,#e8edfa);
  border: 2px dashed #bcc8e8;
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  margin: 12px 0;
}
.img-ph i      { font-size: 30px; display: block; margin-bottom: 8px; opacity: .4; }
.img-ph p      { font-size: 13px; color: #94a3b8; }
.img-ph strong { font-size: 14px; display: block; margin-bottom: 4px; }

/* ── アコーディオン補足 ─────────────────── */
details.supp {
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin: 12px 0;
}
details.supp summary {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 900;
  color: var(--muted);
  background: #f5f7ff;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .2s;
}
details.supp summary:hover { background: #eef2ff; }
details.supp summary::-webkit-details-marker { display: none; }
details.supp summary::before { content: '▶'; font-size: 10px; color: var(--accent); }
details.supp[open] summary::before { content: '▼'; }
.supp-body { padding: 14px 16px; font-size: 14px; line-height: 1.9; color: var(--muted); background: white; }

/* ── 完了ボタン ─────────────────────────── */
.btn-wrap { padding: 18px; }
.done-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--green), #059669);
  color: white;
  font-family: var(--font-bd);
  font-weight: 900;
  font-size: 19px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 6px 18px rgba(16,185,129,.4);
  letter-spacing: .02em;
}
.done-btn:hover  { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16,185,129,.5); }
.done-btn:active { transform: translateY(0); }
.done-btn.completed {
  background: linear-gradient(135deg,#94a3b8,#64748b);
  box-shadow: none;
  cursor: default;
}
.done-btn.completed:hover { transform: none; }
.chal-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 6px 18px rgba(245,158,11,.4);
}
.chal-btn:hover { box-shadow: 0 10px 24px rgba(245,158,11,.5); }

/* ── 完了オーバーレイ ───────────────────── */
#comp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.comp-card {
  background: white;
  border-radius: 24px;
  padding: 40px 40px;
  text-align: center;
  max-width: 480px;
  width: 92%;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
@keyframes popIn { from{transform:scale(.4) rotate(-5deg);opacity:0} to{transform:scale(1) rotate(0);opacity:1} }
.comp-card { animation: popIn .45s cubic-bezier(.34,1.56,.64,1); }
.comp-emoji { font-size: 64px; margin-bottom: 12px; }
.comp-title { font-size: 26px; font-weight: 900; margin-bottom: 8px; color: var(--text); }
.comp-stars { font-size: 34px; letter-spacing: 5px; margin: 10px 0 14px; color: var(--yellow); }
.comp-msg   { font-size: 16px; color: var(--muted); line-height: 1.9; margin-bottom: 22px; }
.comp-close {
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: var(--font-bd);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(79,70,229,.4);
  transition: transform .15s, box-shadow .15s;
}
.comp-close:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(79,70,229,.5); }

/* ── ルビ ────────────────────────────────── */
ruby { ruby-align: center; }
rt   { font-size: .6em; }

/* ── kbd ─────────────────────────────────── */
kbd {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 13px;
  font-family: monospace;
  border: 1px solid #475569;
  box-shadow: 0 2px 0 #0f172a;
}

/* ── pface（ドット絵顔表示） ─────────────── */
.pface {
  display: grid;
  grid-template-columns: repeat(8, 18px);
  grid-template-rows: repeat(8, 18px);
  gap: 1px;
  background: rgba(255,255,255,.08);
  padding: 4px;
  border-radius: 8px;
  image-rendering: pixelated;
  display: inline-grid;
}
.px { border-radius: 2px; }
.pf-caption { text-align:center; font-size:13px; opacity:.7; margin-top:6px; color:white; font-weight:700; }

/* ══════════════════════════════════
   進捗リセットボタン（ガイド右下・控えめ）
══════════════════════════════════ */
/* ── お手本ギャラリー（チャレンジ） ──────────── */
.ref-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.ref-card {
  background: #f8faff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}
.ref-face {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  gap: 0;
  image-rendering: pixelated;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 0 0 1px #eef;
}
.ref-card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 6px;
}
.ref-use-btn {
  margin-top: 7px;
  width: 100%;
  padding: 5px 4px;
  border: none;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-bd);
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background .15s, transform .15s;
}
.ref-use-btn:hover { background: #4338ca; transform: translateY(-1px); }
.chal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f7ff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.chal-row i { color: var(--accent); }

@media (max-width: 1100px) {
  .ref-gallery { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════
   身につく5つの力（レーダーチャート）
══════════════════════════════════ */
.skill-block {
  background: #fff;
  border-radius: 16px;
  padding: 18px 16px;
  margin: 14px 0 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.skill-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}
.skill-title i { color: var(--accent); }
.skill-lead {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
  margin-bottom: 10px;
}
.skill-lead strong { color: var(--accent); }
.skill-radar-wrap {
  display: flex;
  justify-content: center;
}
.skill-radar {
  width: 100%;
  max-width: 280px;
  height: auto;
}
.skill-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  margin-top: 12px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.skill-leg-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}
.skill-leg-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}
.skill-leg-label { color: var(--text); font-weight: 700; flex: 1; }
.skill-leg-val { color: var(--accent); font-weight: 900; }
@media (max-width: 1100px) {
  .skill-legend { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════
   育つ力タグ（セクションヘッダー）
══════════════════════════════════ */
.skill-tag {
  font-size: 11px;
  font-weight: 700;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 99px;
  padding: 3px 9px;
  white-space: nowrap;
  margin-right: 8px;
}
@media (max-width: 1100px) {
  .skill-tag { display: none; }
}

/* ══════════════════════════════════
   スキル獲得トースト（増えた時だけ・自動で消える）
══════════════════════════════════ */
.skill-toast {
  position: absolute;
  left: 50%;
  bottom: 64px;
  transform: translate(-50%, 20px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px 6px;
  box-shadow: 0 12px 36px rgba(0,0,0,.22);
  z-index: 8000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s cubic-bezier(.34,1.56,.64,1);
  width: 230px;
  text-align: center;
}
.skill-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.skill-toast-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
}
.skill-toast-head i { font-size: 18px; }
.toast-radar { width: 100%; height: auto; margin-top: -6px; }

/* ══════════════════════════════════
   完了オーバーレイ：TOPに戻る型
══════════════════════════════════ */
.comp-warn {
  display: flex;
  gap: 10px;
  text-align: left;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 13px 15px;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.7;
  color: #92400e;
}
.comp-warn i { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.comp-warn strong { color: #b45309; }
.comp-home {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  font-family: var(--font-bd);
  font-weight: 900;
  font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 6px 18px rgba(79,70,229,.4);
  transition: transform .15s, box-shadow .15s;
}
.comp-home:hover { transform: translateY(-2px); box-shadow: 0 9px 26px rgba(79,70,229,.5); }
.comp-close-link {
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}
.comp-close-link:hover { color: var(--text); }

/* ── 全クリア後の「おわる」FAB（TOP戻り再表示） ── */
#finish-fab {
  position: fixed;
  right: 18px; bottom: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 18px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border: none;
  color: #fff;
  font-family: var(--font-bd);
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(79,70,229,.4);
  z-index: 9000;
  transition: transform .15s, box-shadow .15s;
  animation: fabPulse 2s ease-in-out infinite;
}
#finish-fab:hover { transform: translateY(-2px); box-shadow: 0 9px 26px rgba(79,70,229,.5); }
#finish-fab i { font-size: 14px; }
@keyframes fabPulse {
  0%,100% { box-shadow: 0 6px 18px rgba(79,70,229,.4); }
  50%     { box-shadow: 0 6px 26px rgba(79,70,229,.7); }
}

/* ══════════════════════════════════
   進捗ベール（まだ進んでいない範囲をうすく覆う）
   ── ピクセルアート講座版：崩壊はドットが砕けて散る演出 ──
══════════════════════════════════ */
#progress-veil {
  position: fixed;
  pointer-events: none;        /* 下のコンテンツは見られる・押せる（飛ばせる）*/
  z-index: 5;
  background: rgba(38, 33, 64, 0.34);  /* 均一の暗さ（グラデなし）*/
  opacity: 0;
  transition: opacity .3s ease, top .25s ease;
}
#progress-veil.show { opacity: 1; }

/* ドット崩壊エフェクト（突破した感）：小さめのピクセルが散る */
.veil-crumb {
  position: fixed;
  z-index: 6;
  pointer-events: none;
  background: rgba(38, 33, 64, 0.40);
  border-radius: 2px;
  animation: veilCrumble .9s cubic-bezier(.4,.1,.7,1) forwards;
}
@keyframes veilCrumble {
  0%   { opacity: 1; transform: translate(0,0) rotate(0deg) scale(1); }
  18%  { opacity: 1; transform: translate(calc(var(--dx)*.12), -10px) rotate(calc(var(--rot)*.2)) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.4); }
}
@media(prefers-reduced-motion: reduce) {
  .veil-crumb { animation-duration: .01s !important; }
}
