/* ==========================================================================
   Typing: The Universe - スタイルシート
   宇宙進化スキルツリー、宇宙図鑑モーダル、分岐HUD、すりガラスデザイン
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-drag: none;
}

:root {
  --ambient-cat-color: rgba(139, 92, 246, 0.12); /* デフォルト：宇宙の紫アンビエント */
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "BIZ UDPGothic", Meiryo, sans-serif;
  background-color: #030712;
  color: #f8fafc;
  transition: background-color 2.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 38%, var(--ambient-cat-color) 0%, rgba(3, 7, 18, 0) 70%),
              radial-gradient(circle at 15% 85%, var(--ambient-cat-color) 0%, rgba(3, 7, 18, 0) 50%);
  pointer-events: none;
  z-index: 2;
  transition: background 1.5s ease;
}

#spaceCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.ui-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 28px;
}

/* --------------------------------------------------------------------------
   ヘッダー（ステージ表示、図鑑・系統樹ボタン、言語切替等）
   -------------------------------------------------------------------------- */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: auto;
}

.stage-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  padding: 8px 18px;
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.5s ease;
}

.stage-badge .stage-tag {
  font-size: 11px;
  font-weight: 800;
  background: #2563eb;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.stage-badge .stage-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.stage-badge .progress-count {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 8px;
  border-radius: 10px;
}

.header-controls {
  display: flex;
  gap: 10px;
}

.btn-control {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.return-title-btn {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.35));
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
}

body.universe-mode .return-title-btn {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.45));
  border-color: rgba(52, 211, 153, 0.5);
  color: #6ee7b7;
}

.return-title-btn:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-color: #10b981;
}

.achieve-hud-pill {
  display: inline-block;
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.5);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  margin-left: 4px;
}

.level-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

body.universe-mode .level-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-color: rgba(15, 23, 42, 0.7);
  color: #e2e8f0;
}

.btn-control:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  background: #ffffff;
}

.btn-control:active {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   合成通知トーストバナー
   -------------------------------------------------------------------------- */
.fusion-banner {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(37, 99, 235, 0.9);
  backdrop-filter: blur(14px);
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 20;
}

.fusion-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --------------------------------------------------------------------------
   中央エリア：豆知識カード（クリックで消せるUX）
   -------------------------------------------------------------------------- */
.center-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  max-width: 620px;
  margin: 0 auto;
}

.knowledge-panel {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  padding: 18px 28px;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.08);
  text-align: center;
  opacity: 0;
  transform: translateY(-15px) scale(0.96);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  cursor: pointer;
  position: relative;
}

.knowledge-panel:hover {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
  transform: translateY(-13px) scale(0.97);
}

.knowledge-panel.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #0f172a;
}

.knowledge-formula {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.knowledge-sub {
  font-size: 12px;
  font-weight: 700;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.knowledge-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
  font-weight: 500;
}

.knowledge-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 8px;
}

/* ⏳ 自然史・科学史デュアル年代 ＆ 🏛️ 公的学術典拠（デマ・クレーム対策） */
.knowledge-meta-grid {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.knowledge-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.knowledge-meta-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.knowledge-meta-label {
  font-weight: 700;
  color: #475569;
  flex-shrink: 0;
  min-width: 65px;
}

.knowledge-meta-value {
  color: #1e293b;
  font-weight: 500;
  word-break: break-word;
}

#knowledgeSourceVal {
  color: #0284c7;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   下部中央：タイピングHUD ＆ 分岐セレクター
   -------------------------------------------------------------------------- */
.bottom-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  margin-bottom: 20px;
  width: 100%;
}

/* 分岐セレクター（現在タイピング可能な物質の選択チップ） */
.branch-selector-wrapper {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.branch-header-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.hud-category-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 820px;
  padding: 2px 4px 6px 4px;
}

.hud-category-filter::-webkit-scrollbar {
  height: 3px;
}

.hud-category-filter::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 2px;
}

.hud-cat-btn {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.hud-cat-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: #38bdf8;
  color: #ffffff;
}

.hud-cat-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.hud-cat-btn.main-story-btn {
  background: rgba(217, 119, 6, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
  color: #fef08a;
}

.hud-cat-btn.main-story-btn:hover {
  background: rgba(217, 119, 6, 0.45);
  border-color: #fbbf24;
  color: #ffffff;
}

.hud-cat-btn.main-story-btn.active {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  border-color: #fde047;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.branch-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.5px;
}

.branch-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 780px;
  max-height: 84px;
  overflow-y: auto;
  padding: 4px 6px;
}

.branch-container::-webkit-scrollbar {
  width: 5px;
}

.branch-container::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 4px;
}

