/* ═══════════════════════════════════════════════
   SPELLSLINGER — モダンダークファンタジーUI
   グラスモーフィズム / ネオングロー / Cinzel + Zen Kaku
   ═══════════════════════════════════════════════ */
:root {
  --bg-0: #0a0812;
  --bg-1: #151020;
  --bg-2: #1d1530;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --ink: #f2ecdf;
  --ink-dim: #9d93a8;
  --gold: #ffb054;
  --gold-hi: #ffd58a;
  --gold-deep: #b06a1e;
  --magic: #7b9cff;
  --magic-hi: #5ee0ff;
  --danger: #ff4d6a;
  --heal: #63e6a4;
  --perfect: #ffe9b0;
  --rare-n: #aab0bd;
  --rare-r: #6f9dff;
  --rare-sr: #c07dff;
  --rare-ur: #ff9440;
  --gear-common: #b8bcc4;
  --gear-magic: #86a4ff;
  --gear-rare: #ffd75e;
  --gear-legend: #ff9440;
  --grad-ember: linear-gradient(135deg, #ffd58a 0%, #ffb054 45%, #ff7a3d 100%);
  --grad-arcane: linear-gradient(135deg, #5ee0ff 0%, #7b9cff 100%);
  --font-jp: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  --font-display: 'Cinzel', 'Times New Roman', serif;
  --shadow-panel: 0 10px 36px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --r-lg: 20px;
  --r-md: 15px;
  --r-sm: 11px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: var(--font-jp);
  background: radial-gradient(ellipse 120% 70% at 50% -10%, var(--bg-2), transparent 60%), var(--bg-0);
  color: var(--ink);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* 背景の環境光(ゆっくり漂う色glow) */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.amb-glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.amb-glow.g1 {
  width: 480px; height: 480px; left: -140px; top: 8%;
  background: radial-gradient(circle, rgba(255, 122, 61, 0.25), transparent 70%);
  animation: ambDrift1 16s ease-in-out infinite alternate;
}
.amb-glow.g2 {
  width: 520px; height: 520px; right: -160px; bottom: 4%;
  background: radial-gradient(circle, rgba(123, 156, 255, 0.18), transparent 70%);
  animation: ambDrift2 20s ease-in-out infinite alternate;
}
@keyframes ambDrift1 { to { transform: translate(60px, 70px) scale(1.15); } }
@keyframes ambDrift2 { to { transform: translate(-70px, -50px) scale(1.1); } }

#shake-wrap { height: 100%; position: relative; z-index: 1; }
#shake-wrap.shake { animation: shake .28s linear; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 4px); }
  40% { transform: translate(6px, -5px); }
  60% { transform: translate(-4px, -3px); }
  80% { transform: translate(3px, 4px); }
}
#shake-wrap.shake-big { animation: shakeBig .45s linear; }
@keyframes shakeBig {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-12px, 8px) rotate(-.6deg); }
  30% { transform: translate(11px, -9px) rotate(.5deg); }
  45% { transform: translate(-9px, -6px); }
  60% { transform: translate(8px, 7px) rotate(-.4deg); }
  80% { transform: translate(-5px, 3px); }
}
.battle-area.shake { animation: battleShake .14s linear; }
.battle-area.shake-big { animation: battleShakeBig .2s linear; }
@keyframes battleShake {
  0%, 100% { transform: translate3d(0,0,0); }
  30% { transform: translate3d(-5px,2px,0); }
  60% { transform: translate3d(4px,-2px,0); }
  82% { transform: translate3d(-2px,1px,0); }
}
@keyframes battleShakeBig {
  0%, 100% { transform: translate3d(0,0,0); }
  18% { transform: translate3d(-8px,4px,0) rotate(-.35deg); }
  38% { transform: translate3d(7px,-4px,0) rotate(.3deg); }
  58% { transform: translate3d(-5px,-2px,0); }
  78% { transform: translate3d(3px,2px,0); }
}

#app {
  max-width: 540px; height: 100%;
  margin: 0 auto;
  display: flex; flex-direction: column;
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 20%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 70%);
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.9);
  transition: box-shadow .4s;
}

/* オーバードライブ(×4以上のコンボ)で金の縁光 */
#app.overdrive {
  box-shadow: inset 0 0 0 2px rgba(255, 176, 84, 0.75), inset 0 0 60px rgba(255, 176, 84, 0.14), 0 0 100px rgba(0, 0, 0, 0.9);
}

.screen { display: none; flex: 1; flex-direction: column; overflow-y: auto; padding: 18px; }
.screen.active { display: flex; animation: screenIn .35s cubic-bezier(.2, .9, .3, 1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(.99); } }

.hidden { display: none !important; }

/* ═══════════ タイトル ═══════════ */
#screen-title { align-items: center; justify-content: flex-start; padding-top: 42px; position: relative; }

.title-glow {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  width: 360px; height: 170px;
  background: radial-gradient(ellipse, rgba(255, 176, 84, 0.22), transparent 65%);
  filter: blur(6px);
  animation: pulseGlow 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulseGlow { 50% { opacity: .45; transform: translateX(-50%) scale(1.12); } }

.game-logo { text-align: center; line-height: 1.05; margin-bottom: 8px; position: relative; }
.logo-en {
  display: block;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 44px; letter-spacing: 4px;
  background: var(--grad-ember);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(255, 140, 60, 0.45));
}
.logo-ja { display: block; font-size: 15px; font-weight: 700; color: var(--magic); margin-top: 10px; letter-spacing: 5px; text-shadow: 0 0 18px rgba(123, 156, 255, .5); }
.title-sub { color: var(--ink-dim); font-size: 12px; margin-bottom: 20px; letter-spacing: 3px; }

.hero-badge {
  font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 22px;
  border: 1px solid var(--stroke); border-radius: 999px; padding: 7px 20px;
  background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-panel);
}

.tier-select { width: 100%; margin-bottom: 18px; }
.tier-label { font-size: 11px; letter-spacing: 2px; color: var(--ink-dim); margin-bottom: 8px; text-align: center; }
.tier-buttons { display: flex; gap: 9px; }
.tier-btn {
  flex: 1; padding: 11px 4px 9px;
  font-family: inherit; font-size: 15px; font-weight: 700; color: var(--ink-dim);
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-md);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  cursor: pointer; transition: all .18s;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tier-btn small { font-size: 10px; font-weight: 500; opacity: .75; }
.tier-btn.selected {
  color: #1c1002;
  background: var(--grad-ember); border-color: transparent;
  box-shadow: 0 6px 24px rgba(255, 150, 60, 0.4), inset 0 1px 0 rgba(255, 255, 255, .4);
  transform: translateY(-2px);
}
.tier-mastery { text-align: center; font-size: 11px; color: var(--ink-dim); margin-top: 8px; min-height: 15px; }

.mode-buttons { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.mode-row { display: flex; gap: 10px; }
.mode-btn {
  width: 100%; padding: 14px 18px;
  font-family: inherit; font-size: 16px; font-weight: 700; color: var(--ink); text-align: left;
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-md);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-panel);
  cursor: pointer; transition: transform .12s, box-shadow .2s, border-color .2s;
  display: flex; flex-direction: column; gap: 3px;
  position: relative; overflow: hidden;
}
.mode-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.06) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .5s;
}
.mode-btn:hover::before, .mode-btn:active::before { transform: translateX(100%); }
.mode-btn small { font-size: 11px; font-weight: 500; color: var(--ink-dim); }
.mode-btn:active { transform: scale(.975); }
.mode-btn.primary {
  border: 1px solid rgba(255, 176, 84, 0.55);
  background: linear-gradient(135deg, rgba(255, 176, 84, 0.16), rgba(255, 122, 61, 0.07)), var(--glass);
  box-shadow: 0 8px 30px rgba(255, 140, 60, 0.22), var(--shadow-panel);
}
.mode-btn.primary::after {
  content: '▶'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  color: var(--gold); font-size: 13px;
  animation: nudge 1.4s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translateY(-50%) translateX(5px); opacity: .6; } }
.mode-btn:disabled { opacity: .38; cursor: default; }
.mode-btn.half { flex: 1; }

.title-footer { margin-top: auto; padding-top: 18px; display: flex; gap: 9px; align-items: center; width: 100%; }
.opt-btn {
  font-family: inherit; font-size: 12px; font-weight: 500; color: var(--ink-dim);
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 999px;
  padding: 7px 13px; cursor: pointer; transition: all .18s;
}
.opt-btn.on { color: var(--gold-hi); border-color: rgba(255, 176, 84, 0.5); box-shadow: 0 0 14px rgba(255, 176, 84, 0.18); }
.streak-badge { font-size: 12px; font-weight: 700; color: var(--gold); margin-left: auto; }

/* ═══════════ HUD ═══════════ */
#screen-game { padding: 0; overflow: hidden; }
.hud {
  padding: 12px 16px 10px;
  background: rgba(10, 8, 18, 0.55);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--stroke);
}
.hud-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.hud-floor { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--gold); letter-spacing: 1px; text-shadow: 0 0 16px rgba(255, 176, 84, .4); }
.hud-level { font-size: 12px; font-weight: 700; color: var(--magic-hi); }
.hud-mode { font-size: 11px; color: var(--ink-dim); }
.hud-score { margin-left: auto; font-family: var(--font-display); font-weight: 700; font-size: 21px; color: var(--ink); font-variant-numeric: tabular-nums; }
.hud-score.bump { animation: scoreBump .25s; }
@keyframes scoreBump { 40% { transform: scale(1.22); color: var(--gold-hi); } }

.exp-bar { height: 4px; background: rgba(255, 255, 255, 0.07); border-radius: 3px; overflow: hidden; }
.exp-fill { height: 100%; width: 0%; background: var(--grad-ember); border-radius: 3px; transition: width .4s; box-shadow: 0 0 8px rgba(255, 176, 84, .6); }

.relic-tray { display: flex; gap: 6px; margin-top: 8px; min-height: 22px; flex-wrap: wrap; }
.relic-chip {
  font-size: 13px; background: var(--glass); border: 1px solid var(--stroke);
  border-radius: 8px; padding: 2px 7px; cursor: pointer;
  transition: all .15s;
}
.relic-chip:hover { border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 176, 84, .3); }

/* ═══════════ バトルエリア ═══════════ */
.battle-area { flex: 1; position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 0; }

.floor-banner {
  position: absolute; top: 14px; left: 0; right: 0; text-align: center;
  font-family: var(--font-display); font-weight: 700;
  font-size: 24px; color: var(--gold-hi); letter-spacing: 6px;
  opacity: 0; pointer-events: none; z-index: 5;
  text-shadow: 0 0 26px rgba(255, 176, 84, .8), 0 2px 8px rgba(0, 0, 0, .8);
}
.floor-banner.show { animation: bannerIn 1.5s cubic-bezier(.2, .8, .3, 1); }
@keyframes bannerIn {
  0% { opacity: 0; transform: translateY(-14px) scale(.85); letter-spacing: 14px; }
  22% { opacity: 1; transform: translateY(0) scale(1); letter-spacing: 6px; }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* 戦闘シーン:動く霧 + 光のプール */
.enemy-zone {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 16px 14px; margin: 0 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke);
  background:
    radial-gradient(ellipse 60% 34% at 50% 70%, rgba(255, 140, 60, 0.13), transparent 70%),
    radial-gradient(ellipse 100% 100% at 50% 0%, rgba(123, 156, 255, 0.05), transparent 55%),
    linear-gradient(180deg, rgba(20, 14, 30, 0.6), rgba(10, 8, 16, 0.35));
  box-shadow: inset 0 0 44px rgba(0, 0, 0, 0.5), var(--shadow-panel);
  position: relative; overflow: hidden;
}
.enemy-zone::before, .enemy-zone::after {
  content: ''; position: absolute; width: 130%; height: 60%;
  border-radius: 50%; filter: blur(30px);
  background: radial-gradient(ellipse, rgba(150, 130, 200, 0.07), transparent 70%);
  pointer-events: none;
}
.enemy-zone::before { top: -12%; left: -30%; animation: fogA 13s ease-in-out infinite alternate; }
.enemy-zone::after { bottom: -18%; right: -35%; animation: fogB 17s ease-in-out infinite alternate; }
@keyframes fogA { to { transform: translateX(22%) translateY(8%); } }
@keyframes fogB { to { transform: translateX(-20%) translateY(-10%); } }

.enemy { display: flex; flex-direction: column; align-items: center; gap: 9px; position: relative; z-index: 2; }
/* 敵の背後のオーラリング */
.enemy::before {
  content: ''; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 90, 90, 0.14) 30%, rgba(255, 122, 61, 0.07) 55%, transparent 70%);
  animation: auraPulse 2.6s ease-in-out infinite;
  pointer-events: none; z-index: -1;
}
@keyframes auraPulse { 50% { transform: translateX(-50%) scale(1.16); opacity: .7; } }

.enemy-tags { display: flex; gap: 6px; min-height: 20px; }
.enemy-tag {
  font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; letter-spacing: .5px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.enemy-tag.ghost { background: rgba(160, 150, 255, .14); color: #c5bcff; border: 1px solid rgba(160, 150, 255, .4); }
.enemy-tag.revenge { background: rgba(255, 77, 106, .13); color: var(--danger); border: 1px solid rgba(255, 77, 106, .5); animation: revengePulse 1.2s infinite; }
@keyframes revengePulse { 50% { box-shadow: 0 0 14px rgba(255, 77, 106, .55); } }
.enemy-tag.listen { background: rgba(94, 224, 255, .1); color: var(--magic-hi); border: 1px solid rgba(94, 224, 255, .35); }
.enemy-tag.bonus { background: rgba(255, 176, 84, .12); color: var(--gold); border: 1px solid rgba(255, 176, 84, .4); }
.enemy-tag.elite { background: rgba(255, 176, 84, .15); color: var(--gold-hi); border: 1px solid var(--gold); animation: revengePulse 1.3s infinite; }

.enemy-sprite {
  line-height: 1;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .65)) drop-shadow(0 0 24px rgba(255, 100, 80, .2));
  animation: enemyIdle 2s ease-in-out infinite;
  transition: transform .12s, filter .2s, opacity .2s;
}
#enemy-canvas { width: 150px; height: 150px; display: block; }
@keyframes enemyIdle { 50% { transform: translateY(-8px) scale(1.02); } }
.enemy-sprite.spawn { animation: enemySpawn .5s cubic-bezier(.2, 1.6, .4, 1), enemyIdle 2s .5s ease-in-out infinite; }
@keyframes enemySpawn { 0% { transform: scale(0) rotate(-20deg); opacity: 0; filter: blur(8px); } }
.enemy-sprite.die { animation: enemyDie .55s forwards !important; }
@keyframes enemyDie {
  0% { transform: scale(1); filter: brightness(3.2) drop-shadow(0 0 32px var(--gold)); }
  40% { transform: scale(1.28) rotate(7deg); opacity: 1; }
  100% { transform: scale(.05) rotate(45deg) translateY(28px); opacity: 0; filter: blur(4px); }
}
.enemy-sprite.hurt-player { animation: enemyAttack .4s !important; }
@keyframes enemyAttack {
  25% { transform: translateY(30px) scale(1.3); filter: brightness(1.7) drop-shadow(0 0 22px var(--danger)); }
}
.enemy-sprite.hit { animation: enemyHit .34s cubic-bezier(.18,.8,.28,1) !important; }
@keyframes enemyHit {
  0% { transform: translateY(0) scale(1); }
  22% { transform: translateY(-7px) translateX(9px) scale(.94) rotate(4deg); filter: brightness(2.1) saturate(.55) drop-shadow(0 0 24px #fff4a5); }
  55% { transform: translateY(2px) translateX(-3px) scale(1.04) rotate(-2deg); }
  100% { transform: translateY(0) scale(1); }
}
.enemy-sprite.ghost-look { opacity: .78; filter: drop-shadow(0 0 20px #b9b0ff) grayscale(.25); }
.enemy-sprite.elite-look { transform: scale(1.16); filter: drop-shadow(0 0 22px rgba(255, 176, 84, .6)) drop-shadow(0 10px 16px rgba(0, 0, 0, .6)); }

.enemy-plate {
  font-size: 29px; font-weight: 900; text-align: center; padding: 8px 26px; max-width: 92vw;
  background: rgba(8, 6, 14, 0.62);
  border: 1px solid var(--stroke-strong); border-radius: var(--r-md);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  min-height: 52px; display: flex; align-items: center; justify-content: center;
  letter-spacing: 1px; line-height: 1.25;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.enemy-plate.jp { font-size: 23px; }

.replay-btn {
  font-family: inherit; font-size: 13px; font-weight: 700; color: var(--magic-hi);
  background: rgba(94, 224, 255, .08); border: 1px solid rgba(94, 224, 255, .35); border-radius: 999px;
  padding: 8px 18px; cursor: pointer; transition: all .15s;
}
.replay-btn:active { transform: scale(.94); }
.replay-btn:disabled { opacity: .35; }

.atk-timer { width: 220px; height: 5px; background: rgba(255, 255, 255, .08); border-radius: 3px; overflow: hidden; }
.atk-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff7a3d, var(--danger)); border-radius: 3px; box-shadow: 0 0 8px rgba(255, 77, 106, .5); }

/* FXレイヤー(ダメージ数字など) */
.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.dmg-num {
  position: absolute;
  font-family: var(--font-display); font-weight: 900;
  font-size: 36px; color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .8), 0 0 22px rgba(255, 200, 100, .55);
  animation: dmgPop .85s cubic-bezier(.2, .8, .3, 1) forwards; white-space: nowrap;
}
.dmg-num.crit {
  font-size: 50px;
  background: var(--grad-ember);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 180, 80, .8)) drop-shadow(0 2px 4px rgba(0,0,0,.7));
  text-shadow: none;
}
.dmg-num.hurt { color: var(--danger); font-size: 32px; }
@keyframes dmgPop {
  0% { transform: translate(-50%, 0) scale(.3); opacity: 0; }
  18% { transform: translate(-50%, -18px) scale(1.25); opacity: 1; }
  100% { transform: translate(-50%, -70px) scale(.95); opacity: 0; }
}
.perfect-flash {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%);
  font-family: var(--font-display); font-weight: 900;
  font-size: 32px; letter-spacing: 5px;
  background: var(--grad-ember);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 26px rgba(255, 190, 90, .9));
  animation: perfectIn .75s forwards;
}
@keyframes perfectIn {
  0% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.06); }
}

