/* 下水道マスター：現場インフラ・トレーニングスタイル */
:root {
  --bg: #f1f4f8;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --navy: #0f1f36;
  --navy-light: #1b3152;
  --text: #162235;
  --text-muted: #52627a;
  --border: #d8e0ea;
  --amber: #e59000;
  --amber-bg: #fff8e6;
  --cyan: #0284c7;
  --cyan-bg: #e0f2fe;
  --green: #0d9458;
  --green-bg: #e6f7ef;
  --red: #dc2626;
  --red-bg: #feecec;
  --purple: #6d28d9;
  --purple-bg: #f3ecff;
  --shadow: 0 2px 10px rgba(15, 31, 54, 0.06);
  --shadow-lg: 0 10px 28px rgba(15, 31, 54, 0.14);
  --radius: 14px;
  --radius-sm: 9px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:focus-visible, input:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}

/* アプリ全体レイアウト */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* デスクトップ用サイドバー */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--navy);
  color: #e8eef7;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ffffff;
}

.brand-sub {
  font-size: 0.75rem;
  color: #93b0d4;
}

.sidebar-profile {
  margin: 16px 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.profile-rank {
  font-size: 0.78rem;
  color: #fbbf24;
  font-weight: 700;
}

.profile-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  margin: 2px 0 8px;
}

.xp-bar {
  height: 7px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #38bdf8);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.xp-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #a9c0dc;
  margin-top: 5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-weight: 600;
  color: #c8d7eb;
  text-align: left;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.nav-ico {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-ghost-sm {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #b5c7df;
  font-size: 0.85rem;
  text-align: left;
}

.btn-ghost-sm:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* モバイル用ヘッダー＆下部ナビ（PCでは非表示） */
.mobile-header, .bottom-nav {
  display: none;
}

/* メイン領域 */
.main-content {
  flex: 1;
  padding: 28px 32px 48px;
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
}

/* 共通タイポグラフィ・カード */
.page-head {
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* バッジ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
}

.badge-初級, .badge-green { background: var(--green-bg); color: var(--green); }
.badge-中級, .badge-amber { background: var(--amber-bg); color: #b46900; }
.badge-上級, .badge-red { background: var(--red-bg); color: var(--red); }
.badge-cyan { background: var(--cyan-bg); color: #0369a1; }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-navy { background: var(--navy); color: #fff; }

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
}

.btn-amber {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.28);
}

.btn-amber:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-outline {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-bg);
}

.btn-danger-outline {
  background: var(--surface);
  border: 1.5px solid #f5bcbc;
  color: var(--red);
}

.btn-danger-outline:hover {
  background: var(--red-bg);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 13px;
  font-size: 0.84rem;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

/* ホーム画面ヒーロー */
.hero-banner {
  background: linear-gradient(135deg, #0f1f36 0%, #1b385f 60%, #0d4b73 100%);
  color: #fff;
  border-radius: 18px;
  padding: 24px 26px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-rank-label {
  display: inline-block;
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.55);
  color: #fcd34d;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 99px;
  margin-bottom: 8px;
}

.hero-banner h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 800;
}

.hero-banner p {
  margin: 0;
  color: #c9ddf4;
  font-size: 0.92rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}

.stat-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.74rem;
  color: #b7d2ef;
  margin-top: 3px;
}

/* ホームのモードカード */
.mode-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-align: left;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: var(--shadow-lg);
}