.branch-chip {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.branch-chip:hover {
  transform: translateY(-2px);
  background: #ffffff;
  border-color: #3b82f6;
  color: #2563eb;
}

.branch-chip.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.branch-chip .chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* タイピング枠（HUD） */
.typing-hud {
  width: 100%;
  max-width: 720px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 22px 36px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.9);
  text-align: center;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.target-word {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #0f172a;
  margin-bottom: 4px;
}

.target-furigana {
  font-size: 15px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 10px;
  min-height: 22px;
}

.target-romaji {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 12px;
}

.typed-char {
  color: #2563eb;
  text-shadow: 0 0 12px rgba(37, 99, 235, 0.35);
}

.untyped-char {
  color: #cbd5e1;
}

.input-hint {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  animation: pulse-glow 1.8s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* --------------------------------------------------------------------------
   宇宙モード（ダークテーマ）
   -------------------------------------------------------------------------- */
body.universe-mode {
  background-color: #030712;
  color: #f8fafc;
}

body.universe-mode .stage-badge {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(56, 189, 248, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.universe-mode .stage-badge .stage-tag {
  background: #0284c7;
}

body.universe-mode .stage-badge .stage-title {
  color: #e2e8f0;
}

body.universe-mode .stage-badge .progress-count {
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

body.universe-mode .btn-control {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

body.universe-mode .btn-control:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

body.universe-mode .knowledge-panel {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(56, 189, 248, 0.25);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.1);
}

body.universe-mode .close-btn {
  color: #64748b;
}
body.universe-mode .close-btn:hover {
  color: #f8fafc;
}

body.universe-mode .knowledge-formula {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

body.universe-mode .knowledge-sub {
  color: #38bdf8;
}

body.universe-mode .knowledge-desc {
  color: #cbd5e1;
}

body.universe-mode .knowledge-hint {
  color: #64748b;
}

body.universe-mode .knowledge-meta-grid {
  border-top-color: rgba(56, 189, 248, 0.2);
}

body.universe-mode .knowledge-meta-label {
  color: #94a3b8;
}

body.universe-mode .knowledge-meta-value {
  color: #e2e8f0;
}

body.universe-mode #knowledgeSourceVal {
  color: #38bdf8;
}

body.universe-mode .branch-label {
  color: #94a3b8;
}

body.universe-mode .branch-chip {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
}

body.universe-mode .branch-chip:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: #38bdf8;
  color: #38bdf8;
}

body.universe-mode .branch-chip.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.5);
}

body.universe-mode .typing-hud {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 35px rgba(56, 189, 248, 0.15);
}

body.universe-mode .target-word {
  color: #ffffff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

body.universe-mode .target-furigana {
  color: #94a3b8;
}

body.universe-mode .typed-char {
  color: #38bdf8;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
}

body.universe-mode .untyped-char {
  color: rgba(255, 255, 255, 0.25);
}

body.universe-mode .input-hint {
  color: #64748b;
}

.shake {
  animation: shake-hud 0.25s ease-in-out;
}

@keyframes shake-hud {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* --------------------------------------------------------------------------
   モーダルウィンドウ共通（宇宙系統樹 ＆ 宇宙図鑑）
   -------------------------------------------------------------------------- */
.modal-backdrop,
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100005;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.open,
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.18);
  border-radius: 24px;
  width: 92%;
  max-width: 1040px;
  height: 86vh;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
  color: #f8fafc;
  transform: translateY(20px) scale(0.97);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-backdrop.open .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.modal-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-desc {
  flex-shrink: 0;
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   🌳 宇宙系統樹ビュー (Tree View) - 高速アコーディオン＆ツールバー
   -------------------------------------------------------------------------- */
.tree-toolbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tree-toolbar-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tree-toolbar-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tree-toolbar-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #ffffff;
  border-color: #38bdf8;
}

.tree-stats-badge {
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.tree-view-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 6px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tree-tier-row {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.tree-tier-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(56, 189, 248, 0.25);
}

.tree-tier-row.has-available {
  border-color: rgba(52, 211, 153, 0.4);
}

.tree-tier-header {
  flex-shrink: 0;
  min-height: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  background: rgba(15, 23, 42, 0.5);
  transition: background 0.15s ease;
}

.tree-tier-header:hover {
  background: rgba(56, 189, 248, 0.08);
}

.tree-tier-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tree-tier-badge {
  font-size: 11px;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.tree-tier-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}

.tree-tier-count {
  font-size: 11px;
  color: #94a3b8;
}

.tree-tier-count.has-avail {
  color: #34d399;
  font-weight: 700;
}

.tree-tier-toggle-icon {
  font-size: 12px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.tree-nodes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 15, 30, 0.3);
}

.tree-node-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  transition: all 0.2s;
  cursor: pointer;
}

.tree-node-card:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.tree-node-card.unlocked {
  background: rgba(14, 165, 233, 0.15);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.tree-node-card.available {
  background: rgba(16, 185, 129, 0.15);
  border-color: #34d399;
  color: #34d399;
  animation: pulse-ready 1.8s infinite ease-in-out;
}

@keyframes pulse-ready {
  0%, 100% { border-color: #34d399; box-shadow: 0 0 5px rgba(52, 211, 153, 0.3); }
  50% { border-color: #6ee7b7; box-shadow: 0 0 18px rgba(52, 211, 153, 0.6); }
}

.tree-node-card.locked {
  opacity: 0.45;
  border-color: rgba(255, 255, 255, 0.05);
}

.tree-node-card.main-story {
  border-left: 3px solid #f59e0b;
}

.tree-node-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.main-story-tree-badge {
  font-size: 9px;
  font-weight: 800;
  color: #fef08a;
  background: rgba(217, 119, 6, 0.4);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

.tree-node-name {
  font-weight: 700;
}

.tree-node-formula {
  font-size: 10px;
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   📖 宇宙図鑑グリッド (Codex Grid)
   -------------------------------------------------------------------------- */
.codex-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  padding: 6px 4px 16px;
}

.codex-card {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.codex-card.unlocked:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.codex-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}

.codex-card-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: #38bdf8;
}

.codex-card-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
}

.codex-card-en {
  font-size: 12px;
  color: #94a3b8;
}

.codex-card-formula {
  font-size: 11px;
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  padding: 2px 6px;
  border-radius: 6px;
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
}

.codex-card-meta {
  font-size: 10px;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.codex-card-meta-row {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-card-meta-label {
  color: #64748b;
  flex-shrink: 0;
}

.codex-card-meta-val {
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* カスタムスクロールバー */
.tree-view-container::-webkit-scrollbar,
.codex-grid::-webkit-scrollbar {
  width: 8px;
}

.tree-view-container::-webkit-scrollbar-track,
.codex-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.tree-view-container::-webkit-scrollbar-thumb,
.codex-grid::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 4px;
}

.tree-view-container::-webkit-scrollbar-thumb:hover,
.codex-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.6);
}

/* --------------------------------------------------------------------------
   📖 図鑑 ツールバー（検索・件数バッジ）
   -------------------------------------------------------------------------- */
.codex-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.codex-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 240px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 0 12px;
  transition: all 0.2s ease;
}

.codex-search-box:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
  background: rgba(15, 23, 42, 0.95);
}

.codex-search-box .search-icon {
  font-size: 14px;
  margin-right: 8px;
  opacity: 0.7;
}

.codex-search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: #f8fafc;
  font-size: 14px;
  padding: 10px 0;
  outline: none;
}

.codex-search-box input::placeholder {
  color: #64748b;
}

.clear-search-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 50%;
  display: none;
}

