/* ボクセルキャンパス 3D 電気回路ラボ — 小学生・中学生がしっかり読めるUD丸ゴシック・3ステップ学習スタイル */
* { box-sizing: border-box; }
html, body {
  margin: 0; width: 100%; height: 100%; overflow: hidden;
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-size: 17px; color: #1e293b; background: #f1f5f9;
}
button, select, input { font-family: inherit; }
ruby { ruby-align: center; }
ruby rt { font-size: 0.56em; font-weight: 800; color: inherit; opacity: 0.9; line-height: 1.1; }
body { display: flex; flex-direction: column; width: 100%; max-width: 100vw; min-width: 0; }
[hidden] { display: none !important; }

/* ===== トップバー ===== */
#topbar {
  flex: 0 0 auto; min-height: 56px; width: 100%; min-width: 0;
  display: flex; align-items: center; gap: 8px; padding: 4px 12px;
  background: linear-gradient(90deg, #091e3a 0%, #0f3a68 100%);
  border-bottom: 3px solid #f59e0b;
  color: #fff; white-space: nowrap; overflow: hidden;
}
.portal-back-link {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 36px; height: auto; padding: 3px 12px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.16); border: 1.5px solid rgba(255, 255, 255, 0.4);
  color: #fff; text-decoration: none; font-size: 14px; line-height: 1.35; font-weight: 800; flex-shrink: 0;
}
.portal-back-link:hover { background: rgba(255, 255, 255, 0.28); }

.brand { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 900; font-size: 16px; }
.brand small {
  font-weight: 800; margin-left: 6px; font-size: 12.5px;
  padding: 2px 8px; border-radius: 10px; background: #f59e0b; color: #1e1b4b;
}
.nav-group { display: flex; align-items: center; gap: 6px; min-width: 0; flex-shrink: 0; }
.nav-group.right { margin-left: auto; flex-shrink: 0; }
#topbar select {
  height: 36px; border-radius: 7px; border: 0; padding: 0 26px 0 9px;
  font-size: 14.5px; max-width: 265px; min-width: 140px; background: #fff; color: #0f172a; font-weight: 800;
}
#lessonSelect { width: clamp(150px, 19vw, 260px); }