.mode-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mode-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.mode-icon.m1 { background: #e0f2fe; }
.mode-icon.m2 { background: #162235; color: #38bdf8; }
.mode-icon.m3 { background: #fef3c7; }
.mode-icon.m4 { background: #f3e8ff; }

.mode-card h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--navy);
}

.mode-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  flex: 1;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.progress-track {
  flex: 1;
  height: 7px;
  background: #e5ecf4;
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--cyan);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.weak-banner {
  background: linear-gradient(90deg, #fff5f5, #fffbeb);
  border: 1.5px solid #f5c2c2;
  border-radius: var(--radius);
  padding: 15px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

/* フィルターバー */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

.chip {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.14s;
}

.chip:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* 選択肢カード */
.choices-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.55;
  transition: border-color 0.14s, background 0.14s, transform 0.1s;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--cyan);
  background: #f5fbff;
}

.choice-btn:disabled {
  cursor: default;
}

.choice-key {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eaf0f7;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.choice-btn.selected {
  border-color: var(--cyan);
  background: var(--cyan-bg);
}

.choice-btn.selected .choice-key {
  background: var(--cyan);
  color: #fff;
}

.choice-btn.correct {
  border-color: var(--green);
  background: var(--green-bg);
}

.choice-btn.correct .choice-key {
  background: var(--green);
  color: #fff;
}

.choice-btn.wrong {
  border-color: var(--red);
  background: var(--red-bg);
}

.choice-btn.wrong .choice-key {
  background: var(--red);
  color: #fff;
}

/* 解説ボックス */
.feedback-box {
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 16px;
  border-left: 5px solid var(--cyan);
  background: var(--surface-alt);
  animation: fadeSlide 0.25s ease;
}

.feedback-box.ok {
  border-left-color: var(--green);
  background: var(--green-bg);
}

.feedback-box.warn {
  border-left-color: var(--amber);
  background: var(--amber-bg);
}

.feedback-box.ng {
  border-left-color: var(--red);
  background: var(--red-bg);
}

.feedback-title {
  font-weight: 800;
  font-size: 1.02rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(15, 31, 54, 0.1);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === モード1：ミッションタイムライン === */
.mission-meters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.meter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.timeline-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.tdot {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: #d8e1ec;
}

.tdot.done { background: var(--green); }
.tdot.active { background: var(--amber); }

.scene-time {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: #fcd34d;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 10px;
}

/* === モード2：テレビカメラ調査モニター === */
.camera-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.camera-monitor {
  background: #0a1019;
  border-radius: 16px;
  padding: 14px;
  color: #e2f1ff;
  border: 2px solid #24364e;
  box-shadow: var(--shadow-lg);
}

.monitor-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: ui-monospace, "Consolas", monospace;
  font-size: 0.78rem;
  color: #7dd3fc;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.rec-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #f87171;
  font-weight: 700;
}

.rec-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: blink 1.2s infinite;
}

.monitor-screen {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #05080d;
  border: 1px solid #1e3148;
  aspect-ratio: 4 / 3;
}

.monitor-screen svg {
  width: 100%;
  height: 100%;
  display: block;
}

.monitor-osd-bottom {
  display: flex;
  justify-content: space-between;
  font-family: ui-monospace, "Consolas", monospace;
  font-size: 0.76rem;
  color: #a5f3fc;
  margin-top: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.monitor-tools {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.mtool-btn {
  background: #17263a;
  border: 1px solid #304969;
  color: #d8ebff;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.mtool-btn.on {
  background: #0284c7;
  border-color: #38bdf8;
  color: #fff;
}

.pipe-spec-strip {
  background: #121e2e;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 0.83rem;
  color: #cde0f5;
  line-height: 1.55;
}

.rank-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 10px 0 16px;
}

.rank-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.rank-btn.r-d.selected, .rank-btn.r-d:hover:not(:disabled) { border-color: var(--cyan); background: var(--cyan-bg); color: #0369a1; }
.rank-btn.r-e.selected, .rank-btn.r-e:hover:not(:disabled) { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.rank-btn.r-other.selected, .rank-btn.r-other:hover:not(:disabled) { border-color: var(--purple); background: var(--purple-bg); color: var(--purple); }

.rank-btn {
  min-height: 52px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 1.15rem;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: all 0.14s;
}

.rank-btn small {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.rank-btn.r-a.selected, .rank-btn.r-a:hover:not(:disabled) { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.rank-btn.r-b.selected, .rank-btn.r-b:hover:not(:disabled) { border-color: var(--amber); background: var(--amber-bg); color: #b45309; }
.rank-btn.r-c.selected, .rank-btn.r-c:hover:not(:disabled) { border-color: var(--green); background: var(--green-bg); color: var(--green); }

.defect-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 16px;
}

.defect-btn {
  min-height: 46px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.14s;
}

.defect-btn:hover:not(:disabled) {
  border-color: var(--cyan);
  background: #f5fbff;
}

.defect-btn.selected {
  border-color: var(--cyan);
  background: var(--cyan-bg);
  color: #0369a1;
}

.defect-btn.correct, .rank-btn.correct {
  border-color: var(--green) !important;
  background: var(--green-bg) !important;
  color: var(--green) !important;
}

.defect-btn.wrong, .rank-btn.wrong {
  border-color: var(--red) !important;
  background: var(--red-bg) !important;
  color: var(--red) !important;
}

/* === モード3：安全管理カード === */
.hazard-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff5f5;
  border: 1.5px solid #f8b4b4;
  border-radius: 10px;
  margin-bottom: 14px;
  font-weight: 700;
  color: #b91c1c;
  font-size: 0.9rem;
}

/* === モード4：クイズヘッダー === */
.quiz-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.combo-pill {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 4px 12px;
  border-radius: 99px;
  animation: pop 0.28s ease;
}

/* === 図鑑 === */
.search-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 210px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 16px; /* iPad/iPhoneズーム防止 */
  background: var(--surface);
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  background: var(--surface);
  border: 1.5px solid var(--border);
  padding: 8px 13px;
  border-radius: 10px;
  cursor: pointer;
}

.ency-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s, border-color 0.14s;
}

.ency-card:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
}

.ency-card.locked {
  background: #edf1f6;
  border-style: dashed;
  color: var(--text-muted);
}

.ency-card h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--navy);
}

.ency-card.locked h4 {
  color: #6b7a90;
}

.ency-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* モーダル */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 35, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--surface);
  border-radius: 16px;
  max-width: 620px;
  width: 100%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeSlide 0.2s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--navy);
  color: #fff;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.08rem;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 1.1rem;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.detail-list {
  margin: 12px 0;
  padding-left: 20px;
}