.clear-search-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.codex-count-badge {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   📖 図鑑 カテゴリ切り替えタブ
   -------------------------------------------------------------------------- */
.codex-tabs {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 120px;
  overflow-y: auto;
  padding: 4px 2px 10px;
  margin-bottom: 12px;
}

.codex-tabs::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.codex-tabs::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 3px;
}

.codex-tab {
  flex-shrink: 0;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.codex-tab:hover {
  color: #ffffff;
  background: rgba(51, 65, 85, 0.85);
  border-color: rgba(56, 189, 248, 0.4);
}

.codex-tab.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(99, 102, 241, 0.3));
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

/* --------------------------------------------------------------------------
   💡 偉人による発見ポップアウト通知 (Discovery Popout)
   -------------------------------------------------------------------------- */
.discovery-popout-container {
  position: absolute;
  top: 75px;
  right: 28px;
  z-index: 100;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}

.discovery-card {
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(236, 72, 153, 0.5);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65), 0 0 25px rgba(236, 72, 153, 0.25);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 16px 20px;
  color: #f8fafc;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.discovery-card.show {
  transform: translateX(0);
  opacity: 1;
}

.discovery-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ec4899, #38bdf8, transparent);
  animation: discoveryShine 2.5s infinite linear;
}

@keyframes discoveryShine {
  0% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

.discovery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.discovery-tag {
  font-size: 11px;
  font-weight: 800;
  color: #ec4899;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}

.discovery-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  transition: color 0.2s;
}

.discovery-close:hover {
  color: #ffffff;
}

.discovery-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

.discovery-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.45;
  margin-bottom: 12px;
}

.discovery-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.discovery-chip-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #f8fafc;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.discovery-chip-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.discovery-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px currentColor;
}

/* --------------------------------------------------------------------------
   ロック中チップ (Locked Branch Chip)
   -------------------------------------------------------------------------- */
.branch-chip.locked {
  opacity: 0.5;
  border-style: dashed;
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(148, 163, 184, 0.3);
  cursor: not-allowed;
}

.branch-chip.locked:hover {
  opacity: 0.75;
  border-color: rgba(148, 163, 184, 0.6);
}

.branch-chip .chip-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}

/* ==========================================================================
   スタート画面（何もない白い画面にグレーの文字の洗練されたデザイン）
   ========================================================================== */
.start-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s;
  user-select: none;
}

.start-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-content {
  text-align: center;
  padding: 40px 24px;
  max-width: 680px;
  animation: startFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.start-title {
  font-size: 42px;
  font-weight: 300;
  letter-spacing: 0.14em;
  color: #475569; /* 上品なグレー */
  margin: 0 0 16px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.start-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: #94a3b8; /* やわらかなグレー */
  letter-spacing: 0.08em;
  margin: 0 0 48px 0;
}

/* ==========================================================================
   画面右上：オプションボタン（難易度 & ジャンル設定）
   ========================================================================== */
.start-top-bar {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 50;
}

.start-options-btn {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid #cbd5e1;
  padding: 8px 16px;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  outline: none;
}

.start-options-btn:hover {
  background: #ffffff;
  border-color: #94a3b8;
  color: #1e293b;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.start-options-btn:active {
  transform: translateY(0);
}

.start-options-badge {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 1px 7px;
  border-radius: 10px;
}

/* ==========================================================================
   ⚙️ スタート画面 オプションモーダル
   ========================================================================== */
.start-options-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}

.start-options-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.start-options-modal-content {
  background: #ffffff;
  color: #1e293b;
  border-radius: 24px;
  width: 90%;
  max-width: 840px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  transform: scale(0.96) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

.start-options-modal-backdrop.open .start-options-modal-content {
  transform: scale(1) translateY(0);
}

.start-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.start-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 4px 0;
}

.start-modal-desc {
  font-size: 13px;
  color: #475569;
  margin: 0;
}

.start-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.start-modal-close-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.start-options-modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.start-options-apply-btn {
  padding: 10px 28px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  background: #2563eb;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.start-options-apply-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* ==========================================================================
   🎮 設定パネル（モーダル内部）
   ========================================================================== */
.start-settings-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  text-align: left;
}

.start-setting-group {
  margin-bottom: 22px;
}

.start-setting-group:last-child {
  margin-bottom: 0;
}