/* ═══════════ コンボ ═══════════ */
.combo-zone { padding: 4px 46px 6px; }
.combo-display { display: flex; align-items: baseline; gap: 7px; justify-content: center; margin-bottom: 4px; }
.combo-num { font-family: var(--font-display); font-weight: 900; font-size: 27px; color: var(--gold); text-shadow: 0 0 16px rgba(255, 176, 84, .5); }
.combo-label { font-size: 10px; font-weight: 700; color: var(--ink-dim); letter-spacing: 3px; }
.combo-mult { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--magic-hi); }
.combo-display.hot .combo-num { color: #ff8f5e; text-shadow: 0 0 18px rgba(255, 120, 60, .85); }
.combo-display.bump { animation: comboBump .22s; }
@keyframes comboBump { 50% { transform: scale(1.16); } }
.combo-gauge { height: 5px; background: rgba(255, 255, 255, .07); border-radius: 3px; overflow: hidden; }
.combo-fill { height: 100%; width: 0%; background: var(--grad-ember); border-radius: 3px; box-shadow: 0 0 10px rgba(255, 160, 70, .55); }

/* ═══════════ 選択肢 ═══════════ */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 6px 14px 12px; }
.choice-btn {
  font-family: inherit; font-size: 16px; font-weight: 700; color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--stroke); border-radius: var(--r-md);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-panel);
  padding: 16px 10px; cursor: pointer; min-height: 60px;
  transition: transform .1s, border-color .18s, box-shadow .18s;
  line-height: 1.35; word-break: break-word;
}
.choice-btn.en { font-size: 18px; letter-spacing: .5px; }
.choice-btn:hover { border-color: var(--stroke-strong); }
.choice-btn:active { transform: scale(.955); }
.choice-btn.correct-pick {
  background: linear-gradient(135deg, rgba(99, 230, 164, .2), rgba(99, 230, 164, .06));
  border-color: var(--heal);
  color: #e9ffef;
  box-shadow: 0 0 24px rgba(99, 230, 164, .3);
}
.choice-btn.wrong-pick {
  background: linear-gradient(135deg, rgba(255, 77, 106, .22), rgba(255, 77, 106, .07));
  border-color: var(--danger);
  animation: wrongWiggle .3s;
}
.choice-btn.reveal-correct { border-color: var(--heal); box-shadow: 0 0 20px rgba(99, 230, 164, .4); }
.choice-btn.dimmed { opacity: .28; filter: blur(1px); }
@keyframes wrongWiggle { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.choice-btn:disabled { pointer-events: none; }

/* ═══════════ ボス戦 ═══════════ */
.boss-panel { padding: 6px 14px 12px; }
.boss-question { text-align: center; font-size: 14px; font-weight: 700; color: var(--magic-hi); margin-bottom: 10px; }
.boss-slots {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  min-height: 42px; padding: 9px; margin-bottom: 12px;
  background: rgba(8, 6, 14, .5); border: 1px dashed var(--stroke-strong); border-radius: var(--r-md);
}
.boss-slot {
  font-size: 15px; font-weight: 700; padding: 6px 11px; border-radius: 9px;
  background: rgba(255, 176, 84, .13); border: 1px solid rgba(255, 176, 84, .5); color: var(--gold-hi);
  animation: slotLock .25s cubic-bezier(.2, 1.5, .4, 1);
}
@keyframes slotLock { 0% { transform: scale(1.5); } }
.boss-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.boss-chip {
  font-family: inherit; font-size: 16px; font-weight: 700; color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--stroke); border-radius: var(--r-sm);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 10px 14px; cursor: pointer; transition: transform .08s, opacity .25s;
}
.boss-chip:active { transform: scale(.92); }
.boss-chip.used { opacity: 0; pointer-events: none; transform: scale(.6); }
.boss-chip.wrong-pick { animation: wrongWiggle .3s; border-color: var(--danger); }
.boss-hpbar { height: 9px; background: rgba(255, 255, 255, .07); border-radius: 5px; overflow: hidden; margin: 0 42px 10px; border: 1px solid var(--stroke); }
.boss-hpfill { height: 100%; background: linear-gradient(90deg, #c07dff, var(--danger)); transition: width .35s; box-shadow: 0 0 10px rgba(200, 90, 160, .6); }

.giveup-btn {
  position: absolute; bottom: 96px; right: 10px;
  font-family: inherit; font-size: 11px; font-weight: 500; color: var(--ink-dim);
  background: rgba(10, 8, 16, .55); border: 1px solid var(--stroke); border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 5px 11px; cursor: pointer; opacity: .8; z-index: 30;
}

/* ═══════════ 探索マップ ═══════════ */
.map-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6px 10px 2px;
}
#map-canvas {
  width: 100%; max-width: 500px;
  border: 1px solid var(--stroke-strong); border-radius: var(--r-lg);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .6), inset 0 0 60px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0,0,0,.6);
  cursor: pointer;
  touch-action: manipulation;
  display: block;
}
.map-hint { text-align: center; font-size: 10px; color: var(--ink-dim); padding-top: 5px; letter-spacing: .5px; }

/* ═══════════ ボトムHUD(オーブ&スキル) ═══════════ */
.bottom-hud {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 10px 12px; gap: 8px;
}
.orb {
  position: relative; width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #201828, #0c0812 70%);
  border: 2px solid rgba(255, 255, 255, .14);
  box-shadow: inset 0 5px 14px rgba(0, 0, 0, .85), 0 4px 16px rgba(0, 0, 0, .55), inset 0 -2px 6px rgba(255,255,255,.05);
  overflow: hidden; flex-shrink: 0;
}
.orb-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  transition: height .35s cubic-bezier(.2, .8, .3, 1);
}
.hp-orb .orb-fill {
  background: radial-gradient(ellipse 90% 42% at 50% 6%, rgba(255, 160, 160, .6), transparent 60%),
    linear-gradient(180deg, #ff5063, #8c1024 65%, #4d0715);
  box-shadow: 0 0 18px rgba(255, 60, 90, .45);
}
.mana-orb .orb-fill {
  background: radial-gradient(ellipse 90% 42% at 50% 6%, rgba(150, 200, 255, .55), transparent 60%),
    linear-gradient(180deg, #4a8cff, #1c3aa8 65%, #0c1650);
  box-shadow: 0 0 18px rgba(80, 130, 255, .45);
}
.orb-fill::after {
  content: ''; position: absolute; top: -3px; left: 0; right: 0; height: 7px;
  background: rgba(255, 255, 255, .4); border-radius: 50%;
  filter: blur(1px);
  animation: orbWave 2.8s ease-in-out infinite;
}
@keyframes orbWave { 50% { transform: translateY(2.5px) scaleX(.9); } }
.orb-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
  font-size: 16px; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .95); z-index: 2;
}
.orb.low-pulse { animation: hpBlink .7s infinite; }
@keyframes hpBlink { 50% { filter: brightness(1.6); } }

.skills { display: flex; gap: 6px; flex-wrap: nowrap; }
.skill-btn {
  font-family: inherit; width: 47px; height: 54px; border-radius: var(--r-sm);
  font-size: 18px; line-height: 1;
  background: var(--glass);
  border: 1px solid var(--stroke); color: var(--ink);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-panel);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: transform .08s, border-color .15s, box-shadow .2s;
  padding: 0;
}
.skill-btn small { font-size: 9px; font-weight: 700; color: var(--magic); white-space: nowrap; }
.skill-btn:not(:disabled):hover { border-color: rgba(123, 156, 255, .5); box-shadow: 0 0 16px rgba(123, 156, 255, .2), var(--shadow-panel); }
.skill-btn:active { transform: scale(.9); }
.skill-btn:disabled { opacity: .32; cursor: default; }
.skill-btn.locked { opacity: .2; filter: grayscale(1); }
.skill-btn.locked small { color: var(--ink-dim); }
.skill-btn.flash { animation: skillFlash .45s; }
@keyframes skillFlash { 30% { border-color: var(--magic-hi); box-shadow: 0 0 22px rgba(94, 224, 255, .8); transform: scale(1.1); } }

@media (max-width: 430px) {
  .skill-btn { width: 39px; height: 48px; font-size: 15px; }
  .skill-btn small { font-size: 8px; }
  .orb { width: 54px; height: 54px; }
  .orb-text { font-size: 14px; }
}

/* ═══════════ オーバーレイ共通 ═══════════ */
.overlay {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(6, 4, 12, 0.72);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; gap: 16px;
  animation: fadeIn .25s;
}
@keyframes fadeIn { from { opacity: 0; } }

/* フィードバックカード */
.feedback-card {
  width: 100%; max-width: 410px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)), rgba(18, 13, 28, .92);
  border: 1px solid rgba(255, 176, 84, .45); border-radius: var(--r-lg);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .6), 0 0 40px rgba(255, 150, 60, .12), inset 0 1px 0 rgba(255, 255, 255, .1);
  padding: 22px 24px; text-align: center;
  animation: cardIn .35s cubic-bezier(.2, 1.4, .4, 1);
  cursor: pointer;
}
.feedback-card.wrong { border-color: rgba(255, 77, 106, .55); box-shadow: 0 18px 60px rgba(0, 0, 0, .6), 0 0 40px rgba(255, 77, 106, .14), inset 0 1px 0 rgba(255, 255, 255, .1); }
@keyframes cardIn { 0% { transform: translateY(34px) scale(.88); opacity: 0; } }
.fb-verdict { font-size: 19px; font-weight: 900; margin-bottom: 10px; letter-spacing: 2px; }
.fb-verdict.ok { color: var(--heal); text-shadow: 0 0 16px rgba(99, 230, 164, .5); }
.fb-verdict.ng { color: var(--danger); text-shadow: 0 0 16px rgba(255, 77, 106, .5); }
.fb-word {
  font-family: var(--font-display); font-weight: 700;
  font-size: 38px; margin-bottom: 2px; letter-spacing: 1px;
  background: var(--grad-ember);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.fb-meaning { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 13px; }
.fb-example { font-size: 15px; color: var(--magic-hi); line-height: 1.55; }
.fb-example b { color: var(--gold-hi); font-weight: 700; }
.fb-example-ja { font-size: 12px; color: var(--ink-dim); margin-top: 5px; line-height: 1.55; }
.fb-hint { margin-top: 15px; font-size: 11px; color: var(--ink-dim); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* レリック */
.relic-title { font-family: var(--font-display); font-weight: 700; font-size: 21px; color: var(--gold-hi); letter-spacing: 3px; text-shadow: 0 0 22px rgba(255, 176, 84, .5); }
.relic-cards { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 390px; }
.relic-card {
  font-family: inherit; text-align: left;
  background: linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .015)), rgba(18, 13, 28, .9);
  border: 1px solid var(--stroke); border-radius: var(--r-md);
  padding: 15px 17px; cursor: pointer; color: var(--ink);
  display: flex; align-items: center; gap: 15px;
  transition: transform .15s, border-color .15s, box-shadow .2s;
  animation: cardIn .4s cubic-bezier(.2, 1.4, .4, 1) backwards;
  box-shadow: var(--shadow-panel);
}
.relic-card:nth-child(2) { animation-delay: .08s; }
.relic-card:nth-child(3) { animation-delay: .16s; }
.relic-card:hover, .relic-card:active { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 12px 34px rgba(255, 150, 60, .18), var(--shadow-panel); }
.relic-icon { font-size: 34px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
.relic-name { font-size: 15px; font-weight: 900; color: var(--gold-hi); margin-bottom: 3px; }
.relic-desc { font-size: 12px; color: var(--ink-dim); line-height: 1.45; }

/* 宝箱 */
.chest-box { font-size: 92px; cursor: pointer; animation: chestWiggle 1.1s infinite; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .65)) drop-shadow(0 0 26px rgba(255, 176, 84, .25)); }
@keyframes chestWiggle { 0%, 100% { transform: rotate(0); } 42% { transform: rotate(0); } 46% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } 54% { transform: rotate(-4deg); } 58% { transform: rotate(0); } }
.chest-box.opening { animation: chestOpen .55s forwards; }
@keyframes chestOpen { 50% { transform: scale(1.35); filter: brightness(2.8) drop-shadow(0 0 44px var(--gold)); } 100% { transform: scale(0); opacity: 0; } }
.chest-hint { font-size: 13px; color: var(--ink-dim); animation: blink 1.4s infinite; }

.chest-card, .zukan-card {
  width: 195px; border-radius: var(--r-md); padding: 18px 14px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .015)), rgba(18, 13, 28, .92);
  border: 2px solid var(--rare-n); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: var(--shadow-panel);
}
.chest-card { animation: cardReveal .65s cubic-bezier(.2, 1.5, .4, 1); cursor: pointer; }
@keyframes cardReveal { 0% { transform: scale(.2) rotateY(180deg); opacity: 0; } }
.card-rarity { font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: 4px; }
.card-word { font-family: var(--font-display); font-weight: 700; font-size: 25px; color: var(--ink); }
.card-ja { font-size: 13px; font-weight: 500; color: var(--ink-dim); }
.card-stars { font-size: 13px; color: var(--gold); letter-spacing: 2px; text-shadow: 0 0 8px rgba(255, 176, 84, .5); }
.rarity-N { border-color: var(--rare-n); } .rarity-N .card-rarity { color: var(--rare-n); }
.rarity-R { border-color: var(--rare-r); box-shadow: 0 0 22px rgba(111, 157, 255, .3), var(--shadow-panel); } .rarity-R .card-rarity { color: var(--rare-r); }
.rarity-SR { border-color: var(--rare-sr); box-shadow: 0 0 28px rgba(192, 125, 255, .4), var(--shadow-panel); } .rarity-SR .card-rarity { color: var(--rare-sr); }
.rarity-UR { border-color: var(--rare-ur); box-shadow: 0 0 34px rgba(255, 148, 64, .5), var(--shadow-panel); animation: cardReveal .65s cubic-bezier(.2, 1.5, .4, 1), urShine 2s infinite; } .rarity-UR .card-rarity { color: var(--rare-ur); }
@keyframes urShine { 50% { box-shadow: 0 0 52px rgba(255, 148, 64, .85), var(--shadow-panel); } }

/* ═══════════ 戦利品・装備カード ═══════════ */
.loot-title { font-family: var(--font-display); font-weight: 700; font-size: 21px; color: var(--gear-legend); letter-spacing: 3px; text-shadow: 0 0 22px rgba(255, 148, 64, .45); }
.loot-cards { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 400px; max-height: 60vh; overflow-y: auto; }
.gear-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .012)), rgba(16, 12, 24, .94);
  border: 1px solid var(--gear-common); border-radius: var(--r-md);
  padding: 13px 15px; text-align: left;
  animation: cardIn .35s cubic-bezier(.2, 1.4, .4, 1);
  box-shadow: var(--shadow-panel);
}
.gear-card.r-common { border-color: rgba(184, 188, 196, .5); }
.gear-card.r-magic { border-color: rgba(134, 164, 255, .65); box-shadow: 0 0 18px rgba(134, 164, 255, .18), var(--shadow-panel); }
.gear-card.r-rare { border-color: rgba(255, 215, 94, .65); box-shadow: 0 0 22px rgba(255, 215, 94, .2), var(--shadow-panel); }
.gear-card.r-legend { border-color: rgba(255, 148, 64, .8); box-shadow: 0 0 30px rgba(255, 148, 64, .32), var(--shadow-panel); animation: cardIn .35s cubic-bezier(.2, 1.4, .4, 1), urShine 2.2s infinite; }
.gear-name { font-size: 15px; font-weight: 900; margin-bottom: 2px; }
.r-common .gear-name { color: var(--gear-common); }
.r-magic .gear-name { color: var(--gear-magic); }
.r-rare .gear-name { color: var(--gear-rare); }
.r-legend .gear-name { color: var(--gear-legend); }
.gear-meta { font-size: 10px; color: var(--ink-dim); margin-bottom: 7px; }
.gear-affix { font-size: 12px; font-weight: 500; color: var(--ink); line-height: 1.6; }
.gear-affix.implicit { color: var(--ink-dim); }
.gear-vs { font-size: 10px; color: var(--ink-dim); border-top: 1px dashed var(--stroke); margin-top: 8px; padding-top: 7px; line-height: 1.5; }
.gear-actions { display: flex; gap: 8px; margin-top: 10px; }
.gear-btn {
  font-family: inherit; flex: 1; padding: 9px 4px; font-size: 13px; font-weight: 700;
  background: var(--glass); color: var(--ink); border: 1px solid var(--stroke); border-radius: var(--r-sm); cursor: pointer;
  transition: all .15s;
}
.gear-btn.primary { border-color: rgba(255, 176, 84, .6); color: var(--gold-hi); }
.gear-btn.primary:not(:disabled):hover { box-shadow: 0 0 14px rgba(255, 176, 84, .25); }
.gear-btn.danger { color: var(--danger); }
.gear-btn:disabled { opacity: .4; }

/* ═══════════ プロローグ ═══════════ */
.intro-card {
  width: 100%; max-width: 430px; max-height: 88%;
  overflow-y: auto;
  background: linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .015)), rgba(16, 12, 26, .95);
  border: 1px solid rgba(255, 176, 84, .4); border-radius: var(--r-lg);
  box-shadow: 0 20px 70px rgba(0, 0, 0, .65), 0 0 50px rgba(255, 150, 60, .1);
  padding: 24px 24px 20px;
  animation: cardIn .4s cubic-bezier(.2, 1.4, .4, 1);
}
.intro-title { font-size: 16px; font-weight: 900; color: var(--gold-hi); letter-spacing: 2px; margin-bottom: 11px; }
.intro-text { font-size: 13px; line-height: 2; color: var(--ink); margin-bottom: 20px; }
.intro-text b, .intro-list b { color: var(--magic-hi); }
.intro-list { list-style: none; margin-bottom: 22px; }
.intro-list li { font-size: 12px; line-height: 1.7; color: var(--ink-dim); padding: 5px 0 5px 20px; position: relative; }
.intro-list li::before { content: '◆'; position: absolute; left: 2px; color: var(--gold); font-size: 9px; top: 9px; }