.detail-list li {
  margin-bottom: 6px;
  font-size: 0.93rem;
}

.field-tip-box {
  background: var(--amber-bg);
  border: 1px solid #f5d08a;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-top: 12px;
}

/* トースト通知 */
.toast-container {
  position: fixed;
  right: 18px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
}

.toast {
  background: var(--navy);
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  border-left: 4px solid #f59e0b;
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 700;
  animation: fadeSlide 0.25s ease;
}

/* 結果サマリー画面 */
.result-grade {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-size: 2.3rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.35);
}

.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.flex-gap { display: flex; gap: 10px; flex-wrap: wrap; }

/* SVG内アニメーション */
@keyframes sprayDrop {
  0% { stroke-dashoffset: 24; opacity: 0.95; }
  100% { stroke-dashoffset: 0; opacity: 0.35; }
}
.anim-spray {
  stroke-dasharray: 6 6;
  animation: sprayDrop 0.6s linear infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop {
  0% { transform: scale(0.82); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ショップ＆コイン・テーマカスタマイズ */
body.theme-safety {
  --bg: #f8f5ec;
  --navy: #1f1b16;
  --navy-light: #312a21;
  --cyan: #d97706;
  --cyan-bg: #fef3c7;
  --border: #e5dcc8;
}
body.theme-safety .hero-banner {
  background: linear-gradient(135deg, #1c1917 0%, #3a2b12 60%, #784800 100%);
}
body.theme-safety .nav-btn.active, body.theme-safety .btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1c1917;
}

body.theme-aqua {
  --bg: #eef7fb;
  --navy: #0a364c;
  --navy-light: #124d6b;
  --cyan: #0891b2;
  --cyan-bg: #cffafe;
  --border: #c9e2ec;
}
body.theme-aqua .hero-banner {
  background: linear-gradient(135deg, #083344 0%, #0e7490 60%, #0284c7 100%);
}

body.theme-gold {
  --bg: #f7f4ec;
  --navy: #181410;
  --navy-light: #2b231b;
  --cyan: #b45309;
  --cyan-bg: #fef3c7;
  --border: #e2d5bc;
}
body.theme-gold .hero-banner {
  background: linear-gradient(135deg, #14110f 0%, #3b2d14 55%, #8a6416 100%);
  border: 1px solid rgba(250, 204, 21, 0.45);
}
body.theme-gold .nav-btn.active, body.theme-gold .btn-primary {
  background: linear-gradient(135deg, #ca8a04, #a16207);
}

body.theme-dark {
  --bg: #0b1220;
  --surface: #131e31;
  --surface-alt: #19273f;
  --navy: #070d18;
  --navy-light: #16243a;
  --text: #e6eef9;
  --text-muted: #98aecb;
  --border: #263954;
  --amber-bg: rgba(245, 158, 11, 0.16);
  --cyan-bg: rgba(56, 189, 248, 0.16);
  --green-bg: rgba(16, 185, 129, 0.16);
  --red-bg: rgba(239, 68, 68, 0.16);
  --purple-bg: rgba(139, 92, 246, 0.16);
}
body.theme-dark .page-head h1,
body.theme-dark .mode-card h3,
body.theme-dark .ency-card h4,
body.theme-dark .choice-key {
  color: #f1f5f9;
}
body.theme-dark .choice-key { background: #22344f; }
body.theme-dark .choice-btn:hover:not(:disabled),
body.theme-dark .defect-btn:hover:not(:disabled) { background: #1c2d47; }
body.theme-dark .search-input { color: #f1f5f9; }
body.theme-dark .weak-banner { background: #261a24; border-color: #6b2b3e; }
body.theme-dark .hazard-banner { background: #2c161b; border-color: #7f1d1d; color: #fca5a5; }
body.theme-dark .ency-card.locked { background: #0f1828; }
body.theme-dark .field-tip-box { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); }

/* コイン表示・プロフィール強化 */
.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.coin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(250, 204, 21, 0.18);
  border: 1px solid rgba(250, 204, 21, 0.48);
  color: #fde047;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 800;
}

.coin-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(250, 204, 21, 0.22);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fde047;
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 800;
}

.streak-chip {
  font-size: 0.72rem;
  color: #7dd3fc;
  font-weight: 700;
}

.hero-identity {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-machine, .van-showcase {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  color: #dbeafe;
  font-weight: 700;
  flex-shrink: 0;
}

.van-showcase.large {
  background: linear-gradient(135deg, #0b1628 0%, #172e4f 100%);
  border: 1.5px solid #2b4870;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.van-caption {
  font-size: 0.78rem;
  color: #e2e8f0;
  text-align: center;
}

.van-stage-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.eq-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 700;
}

.eq-pill:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* 機材公式スペック表 */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.88rem;
}

.spec-table th, .spec-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.spec-table th {
  width: 34%;
  background: var(--surface-alt);
  font-weight: 800;
  color: var(--text);
}

.maker-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.spec-mini {
  font-size: 0.78rem;
  color: var(--cyan);
  font-weight: 700;
  background: var(--cyan-bg);
  padding: 3px 8px;
  border-radius: 6px;
  align-self: flex-start;
}

/* 緊急度・補修選定カルテ */
.karte-box {
  background: #0d192b;
  color: #e6f0fc;
  border-radius: 16px;
  padding: 16px;
  border: 2px solid #263f61;
  box-shadow: var(--shadow-lg);
}

.karte-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.karte-cell {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.82rem;
}

.karte-cell small {
  display: block;
  color: #93b4d8;
  font-size: 0.72rem;
  margin-bottom: 2px;
}

.defect-log-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
}

.defect-log-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.84rem;
}

.rk-dot {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.rk-dot.rk-a { background: #dc2626; color: #fff; }
.rk-dot.rk-b { background: #d97706; color: #fff; }
.rk-dot.rk-c { background: #059669; color: #fff; }

.calc-steps-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 0.86rem;
}

.calc-steps-box div + div {
  margin-top: 5px;
}

/* ショップカード */
.shop-balance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #0f1f36, #1f3c63);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 18px;
}

.shop-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 13px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.14s, border-color 0.14s;
}

.shop-card.equipped {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22);
}

.swatch-row {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.ach-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ach-card.done {
  border-color: var(--green);
  background: var(--green-bg);
}

@keyframes scanLine {
  0% { transform: translateY(-90px); opacity: 0.2; }
  50% { opacity: 0.75; }
  100% { transform: translateY(90px); opacity: 0.2; }
}
.anim-scan {
  animation: scanLine 2.4s ease-in-out infinite;
}

/* === レスポンシブ（タブレット・スマホ対応） === */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .app-shell {
    flex-direction: column;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--navy);
    color: #fff;
    padding: 11px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.02rem;
  }

  .mobile-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
  }

  .main-content {
    padding: 16px 14px 92px;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--navy);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }

  .bnav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    color: #9cb4d1;
    border-radius: 8px;
    font-size: 1.15rem;
  }

  .bnav-btn small {
    font-size: 0.66rem;
    font-weight: 700;
  }

  .bnav-btn.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.14);
  }

  .grid-2, .grid-3, .camera-workspace {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .toast-container {
    bottom: 78px;
    left: 14px;
    right: 14px;
  }
}