.start-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.start-group-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.start-group-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.start-group-sub {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.start-word-count-badge {
  font-size: 12px;
  font-weight: 800;
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  padding: 3px 12px;
  border-radius: 12px;
  letter-spacing: 0.02em;
}

.start-genre-actions {
  display: flex;
  gap: 6px;
}

.genre-action-btn {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.genre-action-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #64748b;
}

/* プレイルート設定（メインストーリー本流 vs 全教科サブルート） */
.start-route-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.start-route-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  user-select: none;
}

.start-route-card:hover {
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.start-route-card.active {
  border-color: #d97706;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.18), inset 0 0 0 1px #f59e0b;
  transform: translateY(-2px);
}

.start-route-card#routeCardAll.active {
  border-color: #2563eb;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.18), inset 0 0 0 1px #3b82f6;
}

.route-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-icon {
  font-size: 18px;
}

.route-name {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  flex-grow: 1;
}

.route-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #fef3c7;
  color: #b45309;
}

.start-route-card#routeCardAll .route-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.route-desc {
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  line-height: 1.45;
}

/* 難易度カード群（4段階） */
.start-level-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.start-level-card {
  cursor: pointer;
  display: block;
}

.start-level-card input[type="radio"] {
  display: none;
}

.level-card-inner {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 12px;
  height: 100%;
  box-sizing: border-box;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.start-level-card:hover .level-card-inner {
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.start-level-card input[type="radio"]:checked + .level-card-inner,
.start-level-card.active .level-card-inner {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18), inset 0 0 0 1px #2563eb;
  transform: translateY(-2px);
}

/* 教育段階レベルバッジの視認性完全強化（白背景上でもクッキリ明瞭に） */
.level-badge {
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.level-badge.lvl-1 {
  color: #15803d !important; /* 濃いエメラルドグリーン（小学校） */
}

.level-badge.lvl-2 {
  color: #b45309 !important; /* 濃いアンバーゴールド（中学校） */
}

.level-badge.lvl-3 {
  color: #c2410c !important; /* 濃いバーントオレンジ（高校） */
}

.level-badge.lvl-4 {
  color: #7e22ce !important; /* 濃いロイヤルパープル（大学・専門） */
}

.level-desc {
  font-size: 11px;
  font-weight: 500;
  color: #475569 !important;
  line-height: 1.4;
}

/* ジャンルチェックボックス群（動的グリッド・教育段階連動） */
.start-genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.start-genre-checkbox {
  cursor: pointer;
  display: block;
  user-select: none;
}

.start-genre-checkbox input[type="checkbox"] {
  display: none;
}

.genre-chip {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.genre-chip:hover {
  border-color: #64748b;
  background: #f1f5f9;
}

.start-genre-checkbox input[type="checkbox"]:checked + .genre-chip {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8 !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.14);
}

.chip-main {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.chip-name {
  font-size: 12px;
  color: inherit;
}

.chip-count {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.start-genre-checkbox input[type="checkbox"]:checked + .genre-chip .chip-count {
  color: #1d4ed8;
  background: #dbeafe;
}

/* ==========================================================================
   スタートボタン（元通りのシンプルで洗練されたデザイン）
   ========================================================================== */
.start-action-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.start-btn {
  padding: 14px 48px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #475569;
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.start-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #1e293b;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.start-btn:active {
  transform: translateY(0);
}

.start-hint {
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.start-kbd {
  display: inline-block;
  padding: 2px 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  color: #64748b;
  font-family: monospace;
  font-size: 11px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.start-device-notice {
  font-size: 11px;
  color: #64748b;
  background: rgba(241, 245, 249, 0.85);
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 9999px;
  padding: 4px 14px;
  margin-top: 6px;
  letter-spacing: 0.02em;
  display: inline-block;
}

body.universe-mode .start-device-notice {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(51, 65, 85, 0.7);
  color: #94a3b8;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .start-level-options {
    grid-template-columns: repeat(2, 1fr);
  }
  .start-genre-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .start-title {
    font-size: 32px;
  }
  .start-top-bar {
    top: 16px;
    right: 16px;
  }
}

/* ==========================================================================
   画面右上・独立型「偉人発見コンボミニゲーム」HUDスタイル
   ========================================================================== */
.discovery-popout-container {
  position: absolute;
  top: 76px;
  right: 28px;
  z-index: 100;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.discovery-mini-hud {
  width: 330px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 20px rgba(56, 189, 248, 0.15);
  overflow: hidden;
  color: #f8fafc;
  opacity: 0;
  transform: translateX(40px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  user-select: none;
}

.discovery-mini-hud.show {
  opacity: 1;
  transform: translateX(0) scale(1);
}

/* 10秒タイマーバー */
.mini-timer-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.mini-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  transition: width 0.08s linear, background-color 0.3s ease;
}

.mini-timer-bar.warning {
  background: #f59e0b;
}

.mini-timer-bar.danger {
  background: #ef4444;
  animation: timerBlink 0.4s infinite alternate;
}

@keyframes timerBlink {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

.mini-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mini-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.mini-card-title span.scientist-name {
  color: #f1f5f9;
  font-size: 12px;
}

.mini-combo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.4);
  transform: scale(1);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mini-combo-badge.pop {
  transform: scale(1.25);
}

.mini-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s ease, background 0.2s ease;
}

.mini-close-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
}

/* タイピング単語表示 */
.mini-typing-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-word-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.mini-target-word {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.mini-progress-step {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.mini-furigana {
  font-size: 11px;
  color: #38bdf8;
  letter-spacing: 0.04em;
}

.mini-romaji-box {
  font-family: "SF Mono", Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.mini-romaji-typed {
  color: #10b981;
  text-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.mini-romaji-untyped {
  color: #e2e8f0;
}

.mini-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
  margin-top: 2px;
}

/* 全問コンボ達成エフェクト */
.discovery-mini-hud.full-combo {
  border-color: #fbbf24;
  box-shadow: 0 0 35px rgba(251, 191, 36, 0.55), 0 12px 36px rgba(0, 0, 0, 0.5);
  animation: fullComboPulse 1s ease infinite alternate;
}

@keyframes fullComboPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.02); }
}

.mini-complete-banner {
  text-align: center;
  padding: 10px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #fbbf24;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

/* ==========================================================================
   言語・バイリンガル学習設定モーダル & HUDバイリンガル表示
   ========================================================================== */
.target-bilingual-sub {
  font-size: 14px;
  font-weight: 600;
  color: #38bdf8;
  letter-spacing: 0.04em;
  margin-top: 4px;
  min-height: 18px;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
  transition: all 0.2s ease;
}

.lang-modal-content {
  max-width: 660px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.lang-setting-section {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.lang-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.lang-section-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 14px;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.lang-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.7);
  border: 1.5px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
  user-select: none;
}

.lang-card:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lang-card.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
}

.lang-flag {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.lang-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lang-name {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
}

.lang-en {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

.lang-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.apply-lang-btn {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border: 1px solid #38bdf8;
  color: #ffffff;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  transition: all 0.2s ease;
}

.apply-lang-btn:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

/* ==========================================================================
   ★ ベクターイラスト表示スタイル (Illustration Engine)
   ========================================================================== */
.knowledge-illustration {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 4px auto 10px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, rgba(15, 23, 42, 0.4) 70%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 0 12px rgba(56, 189, 248, 0.15);
  padding: 8px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: illustrationPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.knowledge-illustration:empty {
  display: none;
}

.illustration-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  overflow: visible;
}

@keyframes illustrationPop {
  0% { transform: scale(0.6) rotate(-4deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* 図鑑カード内のイラストバッジ */
.codex-card-illustration {
  width: 50px;
  height: 50px;
  margin: 0 auto 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 4px;
}

/* ==========================================================================
   ★ 時代・学術出典オプション表示切り替え (Metadata Toggle)
   ========================================================================== */
.meta-toggle-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.meta-toggle-btn.active {
  background: rgba(234, 179, 8, 0.15);
  border-color: #eab308;
  color: #fef08a;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.3);
}

.meta-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.4);
}

/* 豆知識パネル内のインライン切り替え */
.knowledge-meta-section {
  width: 100%;
  margin-top: 8px;
}

.toggle-panel-meta-btn {
  background: transparent;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  margin-bottom: 6px;
}

.toggle-panel-meta-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  border-color: rgba(56, 189, 248, 0.5);
}

.toggle-panel-meta-btn.open .arrow-icon {
  transform: rotate(180deg);
}

/* オプションが非表示(デフォルト)時の図鑑カード表示調整 */
body.hide-scientific-meta .codex-meta-row,
body.hide-scientific-meta .codex-academic-tag {
  display: none !important;
}

/* ==========================================================================
   🎵 サウンド＆BGMプレイリスト設定モーダル
   ========================================================================== */
.sound-modal-content {
  max-width: 760px;
  width: 92%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(56, 189, 248, 0.15);
  border-radius: 18px;
  overflow: hidden;
  color: #f1f5f9;
}

.sound-player-panel {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 18px;
}

.sound-now-playing {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.sound-disk-visual {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #1e293b, #334155, #0f172a, #334155, #1e293b);
  border: 2px solid #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
  transition: transform 0.5s ease;
}

.sound-disk-visual.spinning {
  animation: spinDisk 4s linear infinite;
}

@keyframes spinDisk {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.disk-center {
  width: 14px;
  height: 14px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 6px #38bdf8;
}

.sound-track-info {
  flex: 1;
  min-width: 0;
}

.track-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.track-state-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.track-state-badge.playing {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.track-synth-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.3);
  display: none;
}

.track-synth-badge.visible {
  display: inline-block;
}

.track-title-text {
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-theme-text {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.sound-player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.player-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  transform: scale(1.05);
}

.player-btn-main {
  width: 44px;
  height: 44px;
  font-size: 18px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border: none;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.player-btn.fav-btn.active {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.5);
  text-shadow: 0 0 8px #fbbf24;
}

.sound-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 12px;
}

.sound-mode-toggles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sound-mode-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.sound-mode-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sound-mode-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 600;
}

.sound-volume-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.volume-slider-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-label {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

.volume-slider {
  width: 75px;
  height: 4px;
  border-radius: 2px;
  background: #334155;
  accent-color: #38bdf8;
  cursor: pointer;
}

.volume-val {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  width: 28px;
  text-align: right;
}

/* 打鍵音セレクター */
.key-preset-section {
  margin-bottom: 16px;
}

.key-preset-section .section-title {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 8px;
}

.key-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.key-preset-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.key-preset-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.4);
}

.key-preset-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.preset-name {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
}

.preset-desc {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
  line-height: 1.3;
}

/* 20曲プレイリスト */
.playlist-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.playlist-section .section-title {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
}

.playlist-guide {
  font-size: 10px;
  color: #94a3b8;
}

.playlist-guide code {
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 4px;
  border-radius: 3px;
  color: #7dd3fc;
}

.playlist-table-container {
  flex: 1;
  overflow-y: auto;
  max-height: 200px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 4px;
}

.playlist-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 10px;
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.playlist-item.active {
  background: rgba(56, 189, 248, 0.18);
  border-left: 3px solid #38bdf8;
}

.playlist-item-num {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  width: 20px;
}

.playlist-item.active .playlist-item-num {
  color: #38bdf8;
}

.playlist-item-main {
  flex: 1;
  min-width: 0;
}

.playlist-item-title {
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-theme {
  font-size: 10px;
  color: #94a3b8;
}

.playlist-fav-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 6px;
  transition: color 0.15s;
}

.playlist-fav-btn:hover {
  color: #fbbf24;
}

.playlist-fav-btn.active {
  color: #fbbf24;
  text-shadow: 0 0 6px #fbbf24;
}

.sound-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.apply-sound-btn {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.apply-sound-btn:hover {
  opacity: 0.9;
}

/* ==========================================================================
   新機能群：お気に入り・特訓・実績・スピード検定・データ管理
   ========================================================================== */

/* --- お気に入りスターボタン（タイピングHUD） --- */
.target-word-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.favorite-star-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #64748b;
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  vertical-align: middle;
}

.favorite-star-btn:hover {
  border-color: #fbbf24;
  color: #f59e0b;
  transform: scale(1.1);
}

.favorite-star-btn.active {
  color: #fbbf24;
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
}

/* 特訓・お気に入りタブ */
.hud-cat-btn.drill-btn {
  border-color: rgba(251, 191, 36, 0.5);
  color: #fef08a;
}
.hud-cat-btn.drill-btn:hover {
  background: rgba(251, 191, 36, 0.15);
}
.hud-cat-btn.drill-btn.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-color: #fbbf24;
}

/* --- 🏆 実績・称号コレクションモーダル --- */
.achievements-modal-content {
  max-width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.achieve-modal-title-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.achieve-count-badge {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding: 8px 4px 16px 4px;
  max-height: 60vh;
}

.achieve-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: transform 0.15s, border-color 0.15s;
}

.achieve-card.unlocked {
  border-color: rgba(251, 191, 36, 0.4);
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.achieve-card.locked {
  opacity: 0.55;
  filter: grayscale(0.8);
}

.achieve-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.achieve-info {
  flex: 1;
  min-width: 0;
}

.achieve-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 4px;
}

.achieve-card.unlocked .achieve-title {
  color: #fde047;
}

.achieve-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

.achieve-date {
  font-size: 10px;
  color: #64748b;
  margin-top: 6px;
}

.achieve-hint {
  font-size: 11px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border: 1px dashed rgba(56, 189, 248, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
  margin-top: 6px;
  line-height: 1.4;
}

.achieve-status {
  font-size: 10px;
  font-weight: 700;
  margin-top: 6px;
  display: inline-block;
}

.achieve-status.unlocked {
  color: #4ade80;
}

.achieve-status.locked {
  color: #94a3b8;
}

/* --- ⏱️ スピード検定・タイムアタックモーダル --- */
.speed-test-modal-content {
  max-width: 760px;
  text-align: center;
}

.speed-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 24px 0 10px 0;
}

.speed-mode-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s;
}

.speed-mode-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  background: rgba(30, 41, 59, 0.85);
}

.mode-icon {
  font-size: 38px;
  margin-bottom: 10px;
}

.mode-title {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 6px;
}

.mode-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 12px;
  min-height: 52px;
}

.mode-meta {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 6px;
  padding: 4px 10px;
  margin-bottom: 14px;
}

.start-speed-mode-btn {
  width: 100%;
  padding: 10px;
  font-weight: 700;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  border: none;
  cursor: pointer;
}

/* スピード検定プレイ中ビュー */
.speed-live-stats-bar {
  display: flex;
  justify-content: space-around;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 24px;
}

.live-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.live-stat-label {
  font-size: 11px;
  color: #94a3b8;
}

.live-stat-val {
  font-size: 18px;
  font-weight: 800;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}

.timer-val {
  color: #38bdf8;
}

.speed-typing-display {
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  padding: 32px 20px;
  margin-bottom: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.speed-target-word {
  font-size: 36px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.speed-target-furigana {
  font-size: 16px;
  color: #38bdf8;
  margin-bottom: 12px;
}

.speed-target-romaji {
  font-size: 22px;
  font-family: 'SF Mono', Consolas, Menlo, monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.speed-actions-row {
  display: flex;
  justify-content: center;
}

.abort-test-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.abort-test-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* 検定結果リザルトモーダル */
.speed-result-modal-content {
  max-width: 540px;
  text-align: center;
}

.result-rank-box {
  margin: 16px 0 24px 0;
}

.result-rank-badge {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 0 0 24px rgba(251, 191, 36, 0.6);
}

.result-rank-badge.rank-s {
  color: #fde047;
  text-shadow: 0 0 30px #f59e0b;
}
.result-rank-badge.rank-a {
  color: #38bdf8;
  text-shadow: 0 0 20px #0284c7;
}
.result-rank-badge.rank-b {
  color: #4ade80;
  text-shadow: 0 0 20px #16a34a;
}
.result-rank-badge.rank-c {
  color: #cbd5e1;
}

.result-rank-title {
  font-size: 18px;
  font-weight: 700;
  color: #e2e8f0;
}

.result-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.result-stat-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.res-stat-label {
  font-size: 11px;
  color: #94a3b8;
}

.res-stat-val {
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
}

.result-actions-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.share-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.retry-btn {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

/* --- 💾 セーブデータ管理・引き継ぎモーダル --- */
.data-modal-content {
  max-width: 620px;
}

.data-actions-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.data-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
}

.data-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 6px;
}

.data-card-desc {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 12px;
  line-height: 1.4;
}

.data-btn-row {
  display: flex;
  gap: 10px;
}

.data-action-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.file-input-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.import-textarea {
  width: 100%;
  height: 90px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #f8fafc;
  font-family: monospace;
  font-size: 11px;
  padding: 8px;
  resize: vertical;
  box-sizing: border-box;
}

.apply-import-btn {
  margin-top: 8px;
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  padding: 8px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.danger-card {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

.danger-btn {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
}
.danger-btn:hover {
  background: #dc2626;
  color: #fff;
}

/* ==========================================================================
   🎯 デュアルタイピング並行入力フォーカスハイライト
   （メインゲームとミニゲームのどちらにフォーカスが当たっているかを美しく可視化）
   ========================================================================== */
.typing-hud.typing-focus {
  border-color: rgba(56, 189, 248, 0.85) !important;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.4), inset 0 0 16px rgba(56, 189, 248, 0.15) !important;
  transition: border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.discovery-mini-hud.typing-focus {
  border-color: rgba(250, 204, 21, 0.9) !important;
  box-shadow: 0 0 28px rgba(250, 204, 21, 0.5), 0 12px 36px rgba(0, 0, 0, 0.5), inset 0 0 16px rgba(250, 204, 21, 0.15) !important;
  transform: scale(1.025);
  transition: border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   📮 フィードバック送信モーダル (Googleドライブ / スプレッドシート連携対応)
   ========================================================================== */
.feedback-modal-card {
  max-width: 580px;
  width: 90%;
  height: auto;
  max-height: 88vh;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6), 0 0 32px rgba(56, 189, 248, 0.2);
}

.feedback-modal-body {
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feedback-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
}

.feedback-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

.required-badge {
  color: #f43f5e;
  font-size: 11px;
  margin-left: 4px;
}

.feedback-type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feedback-type-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: #94a3b8;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.feedback-type-chip input[type="radio"] {
  display: none;
}

.feedback-type-chip:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #e2e8f0;
}

.feedback-type-chip.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
  font-weight: 700;
}

.feedback-input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 13px;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.feedback-input:focus,
.feedback-textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.feedback-textarea {
  width: 100%;
  min-height: 110px;
  padding: 10px 12px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.feedback-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #94a3b8;
  cursor: pointer;
}

.feedback-action-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.feedback-submit-btn {
  flex: 1.4;
  padding: 10px 16px;
  background: linear-gradient(135deg, #10b981, #0284c7);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: all 0.2s;
}

.feedback-submit-btn:hover {
  background: linear-gradient(135deg, #059669, #0369a1);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

.feedback-copy-btn {
  flex: 1;
  padding: 10px 14px;
  background: rgba(51, 65, 85, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  color: #cbd5e1;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-copy-btn:hover {
  background: rgba(71, 85, 105, 0.9);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.5);
}

.feedback-status-msg {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.feedback-status-msg.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.feedback-status-msg.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* ==========================================================================
   タイトル画面左下：生成AI利用に関する注意事項（ディスクレーマー）
   ========================================================================== */
.start-ai-notice {
  position: absolute;
  bottom: 24px;
  left: 28px;
  max-width: 500px;
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 12px;
  padding: 10px 15px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
  z-index: 50;
  pointer-events: auto;
  transition: all 0.3s ease;
}

.start-ai-notice:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(148, 163, 184, 0.9);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.08);
}

.start-ai-notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  margin-bottom: 0;
  border-radius: 4px;
  transition: opacity 0.2s ease;
}

.start-ai-notice-header:hover {
  opacity: 0.85;
}

.ai-notice-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.ai-notice-title {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.04em;
  flex-grow: 1;
}

.ai-notice-arrow {
  font-size: 11px;
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  user-select: none;
}

.start-ai-notice-header[aria-expanded="true"] .ai-notice-arrow {
  transform: rotate(180deg);
}

.ai-notice-body {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.25s ease;
  margin-top: 0;
}

.ai-notice-body.open {
  max-height: 180px;
  opacity: 1;
  margin-top: 6px;
}

.ai-notice-text {
  font-size: 10.5px;
  line-height: 1.5;
  color: #64748b;
  margin: 0;
  letter-spacing: 0.02em;
}

.pc-br {
  display: inline;
}

body.universe-mode .start-ai-notice {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(51, 65, 85, 0.7);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

body.universe-mode .start-ai-notice:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(56, 189, 248, 0.5);
}

body.universe-mode .ai-notice-title {
  color: #94a3b8;
}

body.universe-mode .ai-notice-arrow {
  color: #94a3b8;
}

body.universe-mode .ai-notice-text {
  color: #cbd5e1;
}

@media (max-width: 768px) {
  .start-ai-notice {
    bottom: 14px;
    left: 14px;
    right: 14px;
    max-width: calc(100% - 28px);
    padding: 8px 12px;
  }
  .ai-notice-text {
    font-size: 9.5px;
  }
  .pc-br {
    display: none;
  }
}

/* ==========================================================================
   画面右下：オープンベータ ＆ 個人開発クレジット ＆ 著作権表示
   ========================================================================== */
.start-dev-notice {
  position: absolute;
  bottom: 24px;
  right: 28px;
  max-width: 380px;
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
  z-index: 50;
  pointer-events: auto;
  transition: all 0.3s ease;
  text-align: right;
}

.start-dev-notice:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(148, 163, 184, 0.9);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.08);
}

.dev-notice-badge-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 4px;
}