/* ═══════════ リザルト ═══════════ */
#screen-result { align-items: center; text-align: center; }
.result-title {
  font-family: var(--font-display); font-weight: 900;
  font-size: 26px; letter-spacing: 5px; margin: 16px 0 4px;
  background: var(--grad-ember);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 160, 70, .4));
}
.result-rank {
  font-family: var(--font-display); font-weight: 900;
  font-size: 82px; line-height: 1; color: var(--magic-hi);
  text-shadow: 0 0 40px rgba(94, 224, 255, .55), 0 6px 18px rgba(0, 0, 0, .6);
  margin: 8px 0;
  animation: rankStamp .55s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes rankStamp { 0% { transform: scale(3.2); opacity: 0; filter: blur(8px); } }
.result-score { display: flex; align-items: baseline; gap: 9px; }
#result-score-num { font-family: var(--font-display); font-weight: 700; font-size: 42px; color: var(--ink); font-variant-numeric: tabular-nums; }
.result-score-label { font-size: 11px; color: var(--ink-dim); letter-spacing: 3px; }
.result-best { font-size: 13px; font-weight: 500; color: var(--gold); min-height: 18px; margin: 6px 0; line-height: 1.7; }
.result-stats { display: flex; gap: 20px; margin: 10px 0 14px; font-size: 11px; color: var(--ink-dim); flex-wrap: wrap; justify-content: center; }
.result-stats b { color: var(--ink); font-family: var(--font-display); font-size: 17px; display: block; }

.recap {
  width: 100%; max-width: 430px;
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-md);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 13px; margin-bottom: 14px;
}
.recap-title { font-size: 12px; font-weight: 900; color: var(--danger); letter-spacing: 1px; margin-bottom: 9px; }
.recap-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.recap-item {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--stroke); border-radius: var(--r-sm); padding: 8px 11px; cursor: pointer;
  transition: border-color .15s;
}
.recap-item:hover { border-color: var(--stroke-strong); }
.recap-word { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--gold-hi); min-width: 92px; }
.recap-ja { font-size: 13px; color: var(--ink); flex: 1; }
.recap-speak { font-size: 15px; }
.recap-empty { font-size: 13px; font-weight: 700; color: var(--heal); padding: 8px; }
.result-buttons { width: 100%; max-width: 430px; display: flex; flex-direction: column; gap: 9px; margin-top: auto; padding-bottom: 8px; }

/* ═══════════ 図鑑・装備画面 ═══════════ */
#screen-zukan, #screen-gear { padding: 14px; }
.zukan-header { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.zukan-header h2 { font-size: 18px; font-weight: 900; color: var(--gold-hi); letter-spacing: 1px; }
.back-btn {
  font-family: inherit; font-size: 13px; font-weight: 700; color: var(--ink);
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 999px; padding: 8px 15px; cursor: pointer;
}
.zukan-progress { margin-left: auto; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--magic-hi); }
.zukan-tiers { display: flex; gap: 8px; margin-bottom: 13px; }
.zukan-tier-btn {
  flex: 1; font-family: inherit; font-size: 12px; font-weight: 700; padding: 9px 4px;
  background: var(--glass); color: var(--ink-dim); border: 1px solid var(--stroke); border-radius: var(--r-sm); cursor: pointer;
  transition: all .15s;
}
.zukan-tier-btn.selected { color: #1c1002; background: var(--grad-ember); border-color: transparent; box-shadow: 0 4px 18px rgba(255, 150, 60, .3); }
.zukan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 9px; overflow-y: auto; padding-bottom: 20px; }
.zukan-card { width: auto; padding: 11px 6px; cursor: pointer; border-width: 1.5px; gap: 3px; }
.zukan-card .card-word { font-size: 14px; }
.zukan-card .card-ja { font-size: 11px; }
.zukan-card.unowned { filter: grayscale(1) brightness(.5); }
.zukan-card.unowned .card-word { color: transparent; text-shadow: 0 0 9px rgba(242, 236, 223, .75); }
.zukan-card.rusty { filter: grayscale(.7) brightness(.72); }
.rust-hint { font-size: 9px; color: #d09a5c; }

.gear-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
.gear-slot {
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-md);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 10px 12px; cursor: pointer; min-height: 66px;
  transition: border-color .15s;
}
.gear-slot:hover { border-color: var(--stroke-strong); }
.gear-slot .slot-label { font-size: 10px; color: var(--ink-dim); margin-bottom: 4px; letter-spacing: 1px; }
.gear-slot .slot-item { font-size: 13px; font-weight: 700; line-height: 1.4; }
.gear-slot .slot-empty { color: var(--ink-dim); font-size: 12px; }
.gear-summary {
  font-size: 11px; font-weight: 500; color: var(--magic-hi); line-height: 1.7;
  background: rgba(123, 156, 255, .06); border: 1px solid rgba(123, 156, 255, .25); border-radius: var(--r-sm);
  padding: 9px 12px; margin-bottom: 13px; min-height: 20px;
}
.gear-inv-title { font-size: 11px; color: var(--ink-dim); margin-bottom: 9px; letter-spacing: 1px; }
.gear-inv { display: flex; flex-direction: column; gap: 9px; overflow-y: auto; padding-bottom: 20px; }
.gear-inv .gear-card { cursor: pointer; }
.gear-card.equipped-mark::after { content: '✦ 装備中'; font-size: 10px; font-weight: 700; color: var(--heal); }

/* ═══════════ 勇者・魔法弾 ═══════════ */
.hero { position: absolute; left: 22px; bottom: 14px; z-index: 10; pointer-events: none; }
.hero-sprite {
  line-height: 1;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .6)) drop-shadow(0 0 18px rgba(123, 156, 255, .3));
  transform: scaleX(-1);
  animation: heroIdle 2.4s ease-in-out infinite;
  transition: filter .2s;
}
#hero-canvas { width: 88px; height: 88px; display: block; }
@keyframes heroIdle { 50% { transform: scaleX(-1) translateY(-5px); } }
.hero-sprite.cast { animation: heroCast .3s ease-out, heroIdle 2.4s .3s ease-in-out infinite; }
@keyframes heroCast {
  30% { transform: scaleX(-1) translate(-28px, -20px) scale(1.14); filter: drop-shadow(0 0 26px var(--magic-hi)); }
}
.hero-sprite.hurt { animation: heroHurt .4s, heroIdle 2.4s .4s ease-in-out infinite; }
@keyframes heroHurt {
  25% { transform: scaleX(-1) translateX(12px) rotate(-9deg); filter: drop-shadow(0 0 18px var(--danger)) brightness(1.9) sepia(1) hue-rotate(-50deg); }
  60% { transform: scaleX(-1) translateX(-6px); }
}
.bolt {
  position: absolute; font-size: 27px; z-index: 15; pointer-events: none;
  filter: drop-shadow(0 0 14px var(--magic-hi));
  transition: left .16s ease-in, top .16s ease-in;
}

/* ═══════════ メッセージウィンドウ ═══════════ */
.msg-window {
  margin: 0 14px 8px; padding: 9px 14px; min-height: 40px;
  font-size: 12.5px; font-weight: 500; line-height: 1.5; color: var(--ink);
  background: rgba(10, 8, 18, .6);
  border: 1px solid var(--stroke); border-radius: var(--r-md);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-panel);
  display: flex; align-items: center;
}
.msg-window b { color: var(--gold-hi); font-weight: 700; }
.msg-window.flash { animation: msgFlash .4s; }
@keyframes msgFlash { 0% { background: rgba(123, 156, 255, .16); } }

/* ═══════════ 精致化ディテール ═══════════ */
/* タイトルの飾り罫 */
.filigree {
  display: flex; align-items: center; gap: 12px;
  width: 72%; max-width: 340px;
  color: rgba(255, 176, 84, .65); font-size: 11px;
  margin-bottom: 20px;
}
.filigree::before, .filigree::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 176, 84, .45));
}
.filigree::after { background: linear-gradient(90deg, rgba(255, 176, 84, .45), transparent); }

/* 敵の足元の魔法陣(3D傾斜・二重逆回転リング) */
.magic-circle {
  position: absolute; left: 50%; top: 34px;
  width: 158px; height: 158px;
  margin-left: -79px;
  transform: rotateX(67deg);
  pointer-events: none; z-index: -1;
  opacity: .9;
}
.magic-circle::before, .magic-circle::after {
  content: ''; position: absolute; border-radius: 50%;
}
.magic-circle::before {
  inset: 0;
  border: 2px dashed rgba(255, 176, 84, .5);
  box-shadow: 0 0 22px rgba(255, 150, 60, .35), inset 0 0 26px rgba(255, 150, 60, .16);
  animation: mcSpin 10s linear infinite;
}
.magic-circle::after {
  inset: 16px;
  border: 1.5px solid rgba(123, 156, 255, .45);
  border-top-color: transparent; border-bottom-color: transparent;
  box-shadow: 0 0 14px rgba(123, 156, 255, .25);
  animation: mcSpinRev 6.5s linear infinite;
}
@keyframes mcSpin { to { transform: rotate(360deg); } }
@keyframes mcSpinRev { to { transform: rotate(-360deg); } }

/* 選択肢カードの時間差エントランス */
.choices .choice-btn { animation: choiceIn .32s cubic-bezier(.2, .9, .3, 1) backwards; }
.choices .choice-btn:nth-child(1) { animation-delay: .02s; }
.choices .choice-btn:nth-child(2) { animation-delay: .07s; }
.choices .choice-btn:nth-child(3) { animation-delay: .12s; }
.choices .choice-btn:nth-child(4) { animation-delay: .17s; }
@keyframes choiceIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* コンボゲージのシマー(光が流れる) */
.combo-fill {
  background: linear-gradient(90deg, #ffd58a, #ffb054, #ff7a3d, #ffb054, #ffd58a);
  background-size: 220% 100%;
  animation: gaugeShimmer 2.2s linear infinite;
}
@keyframes gaugeShimmer { to { background-position: -220% 0; } }

/* オーブのラベル */
.orb::after {
  content: attr(data-label);
  position: absolute; bottom: 5px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-display); font-size: 8px; font-weight: 700; letter-spacing: 2px;
  color: rgba(255, 255, 255, .6);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  z-index: 3; pointer-events: none;
}

/* フィードバックカードの習得度 */
.fb-stars {
  font-size: 12px; color: var(--ink-dim); margin: -7px 0 12px;
  letter-spacing: 2px;
}
.fb-stars b { color: var(--gold); font-weight: 700; text-shadow: 0 0 10px rgba(255, 176, 84, .55); }

/* スマホ縦長対応 */
@media (max-height: 640px) {
  #enemy-canvas { width: 116px; height: 116px; }
  .enemy-plate { font-size: 23px; min-height: 44px; }
  .choice-btn { padding: 12px 6px; min-height: 52px; font-size: 15px; }
  #hero-canvas { width: 64px; height: 64px; }
  .msg-window { min-height: 34px; font-size: 11px; }
}

/* ═══════════ PC(大画面)対応 ═══════════ */
@media (min-width: 900px) {
  #app { max-width: 1280px; }
  #map-canvas { max-width: 1400px; }
  .map-panel { flex: 1; justify-content: center; }
  .hud, .bottom-hud { padding-left: 40px; padding-right: 40px; }
  .enemy-zone { max-width: 760px; width: 100%; margin: 0 auto; }
  .msg-window { max-width: 780px; width: calc(100% - 28px); margin-left: auto; margin-right: auto; }
  .choices { max-width: 780px; width: 100%; margin: 0 auto; }
  .boss-panel { max-width: 780px; width: 100%; margin: 0 auto; }
  .combo-zone { max-width: 600px; width: 100%; margin: 0 auto; }
  #enemy-canvas { width: 190px; height: 190px; }
  #hero-canvas { width: 110px; height: 110px; }
  .hero { left: calc(50% - 370px); }
  .skills { gap: 10px; }
  .skill-btn { width: 56px; height: 60px; font-size: 21px; }
  .orb { width: 76px; height: 76px; }
  .orb-text { font-size: 18px; }
  /* タイトルもワイドに */
  #screen-title { max-width: 720px; margin: 0 auto; width: 100%; }
  .mode-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
  .mode-btn.primary { grid-column: 1 / -1; }
  .mode-row { grid-column: 1 / -1; display: flex; }
  .giveup-btn { right: calc(50% - 510px); }
}

/* ═══════════════════════════════════════════════
   ADVENTURE EDITION — 明快な主机游戏风格
   大きな輪郭 / 紙と木の質感 / 押せるUI / 高コントラスト
   ═══════════════════════════════════════════════ */
