/* =============================================
   リセット・ベース
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Zen Maru Gothic', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background-color: #0f0e17;
  background-image: radial-gradient(rgba(139,92,246,0.10) 1px, transparent 1px);
  background-size: 28px 28px;
  color: #e2e8f0;
  min-height: 100vh;
}

/* =============================================
   スクリーン制御
   ============================================= */
.screen        { display: none; flex-direction: column; align-items: center; min-height: 100vh; padding: 20px 16px 40px; }
.screen.active { display: flex; }
.screen-inner  { width: 100%; max-width: 800px; }

/* =============================================
   アニメーション
   ============================================= */
@keyframes float  { 0%,100%{transform:translateY(0)}    50%{transform:translateY(-12px)} }
@keyframes fadeIn { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
@keyframes pulse  { 0%,100%{transform:scale(1)}          50%{transform:scale(1.08)} }
@keyframes spin   { to{transform:rotate(360deg)} }
@keyframes shake  { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
@keyframes flash  { 0%,100%{opacity:1}                   50%{opacity:0.3} }
@keyframes glow   { 0%,100%{text-shadow:0 0 16px #22d3ee66} 50%{text-shadow:0 0 32px #22d3eecc,0 0 8px #fff4} }
@keyframes battleFlashGreen { 0%{box-shadow:inset 0 0 80px 20px rgba(74,222,128,0.22)} 100%{box-shadow:inset 0 0 80px 20px rgba(74,222,128,0)} }
@keyframes battleFlashRed   { 0%{box-shadow:inset 0 0 80px 20px rgba(248,113,113,0.28)} 100%{box-shadow:inset 0 0 80px 20px rgba(248,113,113,0)} }

/* =============================================
   試験選択画面
   ============================================= */
/* ===== タイトル画面 試験選択カード ===== */
.title-exam-select {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  margin: 16px 0 12px; width: 100%; max-width: 500px;
}
a.title-exam-btn, .title-exam-btn {
  flex: 1; min-width: 160px; max-width: 220px;
  background: rgba(26,24,68,0.85); border: 2px solid rgba(139,92,246,0.3);
  border-radius: 16px; padding: 18px 14px; cursor: pointer; color: #e2e8f0;
  text-align: center; transition: background .2s, border-color .2s, transform .15s, box-shadow .2s;
  text-decoration: none; display: block;
}
.title-exam-btn:hover {
  background: rgba(139,92,246,0.22); border-color: #22d3ee;
  transform: translateY(-4px); box-shadow: 0 8px 28px rgba(139,92,246,0.35);
}
.title-exam-btn.active {
  border-color: #22d3ee; background: rgba(34,211,238,0.10);
  box-shadow: 0 4px 18px rgba(34,211,238,0.25);
}
.title-exam-icon { font-size: 2.2rem; margin-bottom: 8px; color: #22d3ee; }
.title-exam-name { font-size: 0.88rem; font-weight: 700; color: #f1f5f9; margin-bottom: 4px; line-height: 1.4; }
.title-exam-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  background: rgba(139,92,246,0.25); color: #c4b5fd;
  padding: 2px 8px; border-radius: 99px; margin-bottom: 8px;
}
.title-exam-desc { font-size: 0.68rem; color: #64748b; line-height: 1.45; }
.title-footer {
  margin-top: 20px; font-size: 0.72rem; color: #475569;
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
}
.title-footer a { color: #7c6fa0; text-decoration: none; }
.title-footer a:hover { color: #a78bfa; }

#exam-screen { justify-content: center; gap: 20px; text-align: center; }
.exam-cards {
  display: flex; gap: 20px; flex-wrap: wrap; justify-content: center;
  max-width: 680px; width: 100%;
}
.exam-card {
  flex: 1; min-width: 220px; max-width: 300px;
  background: #1a1844; border: 2px solid rgba(139,92,246,0.3);
  border-radius: 16px; padding: 28px 20px;
  cursor: pointer; text-align: center;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  color: #e2e8f0; font-family: inherit;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.exam-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 36px rgba(139,92,246,0.4);
  border-color: #22d3ee;
}
.exam-card-icon { font-size: 3rem; margin-bottom: 12px; color: #22d3ee; }
.exam-card-name { font-size: 1rem; font-weight: 700; color: #f1f5f9; margin-bottom: 6px; line-height: 1.4; }
.exam-card-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  background: rgba(139,92,246,0.25); color: #c4b5fd;
  padding: 2px 10px; border-radius: 99px; margin-bottom: 10px;
}
.exam-card-desc { font-size: 0.78rem; color: #94a3b8; line-height: 1.6; margin-bottom: 8px; }
.exam-card-meta { font-size: 0.72rem; color: #64748b; }

/* =============================================
   試験切替タブ（マップ画面上部）
   ============================================= */
.exam-toggle {
  display: flex; gap: 8px; margin-bottom: 12px; width: 100%; max-width: 800px;
}
.exam-toggle-btn {
  flex: 1; padding: 10px 16px;
  background: #1a1844; border: 2px solid rgba(139,92,246,0.2);
  border-radius: 10px; color: #64748b; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; transition: all .2s; font-family: inherit;
}
.exam-toggle-btn.active {
  background: rgba(34,211,238,0.10); border-color: #22d3ee; color: #22d3ee;
}
.exam-toggle-btn:hover:not(.active) {
  border-color: #a78bfa; color: #c4b5fd;
}

/* =============================================
   タイトル・名前入力画面
   ============================================= */
#title-screen, #name-screen {
  justify-content: center; gap: 14px; text-align: center;
  background: #0f0e17;
}
.name-input-box {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: #1a1844; border: 1px solid rgba(139,92,246,0.35); border-radius: 16px;
  padding: 28px 32px; box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  max-width: 360px; width: 100%;
}
.name-input-title { font-size: 1.1rem; font-weight: 700; color: #f1f5f9; }
.hero-name-input {
  width: 100%; padding: 10px 14px; font-size: 1rem;
  border: 2px solid rgba(139,92,246,0.4); border-radius: 10px;
  text-align: center; color: #e2e8f0; background: #0f0e17; outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.hero-name-input::placeholder { color: #64748b; }
.hero-name-input:focus { border-color: #22d3ee; box-shadow: 0 0 0 3px rgba(34,211,238,0.15); }
.hero-art   { font-size: 5rem; animation: float 3s ease-in-out infinite; }
.title-logo { font-size: clamp(1.8rem, 6vw, 2.8rem); font-weight: 900; color: #22d3ee; animation: glow 3s ease-in-out infinite; }
.title-sub  { font-size: 1rem; color: #94a3b8; }
.title-desc { font-size: 0.9rem; color: #64748b; }
.title-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.title-credit  { font-size: 0.72rem; color: #4b5563; margin-top: 8px; }

/* サイト紹介セクション */
.site-intro {
  max-width: 720px; margin: 36px auto 0; padding: 24px 20px;
  text-align: left; background: #1a1844; border: 1px solid rgba(139,92,246,0.25);
  border-radius: 12px; line-height: 1.9;
}
.site-intro-title { font-size: 1.15rem; color: #f1f5f9; margin-bottom: 10px; font-weight: 700; }
.site-intro p { font-size: 0.88rem; color: #94a3b8; margin-bottom: 14px; }
.site-intro-links { list-style: none; padding: 0; margin: 8px 0 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.site-intro-links li { margin: 0; }
.site-intro-links a { color: #22d3ee; font-size: 0.85rem; text-decoration: none; }
.site-intro-links a:hover { text-decoration: underline; }
.site-intro a { color: #22d3ee; }

/* =============================================
   ボタン
   ============================================= */
.btn { padding: 12px 28px; border: none; border-radius: 10px; font-size: 1rem; font-weight: 700; cursor: pointer; transition: transform .15s, box-shadow .15s; font-family: inherit; }
.btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #0f0e17; }
.btn-secondary { background: linear-gradient(135deg, #7c3aed, #4f46e5); color: #fff; }

.nav-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.nav-btn {
  padding: 8px 16px; background: #1a1844; border: 1px solid rgba(139,92,246,0.3);
  border-radius: 8px; color: #c4b5fd; font-size: 0.85rem; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  font-family: inherit;
}
.nav-btn:hover, .nav-btn.active { background: #22d3ee; color: #0f0e17; border-color: #22d3ee; font-weight: 700; }
/* リセットボタン（右寄せ・控えめ） */
.nav-btn-reset {
  margin-left: auto; background: #0f0e17; border-color: rgba(100,116,139,0.4);
  color: #475569; font-size: 0.8rem;
}
.nav-btn-reset:hover { background: #450a0a; color: #f87171; border-color: #f87171; font-weight: 400; }
.nav-break { display: none; }


/* =============================================
   HUD
   ============================================= */
.hud {
  display: flex; align-items: center; gap: 12px;
  background: #1a1844; border: 1px solid rgba(139,92,246,0.25); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 12px; width: 100%; max-width: 800px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.hud-avatar   { font-size: 2.2rem; }
.hud-info     { flex: 1; }
.hud-name     { font-size: 1rem; font-weight: 700; color: #22d3ee; }
.hud-class    { font-size: 0.8rem; color: #94a3b8; margin-bottom: 4px; }
.xp-bar-wrap  { background: #0f0e17; border-radius: 99px; height: 8px; overflow: hidden; }
.xp-bar       { height: 100%; background: linear-gradient(90deg, #22d3ee, #a78bfa); border-radius: 99px; transition: width .4s; }
.hud-xp-label { font-size: 0.78rem; color: #64748b; margin-top: 2px; }
.hud-stats    { display: flex; gap: 12px; }
.hud-stat     { text-align: center; }
.hud-stat-val { font-size: 1.1rem; font-weight: 700; color: #f1f5f9; }
.hud-stat-lbl { font-size: 0.75rem; color: #64748b; }

/* =============================================
   マップ画面
   ============================================= */
.map-title { font-size: 1.2rem; font-weight: 700; color: #f1f5f9; margin-bottom: 8px; }
.map-unlock-hint {
  font-size: 0.78rem; color: #64748b; margin-bottom: 8px; text-align: center; line-height: 1.45;
}
.map-weak-hint {
  font-size: 0.8rem; color: #cbd5e1; margin: 0 0 16px; padding: 10px 12px;
  text-align: center; line-height: 1.5; background: #1a1844; border: 1px solid rgba(139,92,246,0.3);
  border-radius: 10px; width: 100%; max-width: 800px;
}
.dungeon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; width: 100%; max-width: 800px;
}
.dungeon-card {
  background: #1a1844; border: 1px solid rgba(139,92,246,0.25); border-radius: 12px;
  padding: 16px 12px; text-align: center; cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  animation: fadeIn .4s ease both;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.dungeon-card:hover  { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(139,92,246,0.35); border-color: #a78bfa; }
.dungeon-card.cleared { border-color: #4ade80; background: linear-gradient(135deg, #052e16, #064e3b); }
.dungeon-card.locked {
  cursor: not-allowed; opacity: 0.45; filter: grayscale(0.5);
  border-style: dashed; border-color: rgba(100,116,139,0.4);
}
.dungeon-card.locked:hover {
  transform: none; box-shadow: none; border-color: rgba(100,116,139,0.4);
}
.dungeon-lock-msg { font-size: 0.78rem; color: #64748b; margin-top: 4px; line-height: 1.35; }
.dungeon-icon     { font-size: 2.4rem; margin-bottom: 8px; display: flex; justify-content: center; align-items: center; min-height: 2.6rem; }
.dungeon-name     { font-size: 1rem; font-weight: 700; color: #f1f5f9; margin-bottom: 2px; line-height: 1.35; }
.dungeon-desc     { font-size: 0.72rem; color: #64748b; margin-bottom: 8px; line-height: 1.4; }
.dungeon-progress { font-size: 0.72rem; color: #64748b; }
.dungeon-progress-bar-wrap { background: #0a0916; border-radius: 99px; height: 7px; overflow: hidden; margin-bottom: 4px; }
.dungeon-progress-bar      { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #22d3ee, #a78bfa); transition: width .4s; }
.dungeon-progress-bar.full { background: linear-gradient(90deg, #4ade80, #86efac); }
.dungeon-progress-text     { font-size: 0.7rem; color: #64748b; }
.dungeon-weak {
  font-size: 0.78rem; color: #94a3b8; margin-top: 6px; line-height: 1.35;
}

/* =============================================
   バトル画面
   ============================================= */
#battle-screen { padding: 0; align-items: stretch; background: #0f0e17; }
#battle-screen.flash-correct { animation: battleFlashGreen .4s ease-out forwards; }
#battle-screen.flash-wrong   { animation: battleFlashRed   .4s ease-out forwards; }

.battle-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #1a1844; border-bottom: 1px solid rgba(139,92,246,0.25);
  position: sticky; top: 0; z-index: 10;
}
.battle-dungeon-name { font-weight: 700; color: #f1f5f9; font-size: 0.95rem; }
.battle-progress     { font-size: 0.85rem; color: #94a3b8; }

/* ラウンドバナー */
.round-banner {
  width: 100%; text-align: center; padding: 7px 12px;
  font-size: 0.85rem; font-weight: 700; color: #fff;
  letter-spacing: 0.04em; transition: background 0.4s;
}

/* 敵エリア */
.enemy-area {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 16px 12px; gap: 6px;
}
.enemy-icon { font-size: 4.5rem; animation: float 2.5s ease-in-out infinite; display: flex; justify-content: center; align-items: center; }
.enemy-name { font-size: 1rem; font-weight: 700; color: #f87171; }

/* ===== HPバー共通 ===== */
.hp-bar-wrap {
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 2px;
}
.hp-bar-label { font-size: 0.78rem; color: #94a3b8; }
.hp-bar-outer {
  background: #0f0e17; border-radius: 99px; height: 14px;
  overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
.hp-bar-inner {
  height: 100%; border-radius: 99px;
  transition: width .5s ease, background .5s;
}
.hp-bar-text { font-size: 0.75rem; color: #94a3b8; text-align: right; }

/* 敵HPバー */
.enemy-hp-inner            { background: linear-gradient(90deg, #4ade80, #86efac); }
.enemy-hp-inner.hp-warning { background: linear-gradient(90deg, #fb923c, #fbbf24); }
.enemy-hp-inner.hp-danger  { background: linear-gradient(90deg, #f87171, #fca5a5); animation: pulse .6s ease-in-out infinite; }

/* プレイヤーHPバー */
.player-hp-inner            { background: linear-gradient(90deg, #22d3ee, #67e8f9); }
.player-hp-inner.hp-warning { background: linear-gradient(90deg, #fb923c, #fbbf24); }
.player-hp-inner.hp-danger  { background: linear-gradient(90deg, #f87171, #fca5a5); animation: flash .8s ease-in-out infinite; }

/* プレイヤーステータスバー */
.player-status-bar {
  display: flex; align-items: center; gap: 10px;
  background: #1a1844; border: 1px solid rgba(139,92,246,0.25); border-radius: 10px;
  padding: 10px 16px; margin: 0 16px 4px;
  max-width: 600px; width: calc(100% - 32px); align-self: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.player-status-icon { font-size: 1.8rem; }
.player-status-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.player-status-name { font-size: 0.8rem; color: #22d3ee; font-weight: 700; }

/* コンボバッジ */
.combo-badge {
  display: none;
  background: linear-gradient(135deg, #fb923c, #fbbf24);
  color: #0f0e17; font-weight: 700; font-size: 0.85rem;
  padding: 4px 14px; border-radius: 99px;
  animation: pulse .6s ease-in-out infinite;
}
.combo-badge.show { display: inline-block; }

/* 問題ボックス */
.question-box {
  background: #1a1844; border: 1px solid rgba(139,92,246,0.25); border-radius: 12px;
  padding: 16px; margin: 8px 16px;
  max-width: 700px; width: calc(100% - 32px); align-self: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.question-category { font-size: 0.82rem; color: #64748b; margin-bottom: 6px; }
.question-text     { font-size: 1rem; line-height: 1.6; color: #e2e8f0; }

/* 選択肢 */
.choices {
  display: flex; flex-direction: column; gap: 10px;
  padding: 0 16px; max-width: 700px; width: calc(100% - 32px);
  align-self: center; margin-top: 4px;
}
.choice-btn {
  background: #221f52; border: 1px solid rgba(139,92,246,0.3); border-radius: 10px;
  color: #e2e8f0; font-size: 0.92rem; padding: 12px 16px;
  text-align: left; cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
  font-family: inherit;
}
.choice-btn:hover:not(:disabled) { background: #312e81; border-color: #a78bfa; transform: translateX(4px); }
.choice-btn.correct { background: #052e16; border-color: #4ade80; color: #4ade80; }
.choice-btn.wrong   { background: #450a0a; border-color: #f87171; color: #f87171; animation: shake .3s ease; }
.choice-btn:disabled { cursor: default; }

/* 結果ボックス */
.result-box {
  display: none;
  background: #1a1844; border: 1px solid rgba(139,92,246,0.25); border-radius: 12px;
  padding: 14px 16px; margin: 12px 16px 0;
  max-width: 700px; width: calc(100% - 32px);
  align-self: center; animation: fadeIn .3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.result-box.show { display: block; }
.result-correct { color: #4ade80; font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.result-wrong   { color: #f87171; font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.result-explain { font-size: 0.85rem; color: #94a3b8; line-height: 1.5; margin-bottom: 6px; }
.xp-gain        { font-size: 0.8rem; color: #a78bfa; }

/* 次へボタン */
.next-btn {
  display: none; margin: 12px auto 24px;
  padding: 12px 32px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border: none; border-radius: 10px;
  color: #0f0e17; font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  font-family: inherit;
}
.next-btn.show  { display: block; }
.next-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(251,191,36,0.35); }

.batch-end-actions {
  display: none;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  margin: 12px auto 24px;
  align-self: center;
}
.batch-end-actions.show { display: flex; }
.batch-end-actions .batch-continue-btn {
  display: block;
  margin: 0;
}

/* =============================================
   ゲームオーバー画面
   ============================================= */
#gameover-screen {
  justify-content: center; gap: 16px; text-align: center;
  background: radial-gradient(ellipse at center, #3a0000 0%, #0f0e17 70%);
}
.gameover-icon  { font-size: 5rem; animation: pulse 1s ease-in-out infinite; }
.gameover-title { font-size: 2.2rem; font-weight: 900; color: #f87171; text-shadow: 0 0 20px rgba(248,113,113,0.6); }
.gameover-sub   { font-size: 1rem; color: #94a3b8; }
.gameover-stats {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px;
  padding: 16px; width: 100%; max-width: 400px; color: #e2e8f0;
}

/* =============================================
   ダンジョン結果画面
   ============================================= */
#result-screen { justify-content: center; gap: 14px; text-align: center; background: #0f0e17; }
.result-icon     { font-size: 4rem; animation: pulse 1s ease-in-out infinite; }
.result-title    { font-size: 1.8rem; font-weight: 900; color: #fbbf24; }
.result-subtitle { font-size: 1rem; color: #94a3b8; }
.result-stats {
  background: #1a1844; border: 1px solid rgba(139,92,246,0.25); border-radius: 12px;
  padding: 16px; width: 100%; max-width: 400px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.result-row         { padding: 6px 0; border-bottom: 1px solid rgba(139,92,246,0.15); color: #e2e8f0; font-size: 0.9rem; }
.result-row:last-child { border-bottom: none; }
.result-buttons     { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* =============================================
   実績画面
   ============================================= */
#achievement-screen { align-items: flex-start; background: #0f0e17; }
.screen-title { font-size: 1.4rem; font-weight: 700; color: #f1f5f9; margin-bottom: 16px; }
.trophy-grid       { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.trophy-tier-label {
  color: #64748b; font-size: 0.8rem; font-weight: 700;
  padding: 8px 0 4px; border-top: 1px solid rgba(139,92,246,0.2); margin-top: 4px;
}
.trophy-card {
  display: flex; align-items: center; gap: 12px;
  background: #1a1844; border: 1px solid rgba(139,92,246,0.2); border-radius: 10px;
  padding: 12px; transition: border-color .2s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.trophy-card.unlocked { border-color: #fbbf24; box-shadow: 0 2px 12px rgba(251,191,36,0.15); }
.trophy-card.locked   { opacity: 0.35; filter: grayscale(1); }
.trophy-icon { font-size: 1.8rem; }
.trophy-name { font-size: 0.9rem; font-weight: 700; color: #f1f5f9; }
.trophy-desc { font-size: 0.78rem; color: #64748b; }

/* =============================================
   レベルアップモーダル
   ============================================= */
#levelup-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 100;
  align-items: center; justify-content: center;
}
#levelup-modal.show { display: flex; }
.levelup-box {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border: 2px solid #fbbf24; border-radius: 16px;
  padding: 32px; text-align: center; gap: 12px;
  display: flex; flex-direction: column; align-items: center;
  animation: fadeIn .3s ease;
  box-shadow: 0 0 40px rgba(251,191,36,0.25);
}
.levelup-icon  { font-size: 3rem; animation: spin 1s linear infinite; }
.levelup-title { font-size: 1.6rem; font-weight: 900; color: #fbbf24; }
.levelup-class { font-size: 1rem; color: #c4b5fd; }

/* =============================================
   トースト
   ============================================= */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #22d3ee; color: #0f0e17; font-weight: 700;
  padding: 10px 24px; border-radius: 99px; font-size: 0.9rem;
  opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 200;
}
#toast.show { opacity: 1; }

/* =============================================
   レスポンシブ
   ============================================= */
@media (max-width: 1024px) {
  .screen       { padding: 16px 12px 32px; }
  .screen-inner { max-width: 100%; }
  .hud-stats    { gap: 10px; }
  .dungeon-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 768px) {
  .hero-art         { font-size: 4rem; }
  .title-buttons    { width: 100%; }
  .title-buttons .btn {
    width: 100%;
    max-width: 360px;
  }

  .hud {
    flex-wrap: wrap;
    justify-content: center;
  }
  .hud-avatar { font-size: 2rem; }
  .hud-info   { width: 100%; }
  .hud-stats  {
    width: 100%;
    justify-content: space-between;
  }

  /* ナビバー：4ボタン均等1行 + リセット2行目右寄せ */
  .nav-break { display: block; flex-basis: 100%; height: 0; }
  .nav-bar .nav-btn:not(.nav-btn-reset) { flex: 1; text-align: center; }
  .nav-btn-reset {
    flex-basis: auto;
    margin-left: auto;
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .battle-header {
    flex-wrap: wrap;
    row-gap: 6px;
    justify-content: center;
    text-align: center;
  }
  .battle-dungeon-name,
  .battle-progress {
    width: 100%;
  }

  .dungeon-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .screen            { padding: 12px 8px 24px; }
  .title-buttons .btn { max-width: 100%; }
  .hud-stats         { gap: 8px; }
  .dungeon-grid      { grid-template-columns: repeat(2, 1fr); }
  .title-logo        { font-size: 1.6rem; }
  .nav-bar           { width: 100%; }
  .enemy-icon        { font-size: 3.2rem; }
  .choices           { padding: 0 8px; }
  .question-box      { margin: 8px 8px; }
  .result-stats      { font-size: 0.85rem; }
  .player-status-bar { margin: 0 8px 4px; }
}

/* =============================================
   成績画面
   ============================================= */
.stats-summary {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; width: 100%; margin-bottom: 24px;
}
.stats-card {
  background: #1a1844; border: 1px solid rgba(139,92,246,0.25);
  border-radius: 12px; padding: 16px; text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.stats-val { font-size: 1.4rem; font-weight: 700; color: #22d3ee; }
.stats-lbl { font-size: 0.75rem; color: #64748b; margin-top: 4px; }
.stats-section-title { font-size: 1rem; font-weight: 700; color: #f1f5f9; margin: 4px 0 12px; }
.stats-bars { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.stats-bar-row { display: flex; align-items: center; gap: 10px; }
.stats-bar-label {
  font-size: 0.75rem; color: #94a3b8; width: 130px; flex-shrink: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stats-bar-wrap { flex: 1; background: #0f0e17; border-radius: 99px; height: 12px; overflow: hidden; }
.stats-bar-fill {
  height: 100%; background: linear-gradient(90deg, #22d3ee, #a78bfa);
  border-radius: 99px; transition: width 0.6s ease;
}
.stats-bar-pct { font-size: 0.75rem; color: #64748b; width: 44px; text-align: right; flex-shrink: 0; }

/* 特殊ダンジョンカード */
.dungeon-card-special {
  border-color: #7c3aed;
  background: linear-gradient(135deg, #2e1065, #1e1b4b);
}
.dungeon-card-special:hover { border-color: #a78bfa; box-shadow: 0 8px 28px rgba(124,58,237,0.4); }
.dungeon-card-weak {
  border-color: #b91c1c;
  background: linear-gradient(135deg, #450a0a, #1a1844);
}
.dungeon-card-weak:hover { border-color: #f87171; box-shadow: 0 8px 28px rgba(239,68,68,0.3); }