.beta-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  color: #0284c7;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 9999px;
  padding: 2px 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.solo-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #7c3aed;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: 9999px;
  padding: 2px 8px;
  letter-spacing: 0.03em;
}

.dev-notice-text {
  font-size: 11px;
  line-height: 1.4;
  color: #475569;
  margin: 0;
  letter-spacing: 0.02em;
}

body.universe-mode .start-dev-notice {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(51, 65, 85, 0.7);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

body.universe-mode .start-dev-notice:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(56, 189, 248, 0.5);
}

body.universe-mode .dev-notice-text {
  color: #cbd5e1;
}

@media (max-width: 768px) {
  .start-dev-notice {
    position: static;
    margin: 12px auto 0;
    max-width: 90%;
    text-align: center;
  }
  .dev-notice-badge-row {
    justify-content: center;
  }
}

/* ==========================================================================
   オプション設定モーダル内：表示・フィードバックサポート設定
   ========================================================================== */
.start-support-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.start-checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.start-checkbox-card:hover {
  border-color: #38bdf8;
  background: #f8fafc;
}

.start-checkbox-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #2563eb;
}

.checkbox-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checkbox-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.checkbox-card-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.start-feedback-direct-box {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 2px;
}

.start-feedback-direct-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #2563eb;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.start-feedback-direct-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.direct-btn-hint {
  font-size: 11px;
  color: #64748b;
}