.progress-wrap { display: flex; align-items: center; gap: 6px; font-size: 14px; flex-shrink: 0; }
.top-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 14px; font-weight: 900; font-size: 14px; line-height: 1.35;
}
.top-pill.stars { background: rgba(250, 204, 21, 0.24); border: 1.5px solid #facc15; color: #fef08a; }
.top-pill.badges { background: rgba(56, 189, 248, 0.24); border: 1.5px solid #7dd3fc; color: #e0f2fe; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 38px; height: auto; padding: 4px 14px; border: 1.5px solid #cbd5e1; border-radius: 8px;
  background: #fff; color: #1e293b; font-size: 15px; line-height: 1.4; cursor: pointer; white-space: nowrap; font-weight: 800;
}
.btn:hover { background: #e0f2fe; }
.btn:disabled { opacity: .45; cursor: default; }
#topbar .btn { min-height: 36px; padding: 3px 12px; font-size: 14px; border-color: transparent; }
.btn-plaza { background: #fef3c7; color: #92400e; font-weight: 900; }
.btn-plaza:hover { background: #fde68a; }
.btn-top-reset { background: #fff1f2 !important; color: #be123c !important; border: 1.5px solid #fda4af !important; font-weight: 900; }
.btn-debug {
  background: rgba(30, 41, 59, 0.85); color: #cbd5e1;
  border: 1.5px solid #64748b !important; font-weight: 800;
}
.btn-debug.on {
  background: #a855f7; color: #ffffff; border-color: #facc15 !important; font-weight: 900;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.65);
}
.btn-run { background: #16a34a; color: #fff; border-color: #15803d; font-weight: 900; font-size: 15.5px; }
.btn-run:hover { background: #15803d; }

.status { padding: 5px 12px; border-radius: 14px; font-size: 13.5px; font-weight: 800; }
.status.loading { background: #f59e0b; color: #1e293b; }
.status.ready { background: #22c55e; color: #fff; }
.status.error { background: #dc2626; color: #fff; }
#loadStatus:empty { display: none; }

/* ===== 2ペイン構成 ===== */
#panes { flex: 1 1 auto; display: flex; width: 100%; min-width: 0; min-height: 0; position: relative; overflow: hidden; }
#leftPane {
  flex: 0 0 54%; display: flex; flex-direction: column;
  min-width: 280px; max-width: calc(100% - 330px); min-height: 0; background: #0f172a;
}
#rightPane {
  flex: 1 1 0; display: flex; flex-direction: column;
  min-width: 330px; min-height: 0; background: #fff; position: relative;
}
#vresizer { flex: 0 0 9px; cursor: col-resize; background: #cbd5e1; border-left: 1px solid #94a3b8; border-right: 1px solid #94a3b8; }
#vresizer:hover, body.dragging #vresizer { background: #f59e0b; }
body.dragging { user-select: none; }
#dragShield { display: none; position: absolute; inset: 0; z-index: 10; }
body.dragging #dragShield { display: block; }

/* ===== 3Dワールドパネル ===== */
#worldPanel { position: relative; flex: 1 1 100%; display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: #0f172a; }
#canvasWrap { position: relative; flex: 1 1 100%; min-height: 0; background: #7dd3fc; overflow: hidden; cursor: crosshair; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hudCv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

.room-banner {
  position: absolute; left: 8px; top: 116px; z-index: 6;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border-radius: 10px;
  background: rgba(15, 41, 74, 0.90); border: 2px solid #38bdf8;
  color: #f0f9ff; font-size: 14px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.hud-top-btns {
  position: absolute; top: 8px; right: 10px; z-index: 6;
  display: flex; align-items: center; gap: 6px;
}
.hud-key-btn {
  min-height: 34px; height: auto; padding: 4px 11px;
  border: 1.5px solid rgba(148, 163, 184, 0.85); border-radius: 8px;
  background: rgba(15, 23, 42, 0.86); color: #f8fafc;
  font-size: 13px; line-height: 1.35; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.hud-key-btn:hover { background: #0284c7; border-color: #bae6fd; color: #fff; }

/* ===== ゲーム内オーバーレイ共通 ===== */
.game-overlay { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.overlay-bar {
  flex: 0 0 auto; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap;
  padding: 6px 14px; background: #0f243d; color: #f8fafc; border-bottom: 2px solid #f59e0b;
}
.overlay-title { font-weight: 900; font-size: 16.5px; display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.overlay-close-btn {
  flex-shrink: 0; min-height: 36px; height: auto; padding: 4px 14px; border: 1.5px solid #64748b; border-radius: 8px;
  background: #334155; color: #f8fafc; font-size: 14px; line-height: 1.4; font-weight: 800; cursor: pointer;
}
.overlay-close-btn:hover { background: #dc2626; border-color: #ef4444; color: #fff; }

/* ===== 3ステップ学習ステージ（①電気回路レクチャー ／ ②道場でかくにん）共通 ===== */
.stage-overlay {
  position: absolute; inset: 0; z-index: 42;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.stage-stepper-bar {
  flex: 0 0 auto; min-height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  padding: 8px 18px;
  background: linear-gradient(90deg, #091e3a 0%, #103b6d 100%);
  border-bottom: 3px solid #f59e0b; color: #f8fafc;
}
.stage-room-badge {
  font-size: 14.5px; line-height: 1.82; font-weight: 900; color: #fde047;
  padding: 7px 15px 5px; border-radius: 11px;
  background: rgba(255, 255, 255, 0.12); border: 1.5px solid rgba(250, 204, 21, 0.45);
  max-width: 100%;
}
.stage-steps-nav {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.stage-step-pill {
  min-height: 40px; height: auto; padding: 6px 16px 5px; border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.65); background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1; font-size: 14.5px; line-height: 1.72; font-weight: 900; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  transition: transform .1s, background .12s, border-color .12s;
}
.stage-step-pill:hover { border-color: #bae6fd; color: #ffffff; }
.stage-step-pill.is-active {
  background: #f59e0b; border-color: #fef08a; color: #1e1b4b;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.55); transform: scale(1.03);
}
.stage-step-pill.is-done {
  background: rgba(22, 163, 74, 0.34); border-color: #4ade80; color: #dcfce7;
}
.stage-step-pill.is-locked {
  opacity: 0.75; border-style: dashed;
}
.stage-step-arrow { color: #93c5fd; font-size: 12px; font-weight: 900; }
.stage-bar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== 📖 ステップ①：電気回路レクチャーオーバーレイ ===== */
.lecture-overlay {
  background: linear-gradient(180deg, #dbeafe 0%, #f1f5f9 100%);
  color: #0f172a;
}
.lec-scroll-body {
  flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 18px 20px 28px;
  display: flex; flex-direction: column; align-items: center;
}
.lec-card {
  width: 100%; max-width: 880px; background: #ffffff;
  border: 3px solid #60a5fa; border-radius: 20px;
  padding: 20px 26px 22px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 12px 32px rgba(15, 41, 74, 0.14);
}
.lec-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.lec-slide-badge {
  padding: 5px 15px; border-radius: 999px;
  background: #dbeafe; color: #1e40af; border: 1.5px solid #93c5fd;
  font-size: 14.5px; line-height: 1.5; font-weight: 900;
}
.lec-dots { display: flex; align-items: center; gap: 8px; }
.lec-dot {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid #cbd5e1; background: #f1f5f9; color: #475569;
  font-size: 15px; font-weight: 900; cursor: pointer;
  transition: transform .1s, background .12s;
}
.lec-dot:hover { border-color: #38bdf8; }
.lec-dot.active { background: #0284c7; border-color: #0369a1; color: #ffffff; transform: scale(1.08); }
.lec-dot.passed { background: #dcfce7; border-color: #4ade80; color: #15803d; }

.lec-slide-title {
  margin: 0; font-size: clamp(20px, 2.3vw, 24px); line-height: 1.82;
  font-weight: 900; color: #0f294a;
  border-left: 6px solid #0284c7; padding-left: 12px;
}
.lec-diagram-wrap {
  background: #f8fafc; border: 2px solid #cbd5e1; border-radius: 14px;
  padding: 12px 16px; display: flex; justify-content: center; align-items: center;
}
.lec-svg {
  width: 100%; max-width: 700px; height: auto; max-height: 245px; display: block;
}
.lec-body-text {
  font-size: 18px; line-height: 1.98; color: #0f172a; font-weight: 700; letter-spacing: 0.01em;
}
.lec-card code {
  display: inline-block; padding: 1px 8px; border-radius: 6px;
  background: #1e293b; color: #fef08a; font-family: Menlo, Consolas, monospace;
  font-size: 16px; font-weight: 800; line-height: 1.5;
}
.lec-card kbd {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  background: #e2e8f0; border: 1.5px solid #64748b; box-shadow: 0 1px 0 #94a3b8;
  font-family: Menlo, monospace; font-size: 15.5px; font-weight: 900; color: #0f172a; line-height: 1.5;
}
.lec-point-box {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: 12px;
  background: linear-gradient(90deg, #fefce8 0%, #fffbeb 100%);
  border: 2px solid #facc15; font-size: 17px; line-height: 1.92; color: #713f12; font-weight: 800;
}
.lec-point-icon { font-size: 22px; line-height: 1.4; flex-shrink: 0; }
.lec-point-content { flex: 1; min-width: 0; }

.lec-jukucho-box {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 14px;
  background: #eff6ff; border: 2px solid #7dd3fc;
}
.lec-jukucho-box[data-mood="analyzing"] { background: #f0f9ff; border-color: #38bdf8; }
.lec-jukucho-box[data-mood="passionate"] { background: #fff7ed; border-color: #fb923c; }
.lec-jukucho-avatar {
  flex: 0 0 68px; width: 68px; height: 68px; border-radius: 50%;
  background: #ffffff; border: 2.5px solid #0284c7; overflow: hidden;
  display: flex; align-items: flex-start; justify-content: center;
}
.lec-jukucho-box[data-mood="passionate"] .lec-jukucho-avatar { border-color: #ea580c; }
.lec-jukucho-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.lec-jukucho-talk-wrap { flex: 1; min-width: 0; }
.lec-jukucho-name { font-size: 13.5px; font-weight: 900; color: #0369a1; margin-bottom: 2px; }
.lec-jukucho-box[data-mood="passionate"] .lec-jukucho-name { color: #c2410c; }
.lec-jukucho-talk { margin: 0; font-size: 16.5px; line-height: 1.92; font-weight: 800; color: #0f294a; }

.lec-nav-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; flex-wrap: wrap;
}
.lec-btn-prev {
  min-height: 46px; padding: 6px 18px; font-size: 16px; border-radius: 12px;
}
.lec-btn-next {
  min-height: 48px; padding: 6px 24px; font-size: 17px; font-weight: 900; border-radius: 12px;
  background: #0284c7; color: #ffffff; border-color: #0369a1; margin-left: auto;
}
.lec-btn-next:hover { background: #0369a1; }
.lec-btn-finish {
  min-height: 50px; padding: 6px 26px; font-size: 17.5px; font-weight: 900; border-radius: 12px;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff; border: 2px solid #fde68a;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.38); margin-left: auto;
}
.lec-btn-finish:hover { background: linear-gradient(180deg, #fbbf24 0%, #ea580c 100%); }

/* ===== ⚡ ステップ②：道場でかくにんオーバーレイ ===== */
.typing-overlay {
  background: linear-gradient(180deg, #0b182e 0%, #0f2747 100%);
  color: #f8fafc;
}
.tp-theme-badge { display: inline-block; font-size: 14.5px; font-weight: 900; padding: 8px 16px 6px; border-radius: 16px; background: #f59e0b; color: #1e1b4b; line-height: 1.85; }
.tp-bar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.tp-debug-skip-btn {
  min-height: 38px; height: auto; padding: 5px 14px; border-radius: 8px;
  border: 2px solid #fde047; background: #9333ea; color: #fff; font-size: 13.5px; line-height: 1.65; font-weight: 900; cursor: pointer;
}
.tp-sub-btn {
  min-height: 38px; height: auto; padding: 5px 14px; border-radius: 8px;
  border: 1.5px solid #7dd3fc; background: rgba(14, 165, 233, 0.28); color: #e0f2fe; font-size: 14px; line-height: 1.65; font-weight: 800; cursor: pointer;
}
.tp-body {
  flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 16px 18px 26px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.tp-chart-box {
  width: 100%; max-width: 820px; background: rgba(15, 23, 42, 0.94); border: 2px solid #38bdf8;
  border-radius: 12px; padding: 12px 14px;
}
.tp-chart-title { font-size: 16px; font-weight: 900; color: #fde047; margin-bottom: 8px; line-height: 1.82; }
.qz-chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 8px; }
.tp-chart-cell {
  background: rgba(30, 41, 59, 0.95); border: 1px solid #475569; border-radius: 8px;
  padding: 9px 12px; font-size: 14px; line-height: 1.88; color: #e2e8f0; display: flex; flex-direction: column; gap: 3px;
}
.tp-chart-cell b { color: #7dd3fc; font-size: 15px; line-height: 1.75; }

.tp-stage-card {
  width: 100%; max-width: 820px; background: rgba(30, 41, 59, 0.92); border: 2px solid #64748b;
  border-radius: 18px; padding: 18px 22px; display: flex; flex-direction: column; gap: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.qz-dojo-subhead {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.qz-review-lec-btn {
  min-height: 38px; height: auto; padding: 6px 15px 5px; border-radius: 999px;
  border: 1.5px solid #93c5fd; background: rgba(14, 165, 233, 0.24);
  color: #e0f2fe; font-size: 14px; line-height: 1.72; font-weight: 800; cursor: pointer;
}
.qz-review-lec-btn:hover { background: #0284c7; color: #ffffff; }

.tp-progress-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 15px; font-weight: 900; }
.tp-stage-pill { padding: 5px 13px 4px; border-radius: 12px; background: #0284c7; color: #fff; font-size: 14px; line-height: 1.65; }
.tp-timer-badge { color: #fde68a; font-family: Menlo, Consolas, monospace; }
.tp-miss-badge { color: #fca5a5; }
.tp-bar-track { width: 100%; height: 10px; border-radius: 6px; background: #0f172a; border: 1px solid #475569; overflow: hidden; }
.tp-bar-fill { height: 100%; width: 8%; border-radius: 6px; background: linear-gradient(90deg, #22c55e 0%, #facc15 100%); transition: width 0.2s ease; }

.qz-symbol-wrap {
  align-self: center; background: #0b1324; border: 2px solid #38bdf8; border-radius: 12px;
  padding: 12px 24px; display: flex; justify-content: center; max-width: 100%;
}
.qz-svg { width: 310px; max-width: 100%; height: auto; max-height: 116px; display: block; }
.qz-question-text { font-size: 19.5px; font-weight: 900; line-height: 1.92; color: #ffffff; }
.qz-choices-grid { display: flex; flex-direction: column; gap: 10px; }
.qz-choice-btn {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 16px; border-radius: 12px; border: 2px solid #475569;
  background: #1e293b; color: #f8fafc; font-size: 17px; font-weight: 800; line-height: 1.88;
  cursor: pointer; transition: background .12s, border-color .12s, transform .08s;
}
.qz-choice-btn:hover:not(:disabled) { background: #1e3a5f; border-color: #7dd3fc; transform: translateX(3px); }
.qz-choice-btn.is-correct { background: #14532d !important; border-color: #4ade80 !important; color: #fef08a !important; }
.qz-choice-btn.is-wrong { background: #450a0a !important; border-color: #ef4444 !important; opacity: 0.65; }
.qz-num {
  flex: 0 0 32px; height: 32px; border-radius: 50%; background: #0284c7; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px;
}
.qz-choice-label { flex: 1; min-width: 0; }
.qz-feedback-box {
  padding: 12px 16px; border-radius: 10px; font-size: 16.5px; line-height: 1.9; font-weight: 700;
}
.qz-feedback-box.ok { background: rgba(20, 83, 45, 0.94); border: 2px solid #4ade80; color: #dcfce7; }
.qz-feedback-box.ng { background: rgba(127, 29, 29, 0.94); border: 2px solid #f87171; color: #fee2e2; }
.qz-feedback-box.info { background: rgba(12, 74, 110, 0.94); border: 2px solid #38bdf8; color: #e0f2fe; }

.tp-finish-card {
  width: 100%; max-width: 680px; margin-top: 12px;
  background: rgba(20, 83, 45, 0.95); border: 2.5px solid #4ade80;
  border-radius: 18px; padding: 24px 26px; text-align: center;
}
.tp-finish-icon { font-size: 48px; line-height: 1; }
.tp-finish-card h3 { margin: 10px 0 8px; font-size: 24px; line-height: 1.75; color: #fef08a; }
.tp-finish-stats { font-size: 18px; font-weight: 900; color: #fff; margin: 6px 0; line-height: 1.75; }
.qz-finish-jukucho {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: rgba(15, 23, 42, 0.55); border: 2px solid #86efac;
  border-radius: 14px; padding: 13px 16px; margin: 12px 0 18px;
}
.qz-finish-jukucho img {
  width: 68px; height: 68px; border-radius: 50%; background: #ffffff;
  border: 2px solid #facc15; object-fit: cover; object-position: top center; flex-shrink: 0;
}
.qz-finish-jukucho p {
  margin: 0; font-size: 16.5px; line-height: 1.92; color: #f0fdf4; font-weight: 800;
}
.tp-finish-btns { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.qz-enter-world-btn {
  min-height: 48px; padding: 6px 24px; font-size: 17.5px; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.45);
}

/* ===== 右ペイン（解説＋3ステップバー＋デジタル回路テスター） ===== */
.pane-title {
  flex: 0 0 auto; min-height: 54px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: #eff6ff; border-bottom: 2px solid #bfdbfe;
  color: #0f294a; font-weight: 900; font-size: 18.5px; line-height: 1.78;
}
.mode-tag {
  flex-shrink: 0; font-size: 13.5px; line-height: 1.72; font-weight: 900; padding: 5px 12px 4px; border-radius: 12px;
  background: #dbeafe; color: #1d4ed8; border: 1.5px solid #93c5fd;
}

.world-step-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 8px 14px;
  background: linear-gradient(90deg, #eef2ff 0%, #e0f2fe 100%);
  border-bottom: 1.5px solid #bae6fd;
}
.ws-step-btn {
  display: inline-flex; align-items: center;
  min-height: 36px; height: auto; padding: 6px 13px 5px; border-radius: 999px;
  border: 1.5px solid #93c5fd; background: #ffffff; color: #1e3a8a;
  font-size: 13.5px; line-height: 1.72; font-weight: 900; cursor: pointer;
}
.ws-step-btn:hover { background: #dbeafe; border-color: #3b82f6; }
.ws-step-btn.is-done { background: #dcfce7; border-color: #86efac; color: #166534; }
.ws-arrow { font-size: 11px; color: #64748b; font-weight: 900; }
.ws-step-current {
  min-height: 36px; height: auto; padding: 6px 14px 5px; border-radius: 999px;
  display: inline-flex; align-items: center;
  background: #0284c7; border: 1.5px solid #0369a1; color: #ffffff;
  font-size: 13.5px; line-height: 1.72; font-weight: 900;
}
.ws-step-current.is-done { background: #16a34a; border-color: #15803d; }

.puzzle-action-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 14px; background: #fffbeb; border-bottom: 1.5px solid #fde68a;
}
.btn-debug-skip {
  min-height: 38px; height: auto; padding: 5px 12px; font-size: 13.5px; line-height: 1.65; font-weight: 900;
  background: #9333ea; color: #fff; border: 2px solid #eab308;
}
.btn-inv-open {
  min-height: 38px; height: auto; padding: 5px 12px; font-size: 14.5px; line-height: 1.65; font-weight: 900;
  background: #0d9488; color: #fff; border: 1.5px solid #0f766e;
}
.btn-reset-room {
  min-height: 38px; height: auto; padding: 5px 12px; font-size: 14px; line-height: 1.65; font-weight: 800;
  background: #f8fafc; color: #334155; border-color: #cbd5e1;
}
.btn-reset-menu {
  min-height: 38px; height: auto; padding: 5px 12px; font-size: 14px; line-height: 1.65; font-weight: 900;
  background: #fff1f2; color: #be123c; border: 1.5px solid #fda4af;
}

#lessonScroll { flex: 1 1 0; overflow-y: auto; padding: 14px 16px 28px; }

/* 📊 リアルタイム・デジタル回路テスター（電流計・電圧計・素子ステータス） */
.meter-panel {
  margin-bottom: 14px; padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  border: 2px solid #38bdf8; color: #f8fafc;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
}
.meter-panel.is-shorted {
  border-color: #ef4444; background: linear-gradient(180deg, #450a0a 0%, #7f1d1d 100%);
}
.meter-panel.is-solved {
  border-color: #4ade80;
}
.meter-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px; font-size: 14.5px; line-height: 1.75; font-weight: 900; color: #7dd3fc;
}
.meter-status-pill {
  padding: 5px 12px 4px; border-radius: 12px; font-size: 13px; line-height: 1.72; font-weight: 900;
  background: #334155; color: #e2e8f0;
}
.meter-status-pill.ok { background: #16a34a; color: #fff; }
.meter-status-pill.short { background: #ef4444; color: #fff; }
.meter-chips {
  display: flex; flex-wrap: wrap; gap: 7px;
}
.meter-chip {
  padding: 6px 11px 5px; border-radius: 8px;
  background: rgba(15, 23, 42, 0.85); border: 1.5px solid #475569;
  font-size: 14px; line-height: 1.75; font-weight: 800; color: #e2e8f0;
  font-family: "BIZ UDPGothic", Menlo, monospace;
}
.meter-chip.lit { border-color: #facc15; color: #fef08a; background: rgba(113, 63, 18, 0.45); }
.meter-chip.spin { border-color: #38bdf8; color: #bae6fd; background: rgba(12, 74, 110, 0.55); }
.meter-reason {
  margin-top: 8px; font-size: 15.5px; line-height: 1.9; font-weight: 800; color: #fde68a;
}

/* 支給パーツ・新パーツ案内 */
.unlock-box {
  padding: 10px 14px; margin-bottom: 12px; border-radius: 10px;
  background: linear-gradient(90deg, #fefce8 0%, #fff7ed 100%); border: 2px solid #facc15;
}
.unlock-box-head { font-size: 15px; font-weight: 900; color: #92400e; margin-bottom: 6px; line-height: 1.78; }
.unlock-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.unlock-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px 5px; border-radius: 14px; font-size: 14.5px; line-height: 1.75; font-weight: 900;
  background: #fff; border: 1.5px solid #f59e0b; color: #78350f;
}
.unlock-chip img { width: 20px; height: 20px; }

.room-loadout-box {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px; margin-bottom: 12px; border-radius: 10px;
  background: #f8fafc; border: 1.5px solid #cbd5e1; font-size: 15px; line-height: 1.78;
}
.room-loadout-title { font-weight: 900; color: #1e293b; }
.loadout-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px 5px; border-radius: 14px;
  background: #fff; border: 1.5px solid #94a3b8; font-weight: 800; font-size: 14.5px; line-height: 1.75;
}
.loadout-chip img { width: 18px; height: 18px; }

/* 📐 JIS回路図カード */
.lesson-diagram-card {
  margin-bottom: 13px; padding: 12px 15px; border-radius: 10px;
  background: #f8fafc; border: 2px solid #bae6fd; text-align: center;
}
.lesson-diagram-title {
  font-size: 14.5px; line-height: 1.78; font-weight: 900; color: #0369a1; margin-bottom: 6px; text-align: left;
}
.lesson-circuit-svg {
  width: 100%; max-width: 440px; height: auto; display: inline-block;
}

/* 解説本文 */
#lessonBody { line-height: 1.94; font-size: 17.5px; letter-spacing: 0.02em; color: #0f172a; }
#lessonBody p { margin: .55em 0; }
#lessonBody ol, #lessonBody ul { margin: .48em 0 .68em 1.4em; padding: 0; }
#lessonBody li { margin-bottom: .5em; }
#lessonBody code {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  background: #1e293b; color: #fef08a; font-family: Menlo, Consolas, monospace;
  font-size: 15.5px; font-weight: 800;
}
#lessonBody kbd {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  background: #e2e8f0; border: 1.5px solid #64748b; box-shadow: 0 1px 0 #94a3b8;
  font-family: Menlo, monospace; font-size: 15.5px; font-weight: 900; color: #0f172a;
}
.stage-lead {
  padding: 13px 15px; margin-bottom: 13px; border-radius: 10px;
  background: #eff6ff; border: 2px solid #93c5fd; color: #1e3a8a; font-size: 18px; line-height: 1.92;
}
.cmd-step-card {
  padding: 12px 15px; margin-bottom: 12px; border-radius: 10px;
  background: #f8fafc; border: 2px solid #cbd5e1; font-size: 17px; line-height: 1.9;
}
.cmd-step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 18px; line-height: 1.82; margin-bottom: 6px; color: #0f172a; }
.cmd-tag { display: inline-block; padding: 5px 11px 4px; border-radius: 12px; background: #0284c7; color: #fff; font-size: 13.5px; line-height: 1.72; font-weight: 900; }
.cmd-tag.goal { background: #16a34a; }

.sec { margin: 16px 0 8px; font-size: 18.5px; font-weight: 900; color: #0f294a; line-height: 1.55; }
#goalList { list-style: none; margin: 0; padding: 0; }
#goalList li {
  padding: 10px 13px; margin-bottom: 7px; border-radius: 9px;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  font-size: 16.5px; line-height: 1.9; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
#goalList li.ok { background: #dcfce7; border-color: #86efac; color: #14532d; font-weight: 900; }
#goalList li .goal-text::before { content: "⬜ "; }
#goalList li.ok .goal-text::before { content: "✅ "; }
.goal-inline-actions { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.goal-inline-btn {
  min-height: 35px; height: auto; padding: 4px 13px; border-radius: 17px;
  border: 1.5px solid #d97706; background: #fef3c7; color: #92400e; font-size: 13.5px; line-height: 1.45; font-weight: 900; cursor: pointer;
}
.goal-debug-btn {
  min-height: 35px; height: auto; padding: 4px 12px; border-radius: 17px;
  border: 1.5px solid #eab308; background: #9333ea; color: #fff; font-size: 13px; line-height: 1.45; font-weight: 900; cursor: pointer;
}

/* 3つ星評価ボックス */
.star-eval-box {
  margin-top: 14px; padding: 12px 15px; border-radius: 10px;
  background: #fffbeb; border: 2px solid #fcd34d; font-size: 16px;
}
.star-eval-head { display: flex; align-items: center; justify-content: space-between; font-size: 17px; font-weight: 900; color: #92400e; margin-bottom: 5px; }
.star-icons { font-size: 21px; letter-spacing: 2px; }
.star-list { margin: 0; padding-left: 22px; color: #78350f; line-height: 1.86; font-weight: 700; }
.star-list li.achieved { color: #15803d; font-weight: 900; }

#result {
  margin-top: 14px; padding: 14px 16px; border-radius: 10px;
  font-weight: 900; display: none; font-size: 17px; line-height: 1.85;
}
#result.ok { display: block; background: #dcfce7; color: #14532d; border: 2px solid #4ade80; }
#result.info { display: block; background: #e0f2fe; color: #075985; border: 2px solid #38bdf8; }

.lesson-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.hints-stack { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.hint-item {
  background: #fff8e1; border: 2px solid #fcd34d; border-radius: 10px;
  padding: 12px 15px; font-size: 16.5px; line-height: 1.88; color: #451a03; font-weight: 700;
}
.note { font-size: 14px; line-height: 1.78; color: #475569; margin-top: 18px; }

/* ===== キー操作ガイド・インベントリ・看板・リセットモーダル ===== */
.keyhelp-overlay { z-index: 35; background: rgba(12, 19, 31, 0.96); color: #f1f5f9; }
.keyhelp-body {
  flex: 1 1 0; overflow-y: auto; padding: 16px 18px 22px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-content: start;
}
.keyhelp-card { background: rgba(30, 41, 59, 0.90); border: 1.5px solid #475569; border-radius: 12px; padding: 14px 16px; }
.keyhelp-card-wide { grid-column: 1 / -1; }
.keyhelp-card h4 { margin: 0 0 10px; font-size: 17.5px; color: #fde047; border-bottom: 1px solid rgba(148,163,184,.3); padding-bottom: 6px; }
.keyhelp-list { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.keyhelp-list-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.keyhelp-list > div { display: flex; align-items: flex-start; gap: 12px; font-size: 15.5px; line-height: 1.6; }
.keyhelp-list dt { flex: 0 0 140px; font-weight: 900; color: #f8fafc; }
.keyhelp-list dd { margin: 0; flex: 1; color: #e2e8f0; }
.keyhelp-list kbd {
  display: inline-block; min-width: 26px; text-align: center; padding: 2px 7px; margin-right: 3px;
  border-radius: 5px; background: #0f172a; border: 1.5px solid #64748b; color: #fef08a; font-family: Menlo, monospace; font-size: 14px; font-weight: 900;
}

.inv-modal {
  position: fixed; inset: 0; z-index: 1200; background: rgba(10, 15, 24, 0.65);
  display: flex; align-items: center; justify-content: center; padding: 14px; user-select: none;
}
.inv-dialog {
  width: 540px; max-width: 96vw; max-height: 94vh; display: flex; flex-direction: column;
  background: #e2e8f0; border: 3px solid #0f294a; border-radius: 12px; color: #1e293b; overflow: hidden;
  box-shadow: 0 18px 42px rgba(0,0,0,.55);
}
.inv-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; background: #0f294a; color: #f8fafc; border-bottom: 2px solid #f59e0b;
}
.inv-title-wrap { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.inv-title { font-weight: 900; font-size: 16.5px; }
.inv-treasure-badge {
  padding: 3px 10px; border-radius: 12px; background: rgba(250, 204, 21, 0.22);
  border: 1.5px solid #facc15; color: #fde047; font-size: 14px; font-weight: 800;
}
.inv-close { width: 32px; height: 32px; border: 1px solid #475569; border-radius: 6px; background: #334155; color: #fff; font-size: 16px; font-weight: 800; cursor: pointer; }
.inv-body { padding: 12px 14px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.inv-section { background: #cbd5e1; border: 2px solid #94a3b8; border-radius: 8px; padding: 8px 10px 10px; }
.inv-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; font-size: 14px; font-weight: 800; margin-bottom: 6px; }
.hotbar-head { margin-top: 8px; }
.inv-hover-name { font-size: 14px; font-weight: 900; color: #0f4c81; background: rgba(255,255,255,.88); padding: 2px 8px; border-radius: 4px; }
.inv-hover-name:empty { display: none; }
.btn-takeall { min-height: 32px; height: auto; padding: 4px 12px; font-size: 14px; font-weight: 900; background: #15803d; color: #fff; border-color: #166534; }
.mc-grid { display: grid; grid-template-columns: repeat(9, 46px); gap: 4px; justify-content: center; }
.mc-slot {
  position: relative; width: 46px; height: 46px; background: #64748b;
  border: 2px solid #334155; border-radius: 5px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.mc-slot:hover { background: #475569; outline: 2px solid #f8fafc; z-index: 2; }
.mc-slot.active { background: #0369a1; outline: 2.5px solid #facc15; z-index: 1; }
.mc-slot.treasure { background: #78350f; box-shadow: inset 0 0 8px rgba(250, 204, 21, 0.45); }
.mc-slot img { width: 34px; height: 34px; pointer-events: none; }
.mc-count {
  position: absolute; right: 3px; bottom: 1px; font-family: Menlo, monospace; font-size: 12.5px; font-weight: 900;
  color: #fff; text-shadow: 1px 1px 0 #0f172a; pointer-events: none;
}
.mc-key {
  position: absolute; left: 2px; top: 1px; padding: 0 3px; border-radius: 3px;
  font-family: Menlo, monospace; font-size: 10.5px; font-weight: 800; color: #e2e8f0; background: rgba(15,23,42,.65);
}
.inv-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding: 8px 14px; background: #0f294a; color: #e2e8f0; font-size: 13px; font-weight: 700; }

.sign-modal {
  position: fixed; inset: 0; z-index: 1250; background: rgba(10, 15, 24, 0.62);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.sign-dialog {
  width: 540px; max-width: 95vw; display: flex; flex-direction: column;
  background: #0f294a; border: 3px solid #38bdf8; border-radius: 12px; color: #f8fafc; overflow: hidden;
}
.sign-header { display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: #09182e; }
.sign-title { font-weight: 900; font-size: 18px; color: #fde047; }
.sign-coord { margin-right: auto; font-family: Menlo, monospace; font-size: 13.5px; color: #94a3b8; }
.sign-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; max-height: 72vh; overflow-y: auto; }
.sign-board {
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2.5px solid #0284c7; border-radius: 8px; padding: 16px 18px; text-align: left;
}
.sign-line { font-size: 18px; font-weight: 900; line-height: 1.9; color: #0f172a; }
.sign-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: #09182e; }
.sign-footer-hint { font-size: 14px; color: #cbd5e1; font-weight: 700; }
.btn-sign-ok { min-height: 38px; height: auto; padding: 4px 18px; background: #f59e0b; color: #1e1b4b; border-color: #d97706; font-size: 15px; font-weight: 900; }

/* リセットモーダル */
.reset-modal {
  position: fixed; inset: 0; z-index: 1300; background: rgba(10, 15, 24, 0.70);
  display: flex; align-items: center; justify-content: center; padding: 14px;
}
.reset-dialog {
  width: 640px; max-width: 96vw; max-height: 92vh; display: flex; flex-direction: column;
  background: #f8fafc; border: 3px solid #0f294a; border-radius: 14px; overflow: hidden; color: #0f172a;
}
.reset-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; background: #0f294a; color: #f8fafc; border-bottom: 3px solid #f59e0b;
}
.reset-title { font-size: 18px; font-weight: 900; }
.reset-body { padding: 14px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.reset-lead { margin: 0; font-size: 16px; line-height: 1.88; color: #334155; font-weight: 700; }
.reset-group { background: #ffffff; border: 2px solid #cbd5e1; border-radius: 11px; padding: 12px 14px; }
.reset-group.danger-group { background: #fff1f2; border-color: #fda4af; }
.reset-group-title { font-size: 16px; font-weight: 900; color: #0f294a; margin-bottom: 9px; }
.reset-areas-list { display: flex; flex-direction: column; gap: 8px; }
.reset-item-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 9px; background: #f8fafc; border: 1.5px solid #e2e8f0;
}
.reset-item-name { font-size: 16px; font-weight: 900; color: #0f172a; }
.reset-item-meta { font-size: 14px; line-height: 1.75; font-weight: 700; color: #475569; margin-top: 2px; }
.btn-reset-area {
  min-height: 38px; height: auto; padding: 5px 14px; border-radius: 8px; border: 1.5px solid #f59e0b;
  background: #fef3c7; color: #92400e; font-size: 14.5px; line-height: 1.45; font-weight: 900; cursor: pointer;
}
.reset-all-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reset-all-desc { flex: 1 1 300px; font-size: 15px; line-height: 1.85; color: #881337; font-weight: 700; }
.btn-reset-all-danger {
  min-height: 42px; height: auto; padding: 6px 18px; border-radius: 9px; border: 2px solid #9f1239;
  background: #e11d48; color: #ffffff; font-size: 15.5px; line-height: 1.45; font-weight: 900; cursor: pointer;
}
.reset-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: #f1f5f9; border-top: 1.5px solid #cbd5e1; font-size: 13.5px; color: #475569; font-weight: 700;
}

body.pseudo-fs #topbar { display: none; }
@media (max-width: 1380px) { .brand { display: none; } }
@media (max-width: 980px) {
  .progress-wrap { display: none; }
}
@media (max-width: 760px) {
  #panes { flex-direction: column; }
  #leftPane { flex: 0 0 52% !important; width: 100% !important; max-width: 100% !important; }
  #vresizer { display: none; }
  #rightPane { flex: 1 1 48%; width: 100%; border-top: 2px solid #cbd5e1; }
  .keyhelp-body, .keyhelp-list-2col { grid-template-columns: 1fr; }
  .stage-stepper-bar { padding: 7px 12px; }
  .stage-step-pill { min-height: 34px; height: auto; padding: 3px 11px; font-size: 13px; }
  .lec-scroll-body, .tp-body { padding: 12px 12px 24px; }
  .lec-card, .tp-stage-card { padding: 16px 15px; }
  .lec-body-text { font-size: 16.5px; }
  .lec-jukucho-box, .qz-finish-jukucho { padding: 10px 12px; gap: 10px; }
  .lec-jukucho-avatar, .qz-finish-jukucho img { flex: 0 0 54px; width: 54px; height: 54px; }
}