:root {
  --bg-0: #102f42;
  --bg-1: #17485e;
  --bg-2: #276b78;
  --glass: rgba(255, 250, 231, .10);
  --glass-strong: rgba(255, 250, 231, .18);
  --stroke: rgba(255, 250, 231, .22);
  --stroke-strong: rgba(255, 250, 231, .42);
  --ink: #fff9e9;
  --ink-dim: #bed5d7;
  --gold: #ffc83d;
  --gold-hi: #fff1a8;
  --gold-deep: #a85a20;
  --magic: #49d4e6;
  --magic-hi: #90f0f2;
  --danger: #f25b4b;
  --heal: #54c975;
  --perfect: #fff2aa;
  --grad-ember: linear-gradient(180deg, #ffe278 0%, #ffc83d 58%, #f2a52f 100%);
  --grad-arcane: linear-gradient(180deg, #85edf0, #38bdd7);
  --font-jp: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  --font-display: 'Fredoka', 'M PLUS Rounded 1c', sans-serif;
  --shadow-panel: 0 5px 0 rgba(4, 26, 38, .55), 0 12px 28px rgba(3, 20, 31, .22), inset 0 1px 0 rgba(255,255,255,.35);
  --r-lg: 28px;
  --r-md: 19px;
  --r-sm: 13px;
  --paper: #fff7dd;
  --paper-2: #f6e7bd;
  --navy: #17384a;
  --outline: #153747;
  --red: #ef5b45;
  --red-deep: #a93432;
}

html { background: #0c2a3b; }
body {
  background:
    radial-gradient(circle at 16% 8%, rgba(255,226,120,.26) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 14%, rgba(255,255,255,.18) 0 2px, transparent 3px),
    radial-gradient(circle at 90% 42%, rgba(255,226,120,.18) 0 3px, transparent 4px),
    linear-gradient(180deg, #1a6473 0%, #174a61 45%, #102f42 100%);
  background-size: 180px 180px, 240px 240px, 310px 310px, auto;
}

body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 22% 12% at 12% 103%, rgba(46,128,102,.85) 0 64%, transparent 66%),
    radial-gradient(ellipse 25% 14% at 35% 105%, rgba(65,155,107,.68) 0 64%, transparent 66%),
    radial-gradient(ellipse 27% 13% at 75% 105%, rgba(39,122,98,.82) 0 64%, transparent 66%),
    radial-gradient(ellipse 22% 12% at 96% 103%, rgba(72,154,103,.62) 0 64%, transparent 66%);
  opacity: .5;
}

.ambient { opacity: .45; }
.amb-glow { filter: blur(72px); }
.amb-glow.g1 { background: radial-gradient(circle, rgba(255,205,73,.36), transparent 70%); }
.amb-glow.g2 { background: radial-gradient(circle, rgba(74,214,211,.32), transparent 70%); }

#app {
  max-width: 560px;
  background:
    radial-gradient(circle at 50% -10%, rgba(255,255,255,.12), transparent 38%),
    linear-gradient(180deg, rgba(16,56,72,.54), rgba(10,38,52,.7));
  border-inline: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 0 90px rgba(3,20,31,.5);
}

.screen { scrollbar-width: thin; scrollbar-color: rgba(255,231,145,.65) transparent; }
.screen.active { animation: adventureScreenIn .42s cubic-bezier(.2,1.1,.32,1); }
@keyframes adventureScreenIn { from { opacity: 0; transform: translateY(16px) scale(.975); } }

button { -webkit-font-smoothing: antialiased; }
button:focus-visible, [tabindex]:focus-visible {
  outline: 4px solid #fff4a8;
  outline-offset: 3px;
}

/* ── タイトル: 冒険のポスター ── */
#screen-title {
  padding: 24px 20px 18px;
  overflow-x: hidden;
}
#screen-title::before, #screen-title::after {
  content: ''; position: absolute; pointer-events: none;
  width: 170px; height: 170px; border: 3px solid rgba(255,243,173,.12); border-radius: 42% 58% 55% 45%;
  transform: rotate(24deg); z-index: -1;
}
#screen-title::before { left: -112px; top: 86px; }
#screen-title::after { right: -118px; top: 184px; transform: rotate(-18deg); }
.title-glow {
  top: -38px; width: 520px; height: 260px; filter: blur(3px);
  background: radial-gradient(ellipse, rgba(255,222,106,.34), transparent 68%);
}
.game-logo { margin: 0 0 5px; transform: rotate(-1deg); }
.game-logo::before {
  content: '✦'; display: block; width: 50px; height: 50px; margin: 0 auto -6px;
  font: 800 31px/50px var(--font-display); color: var(--gold); text-align: center;
  border: 4px solid var(--paper); border-radius: 50%; background: var(--red);
  box-shadow: 0 4px 0 var(--red-deep), 0 7px 18px rgba(3,20,31,.3);
  text-shadow: 0 2px 0 rgba(112,48,30,.45);
  animation: crestFloat 2.8s ease-in-out infinite;
}
@keyframes crestFloat { 50% { transform: translateY(-4px) rotate(5deg); } }
.logo-en {
  font-size: clamp(38px, 8vw, 58px); letter-spacing: .02em; line-height: .95;
  color: var(--paper); -webkit-text-fill-color: var(--paper); background: none;
  -webkit-text-stroke: 2px #714329;
  filter: drop-shadow(0 5px 0 #ba6a32) drop-shadow(0 9px 10px rgba(3,20,31,.32));
}
.logo-ja {
  display: inline-block; margin-top: 12px; padding: 5px 17px 6px;
  font-size: 14px; letter-spacing: .12em; color: var(--navy); text-shadow: none;
  background: var(--gold); border: 3px solid var(--paper); border-radius: 999px;
  box-shadow: 0 4px 0 #b87027;
}
.title-sub {
  margin: 13px 0 11px; color: #e8f5e9; font-size: 11px; font-weight: 800; letter-spacing: .16em;
  text-shadow: 0 2px 0 rgba(7,37,49,.55);
}
.filigree { display: none; }
.hero-badge {
  margin-bottom: 14px; padding: 7px 17px 8px; color: var(--navy); font-size: 12px; font-weight: 900;
  background: var(--paper); border: 3px solid var(--outline); border-radius: 999px;
  box-shadow: 0 4px 0 #0c2938, inset 0 2px 0 #fff;
  backdrop-filter: none;
}
.tier-select {
  margin-bottom: 13px; padding: 11px 12px 10px;
  background: rgba(9,43,57,.52); border: 2px solid rgba(255,255,255,.16); border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.tier-label {
  color: #e9f5e9; font-weight: 900; font-size: 10px; letter-spacing: .12em; margin-bottom: 7px;
}
.tier-buttons { gap: 8px; }
.tier-btn {
  position: relative; padding: 9px 4px 8px; color: #42606a;
  background: #d7e7dc; border: 3px solid var(--outline); border-radius: 15px;
  box-shadow: 0 4px 0 #0b2c3a, inset 0 2px 0 rgba(255,255,255,.8);
  backdrop-filter: none; transition: transform .14s, box-shadow .14s, background .18s;
}
.tier-btn:hover { transform: translateY(-2px); }
.tier-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0b2c3a; }
.tier-btn.selected {
  color: #58361e; background: var(--grad-ember); border-color: #fff0a3;
  box-shadow: 0 5px 0 #b56625, 0 8px 18px rgba(3,20,31,.22), inset 0 2px 0 #fff3b2;
  transform: translateY(-2px);
}
.tier-btn small { font-size: 9px; font-weight: 800; }
.tier-mastery { color: #cce4df; font-weight: 700; margin-top: 7px; min-height: 13px; }

.mode-buttons { gap: 10px; }
.mode-btn {
  min-height: 60px; padding: 12px 58px 12px 17px; gap: 1px;
  font-size: 15px; font-weight: 900; color: var(--navy);
  background: var(--paper); border: 3px solid var(--outline); border-radius: 18px;
  box-shadow: 0 5px 0 #0b2937, 0 9px 20px rgba(3,20,31,.22), inset 0 2px 0 #fff;
  backdrop-filter: none; overflow: visible;
  transition: transform .15s cubic-bezier(.2,1.5,.4,1), box-shadow .15s, filter .15s;
}
.mode-btn::before {
  inset: 3px; border-radius: 12px;
  background: linear-gradient(110deg, transparent 28%, rgba(255,255,255,.55) 48%, transparent 68%);
  pointer-events: none;
}
.mode-btn::after {
  content: '›'; position: absolute; right: 16px; top: 50%; transform: translateY(-54%);
  width: 30px; height: 30px; border-radius: 50%;
  color: #fff; background: #38a9b7; border: 3px solid var(--outline);
  font: 900 28px/22px var(--font-display); text-align: center;
  box-shadow: 0 3px 0 #0d6170;
}
.mode-btn:hover:not(:disabled) { transform: translateY(-3px) rotate(-.25deg); filter: brightness(1.04); }
.mode-btn:active:not(:disabled) { transform: translateY(4px) scale(.99); box-shadow: 0 1px 0 #0b2937; }
.mode-btn small { color: #63767b; font-size: 10px; font-weight: 700; }
.mode-btn.primary {
  color: #fff; background: linear-gradient(180deg, #f87858, #e84e42); border-color: #732f32;
  box-shadow: 0 6px 0 #8e3030, 0 11px 24px rgba(3,20,31,.3), inset 0 2px 0 rgba(255,255,255,.42);
}
.mode-btn.primary small { color: #ffe8d5; }
.mode-btn.primary::after {
  content: '▶'; color: #7f3a28; background: #ffe275; border-color: #7f3a28;
  font-size: 13px; line-height: 25px; animation: nudge 1.4s ease-in-out infinite;
}
.mode-btn:disabled {
  opacity: .62; color: #6c7a77; background: #b8c8c2; filter: saturate(.45);
  box-shadow: 0 3px 0 #163947; transform: translateY(2px);
}
.mode-btn:disabled::after { background: #839e9e; box-shadow: none; }
.mode-row { gap: 10px; }
.mode-row .mode-btn { padding-right: 42px; }
.mode-row .mode-btn::after { right: 10px; width: 25px; height: 25px; font-size: 23px; line-height: 18px; }

.title-footer { padding-top: 15px; gap: 7px; }
.opt-btn, .back-btn {
  color: var(--navy); background: #e8f1df; border: 3px solid var(--outline); border-radius: 999px;
  box-shadow: 0 3px 0 #0c2b39; font-weight: 800; padding: 7px 12px;
  transition: transform .12s, box-shadow .12s;
}
.opt-btn:active, .back-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0c2b39; }
.opt-btn.on { color: #74431f; background: #ffe47b; border-color: #74431f; box-shadow: 0 3px 0 #a45a2b; }
.streak-badge { color: #fff1a7; text-shadow: 0 2px 0 #5f3827; }

/* ── ゲームHUD: 地下城の中でも一目で読める ── */
#screen-game {
  background: linear-gradient(180deg, #123a4b, #071f2d);
}
.hud {
  padding: 10px 16px 9px;
  color: var(--navy); background: linear-gradient(180deg, #fff8df, #f4e1ad);
  border: 0; border-bottom: 4px solid #9e6234;
  box-shadow: 0 6px 0 rgba(7,31,45,.42), inset 0 2px 0 #fff;
  backdrop-filter: none; z-index: 30;
}
.hud-row { align-items: center; margin-bottom: 7px; }
.hud-floor {
  color: #fff; background: var(--red); border: 3px solid #713039; border-radius: 12px;
  padding: 3px 10px; font-size: 18px; line-height: 1.1; letter-spacing: 0;
  box-shadow: 0 3px 0 #8c3134; text-shadow: 0 2px 0 #923b31;
}
.hud-level { color: #13788b; font-size: 12px; font-weight: 900; }
.hud-mode { color: #766852; font-weight: 800; }
.hud-score { color: var(--navy); font-size: 22px; text-shadow: none; }
.hud-score::before { content: 'SCORE '; color: #8b7352; font-size: 9px; letter-spacing: .08em; }
.exp-bar, .combo-gauge {
  height: 8px; background: #c8b98f; border: 2px solid #6c563d; border-radius: 999px;
  box-shadow: inset 0 2px 2px rgba(72,44,24,.24); overflow: hidden;
}
.exp-fill { background: linear-gradient(180deg,#6ce0e0,#24a8c0); box-shadow: inset 0 2px 0 rgba(255,255,255,.45); }
.relic-tray { margin-top: 5px; min-height: 17px; }
.relic-chip { background: #fff8dd; color: var(--navy); border: 2px solid #7d6646; box-shadow: 0 2px 0 #76533b; }

.battle-area { background: radial-gradient(ellipse at 50% 45%, rgba(59,128,132,.18), transparent 65%); }
.map-panel {
  margin: 14px 12px 2px; border: 4px solid #092c3b; border-radius: 24px;
  background: #061a25; box-shadow: 0 6px 0 #04151f, 0 10px 28px rgba(0,0,0,.32), inset 0 0 0 2px rgba(255,232,160,.16);
  overflow: hidden;
}
#map-canvas { border-radius: 18px; }
.map-hint {
  color: #fff1ba; background: rgba(7,31,45,.88); font-weight: 800; letter-spacing: .01em;
  text-shadow: 0 2px 0 #071f2d; padding: 4px 10px 5px;
}
.enemy-zone {
  border: 4px solid #0b3141; border-radius: 28px;
  background:
    radial-gradient(ellipse 62% 38% at 50% 70%, rgba(255,188,74,.22), transparent 70%),
    linear-gradient(180deg, #17475b, #0b2838);
  box-shadow: 0 7px 0 #061d2b, 0 13px 30px rgba(0,0,0,.28), inset 0 2px 0 rgba(255,255,255,.12);
}
.enemy-plate {
  color: var(--navy); background: var(--paper); border: 4px solid var(--outline); border-radius: 18px;
  box-shadow: 0 5px 0 #0a2a38, inset 0 2px 0 #fff; backdrop-filter: none;
}
.enemy-tag { border-width: 2px !important; font-weight: 900; }
.atk-timer {
  height: 10px; background: #4d2830; border: 2px solid #f3c9a1; border-radius: 999px;
  box-shadow: 0 3px 0 #061d2b; overflow: hidden;
}
.atk-fill { background: linear-gradient(180deg,#ff9c68,#ef4e46); box-shadow: inset 0 2px 0 rgba(255,255,255,.35); }

.msg-window {
  color: var(--navy); background: var(--paper); border: 3px solid var(--outline); border-radius: 16px;
  box-shadow: 0 4px 0 #071f2d, inset 0 2px 0 #fff; backdrop-filter: none;
  font-weight: 700;
}
.msg-window b { color: #b34a30; font-weight: 900; }
.msg-window.flash { animation: paperFlash .38s; }
@keyframes paperFlash { 0% { background: #fff095; transform: scale(1.015); } }

.choices { gap: 11px; }
.choice-btn, .boss-chip {
  color: var(--navy); background: #fff7dc; border: 3px solid var(--outline); border-radius: 17px;
  box-shadow: 0 5px 0 #0a2a38, inset 0 2px 0 #fff; backdrop-filter: none;
  font-weight: 900; transition: transform .13s, box-shadow .13s, background .13s;
}
.choice-btn:hover, .boss-chip:hover { transform: translateY(-2px); background: #fffbe9; border-color: #153747; }
.choice-btn:active, .boss-chip:active { transform: translateY(4px); box-shadow: 0 1px 0 #0a2a38; }
.choice-btn.correct-pick {
  color: #17452a; background: #abed9e; border-color: #205d39; box-shadow: 0 5px 0 #205d39;
}
.choice-btn.wrong-pick { color: #6f2528; background: #ffaaa0; border-color: #8d3034; }
.choice-btn.reveal-correct { background: #d6f5ae; border-color: #327649; box-shadow: 0 5px 0 #327649; }

.combo-zone { padding-top: 5px; }
.combo-num { color: #ffe274; -webkit-text-stroke: 1px #8d4b2c; text-shadow: 0 3px 0 #9d4f2c; }
.combo-label { color: #cce3df; font-weight: 900; }
.combo-mult { color: #80edf0; text-shadow: 0 2px 0 #16687c; }
.combo-gauge { background: #5a3a32; border-color: #d49c62; }
.giveup-btn { color: #f7dfbf; border: 2px solid rgba(255,241,186,.38); font-weight: 800; }

.bottom-hud {
  background: linear-gradient(180deg, rgba(9,35,48,.25), #082432 46%);
  border-top: 2px solid rgba(255,241,186,.15);
}
.skill-btn {
  color: #fff9e8; background: linear-gradient(180deg,#29566a,#17394b); border: 3px solid #071f2d;
  border-radius: 15px; box-shadow: 0 4px 0 #041721, inset 0 2px 0 rgba(255,255,255,.16);
}
.skill-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #041721; }
.skill-btn.ready { border-color: #ffe27a; box-shadow: 0 4px 0 #9a572d, 0 0 0 2px rgba(255,226,122,.3); }
.orb { border-width: 4px; box-shadow: 0 5px 0 #031923, 0 8px 18px rgba(0,0,0,.3), inset 0 2px 0 rgba(255,255,255,.38); }

/* ── オーバーレイとコレクション: 羊皮紙の情報カード ── */
.overlay { background: rgba(5,25,35,.82); backdrop-filter: blur(6px); }
.intro-card, .feedback-card {
  color: var(--navy); background: var(--paper); border: 5px solid #9d6336; border-radius: 28px;
  box-shadow: 0 9px 0 #5f3829, 0 22px 70px rgba(0,0,0,.38), inset 0 3px 0 #fff;
}
.intro-title { color: #a44732; font-weight: 900; }
.intro-text, .intro-list li { color: #405660; }
.intro-text b, .intro-list b { color: #087f94; }
.intro-list li::before { color: #ef6944; }
.feedback-card.correct { border-color: #3a9156; box-shadow: 0 9px 0 #235e3b, 0 22px 70px rgba(0,0,0,.38), inset 0 3px 0 #fff; }
.feedback-card.wrong { border-color: #b6433f; box-shadow: 0 9px 0 #722e34, 0 22px 70px rgba(0,0,0,.38), inset 0 3px 0 #fff; }
.fb-word, .card-word { color: var(--navy); }
.fb-meaning, .fb-example, .fb-example-ja, .fb-hint { color: #536a70; }
.relic-title, .loot-title { color: #fff2a5; text-shadow: 0 3px 0 #75422d; }
.relic-card, .gear-card, .chest-card, .zukan-card {
  color: var(--navy); background: linear-gradient(165deg,#fffdf0,#f4e5bd); border-width: 3px;
  box-shadow: 0 5px 0 #0b2b38, 0 11px 25px rgba(0,0,0,.25), inset 0 2px 0 #fff;
}
.relic-name { color: #a94a31; }
.relic-desc, .gear-meta, .gear-affix.implicit, .gear-vs, .card-ja { color: #637478; }
.gear-affix { color: var(--navy); }
.gear-btn {
  color: var(--navy); background: #e4eee0; border: 2px solid var(--outline); border-radius: 12px;
  box-shadow: 0 3px 0 #0b2b38; font-weight: 900;
}
.gear-btn.primary { color: #fff; background: #e75a43; border-color: #733039; box-shadow: 0 3px 0 #8e3032; }

#screen-result, #screen-zukan, #screen-gear {
  background:
    radial-gradient(circle at 85% 10%, rgba(255,227,112,.22), transparent 24%),
    linear-gradient(180deg,#1a5d6e,#10384d);
}
.result-title { color: #fff4b3; -webkit-text-fill-color: #fff4b3; background: none; text-shadow: 0 4px 0 #a65031; }
.result-rank { color: #fff078; -webkit-text-stroke: 3px #a24d31; text-shadow: 0 6px 0 #71362d, 0 11px 25px rgba(0,0,0,.28); }
.result-score-label, .result-stats { color: #c7e3de; }
.result-stats b, #result-score-num { color: #fff8dd; }
.result-best { color: #ffe37b; }
.recap {
  background: var(--paper); border: 4px solid var(--outline); border-radius: 21px;
  box-shadow: 0 5px 0 #0a2a38; backdrop-filter: none;
}
.recap-item { background: #f7e9c4; border: 2px solid #b9a779; }
.recap-word { color: #ad4932; }
.recap-ja { color: var(--navy); }
.zukan-header {
  background: var(--paper); border: 4px solid var(--outline); border-radius: 20px;
  box-shadow: 0 5px 0 #0a2a38; padding: 9px 11px; margin-bottom: 16px;
}
.zukan-header h2 { color: var(--navy); }
.zukan-progress { color: #087f94; }
.zukan-tier-btn {
  color: #607278; background: #d7e6dc; border: 3px solid var(--outline); border-radius: 14px;
  box-shadow: 0 3px 0 #0a2a38; font-weight: 900;
}
.zukan-tier-btn.selected { color: #623820; background: var(--grad-ember); border-color: #fff0a0; box-shadow: 0 4px 0 #9f582b; }
.gear-slot, .gear-summary {
  color: var(--navy); background: var(--paper); border: 3px solid var(--outline); border-radius: 17px;
  box-shadow: 0 4px 0 #0a2a38; backdrop-filter: none;
}
.gear-slot .slot-label, .gear-slot .slot-empty, .gear-inv-title { color: #cce2de; }
.gear-slot .slot-label, .gear-slot .slot-empty { color: #71807f; }
.gear-summary { color: #08798b; }

@media (max-width: 560px) {
  #screen-title { padding: 17px 13px 14px; }
  .game-logo::before { width: 42px; height: 42px; font-size: 26px; line-height: 42px; border-width: 3px; }
  .logo-en { font-size: clamp(34px, 11vw, 47px); -webkit-text-stroke-width: 1.5px; }
  .logo-ja { margin-top: 10px; font-size: 12px; }
  .title-sub { margin: 11px 0 9px; }
  .hero-badge { margin-bottom: 11px; }
  .tier-select { padding: 9px 9px 8px; margin-bottom: 11px; }
  .mode-btn { min-height: 57px; }
  .title-footer { flex-wrap: wrap; }
  .map-panel { margin-inline: 7px; }
}

@media (max-height: 720px) and (min-width: 700px) {
  #screen-title { padding-top: 12px; }
  .game-logo::before { width: 40px; height: 40px; font-size: 24px; line-height: 40px; }
  .logo-en { font-size: 43px; }
  .logo-ja { margin-top: 7px; padding-block: 3px 4px; font-size: 11px; }
  .title-sub { margin: 8px 0 7px; }
  .hero-badge { margin-bottom: 8px; padding-block: 5px 6px; }
  .tier-select { padding-block: 7px; margin-bottom: 9px; }
  .tier-btn { padding-block: 6px; }
  .mode-btn { min-height: 55px; padding-block: 8px; }
  .title-footer { padding-top: 10px; }
}

@media (min-width: 900px) {
  #app { max-width: 1360px; }
  #screen-title { max-width: 1020px; padding-inline: 28px; }
  .mode-buttons { grid-template-columns: 1.18fr .82fr; gap: 12px; }
  .mode-btn.primary { grid-column: 1 / -1; min-height: 64px; }
  .mode-row { grid-column: 1 / -1; }
  .map-panel { margin-inline: 20px; }
  .hud, .bottom-hud { padding-left: 34px; padding-right: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ═══════════════════════════════════════════════
   BATTLE STYLE — 冒険モードから独立した戦闘ルール
   ═══════════════════════════════════════════════ */
.battle-style-select {
  width: 100%;
  margin: 0 0 13px;
  padding: 10px 11px 9px;
  color: #eaf6ed;
  background: rgba(7, 35, 49, .72);
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 5px 0 rgba(5, 28, 40, .28);
}
.battle-style-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 2px 7px;
}
.battle-style-heading span {
  color: #9ed9d6;
  font: 800 7px/1 var(--font-display);
  letter-spacing: .14em;
}
.battle-style-heading b {
  color: #fff0aa;
  font-size: 10px;
  letter-spacing: .08em;
}
.battle-style-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.battle-style-btn {
  min-width: 0;
  min-height: 46px;
  padding: 6px 5px 7px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: #49636a;
  background: linear-gradient(180deg, #f4f0d9, #dce8d7);
  border: 3px solid #17384a;
  border-radius: 13px;
  box-shadow: 0 3px 0 #0a2937, inset 0 2px 0 rgba(255, 255, 255, .88);
  cursor: pointer;
  transition: transform .16s cubic-bezier(.2, 1.4, .4, 1), box-shadow .16s, background .16s, color .16s;
}
.battle-style-btn > span {
  color: #688086;
  font: 900 7px/1 var(--font-display);
  letter-spacing: .11em;
}
.battle-style-btn > b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
}
.battle-style-btn:hover { transform: translateY(-2px); }
.battle-style-btn:active { transform: translateY(2px) scale(.985); box-shadow: 0 1px 0 #0a2937; }
.battle-style-btn.selected {
  color: #fff9dc;
  background: linear-gradient(180deg, #2699a3, #177383);
  border-color: #fff0a4;
  box-shadow: 0 4px 0 #0b5362, inset 0 2px 0 rgba(255, 255, 255, .26);
  transform: translateY(-1px);
}
.battle-style-btn.selected > span { color: #fff0a4; }
.battle-style-desc {
  min-height: 15px;
  margin: 7px 3px 0;
  color: #c8dfdc;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
  text-wrap: pretty;
}
.result-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.hud-mode {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hud-battle-style {
  flex: 0 0 auto;
  padding: 3px 7px 4px;
  color: #fff6cf;
  background: #267f8d;
  border: 2px solid #17384a;
  border-radius: 7px;
  box-shadow: 0 2px 0 #0d5260;
  font: 900 8px/1 var(--font-display);
  letter-spacing: .08em;
}
#screen-game[data-battle-style="turn"] .hud-battle-style {
  color: #17384a;
  background: #ffe37a;
  border-color: #74452e;
  box-shadow: 0 2px 0 #a9662d;
}
#screen-game[data-battle-style="rush"] .hud-battle-style {
  color: #fff6df;
  background: #d75945;
  border-color: #713039;
  box-shadow: 0 2px 0 #8d3134;
}

.battle-status {
  min-height: 31px;
  padding: 5px 16px 6px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: #d9eeea;
  background: #0b2c3b;
  border-bottom: 2px solid rgba(255, 255, 255, .1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  font-variant-numeric: tabular-nums;
}
.battle-status b {
  padding: 3px 6px;
  color: #fff5bd;
  background: #227f8e;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 5px;
  font: 900 8px/1 var(--font-display);
  letter-spacing: .07em;
}
.battle-status > span { font-size: 10px; font-weight: 900; white-space: nowrap; }
.battle-status > small {
  min-width: 0;
  overflow: hidden;
  color: #9dbab8;
  font-size: 8px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.battle-status[data-style="turn"] { background: #124856; }
.battle-status[data-style="turn"] b { color: #513520; background: #ffe37a; border-color: #fff3b0; }
.battle-status[data-state="resolve"] { color: #183847; background: #e7c65d; }
.battle-status[data-state="resolve"] b { color: #fff7d5; background: #b44e3e; border-color: #713039; }
.battle-status[data-state="resolve"] > small { color: #6f5937; }
.battle-status[data-style="rush"] { background: #522f34; }
.battle-status[data-style="rush"] b { background: #df5d47; border-color: #f4a174; }
.battle-status[data-state="frozen"] { background: #1c5968; }
.battle-status[data-state="frozen"] b { background: #277f91; }

.enemy-tag.rule {
  color: #183847;
  background: #ffe47b;
  border-color: #815238;
  box-shadow: 0 2px 0 #a7642e;
}
#screen-game[data-battle-style="turn"] .atk-timer { display: none; }
#screen-game[data-battle-style="rush"] .atk-fill {
  background: linear-gradient(180deg, #ffe775, #ef9f3f 58%, #d85b43);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .48);
}

@media (max-width: 560px) {
  .battle-style-select { padding: 8px 8px 7px; border-radius: 16px; }
  .battle-style-tabs { gap: 5px; }
  .battle-style-btn { min-height: 43px; padding-inline: 3px; border-radius: 11px; }
  .battle-style-btn > b { font-size: 9px; }
  .battle-style-desc { font-size: 8px; }
  .hud-battle-style { padding-inline: 5px; font-size: 7px; }
  .battle-status { padding-inline: 9px; gap: 6px; }
}

@media (max-width: 360px) {
  .battle-style-btn > b { font-size: 8px; }
  .battle-status > small { display: none; }
  .battle-status { grid-template-columns: auto 1fr; }
}

@media (max-height: 640px) {
  .battle-status > small { display: none; }
  .battle-status { grid-template-columns: auto 1fr; min-height: 27px; padding-block: 4px; }
}

/* ═══════════════════════════════════════════════
   QUALITY PASS 02 — シーン画質 / 空気感 / 奥行き
   ═══════════════════════════════════════════════ */
#screen-game::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 8% 28%, rgba(86,211,208,.08), transparent 22%),
    radial-gradient(circle at 91% 62%, rgba(255,184,92,.07), transparent 24%);
}
#screen-game > *:not(.giveup-btn) { position: relative; z-index: 1; }
#screen-game > .giveup-btn { position: absolute; z-index: 6; }

.map-panel {
  isolation: isolate;
  border-color: #061f2b;
  box-shadow:
    0 7px 0 #041720,
    0 16px 38px rgba(0,0,0,.4),
    0 0 0 2px rgba(255,220,139,.14),
    inset 0 0 0 2px rgba(255,255,255,.08);
}
.map-panel::before {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: 18px;
  box-shadow: inset 0 0 38px rgba(0,0,0,.32), inset 0 2px 0 rgba(255,255,255,.1);
}
#map-canvas {
  display: block;
  filter: saturate(1.08) contrast(1.035);
  image-rendering: auto;
}
.map-hint {
  border-top: 1px solid rgba(255,226,145,.25);
  box-shadow: 0 -8px 18px rgba(4,19,27,.22);
}

.floor-banner {
  width: max-content; max-width: calc(100% - 40px); left: 50%; right: auto;
  transform: translateX(-50%); padding: 8px 26px 10px;
  color: #fff1a6; background: linear-gradient(180deg,rgba(18,55,69,.96),rgba(8,35,48,.96));
  border: 3px solid #f1b95d; border-radius: 16px;
  box-shadow: 0 5px 0 #713f2b, 0 12px 32px rgba(0,0,0,.34), inset 0 2px 0 rgba(255,255,255,.15);
  text-shadow: 0 3px 0 #71412d;
}
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%,-18px) scale(.78); letter-spacing: 14px; }
  22% { opacity: 1; transform: translate(-50%,0) scale(1); letter-spacing: 6px; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,4px) scale(1.02); }
}

.enemy-zone {
  min-height: 275px;
  background:
    radial-gradient(circle at 12% 18%, rgba(149,229,229,.13) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 24%, rgba(255,220,139,.16) 0 1.5px, transparent 2.5px),
    radial-gradient(ellipse 58% 30% at 50% 82%, rgba(255,185,84,.2), transparent 70%),
    linear-gradient(180deg, #1c5870 0%, #123f55 48%, #0a2939 100%);
  background-size: 91px 91px, 137px 137px, auto, auto;
  box-shadow:
    0 8px 0 #051d29,
    0 18px 42px rgba(0,0,0,.34),
    inset 0 2px 0 rgba(255,255,255,.13),
    inset 0 -28px 48px rgba(2,16,25,.36);
}
.enemy-zone::before {
  top: 0; left: 0; width: 100%; height: 100%; border-radius: 0; filter: none;
  background:
    radial-gradient(ellipse 30% 16% at 20% 36%, rgba(128,218,218,.09), transparent 72%),
    radial-gradient(ellipse 38% 18% at 78% 54%, rgba(255,211,144,.07), transparent 72%);
  animation: battleMist 7s ease-in-out infinite alternate;
}
.enemy-zone::after {
  left: -8%; right: auto; bottom: -3%; width: 116%; height: 34%; border-radius: 50% 50% 0 0; filter: none;
  background:
    linear-gradient(90deg, transparent 49.6%, rgba(142,196,197,.1) 50%, transparent 50.4%),
    linear-gradient(0deg, transparent 49%, rgba(142,196,197,.09) 50%, transparent 51%),
    linear-gradient(180deg, rgba(82,129,135,.18), rgba(4,24,34,.1));
  background-size: 64px 100%, 100% 28px, auto;
  transform: perspective(180px) rotateX(58deg) scale(1.16);
  transform-origin: center bottom;
  opacity: .7;
}
@keyframes battleMist { to { transform: translate3d(18px,-6px,0) scale(1.05); opacity: .72; } }

.enemy-sprite {
  filter: drop-shadow(0 12px 12px rgba(0,0,0,.52)) drop-shadow(0 0 18px rgba(255,190,100,.16));
}
.enemy::before {
  background: radial-gradient(circle, rgba(255,184,90,.2) 20%, rgba(239,100,77,.08) 52%, transparent 72%);
}
.enemy-plate {
  min-width: 120px;
  box-shadow: 0 6px 0 #082532, 0 12px 24px rgba(0,0,0,.24), inset 0 2px 0 #fff;
}
.magic-circle { opacity: .95; filter: drop-shadow(0 0 7px rgba(255,197,94,.32)); }
.magic-circle::before { border-style: solid; border-color: rgba(255,211,111,.6); }
.magic-circle::after { border-color: rgba(116,231,234,.52); border-left-style: dashed; border-right-style: dashed; }

.hero-sprite {
  filter: drop-shadow(0 10px 10px rgba(0,0,0,.5)) drop-shadow(0 0 14px rgba(105,226,235,.32));
}
.perfect-flash {
  -webkit-text-stroke: 2px #80442f;
  text-shadow: 0 5px 0 #8f4931, 0 10px 28px rgba(0,0,0,.35);
}

.feedback-card, .intro-card, .relic-card, .gear-card, .chest-card, .zukan-card {
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.72), transparent 28%),
    repeating-linear-gradient(8deg, rgba(117,84,49,.018) 0 1px, transparent 1px 5px),
    linear-gradient(165deg,#fffdf0,#f4e5bd);
}
.overlay::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 44%, rgba(255,221,132,.11), transparent 36%);
}

@media (min-width: 900px) {
  #hero-canvas { width: 126px; height: 126px; }
  .hero { left: calc(50% - 390px); bottom: 10px; }
  #enemy-canvas { width: 178px; height: 178px; }
  .enemy-zone { min-height: 286px; padding: 10px 16px 8px; gap: 6px; }
  .enemy { gap: 6px; }
}

@media (max-width: 560px) {
  .floor-banner { font-size: 20px; padding: 7px 15px 9px; letter-spacing: 3px; }
  .enemy-zone { min-height: 240px; }
  .enemy-zone::after { opacity: .5; }
}

/* ═══════════════════════════════════════════════
   QUALITY PASS 03 — 主役演出 / 転場 / 打撃感
   ═══════════════════════════════════════════════ */
.title-showcase { display: none; }

.scene-transition {
  position: fixed; inset: 0; z-index: 80; pointer-events: none;
  display: grid; place-items: center;
  color: #ffe47b;
  background:
    radial-gradient(circle at 50% 50%, rgba(75,190,190,.42), transparent 34%),
    radial-gradient(circle at 50% 50%, #245f6d, #173f52 68%);
  clip-path: circle(0 at 50% 50%); visibility: hidden;
}
.scene-transition span {
  width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center;
  color: #ffe57b; background: #ef5b45; border: 5px solid #fff4c8;
  font: 900 38px/1 var(--font-display);
  box-shadow: 0 7px 0 #8e3032, 0 14px 40px rgba(0,0,0,.34);
  opacity: 0; transform: scale(.55) rotate(-30deg);
}
.scene-transition.play {
  visibility: visible;
  animation: sceneIris .62s cubic-bezier(.66,0,.34,1) both;
}
.scene-transition.play span { animation: transitionCrest .62s ease both; }
@keyframes sceneIris {
  0% { clip-path: circle(0 at 50% 50%); }
  43%, 57% { clip-path: circle(150vmax at 50% 50%); }
  100% { clip-path: circle(0 at 50% 50%); }
}
@keyframes transitionCrest {
  0%, 12% { opacity: 0; transform: scale(.5) rotate(-35deg); }
  30%, 70% { opacity: 1; transform: scale(1) rotate(0); }
  88%, 100% { opacity: 0; transform: scale(.65) rotate(30deg); }
}

/* 魔法弾を絵文字から発光する独自エフェクトへ */
.bolt {
  width: 27px; height: 27px; font-size: 0; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fff 0 13%, #aefaff 18%, #55d8e9 43%, rgba(63,175,229,.2) 68%, transparent 72%);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 0 8px #fff, 0 0 18px #67e4ee, 0 0 34px rgba(90,156,255,.8);
  transition: left .16s cubic-bezier(.2,.85,.35,1), top .16s cubic-bezier(.2,.85,.35,1);
}
.bolt::before {
  content: '✦'; position: absolute; inset: -5px;
  color: #fff3a4; font: 900 35px/35px var(--font-display); text-align: center;
  text-shadow: 0 0 8px #fff, 0 0 18px #73e5ed;
  animation: boltSpin .22s linear infinite;
}
.bolt::after {
  content: ''; position: absolute; right: 75%; top: 9px; width: 56px; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(103,228,238,.18), rgba(255,255,255,.82));
  filter: blur(2px); transform: rotate(-8deg); transform-origin: right center;
}
@keyframes boltSpin { to { transform: rotate(90deg); } }

.impact-ring {
  position: absolute; z-index: 34; width: 24px; height: 24px; pointer-events: none;
  border: 4px solid #8df2f1; border-radius: 50%;
  box-shadow: 0 0 12px #fff, 0 0 30px rgba(95,225,236,.8), inset 0 0 10px #fff;
  transform: translate(-50%,-50%) scale(.2);
  animation: impactRing .58s cubic-bezier(.14,.74,.2,1) forwards;
}
.impact-ring.critical { border-color: #ffe56f; box-shadow: 0 0 14px #fff, 0 0 34px rgba(255,180,75,.9), inset 0 0 10px #fff; }
.impact-ring i {
  --a: 0deg; --d: 40px;
  position: absolute; left: 50%; top: 50%; width: 11px; height: 3px; border-radius: 999px;
  background: linear-gradient(90deg,#fff,#8df2f1,transparent);
  box-shadow: 0 0 7px #fff;
  transform-origin: left center;
  transform: rotate(var(--a)) translateX(10px);
  animation: impactSpark .5s ease-out forwards;
}
.impact-ring.critical i { background: linear-gradient(90deg,#fff,#ffe56f,transparent); }
@keyframes impactRing {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.18); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(4.2); border-width: 1px; }
}
@keyframes impactSpark {
  0% { opacity: 1; transform: rotate(var(--a)) translateX(7px) scaleX(.3); }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scaleX(1.25); }
}
.battle-area.impact-punch .enemy-zone { animation: impactPunch .24s cubic-bezier(.15,.85,.2,1); }
@keyframes impactPunch {
  0% { transform: scale(1); filter: brightness(1); }
  22% { transform: scale(.987); filter: brightness(1.32); }
  58% { transform: scale(1.008); }
  100% { transform: scale(1); filter: brightness(1); }
}

@media (min-width: 900px) {
  #screen-title > :not(.title-showcase):not(.title-glow) { position: relative; z-index: 2; }
  .title-showcase {
    display: block; position: absolute; left: -104px; top: 18px; z-index: 1;
    width: 320px; height: 320px; pointer-events: none;
    filter: drop-shadow(0 18px 22px rgba(3,22,31,.3));
  }
  #title-hero-canvas { width: 100%; height: 100%; display: block; }
  .title-showcase::before {
    content: ''; position: absolute; inset: 45px 26px 18px; border-radius: 50%; z-index: -1;
    background: radial-gradient(circle,rgba(255,237,147,.28),rgba(74,211,211,.12) 50%,transparent 72%);
    animation: showcaseAura 3.6s ease-in-out infinite;
  }
  .showcase-word {
    position: absolute; z-index: 3; padding: 4px 10px 5px;
    color: #17384a; background: #fff4c9; border: 2px solid #17384a; border-radius: 10px;
    box-shadow: 0 3px 0 #0d2b39; font: 700 10px/1 var(--font-display); letter-spacing: .08em;
    animation: wordFloat 2.8s ease-in-out infinite;
  }
  .word-one { left: 20px; top: 105px; transform: rotate(-8deg); }
  .word-two { right: 3px; top: 72px; transform: rotate(8deg); animation-delay: -.9s; }
  .word-three { right: 20px; bottom: 52px; transform: rotate(-4deg); animation-delay: -1.7s; }
  @keyframes showcaseAura { 50% { transform: scale(1.08); opacity: .72; } }
  @keyframes wordFloat { 50% { translate: 0 -7px; } }
}

@media (prefers-reduced-motion: reduce) {
  .scene-transition { display: none; }
}

/* 統一されたゲーム内グリフ。OSごとに変わる絵文字を主メニューから排除 */
.mode-btn { padding-left: 66px; }
.mode-btn { overflow: hidden; }
.mode-icon {
  position: absolute; left: 15px; top: 50%; translate: 0 -50%;
  width: 34px; height: 34px; display: grid; place-items: center;
  color: #fff6d0; background: linear-gradient(180deg,#38b7c2,#238295);
  border: 3px solid var(--outline); border-radius: 12px;
  box-shadow: 0 3px 0 #0b5262, inset 0 2px 0 rgba(255,255,255,.32);
  font: 800 20px/1 var(--font-display); letter-spacing: 0;
}
.mode-btn.primary .mode-icon {
  color: #7b3b2b; background: linear-gradient(180deg,#fff08b,#ffc83d);
  border-color: #743434; box-shadow: 0 3px 0 #a8552d, inset 0 2px 0 rgba(255,255,255,.55);
}
.mode-btn:disabled .mode-icon { color: #d4dfd7; background: #788f8e; border-color: #38515a; box-shadow: none; }
.mode-icon.type-icon { font-size: 13px; text-transform: none; }
.mode-row .mode-btn { padding-left: 56px; }
.mode-row .mode-icon { left: 11px; width: 29px; height: 29px; border-radius: 10px; font-size: 15px; }
.opt-btn { font-family: var(--font-display), var(--font-jp); letter-spacing: .015em; }

/* 物種固有のCanvasアニメに任せ、ラッパー側の二重浮遊をなくす */
.enemy-sprite { animation: none; }
.enemy-sprite.spawn { animation: enemySpawn .48s cubic-bezier(.2,1.55,.4,1); }
.hero-sprite { animation: none; }
.hero-sprite.cast { animation: heroCast .32s ease-out; }
.hero-sprite.hurt { animation: heroHurt .42s ease-out; }

/* タイトル主人公は全サイズで残し、画面幅に応じてポスター的にトリミング */
#screen-title > :not(.title-showcase):not(.title-glow) { position: relative; z-index: 2; }
.title-showcase {
  display: block; position: absolute; left: -30px; top: 24px; z-index: 1;
  width: 145px; height: 145px; pointer-events: none;
  filter: drop-shadow(0 10px 14px rgba(3,22,31,.26));
}
#title-hero-canvas { width: 100%; height: 100%; display: block; }
.title-showcase .showcase-word { display: none; }

@media (min-width: 561px) and (max-width: 899px) {
  .title-showcase { left: -20px; top: 8px; width: 190px; height: 190px; }
}

@media (min-width: 900px) {
  .title-showcase { left: -36px; top: -18px; width: 280px; height: 280px; }
  .title-showcase .showcase-word { display: block; }
  .word-one { left: 40px; top: 104px; }
  .word-two { right: -4px; top: 70px; }
  .word-three { right: 8px; bottom: 42px; }
}

@media (max-width: 560px) {
  .mode-btn { padding-left: 60px; }
  .mode-icon { left: 12px; width: 32px; height: 32px; }
}

/* ═══════════════════════════════════════════════
   QUALITY PASS 04 — 装備 / 図鑑 / 戦果 / 操作HUD
   ═══════════════════════════════════════════════ */

/* コレクション画面共通 */
#screen-gear,
#screen-zukan {
  padding: clamp(12px, 2vw, 24px);
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 8%, rgba(99,224,216,.16), transparent 28%),
    radial-gradient(circle at 90% 4%, rgba(255,218,112,.16), transparent 24%),
    linear-gradient(180deg,#1b6271 0%,#123f53 54%,#0c2e42 100%);
}

.zukan-header,
.gear-dashboard,
.gear-summary,
.gear-inv-title,
.gear-inv,
.zukan-overview,
.zukan-tiers,
.zukan-grid {
  width: min(100%, 1120px);
  margin-inline: auto;
}

.zukan-header {
  flex: 0 0 auto;
  min-height: 64px;
  gap: 14px;
  padding: 9px 12px;
  border-width: 3px;
  box-shadow: 0 5px 0 #082b39, 0 12px 28px rgba(3,26,37,.22), inset 0 2px 0 #fff;
}

.collection-heading { min-width: 0; }
.collection-heading > span {
  display: block;
  margin-bottom: 3px;
  color: #a34b34;
  font: 800 9px/1 var(--font-display);
  letter-spacing: .18em;
}
.collection-heading h2 { line-height: 1.05; letter-spacing: .02em; }
.collection-eyebrow {
  color: #ffe683;
  font: 800 9px/1 var(--font-display);
  letter-spacing: .18em;
}
.zukan-progress {
  padding: 6px 10px 7px;
  color: #087587;
  background: #d9ebe2;
  border: 2px solid #153747;
  border-radius: 999px;
  font: 800 11px/1 var(--font-display);
  letter-spacing: .04em;
  white-space: nowrap;
}
.back-btn {
  min-height: 42px;
  color: #143646;
  background: #e4eee0;
  border: 2px solid #153747;
  box-shadow: 0 3px 0 #8c9c8f;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.back-btn:hover { background: #f5f3d9; }
.back-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8c9c8f; }

/* 装備: 主人公と4スロットを一つのロードアウトとして見せる */
.gear-dashboard {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(230px, 286px) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 13px;
}
.gear-hero-card {
  min-height: 254px;
  padding: 12px 14px 13px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  color: #fff9e9;
  background:
    radial-gradient(circle at 50% 46%, rgba(255,225,115,.18), transparent 42%),
    linear-gradient(165deg,#1b6070,#0c3448);
  border: 3px solid #082a38;
  border-radius: 22px;
  box-shadow: 0 6px 0 #071f2c, 0 14px 32px rgba(2,22,32,.28), inset 0 2px 0 rgba(255,255,255,.16);
}
.gear-hero-card::after {
  content: '';
  position: absolute;
  left: 12%; right: 12%; bottom: 47px;
  height: 1px;
  background: linear-gradient(90deg,transparent,rgba(255,232,147,.55),transparent);
}
.gear-hero-stage {
  width: min(100%, 214px);
  height: 190px;
  position: relative;
  isolation: isolate;
}
#gear-hero-canvas { width: 100%; height: 100%; display: block; position: relative; z-index: 2; }
.gear-hero-ring {
  position: absolute;
  left: 50%; top: 58%;
  border: 1px solid rgba(255,226,117,.42);
  border-radius: 50%;
  transform: translate(-50%,-50%) rotate(8deg);
  pointer-events: none;
}
.gear-hero-ring.ring-a { width: 170px; height: 66px; animation: gearRingA 9s linear infinite; }
.gear-hero-ring.ring-b { width: 132px; height: 48px; border-color: rgba(113,229,232,.42); animation: gearRingB 7s linear infinite; }
@keyframes gearRingA { to { transform: translate(-50%,-50%) rotate(368deg); } }
@keyframes gearRingB { to { transform: translate(-50%,-50%) rotate(-352deg); } }
.gear-hero-copy { position: relative; z-index: 2; width: 100%; text-align: center; }
.gear-hero-copy strong { display: block; color: #fff4ae; font-size: 15px; font-weight: 900; }
.gear-hero-copy span { display: block; margin-top: 3px; color: #c5e4df; font-size: 10px; font-weight: 700; }

.gear-slots {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 12px;
  margin: 0;
}
.gear-slot,
.gear-card {
  --gear-common: #53646b;
  --gear-magic: #355eb4;
  --gear-rare: #8a5b00;
  --gear-legend: #b64629;
}
.gear-slot {
  width: 100%;
  min-height: 120px;
  appearance: none;
  position: relative;
  padding: 11px 13px 10px;
  color: #153747;
  font: inherit;
  text-align: left;
  background-image:
    radial-gradient(circle at 100% 0,rgba(255,255,255,.9),transparent 27%),
    linear-gradient(165deg,#fffdf0,#f4e5bd);
  border-width: 3px;
  box-shadow: 0 5px 0 #092a38, 0 11px 24px rgba(2,23,33,.22), inset 0 2px 0 #fff;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.gear-slot:disabled { opacity: 1; color: #153747; }
.gear-slot.filled { cursor: pointer; }
.gear-slot.filled:hover { transform: translateY(-2px); border-color: #e0a741; box-shadow: 0 7px 0 #092a38, 0 15px 28px rgba(2,23,33,.25), inset 0 2px 0 #fff; }
.gear-slot.empty { border-style: dashed; background: linear-gradient(165deg,#e7ead7,#cfdccf); }
.slot-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.slot-glyph,
.gear-item-glyph {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  color: #fff7ca;
  background: linear-gradient(180deg,#36aab5,#1f7186);
  border: 2px solid #153747;
  border-radius: 11px;
  box-shadow: 0 3px 0 #0d5060, inset 0 1px 0 rgba(255,255,255,.38);
  font: 900 18px/1 var(--font-display);
}
.slot-glyph[data-slot="armor"], .gear-item-glyph[data-slot="armor"] { background: linear-gradient(180deg,#6193c9,#3c6193); }
.slot-glyph[data-slot="ring"], .gear-item-glyph[data-slot="ring"] { background: linear-gradient(180deg,#ddaa46,#a46c26); }
.slot-glyph[data-slot="amulet"], .gear-item-glyph[data-slot="amulet"] { background: linear-gradient(180deg,#a776c8,#70498f); }
.gear-slot .slot-label { margin: 0; color: #36505a; font-size: 12px; font-weight: 900; letter-spacing: .04em; }
.gear-slot .slot-label small { display: block; margin-top: 2px; color: #7a8988; font: 700 8px/1 var(--font-display); letter-spacing: .1em; }
.gear-slot .slot-item { color: #153747; font-size: 14px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gear-slot.r-common .slot-item { color: var(--gear-common); }
.gear-slot.r-magic .slot-item { color: var(--gear-magic); }
.gear-slot.r-rare .slot-item { color: var(--gear-rare); }
.gear-slot.r-legend .slot-item { color: var(--gear-legend); }
.slot-affix { margin-top: 3px; color: #607478; font-size: 9px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-action { position: absolute; right: 10px; bottom: 8px; color: #08798b; font-size: 8px; font-weight: 900; }
.gear-slot .slot-empty { display: flex; flex-direction: column; gap: 2px; color: #607478; }
.gear-slot .slot-empty b { color: #53696c; font-size: 13px; }
.gear-slot .slot-empty span { font-size: 9px; }

.gear-summary {
  min-height: 58px;
  margin-bottom: 14px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #153747;
  border-width: 3px;
}
.summary-label { color: #a34b34; font: 800 9px/1 var(--font-display); letter-spacing: .14em; white-space: nowrap; }
.gear-bonus-list { display: flex; flex-wrap: wrap; gap: 6px; }
.gear-bonus-list span { padding: 5px 8px; color: #086f80; background: #d8ebe3; border: 1px solid #79a9a1; border-radius: 999px; font-size: 10px; font-weight: 900; }
.summary-mark {
  width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center;
  color: #70432e; background: #ffe57d; border: 2px solid #70432e; border-radius: 50%;
}
.gear-summary > span:last-child b { display: block; color: #153747; font-size: 12px; }
.gear-summary > span:last-child small { display: block; margin-top: 2px; color: #647778; font-size: 10px; }
.gear-inv-title {
  flex: 0 0 auto;
  display: flex; align-items: end; justify-content: space-between; gap: 12px;
  margin-bottom: 9px;
  color: #cce5df;
  font-size: 10px;
  letter-spacing: .03em;
}
.gear-inv-title b { margin-right: 8px; color: #fff3b0; font-size: 15px; }
.gear-inv-title small { color: #a9ccca; font-size: 9px; }
.gear-inv {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  align-content: start;
  gap: 12px;
  padding: 2px 4px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.gear-card { min-width: 0; position: relative; border-width: 3px; }
.gear-card.r-common { border-color: #78878b; }
.gear-card.r-magic { border-color: #5078c7; }
.gear-card.r-rare { border-color: #ad7916; }
.gear-card.r-legend { border-color: #c55735; }
.r-common .gear-name { color: var(--gear-common); }
.r-magic .gear-name { color: var(--gear-magic); }
.r-rare .gear-name { color: var(--gear-rare); }
.r-legend .gear-name { color: var(--gear-legend); }
.gear-card-head { display: flex; align-items: center; gap: 10px; padding-right: 54px; margin-bottom: 8px; }
.gear-card-head > span:last-child { min-width: 0; }
.gear-card .gear-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gear-card.equipped-mark { border-color: #2b755b; box-shadow: 0 5px 0 #194d3d, 0 11px 25px rgba(0,0,0,.2), inset 0 2px 0 #fff; }
.gear-card.equipped-mark::after {
  content: '装備中';
  position: absolute; top: 9px; right: 9px;
  padding: 4px 7px;
  color: #fff; background: #26765b; border-radius: 999px;
  font-size: 8px; font-weight: 900;
}
.gear-btn { min-height: 42px; }
.gear-btn.danger { color: #943d39; }
.gear-btn.danger.confirm { color: #fff; background: #b43f39; border-color: #6f2828; box-shadow: 0 3px 0 #6f2828; }
.gear-empty {
  grid-column: 1 / -1;
  min-height: 190px;
  padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  color: #153747; text-align: center;
  background: linear-gradient(165deg,#fffdf0,#eee1ba);
  border: 3px dashed #8f815f; border-radius: 19px;
  box-shadow: 0 5px 0 #082b39;
}
.gear-empty-emblem {
  width: 48px; height: 48px; display: grid; place-items: center;
  color: #78432e; background: #ffe47b; border: 3px solid #78432e; border-radius: 50%;
  box-shadow: 0 4px 0 #b56a32;
  font-size: 23px;
}
.gear-empty strong { margin-top: 5px; font-size: 17px; }
.gear-empty p { max-width: 360px; color: #5d7275; font-size: 12px; line-height: 1.6; }
.gear-empty small { margin-top: 5px; color: #a44c35; font: 800 8px/1 var(--font-display); letter-spacing: .08em; }

/* 図鑑: 完成度を先に見せ、未発見カードは封印として扱う */
.zukan-overview {
  flex: 0 0 auto;
  min-height: 104px;
  margin-bottom: 12px;
  padding: 14px 18px 19px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  color: #fff9e9;
  background:
    radial-gradient(circle at 86% 10%,rgba(255,225,111,.22),transparent 33%),
    linear-gradient(155deg,#1e6d78,#103d52);
  border: 3px solid #082a38;
  border-radius: 20px;
  box-shadow: 0 5px 0 #071f2c, inset 0 2px 0 rgba(255,255,255,.15);
}
.zukan-overview-copy { flex: 1; min-width: 0; }
.zukan-overview-copy strong { display: block; margin: 7px 0 3px; color: #fff5b2; font-size: 18px; }
.zukan-overview-copy small { display: block; color: #c0dedc; font-size: 10px; line-height: 1.4; }
.zukan-medallion {
  width: 66px; height: 66px; flex: 0 0 auto;
  display: flex; align-items: baseline; justify-content: center;
  padding-top: 15px;
  color: #70412f;
  background: radial-gradient(circle at 35% 28%,#fff8b4,#ffd451 70%);
  border: 3px solid #70412f; border-radius: 50%;
  box-shadow: 0 5px 0 #a75b2d, inset 0 2px 0 rgba(255,255,255,.75);
}
.zukan-medallion b { font: 900 24px/1 var(--font-display); }
.zukan-medallion span { font: 800 10px/1 var(--font-display); }
.zukan-progress-track {
  position: absolute; left: 18px; right: 18px; bottom: 9px;
  height: 7px; overflow: hidden;
  background: #082b39; border: 1px solid #071f2c; border-radius: 999px;
  box-shadow: inset 0 2px 2px rgba(0,0,0,.35);
}
.zukan-progress-track i {
  display: block; width: 0; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg,#43c0c2,#ffe270);
  box-shadow: 0 0 9px rgba(255,226,112,.5);
  transition: width .4s ease-out;
}
.zukan-tiers { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin-bottom: 13px; }
.zukan-tier-btn { min-height: 49px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; }
.zukan-tier-btn b { font-size: 12px; }
.zukan-tier-btn small { font: 800 9px/1 var(--font-display); opacity: .74; }
.zukan-grid {
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 12px;
  padding: 3px 4px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.zukan-card {
  --rare-n: #53646b;
  --rare-r: #355eb4;
  --rare-sr: #78439c;
  --rare-ur: #b64629;
  width: 100%; min-height: 132px;
  appearance: none;
  position: relative;
  justify-content: center;
  color: #153747;
  font: inherit;
  border-width: 3px;
  cursor: pointer;
  animation: collectionCardIn .35s cubic-bezier(.2,.8,.25,1) both;
  animation-delay: calc(var(--card-order) * 18ms);
  transition: transform .15s, filter .15s, box-shadow .15s;
}
@keyframes collectionCardIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.zukan-card:not(:disabled):hover { transform: translateY(-3px); filter: brightness(1.035); }
.zukan-card:focus-visible,
.gear-slot:focus-visible,
.gear-btn:focus-visible,
.back-btn:focus-visible,
.zukan-tier-btn:focus-visible,
.skill-btn:focus-visible { outline: 3px solid #fff09a; outline-offset: 3px; }
.zukan-card:disabled { opacity: 1; cursor: default; }
.zukan-card .card-rarity { color: #637477; font-size: 9px; letter-spacing: .13em; }
.zukan-card.rarity-R .card-rarity { color: var(--rare-r); }
.zukan-card.rarity-SR .card-rarity { color: var(--rare-sr); }
.zukan-card.rarity-UR .card-rarity { color: var(--rare-ur); }
.zukan-card .card-word { max-width: 100%; overflow: hidden; text-overflow: ellipsis; color: #153747; font-size: clamp(13px,1.5vw,18px); white-space: nowrap; }
.zukan-card .card-ja { min-height: 28px; display: flex; align-items: center; justify-content: center; color: #5f7173; font-size: 10px; line-height: 1.35; }
.zukan-card .card-stars { color: #aa6b16; font-size: 11px; }
.card-sound {
  position: absolute; top: 7px; right: 7px;
  width: 22px; height: 22px; display: grid; place-items: center;
  color: #fff; background: #228497; border: 1px solid #153747; border-radius: 50%;
  font-size: 8px;
}
.zukan-card.unowned {
  filter: none;
  border-color: #7c8c88;
  border-style: dashed;
  background-image:
    repeating-linear-gradient(45deg,rgba(20,55,71,.025) 0 5px,transparent 5px 10px),
    linear-gradient(165deg,#e1e8dd,#cbd7cf);
  box-shadow: 0 4px 0 #082b39, inset 0 2px 0 rgba(255,255,255,.65);
}
.zukan-card.unowned .card-word { color: #536a6a; text-shadow: none; }
.zukan-card.unowned .card-rarity { color: #71817e; }
.zukan-card.unowned .card-stars { color: #83928d; }
.card-seal {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: #e2e8df; background: #71827d; border: 3px double #dbe4dc; border-radius: 50%;
  box-shadow: 0 3px 0 #405753;
  font: 900 18px/1 var(--font-display);
}
.zukan-card.rusty { filter: none; border-color: #aa653e; }
.rust-hint {
  position: absolute; top: 7px; left: 7px;
  padding: 4px 6px;
  color: #fff; background: #a65a35; border-radius: 999px;
  font: 800 7px/1 var(--font-display); letter-spacing: .04em;
}

/* 戦果画面: ランク、数値、復習を明確に分離 */
#screen-result {
  padding: clamp(14px,2.5vw,28px);
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 3%,rgba(255,225,106,.22),transparent 25%),
    radial-gradient(circle at 10% 20%,rgba(87,221,215,.14),transparent 30%),
    linear-gradient(180deg,#1b6170,#10384d 60%,#0b2d40);
}
.result-hero,
.result-report,
.recap,
.result-buttons { width: min(100%, 760px); }
.result-hero { position: relative; flex: 0 0 auto; min-height: 205px; display: flex; flex-direction: column; align-items: center; }
.result-kicker { color: #bfe4df; font: 800 9px/1 var(--font-display); letter-spacing: .22em; }
.result-title { margin: 8px 0 2px; font-size: clamp(21px,3.2vw,32px); line-height: 1.15; }
.result-rank-shell {
  width: 122px; height: 122px;
  display: grid; place-items: center;
  position: relative;
  margin-top: 8px;
  background: radial-gradient(circle,#fff4a5 0 40%,#ef6547 42% 66%,#fff1a4 68% 73%,#1b6271 75%);
  border: 3px solid #763c2e; border-radius: 50%;
  box-shadow: 0 7px 0 #7d362d, 0 17px 36px rgba(2,22,32,.32), inset 0 2px 0 #fff;
}
.result-rank-shell::before,
.result-rank-shell::after { content: '✦'; position: absolute; top: 47px; color: #ffe77f; font-size: 13px; }
.result-rank-shell::before { left: -29px; }
.result-rank-shell::after { right: -29px; }
.result-rank { margin: 0; color: #fff8dc; font-size: 66px; -webkit-text-stroke: 2px #74372d; text-shadow: 0 4px 0 #78372d; }
.result-rank.rank-ss,
.result-rank.rank-s { color: #fff078; -webkit-text-stroke-color: #a24d31; }
.result-rank.rank-a,
.result-rank.rank-b { color: #9cf1ef; -webkit-text-stroke-color: #176477; text-shadow: 0 4px 0 #176477; }
.result-rank.rank-c,
.result-rank.rank-d,
.result-rank.rank-e { color: #fff7dd; -webkit-text-stroke-color: #65747a; text-shadow: 0 4px 0 #53646b; }
.result-report {
  flex: 0 0 auto;
  margin: 2px auto 14px;
  padding: 13px;
  color: #153747;
  background: linear-gradient(165deg,#fffdf0,#f2e4bc);
  border: 4px solid #153747; border-radius: 21px;
  box-shadow: 0 6px 0 #082b39, inset 0 2px 0 #fff;
}
.result-score { justify-content: center; padding: 2px 0 8px; border-bottom: 1px dashed #a99d7d; }
#result-score-num { color: #a74632; font-size: clamp(34px,6vw,48px); }
.result-score-label { color: #6d7c79; font-weight: 900; }
.result-best { min-height: 0; margin: 10px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; color: #153747; }
.result-achievement {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 27px; padding: 5px 8px;
  color: #36545a; background: #e4eee0; border: 1px solid #92aaa1; border-radius: 9px;
  font-size: 10px; line-height: 1.2;
}
.result-achievement b { color: #08798b; font-family: var(--font-display); }
.result-achievement small { padding: 2px 5px; color: #6d3d2d; background: #ffe271; border-radius: 999px; font-size: 7px; font-weight: 900; }
.result-achievement.best { color: #743c2e; background: #ffe78a; border-color: #ab6b2f; }
.result-achievement.best b { color: #a74632; }
.result-achievement.loot { background: #ece1f5; border-color: #a285af; }
.result-stats {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 7px;
  margin: 0;
  color: #607476;
}
.result-stats span { min-width: 0; padding: 8px 5px; background: rgba(255,255,255,.43); border: 1px solid #c5b994; border-radius: 11px; }
.result-stats b { color: #153747; font-size: 18px; }
#screen-result .recap { flex: 0 0 auto; margin: 0 auto 14px; padding: 13px; }
.recap-title { display: flex; align-items: center; gap: 8px; color: #a74733; text-align: left; }
.recap-title::before { content: 'Aa'; width: 29px; height: 29px; display: grid; place-items: center; color: #fff; background: #ef6848; border: 2px solid #733039; border-radius: 9px; font: 800 10px/1 var(--font-display); }
.recap-item { width: 100%; min-height: 46px; color: inherit; font: inherit; }
.recap-speak { width: 28px; height: 28px; display: grid; place-items: center; color: #fff; background: #218395; border-radius: 50%; font-size: 9px; }
.result-buttons { flex: 0 0 auto; max-width: 760px; margin: 0 auto; padding-bottom: max(8px,env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 9px; }
.result-buttons .mode-btn { min-height: 54px; margin: 0; padding: 9px 12px; justify-content: center; align-items: center; text-align: center; }
.result-buttons .mode-btn.primary { grid-column: auto; }
.result-buttons .mode-btn:not(#btn-result-gear) { padding-left: 12px; }
.result-buttons #btn-result-gear { padding-left: 49px; }
.result-buttons #btn-result-gear .mode-icon { left: 9px; width: 29px; height: 29px; }

/* 正誤カード: 結果ラベルと例文の読み順を強める */
.feedback-card { position: relative; overflow: hidden; padding: 24px 24px 20px; }
.feedback-card::after {
  content: '';
  position: absolute; left: 15%; right: 15%; top: -10px; height: 18px;
  background: #3a9156; border: 3px solid #235e3b; border-radius: 0 0 12px 12px;
}
.feedback-card.wrong::after { background: #d25349; border-color: #722e34; }
.fb-verdict { margin: 5px 0 8px; color: #28704a; font: 900 13px/1 var(--font-display); letter-spacing: .12em; text-shadow: none; }
.fb-verdict.ok { color: #28704a; text-shadow: none; }
.fb-verdict.ng { color: #a63f3b; text-shadow: none; }
.fb-word { color: #153747; -webkit-text-fill-color: #153747; background: none; font-size: clamp(34px,8vw,45px); }
.fb-meaning { color: #a44834; }
.fb-example { margin-top: 6px; padding: 11px 12px; color: #244b57; background: #e3eee3; border: 2px solid #9aab91; border-radius: 13px; }
.fb-example b { color: #a44834; }
.fb-example-ja { color: #637679; }
.fb-hint { display: inline-block; margin-top: 14px; padding: 5px 10px; color: #667777; background: rgba(255,255,255,.5); border-radius: 999px; }

/* SpriteLibの宝箱を高DPI Canvasで表示 */
.chest-box { width: min(76vw,320px); padding: 0; appearance: none; font-size: 0; background: transparent; border: 0; cursor: pointer; filter: drop-shadow(0 14px 22px rgba(0,0,0,.42)); }
#chest-canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 13; }
.chest-hint { padding: 7px 13px; color: #173b49; background: #fff4c8; border: 2px solid #173b49; border-radius: 999px; box-shadow: 0 3px 0 #8c623d; font-weight: 900; }
.loot-title { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.loot-title span { font: 900 23px/1 var(--font-display); letter-spacing: .14em; }
.loot-title small { color: #c8e3de; font: 800 9px/1 var(--font-jp); letter-spacing: .04em; text-shadow: none; }

/* スキルHUD: 名前・コスト・可用状態を同時に見せる */
.skill-dock { min-width: 0; display: grid; justify-items: center; gap: 7px; }
.skill-caption {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
  color: #d9ebe7;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .04em;
}
.skill-caption > span { color: #fff1b9; font: 900 9px/1 var(--font-display); letter-spacing: .12em; }
.skill-caption small { color: #a9c5c4; font: 800 7px/1 var(--font-jp); white-space: nowrap; }
.skill-caption b { color: #fff1b9; font-family: var(--font-display); }
.skills { display: grid; grid-template-columns: repeat(6,52px); gap: 7px; justify-content: center; }
.skill-btn {
  width: 52px; height: 61px;
  position: relative;
  gap: 3px;
  border-radius: 15px;
  overflow: visible;
}
.skill-glyph { color: #d8f4f0; font: 900 20px/1 var(--font-display); text-shadow: 0 2px 0 #0c2a38; }
.skill-name { color: #edf6e9; font-size: 9px; font-weight: 900; line-height: 1; letter-spacing: .02em; }
.skill-btn small {
  position: absolute; top: -7px; right: -7px;
  min-width: 27px; height: 21px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  color: #143646; background: #a9e1de; border: 2px solid #082432; border-radius: 8px;
  box-shadow: 0 2px 0 #061923, inset 0 1px 0 rgba(255,255,255,.45);
  font: 900 9px/1 var(--font-display);
  font-variant-numeric: tabular-nums;
}
.skill-btn small::before {
  content: attr(data-unit);
  order: -1;
  color: #226271;
  font-size: 6px;
  letter-spacing: .02em;
}
.skill-btn small[data-kind="stock"] { color: #225a3c; background: #aee4b7; }
.skill-btn small[data-kind="locked"] { color: #fff2c5; background: #6c7f82; }
.skill-btn small[data-kind="locked"]::before { color: #fff2c5; }
.skill-btn small[data-kind="active"] { color: #153e34; background: #aaf0bd; }
.skill-btn small[data-kind="active"]::before { display: none; }
.skill-btn.locked::before {
  content: '';
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 5px;
  height: 2px;
  border-radius: 999px;
  background: rgba(186, 207, 205, .25);
}
.skill-btn[data-skill="potion"] .skill-glyph { color: #8df0a9; }
.skill-btn[data-skill="freeze"] .skill-glyph { color: #86e8ef; }
.skill-btn[data-skill="reveal"] .skill-glyph { color: #ffe276; }
.skill-btn[data-skill="barrier"] .skill-glyph { color: #a7c6ff; }
.skill-btn[data-skill="blink"] .skill-glyph { color: #d6adff; }
.skill-btn[data-skill="meteor"] .skill-glyph { color: #ff9c6d; }
.skill-btn.ready { transform: translateY(-1px); border-color: #ffe27a; box-shadow: 0 5px 0 #9a572d, 0 0 0 2px rgba(255,226,122,.28), 0 0 14px rgba(255,221,109,.22); }
.skill-btn.active-buff { opacity: 1; background: linear-gradient(180deg,#397e70,#205a55); border-color: #aaf0bd; box-shadow: 0 4px 0 #174a43, 0 0 16px rgba(119,237,176,.36); }
.skill-btn.locked { opacity: .74; filter: grayscale(.64); }
.skill-btn.locked .skill-name { color: #afc1c1; }
.skill-btn:disabled:not(.locked):not(.active-buff) { opacity: .72; filter: saturate(.7); }

.replay-btn { display: inline-flex; align-items: center; gap: 7px; color: #fff5c7; background: #247f91; border: 2px solid #102f42; box-shadow: 0 3px 0 #0a3848; }
.replay-glyph { width: 22px; height: 22px; display: grid; place-items: center; color: #70412f; background: #ffe170; border: 1px solid #70412f; border-radius: 50%; font-size: 8px; }
.intro-title { display: flex; align-items: center; gap: 9px; letter-spacing: .04em; }
.intro-glyph { min-width: 48px; padding: 5px 7px; color: #fff; background: #e75a43; border: 2px solid #733039; border-radius: 8px; box-shadow: 0 2px 0 #8e3032; font: 800 8px/1 var(--font-display); letter-spacing: .08em; text-align: center; }

/* 初回ガイド: 3つだけ先に教え、詳細は必要なときだけ展開する */
.intro-card {
  width: min(470px, calc(100vw - 28px));
  max-width: 470px;
  padding: 25px 27px 23px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c78c55 transparent;
}
.intro-card .intro-title { margin-bottom: 10px; }
.intro-card .intro-text {
  max-width: 38em;
  margin-bottom: 19px;
  line-height: 1.85;
  text-wrap: pretty;
}
.intro-steps {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  list-style: none;
}
.intro-steps li {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 11px 13px 12px 11px;
  color: #405660;
  background: linear-gradient(180deg, #fffdf1, #f7e9c7);
  border: 2px solid #b78355;
  border-radius: 14px;
  box-shadow: 0 3px 0 #d2ad78, inset 0 1px 0 #fff;
}
.intro-step-num {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #fff8dc;
  background: #ef6944;
  border: 2px solid #78323a;
  border-radius: 11px;
  box-shadow: 0 2px 0 #9b3f35;
  font: 800 15px/1 var(--font-display);
}
.intro-steps b {
  display: block;
  color: #087f94;
  font-size: 13px;
  line-height: 1.35;
}
.intro-steps small {
  display: block;
  margin-top: 3px;
  color: #5d6e70;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.45;
  text-wrap: pretty;
}
.intro-more {
  margin-top: 3px;
  border: 2px solid #b78355;
  border-radius: 13px;
  background: rgba(255, 250, 230, .7);
  overflow: hidden;
}
.intro-more summary {
  min-height: 45px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 8px 50px 8px 14px;
  color: #405660;
  cursor: pointer;
  list-style: none;
  transition: background .18s, color .18s;
}
.intro-more summary::-webkit-details-marker { display: none; }
.intro-more summary:hover { color: #17384a; background: #fff9e8; }
.intro-more summary:focus-visible {
  outline: 3px solid #087f94;
  outline-offset: -3px;
}
.intro-more summary > span { font-size: 12px; font-weight: 900; }
.intro-more summary > small { color: #788486; font-size: 9px; font-weight: 700; }
.intro-more summary::after {
  content: '+';
  position: absolute;
  right: 13px;
  top: 50%;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: #fff8dc;
  background: #238b9b;
  border: 2px solid #17384a;
  border-radius: 9px;
  box-shadow: 0 2px 0 #125160;
  font: 800 18px/1 var(--font-display);
  transform: translateY(-50%);
  transition: transform .2s cubic-bezier(.2,1.4,.4,1);
}
.intro-more[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.intro-more[open] summary { border-bottom: 1px dashed #c99e69; }
.intro-more .intro-list {
  margin: 0;
  padding: 5px 13px 10px;
}
.intro-more .intro-list li {
  padding: 5px 2px 5px 19px;
  font-size: 10.5px;
  line-height: 1.55;
  text-wrap: pretty;
}
.intro-more .intro-list li::before { left: 2px; top: 8px; font-size: 7px; }
#btn-intro-close {
  min-height: 68px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  margin-top: 17px;
  padding: 13px 68px;
  text-align: center;
  font-size: 17px;
  letter-spacing: .02em;
  box-shadow: 0 6px 0 #8f3031, 0 -12px 22px 7px rgba(255, 248, 221, .92);
}
#btn-intro-close::after { right: 17px; }
#btn-intro-close:focus-visible {
  outline: 4px solid #fff09a;
  outline-offset: 4px;
}

@media (max-width: 560px) {
  .intro-card { padding: 20px 18px 18px; border-width: 4px; border-radius: 23px; }
  .intro-card .intro-text { line-height: 1.72; }
  .intro-steps { gap: 8px; }
  .intro-steps li { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; padding: 9px 10px; }
  .intro-step-num { width: 29px; height: 29px; border-radius: 10px; font-size: 13px; }
  .intro-steps b { font-size: 12px; }
  .intro-steps small { font-size: 9.5px; }
  #btn-intro-close { min-height: 62px; margin-top: 14px; font-size: 16px; }
}

@media (max-width: 899px) {
  #screen-gear,
  #screen-zukan { overflow-y: auto; }
  .gear-dashboard { grid-template-columns: 220px minmax(0,1fr); }
  .gear-hero-card { min-height: 235px; }
  .gear-hero-stage { height: 173px; }
  .gear-slot { min-height: 111px; }
  .gear-inv,
  .zukan-grid { overflow: visible; }
  .zukan-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 640px) {
  .gear-dashboard { display: block; }
  .gear-hero-card { min-height: 152px; display: grid; grid-template-columns: 150px minmax(0,1fr); align-items: center; }
  .gear-hero-card > .collection-eyebrow { position: absolute; left: 166px; top: 40px; }
  .gear-hero-stage { width: 150px; height: 136px; grid-row: 1; }
  .gear-hero-copy { grid-column: 2; text-align: left; padding-right: 8px; }
  .gear-hero-card::after { left: 166px; right: 18px; bottom: 52px; }
  .gear-slots { margin-top: 12px; }
  .gear-slot { min-height: 108px; }
  .gear-inv { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .result-buttons { grid-template-columns: 1fr; }
  .result-buttons #btn-result-gear { padding-left: 49px; }
}

@media (max-width: 560px) {
  #screen-gear,
  #screen-zukan { padding: 10px; }
  .zukan-header { min-height: 56px; gap: 7px; padding: 7px 8px; }
  .collection-heading > span { display: none; }
  .collection-heading h2 { font-size: 16px; }
  .zukan-progress { padding: 5px 7px; font-size: 9px; }
  .back-btn { min-height: 40px; padding: 7px 10px; font-size: 11px; }
  .gear-hero-card { grid-template-columns: 134px minmax(0,1fr); }
  .gear-hero-card > .collection-eyebrow { left: 148px; }
  .gear-hero-stage { width: 134px; }
  .gear-hero-card::after { left: 148px; }
  .gear-slots { gap: 8px; }
  .gear-slot { min-height: 112px; padding: 9px; }
  .slot-glyph { width: 30px; height: 30px; font-size: 15px; }
  .gear-slot .slot-label { font-size: 10px; }
  .gear-slot .slot-item { font-size: 11px; }
  .slot-affix { display: none; }
  .gear-summary { align-items: flex-start; }
  .summary-label { padding-top: 7px; }
  .gear-inv-title small { display: none; }
  .zukan-overview { min-height: 97px; padding: 12px 13px 18px; gap: 10px; }
  .zukan-overview-copy strong { font-size: 15px; }
  .zukan-overview-copy small { font-size: 8px; }
  .zukan-medallion { width: 55px; height: 55px; padding-top: 13px; }
  .zukan-medallion b { font-size: 20px; }
  .zukan-progress-track { left: 13px; right: 13px; }
  .zukan-tier-btn { min-height: 46px; }
  .zukan-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .zukan-card { min-height: 119px; }

  .bottom-hud {
    display: grid;
    grid-template-columns: 54px minmax(0,1fr) 54px;
    align-items: center;
    gap: 7px;
    padding: 7px 8px max(9px,env(safe-area-inset-bottom));
  }
  .skills { grid-template-columns: repeat(3,minmax(44px,48px)); gap: 7px; }
  .skill-btn { width: 100%; min-width: 44px; height: 48px; border-radius: 13px; }
  .skill-glyph { font-size: 16px; }
  .skill-name { font-size: 7px; }
  .skill-btn small { top: -5px; right: -4px; }
  .orb { width: 54px; height: 54px; }
  .enemy-zone { min-height: 205px; }
}

@media (max-width: 360px) {
  .skills { grid-template-columns: repeat(3,44px); gap: 5px; }
  .bottom-hud { grid-template-columns: 50px minmax(0,1fr) 50px; gap: 4px; padding-inline: 5px; }
  .orb { width: 50px; height: 50px; }
  .gear-hero-card { grid-template-columns: 118px minmax(0,1fr); }
  .gear-hero-stage { width: 118px; }
  .gear-hero-card > .collection-eyebrow { left: 132px; }
  .gear-hero-card::after { left: 132px; }
}

@media (prefers-reduced-motion: reduce) {
  .gear-hero-ring,
  .zukan-card,
  .chest-box,
  .feedback-card,
  .result-rank { animation: none !important; }
}

/* ═══════════════════════════════════════════════
   QUALITY PASS 05 — 戦利品確認のアクション階層
   ═══════════════════════════════════════════════ */
#loot-overlay .loot-title,
#loot-overlay .loot-cards,
#loot-overlay .loot-done-btn { width: min(100%, 400px); }

/* カード内の装備は局所アクションなので、進行CTAより一段控えめにする */
#loot-overlay .gear-btn.primary {
  color: #fff;
  background: linear-gradient(180deg,#35a9b5,#217f92);
  border-color: #123b4b;
  box-shadow: 0 3px 0 #125466, inset 0 1px 0 rgba(255,255,255,.32);
}
#loot-overlay .gear-btn.primary:disabled {
  opacity: 1;
  color: #25664f;
  background: #d9ebe2;
  border-color: #4f8b74;
  box-shadow: 0 2px 0 #7aa18f;
}

.loot-done-btn {
  min-height: 62px;
  padding: 8px 9px 9px 18px;
  display: grid;
  grid-template-columns: minmax(0,1fr) 40px;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-align: left;
  font-family: var(--font-jp);
  background: linear-gradient(180deg,#f97858,#e84e42);
  border: 3px solid #733039;
  border-radius: 17px;
  box-shadow: 0 5px 0 #8e3030, 0 12px 24px rgba(2,22,32,.28), inset 0 2px 0 rgba(255,255,255,.4);
  cursor: pointer;
  transition: transform .14s cubic-bezier(.2,1.4,.4,1), box-shadow .14s, filter .14s;
}
.loot-done-btn > span { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.loot-done-btn b { font-size: 15px; font-weight: 900; line-height: 1.15; }
.loot-done-btn small { color: #ffe8d5; font-size: 9px; font-weight: 700; line-height: 1.25; }
.loot-done-btn i {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: #7c392a;
  background: #ffe277;
  border: 3px solid #7c392a;
  border-radius: 50%;
  box-shadow: 0 3px 0 #a85a2d, inset 0 1px 0 rgba(255,255,255,.6);
  font: 900 28px/1 var(--font-display);
  font-style: normal;
  transform: translateY(-1px);
}
.loot-done-btn:hover { transform: translateY(-2px); filter: brightness(1.04); box-shadow: 0 7px 0 #8e3030, 0 15px 28px rgba(2,22,32,.3), inset 0 2px 0 rgba(255,255,255,.4); }
.loot-done-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #8e3030, inset 0 1px 0 rgba(255,255,255,.35); }
.loot-done-btn:focus-visible { outline: 3px solid #fff09a; outline-offset: 4px; }

@media (max-width: 560px) {
  .loot-done-btn { min-height: 58px; padding-left: 15px; }
  .loot-done-btn b { font-size: 14px; }
}

/* ═══════════════════════════════════════════════
   BATTLE MIX — 3ルールを1つのランダムシステムに統合
   ═══════════════════════════════════════════════ */
.battle-style-mixed {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  padding: 10px 12px 11px;
}
.battle-style-mixed::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 28%, rgba(255,255,255,.08) 48%, transparent 68%);
  transform: translate3d(-120%,0,0);
  animation: battle-mix-sheen 5.2s cubic-bezier(.2,.75,.25,1) infinite;
}
.battle-style-mixed .battle-style-heading { margin-bottom: 8px; }
.battle-style-heading i {
  margin-left: auto;
  padding: 3px 6px 4px;
  color: #17384a;
  background: #ffe178;
  border: 1px solid #fff0ad;
  border-radius: 5px;
  box-shadow: 0 2px 0 #a5662e;
  font: 900 6px/1 var(--font-display);
  font-style: normal;
  letter-spacing: .12em;
}
.battle-style-reel {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr) auto minmax(0,1.15fr);
  align-items: stretch;
  gap: 5px;
}
.battle-style-reel > span {
  min-width: 0;
  min-height: 43px;
  padding: 6px 5px 7px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: #f8f4dc;
  background: #176f7d;
  border: 2px solid #9ed9d6;
  border-radius: 12px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.18), 0 3px 0 #082a39;
  transform: translateZ(0);
  animation: battle-rule-pulse 4.8s cubic-bezier(.2,.8,.2,1) infinite;
}
.battle-style-reel > span[data-style="turn"] {
  color: #503722;
  background: #ffe17a;
  border-color: #fff0ae;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.42), 0 3px 0 #a25e2e;
  animation-delay: 1.6s;
}
.battle-style-reel > span[data-style="rush"] {
  color: #fff4e7;
  background: #cf5746;
  border-color: #ffb27c;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 3px 0 #78303a;
  animation-delay: 3.2s;
}
.battle-style-reel small {
  color: inherit;
  font: 900 7px/1 var(--font-display);
  letter-spacing: .1em;
}
.battle-style-reel b {
  max-width: 100%;
  overflow: hidden;
  font-size: 9px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.battle-style-reel em {
  align-self: center;
  color: #8fcac8;
  font: 900 12px/1 var(--font-display);
  font-style: normal;
}
.battle-style-mixed .battle-style-desc {
  margin-top: 8px;
  text-align: center;
}
@keyframes battle-rule-pulse {
  0%, 22%, 100% { transform: translate3d(0,0,0); filter: brightness(1); }
  8% { transform: translate3d(0,-2px,0); filter: brightness(1.12); }
}
@keyframes battle-mix-sheen {
  0%, 62% { transform: translate3d(-120%,0,0); }
  82%, 100% { transform: translate3d(120%,0,0); }
}

@media (max-width: 390px) {
  .battle-style-reel { gap: 3px; }
  .battle-style-reel > span { padding-inline: 3px; }
  .battle-style-reel b { font-size: 8px; }
  .battle-style-reel em { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .battle-style-mixed::after,
  .battle-style-reel > span { animation: none !important; }
}

/* リザルトの装備ボタン: 左アイコンと右矢印の領域を確保して文字切れを防ぐ */
.result-buttons #btn-result-gear {
  padding: 9px 58px 9px 49px;
  font-size: clamp(12px, 1.8vw, 15px);
  line-height: 1.2;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .result-buttons #btn-result-gear { padding-right: 58px; }
}

/* ═══════════════════════════════════════════════
   QUALITY PASS 06 — タイトル構図 / HUD可読性 / 戦果レイアウト
   ═══════════════════════════════════════════════ */
.mode-section-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-height: 22px;
  padding: 0 3px;
  color: #eaf6ed;
}
.mode-section-title span {
  color: #9ed9d6;
  font: 900 8px/1 var(--font-display);
  letter-spacing: .14em;
}
.mode-section-title b {
  color: #fff0aa;
  font-size: 11px;
  letter-spacing: .06em;
}

/* パネルの光源と輪郭を統一 */
.tier-select,
.battle-style-mixed {
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), transparent 42%),
    rgba(7,35,49,.76);
  border-color: rgba(204,235,226,.24);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.13),
    0 5px 0 rgba(4,25,36,.34),
    0 13px 28px rgba(3,20,31,.12);
}
.hero-badge,
.hud-score,
.orb-text,
.battle-status,
.result-stats,
.zukan-progress { font-variant-numeric: tabular-nums; }

/* 選択肢とメニューは同じ押下感に揃える */
.mode-btn:not(:disabled),
.tier-btn:not(:disabled),
.choice-btn:not(:disabled),
.skill-btn:not(:disabled) {
  will-change: transform;
}
.mode-btn:focus-visible,
.tier-btn:focus-visible,
.choice-btn:focus-visible,
.opt-btn:focus-visible,
.giveup-btn:focus-visible {
  outline: 3px solid #fff09a;
  outline-offset: 4px;
}

/* 戦闘中に最初に読む3点: 階層・ルール・スコア */
.hud-row { gap: 12px; }
.hud-mode {
  padding: 3px 7px 4px;
  background: rgba(21,55,71,.08);
  border: 1px solid rgba(21,55,71,.14);
  border-radius: 6px;
}
.battle-status {
  min-height: 38px;
  padding-block: 7px 8px;
  border-bottom-color: rgba(255,241,186,.16);
}
.battle-status b { padding: 4px 8px; font-size: 9px; }
.battle-status > span { font-size: 11px; }
.battle-status > small { font-size: 9px; }
.map-hint { min-height: 24px; display: grid; place-items: center; line-height: 1.35; }
.msg-window { line-height: 1.45; }

/* リザルトの統計は内容量に負けない */
.result-stats span {
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1.25;
  text-wrap: balance;
}
.result-stats b { line-height: 1; }

@media (min-width: 900px) {
  /* モバイル画面を横へ伸ばさず、ブランドと操作を2つの舞台に分ける */
  #screen-title {
    width: 100%;
    max-width: 1180px;
    display: grid;
    grid-template-columns: minmax(290px,.72fr) minmax(610px,1.55fr);
    grid-template-rows: auto auto auto auto;
    align-content: center;
    align-items: start;
    column-gap: clamp(28px,4vw,58px);
    row-gap: 10px;
    padding: 22px 30px 24px;
    overflow-y: auto;
  }
  #screen-title .title-glow {
    left: 16%;
    top: 5%;
    width: 390px;
    height: 330px;
  }
  #screen-title .title-showcase {
    position: relative;
    left: auto;
    top: auto;
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    justify-self: center;
    width: min(100%,300px);
    height: 300px;
    margin: 0 0 -28px;
  }
  #screen-title .word-one { left: 18px; top: 116px; }
  #screen-title .word-two { right: -3px; top: 70px; }
  #screen-title .word-three { right: 8px; bottom: 58px; }
  #screen-title .game-logo {
    grid-column: 1;
    grid-row: 2;
    width: 126%;
    margin: -16px -13% 0;
    transform: scale(.78) rotate(-1deg);
    transform-origin: top center;
  }
  #screen-title .title-sub {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
    margin: -35px 0 0;
    font-size: 10px;
  }
  #screen-title .hero-badge {
    grid-column: 1;
    grid-row: 3;
    align-self: start;
    justify-self: center;
    margin: 28px 0 0;
    padding-inline: 15px;
  }
  #screen-title .tier-select {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    width: 100%;
    margin: 0;
    padding: 12px 14px 11px;
  }
  #screen-title .battle-style-mixed {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    margin: 0;
    padding: 11px 14px 12px;
  }
  #screen-title .mode-buttons {
    grid-column: 2;
    grid-row: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px 10px;
  }
  #screen-title .mode-section-title,
  #screen-title .mode-btn.primary,
  #screen-title .mode-row { grid-column: 1 / -1; }
  #screen-title .mode-btn {
    min-height: 56px;
    padding-block: 8px 9px;
    font-size: 15px;
  }
  #screen-title .mode-btn.primary { min-height: 63px; font-size: 16px; }
  #screen-title .mode-btn small { font-size: 10px; }
  #screen-title .mode-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  #screen-title .title-footer {
    grid-column: 2;
    grid-row: 4;
    justify-content: center;
    margin: 1px 0 0;
    padding-top: 8px;
  }

  /* ワイド画面でも操作サイズを据え置かない */
  .hud { padding: 11px 34px 10px; }
  .hud-row { margin-bottom: 8px; }
  .hud-level { font-size: 13px; }
  .hud-mode { font-size: 11px; }
  .hud-battle-style { padding: 4px 8px 5px; font-size: 9px; }
  .hud-score { font-size: 24px; }
  .battle-status { padding-inline: 34px; }
  .battle-status > span { font-size: 12px; }
  .battle-status > small { font-size: 10px; }
  .msg-window {
    width: min(calc(100% - 220px),780px);
    min-height: 44px;
    margin: 0 auto 9px;
    padding: 10px 16px;
    font-size: 13px;
  }
  .bottom-hud {
    display: grid;
    grid-template-columns: 80px minmax(0,1fr) 80px;
    align-items: center;
    gap: 18px;
    padding: 9px 34px max(13px,env(safe-area-inset-bottom));
  }
  .orb { width: 76px; height: 76px; }
  .orb-text { font-size: 18px; }
  .skill-dock { gap: 8px; }
  .skill-caption { width: min(100%,455px); }
  .skill-caption > span { font-size: 10px; }
  .skill-caption small { font-size: 8px; }
  .skills { grid-template-columns: repeat(6,62px); gap: 10px; }
  .skill-btn { width: 62px; height: 66px; }
  .skill-glyph { font-size: 22px; }
  .skill-name { font-size: 9px; }
  .giveup-btn { bottom: 112px; right: max(22px,calc(50% - 645px)); }

  /* 戦果は左に勲章、右に数字と次の行動 */
  #screen-result.active {
    display: grid;
    grid-template-columns: minmax(260px,320px) minmax(580px,760px);
    grid-template-rows: auto auto auto;
    align-content: center;
    justify-content: center;
    align-items: start;
    gap: 14px 28px;
    padding: 28px;
  }
  #screen-result .result-hero {
    grid-column: 1;
    grid-row: 1 / span 3;
    align-self: center;
    min-height: 380px;
    justify-content: center;
  }
  #screen-result .result-title { max-width: 290px; text-align: center; text-wrap: balance; }
  #screen-result .result-rank-shell { width: 156px; height: 156px; margin-top: 20px; }
  #screen-result .result-rank { font-size: 82px; }
  #screen-result .result-rank-shell::before,
  #screen-result .result-rank-shell::after { top: 62px; }
  #screen-result .result-report { grid-column: 2; grid-row: 1; width: 100%; margin: 0; padding: 16px; }
  #screen-result .result-stats { grid-template-columns: repeat(5,minmax(0,1fr)); }
  #screen-result .recap { grid-column: 2; grid-row: 2; width: 100%; margin: 0; }
  #screen-result .result-buttons {
    grid-column: 2;
    grid-row: 3;
    width: 100%;
    grid-template-columns: repeat(3,minmax(0,1fr));
    margin: 0;
  }
  #screen-result .result-buttons:has(#btn-result-gear.hidden) {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 899px) {
  .mode-section-title { margin-top: 1px; }
  .battle-status { padding-inline: 12px; }
}

@media (max-width: 560px) {
  .mode-section-title { min-height: 19px; }
  .mode-section-title span { font-size: 7px; }
  .mode-section-title b { font-size: 10px; }
  .battle-status { min-height: 34px; padding-block: 5px 6px; }
  .battle-status b { padding: 3px 6px; font-size: 8px; }
  .battle-status > span { font-size: 10px; }
  .result-stats span { min-height: 55px; }
}

@media (min-width: 900px) {
  /* ID指定のグリッドが画面切替のdisplay:noneを上書きしないようにする */
  #screen-title { display: none; }
  #screen-title.active { display: grid; }
}

/* ═══════════════════════════════════════════════
   QUALITY PASS 07 — スマホ戦闘UIの可読性 / タップ領域
   ═══════════════════════════════════════════════ */
.skill-caption .giveup-btn {
  position: static;
  min-width: 64px;
  min-height: 30px;
  padding: 5px 10px 6px;
  opacity: 1;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

@media (max-width: 560px) {
  html,
  body,
  #shake-wrap,
  #app { height: 100dvh; }

  /* 上段は最小12pxを基準にし、数値と現在ルールを一目で読めるようにする */
  .hud { padding: 11px 13px 10px; }
  .hud-row { gap: 8px; margin-bottom: 9px; }
  .hud-floor { padding: 4px 10px 5px; font-size: 20px; }
  .hud-level { font-size: 14px; }
  .hud-mode { font-size: 12px; }
  .hud-battle-style { padding: 4px 7px 5px; font-size: 9px; }
  .hud-score { font-size: 24px; }
  .hud-score::before { font-size: 10px; }
  .exp-bar { height: 9px; }
  .relic-tray { min-height: 14px; }

  /* ルール説明は省略せず2段表示。小さな横一列に押し込まない */
  .battle-status {
    min-height: 52px;
    grid-template-columns: auto minmax(0,1fr);
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 3px;
    padding: 7px 12px 8px;
  }
  .battle-status b {
    grid-row: 1 / 3;
    align-self: stretch;
    display: grid;
    place-items: center;
    min-width: 57px;
    padding: 5px 7px;
    font-size: 9.5px;
  }
  .battle-status > span {
    align-self: end;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .battle-status > small {
    align-self: start;
    overflow: visible;
    font-size: 10.5px;
    line-height: 1.25;
    text-overflow: clip;
    white-space: normal;
  }

  /* 地图从近方形改为横向镜头，把高度留给文字和技能操作 */
  .map-panel { margin: 10px 8px 2px; border-width: 3px; border-radius: 20px; }
  #map-canvas { border-radius: 15px; }
  .map-hint { display: none; }
  .combo-zone { padding: 4px 28px 6px; }
  .combo-label { font-size: 11px; }
  .combo-mult { font-size: 19px; }

  /* 战报按正文处理，避免落到辅助说明字号 */
  .msg-window {
    display: block;
    min-height: 48px;
    margin: 0 10px 9px;
    padding: 10px 13px;
    font-size: 14px;
    line-height: 1.45;
    word-break: keep-all;
    overflow-wrap: anywhere;
    text-wrap: pretty;
  }

  /* 两行三列技能：按钮、名称和状态角标全部达到手机可读尺寸 */
  .bottom-hud {
    grid-template-columns: 68px minmax(0,1fr) 68px;
    gap: 9px;
    padding: 9px 10px max(12px,env(safe-area-inset-bottom));
  }
  .skill-dock { width: 100%; gap: 9px; }
  .skill-caption {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 0;
  }
  .skill-caption > span { font-size: 12.5px; letter-spacing: .06em; }
  .skill-caption small { display: none; }
  .skill-caption .giveup-btn {
    min-width: 64px;
    min-height: 38px;
    padding: 7px 8px 8px;
    font-size: 12.5px;
  }
  .skills {
    width: 100%;
    grid-template-columns: repeat(3,minmax(56px,1fr));
    gap: 9px 8px;
  }
  .skill-btn {
    width: 100%;
    min-width: 56px;
    height: 66px;
    gap: 5px;
    border-radius: 14px;
  }
  .skill-glyph { font-size: 22px; }
  .skill-name { font-size: 12px; letter-spacing: 0; }
  .skill-btn small {
    top: -6px;
    right: -4px;
    min-width: 30px;
    height: 23px;
    font-size: 10px;
  }
  .orb { width: 68px; height: 68px; }
  .orb-text { font-size: 18px; }
  .orb::after { bottom: 5px; font-size: 10px; letter-spacing: 1.5px; }

  .choice-btn { min-height: 62px; padding: 15px 9px; font-size: 17px; }
  .choice-btn.en { font-size: 19px; }
}

@media (max-width: 360px) {
  .hud-row { gap: 6px; }
  .hud-mode { max-width: 42px; }
  .hud-score { font-size: 22px; }
  .bottom-hud { grid-template-columns: 56px minmax(0,1fr) 56px; gap: 5px; padding-inline: 6px; }
  .skills { grid-template-columns: repeat(3,minmax(52px,1fr)); gap-inline: 5px; }
  .skill-btn { min-width: 52px; }
  .orb { width: 56px; height: 56px; }
}