/* ==========================================================================
   画面左側：Tier表記の直下に配置する独立型要望タブ
   ========================================================================== */
.feedback-tab-container {
  position: absolute;
  top: 76px; /* stage-badgeの高さ(約38px) + 上パディング(20px) + 余白(18px) で真下に配置 */
  left: 28px; /* stage-badgeの左端と整列 */
  z-index: 100;
  pointer-events: auto;
}

.floating-feedback-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-feedback-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.2);
  background: #ffffff;
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.3);
}

.floating-feedback-tab:active {
  transform: translateY(0);
}

.floating-feedback-tab .tab-icon {
  font-size: 13px;
}

.floating-feedback-tab .tab-text {
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

/* 宇宙モード（ダークテーマ）対応 */
body.universe-mode .floating-feedback-tab {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #e2e8f0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

body.universe-mode .floating-feedback-tab:hover {
  background: rgba(30, 41, 59, 0.95);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.25);
}

/* ==========================================================================
   📜 利用規約・免責事項・学術クレジット モーダル (Terms & Disclaimer)
   ========================================================================== */
.terms-modal-content {
  max-width: 780px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: #1e293b;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.terms-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.7;
  color: #334155;
  background: #f8fafc;
}

.terms-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.terms-heading {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 0;
  margin-bottom: 12px;
  border-left: 4px solid #2563eb;
  padding-left: 10px;
}

.terms-text {
  margin: 0 0 10px 0;
}

.terms-list {
  margin: 8px 0 12px 20px;
  padding: 0;
}

.terms-list li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.terms-callout {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  color: #1e40af;
  margin-top: 10px;
}

.terms-modal-footer {
  padding: 16px 24px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
}

.terms-agree-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 600;
  padding: 10px 32px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

.terms-agree-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* スタート画面の利用規約リンクボタン */
.start-notice-links {
  margin-top: 10px;
}

.terms-link-btn {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #64748b;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.terms-link-btn:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: #2563eb;
  color: #2563eb;
}

/* ==========================================================================
   🔒 フィードバックフォーム セキュリティ・プライバシー表示
   ========================================================================== */
.feedback-security-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}

.feedback-field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.feedback-char-count {
  font-size: 11px;
  color: #64748b;
  font-family: monospace;
}

/* ==========================================================================
   🎉 メインストーリー制覇 祝賀モーダル
   ========================================================================== */
.main-clear-backdrop {
  z-index: 100010 !important;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(14px);
}

.main-clear-modal-content {
  max-width: 580px;
  width: 90%;
  background: linear-gradient(145deg, #0f172a, #1e1b4b);
  border: 2px solid rgba(245, 158, 11, 0.5);
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  color: #ffffff;
  box-shadow: 0 0 60px rgba(245, 158, 11, 0.3), 0 25px 50px rgba(0, 0, 0, 0.6);
  animation: mainClearPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes mainClearPop {
  0% { transform: scale(0.7) translateY(40px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.main-clear-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.main-clear-trophy {
  font-size: 5rem;
  filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.6));
  animation: floatTrophy 2.5s ease-in-out infinite;
}

@keyframes floatTrophy {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}

.main-clear-sparkle {
  font-size: 2rem;
  animation: sparkleTwinkle 1.5s ease-in-out infinite alternate;
}

@keyframes sparkleTwinkle {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 1; }
}

.main-clear-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.main-clear-rank-badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid #f59e0b;
  border-radius: 9999px;
  color: #fbbf24;
  font-size: 0.95rem;
  font-weight: bold;
  margin-bottom: 16px;
}

.main-clear-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.main-clear-unlock-notice {
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(56, 189, 248, 0.5);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 24px;
}

.notice-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: bold;
  background: #0284c7;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.main-clear-unlock-notice p {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: #94a3b8;
}

.main-clear-action-row {
  margin-top: 10px;
}

.main-clear-advance-btn {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: bold;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
  transition: all 0.2s ease;
}

.main-clear-advance-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(59, 130, 246, 0.6);
}



