/* ===== 絵文字バトラー UI ===== */
:root {
  --bg: #12101f;
  --bg2: #1c1832;
  --bg3: #262045;
  --ink: #efeadf;
  --ink-dim: #9b93b8;
  --line: #453c6e;
  --line-bright: #6a5fa8;
  --hp-good: #6fd66f;
  --hp-mid: #ffd54f;
  --hp-bad: #ff6b6b;
  --exp: #64b5f6;
  --shadow: rgba(0, 0, 0, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0a0912;
  color: var(--ink);
  font-family: "DotGothic16", "MS Gothic", monospace;
  /* 分かち書きの スペース位置でだけ 折り返す(意味単位の改行) */
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* ゲーム機の画面 */
#game {
  width: 100%;
  max-width: 520px;
  height: 100dvh;
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, #241d47 0%, var(--bg) 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,.8);
}

.hidden { display: none !important; }

/* ── 画面共通 ── */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── タイトル ── */
#screen-title {
  position: relative;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2.4vh, 28px);
  text-align: center;
  padding: 18px 24px;
  overflow-y: auto;
  min-height: 0;
}
#screen-title .logo-emoji {
  font-size: clamp(38px, 8vh, 64px);
  letter-spacing: 8px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
#screen-title h1 {
  font-size: clamp(24px, 4.6vh, 34px);
  letter-spacing: 4px;
  text-shadow: 3px 3px 0 var(--shadow);
}
#screen-title .subtitle {
  color: var(--ink-dim);
  font-size: 11px;
  letter-spacing: 1px;
}
#screen-title .record {
  font-size: 12px;
  max-width: 92%;
  line-height: 1.7;
  color: var(--ink-dim);
  border: 2px solid var(--line);
  padding: 8px 18px;
  background: var(--bg2);
}
#screen-title .record b { color: var(--ink); font-size: 18px; }

/* ── ボタン共通 ── */
button {
  font-family: inherit;
  color: var(--ink);
  background: var(--bg3);
  border: 2px solid var(--line-bright);
  box-shadow: 0 3px 0 var(--shadow);
  padding: 12px 16px;
  font-size: 16px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform .05s;
}
button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
button:focus-visible { outline: 3px solid #fff176; outline-offset: 2px; }
button:disabled { opacity: .4; cursor: default; }
button.primary {
  background: #3d3573;
  font-size: 18px;
  padding: 14px 34px;
}
button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-dim);
  box-shadow: none;
  font-size: 13px;
  padding: 8px 14px;
}

/* ── バトル画面ヘッダー ── */
#battle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
  background: rgba(0,0,0,.25);
}
#floor-label { font-size: 14px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#floor-label .boss-mark { color: #ff6b6b; }
.menu-btns { display: flex; gap: 5px; flex-shrink: 0; }
.menu-btns .ghost {
  padding: 7px 9px;
  font-size: 12px;
  letter-spacing: 0;
  white-space: nowrap;
}

/* ── バトルステージ ── */
#stage {
  position: relative;
  height: 300px;
  flex-shrink: 0;
  overflow: hidden;
}
/* 星 */
#stage::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 20%, #fff9 50%, transparent 50%),
    radial-gradient(1px 1px at 38% 8%,  #fff6 50%, transparent 50%),
    radial-gradient(2px 2px at 66% 16%, #fff7 50%, transparent 50%),
    radial-gradient(1px 1px at 85% 30%, #fff8 50%, transparent 50%),
    radial-gradient(1px 1px at 52% 26%, #fff5 50%, transparent 50%),
    radial-gradient(2px 2px at 24% 38%, #fff4 50%, transparent 50%);
  pointer-events: none;
}

.combatant {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.combatant .sprite {
  font-size: 84px;
  line-height: 1.1;
  filter: drop-shadow(0 6px 4px rgba(0,0,0,.5));
  transition: opacity .3s;
}
.combatant .platform {
  width: 120px; height: 22px;
  background: radial-gradient(ellipse at 50% 50%, #2e2758 0%, transparent 70%);
  margin-top: -8px;
}
#enemy-side  { top: 26px; right: 30px; }
#player-side { bottom: 4px; left: 30px; }

/* 情報プレート */
.info-plate {
  position: absolute;
  width: 220px;
  background: var(--bg2);
  border: 2px solid var(--line-bright);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 8px 10px;
  font-size: 13px;
}
#enemy-plate  { top: 30px; left: 14px; }
#player-plate { bottom: 30px; right: 14px; }
.info-plate .row1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 5px;
}
.info-plate .name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-plate .lv { color: var(--ink-dim); flex-shrink: 0; }
.type-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid currentColor;
  margin-top: 4px;
}
.bar {
  height: 10px;
  background: #0d0b18;
  border: 1px solid var(--line);
  position: relative;
}
.bar .fill {
  position: relative;
  z-index: 1;
  height: 100%;
  background: var(--hp-good);
  transition: width .45s steps(12);
}
.bar .bar-ghost {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: rgba(255, 236, 179, .5);
}
.bar.exp-bar { height: 5px; margin-top: 4px; }
.bar.exp-bar .fill { background: var(--exp); transition: width .3s; }
.hp-num { text-align: right; font-size: 12px; color: var(--ink-dim); margin-top: 3px; }

/* ── メッセージウィンドウ ── */
#msg-window {
  min-height: 74px;
  margin: 0 10px;
  background: var(--bg2);
  border: 3px solid var(--line-bright);
  box-shadow: inset 0 0 0 2px var(--bg), 4px 4px 0 var(--shadow);
  padding: 12px 16px;
  font-size: 16px;
  line-height: 1.7;
  position: relative;
}
#msg-window .cursor {
  position: absolute;
  right: 12px; bottom: 6px;
  animation: blink 0.8s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── コマンド ── */
#commands {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 10px 16px;
  align-content: start;
}
.move-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  border-width: 2px;
  min-height: 88px;
}
.move-btn .mv-name { font-size: 15px; }
.move-btn .mv-meta { font-size: 10px; color: var(--ink-dim); line-height: 1.45; }
.move-btn .mv-detail {
  font-size: 10px;
  line-height: 1.45;
  color: #f0c96c;
  text-align: left;
}
.move-btn.type-colored { border-color: var(--type-color); }
.move-btn.type-colored .mv-name::before {
  content: var(--type-icon);
  margin-right: 6px;
}
.move-btn.super { box-shadow: inset 0 0 0 1px #ffcf4a, 0 0 8px rgba(255,207,74,.2); }
.move-btn.resist { opacity: .78; }
.mv-eff {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 5px;
  border: 1px solid currentColor;
  font-size: 10px;
  line-height: 1.3;
  vertical-align: 2px;
}
.mv-eff.super { color: #ffd75e; }
.mv-eff.resist { color: #9aa2b8; }
#commands .sys-btn { min-height: 52px; }

/* ── パーティ/図鑑 オーバーレイ ── */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 7, 16, 0.97);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  overflow-y: auto;
}
.overlay h2 {
  font-size: 20px;
  letter-spacing: 3px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.party-list { display: flex; flex-direction: column; gap: 10px; }
.party-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  border: 2px solid var(--line);
  padding: 10px 12px;
  cursor: pointer;
}
.party-card.active-mon { border-color: #fff176; }
.party-card.fainted { opacity: .45; }
.party-card .p-emoji { font-size: 40px; }
.party-card .p-info { flex: 1; min-width: 0; }
.party-card .p-name { font-size: 15px; }
.party-card .p-sub { font-size: 12px; color: var(--ink-dim); margin: 2px 0 4px; }
.party-card .bar { max-width: 180px; }

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.dex-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--bg2);
  border: 2px solid var(--line);
  font-size: 30px;
}
.dex-cell .dex-name { font-size: 9px; color: var(--ink-dim); }
.dex-cell.unknown { color: var(--line-bright); font-size: 22px; }

/* ── 汎用ダイアログ ── */
.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 12, 0.75);
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.dialog {
  width: 100%;
  max-width: 380px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg2);
  border: 3px solid var(--line-bright);
  box-shadow: inset 0 0 0 2px var(--bg), 6px 6px 0 var(--shadow);
  padding: 22px 18px;
  text-align: center;
}
.dialog .d-emoji { font-size: 64px; margin-bottom: 10px; }
.dialog .d-text { font-size: 16px; line-height: 1.8; margin-bottom: 18px; }
.dialog .d-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── 演出 ── */
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 2px); }
  40% { transform: translate(6px, -2px); }
  60% { transform: translate(-5px, 1px); }
  80% { transform: translate(4px, -1px); }
}
.hit .sprite { animation: shake .4s steps(6); }
.hit-flash .sprite { animation: shake .4s steps(6); filter: brightness(3) drop-shadow(0 6px 4px rgba(0,0,0,.5)); }

@keyframes lunge-player {
  0%, 100% { transform: translate(0,0); }
  40% { transform: translate(26px, -18px); }
}
@keyframes lunge-enemy {
  0%, 100% { transform: translate(0,0); }
  40% { transform: translate(-26px, 18px); }
}
.lunge-player .sprite { animation: lunge-player .35s steps(4); }
.lunge-enemy .sprite { animation: lunge-enemy .35s steps(4); }

.faint .sprite { opacity: 0; transform: translateY(24px); transition: all .5s steps(6); }

/* 技パーティクル */
.particle {
  position: absolute;
  font-size: 30px;
  pointer-events: none;
  z-index: 15;
  animation: fly .5s steps(8) forwards;
}
@keyframes fly {
  0%   { transform: translate(0, 0) scale(0.7); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.25); opacity: 0; }
}

/* 全技共通の非絵文字ピクセルVFX */
.move-vfx {
  position: absolute;
  width: 96px;
  height: 96px;
  z-index: 17;
  pointer-events: none;
  background-image: url("assets/battle-vfx-v1.png");
  background-repeat: no-repeat;
  background-size: 500% 400%;
  background-position: var(--vfx-x) var(--vfx-y);
  image-rendering: pixelated;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.35));
}
.projectile-vfx { animation: vfx-fly .52s steps(10) forwards; }
@keyframes vfx-fly {
  0% { transform: translate(0,0) scale(.42) scaleX(var(--flip)); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translate(var(--dx),var(--dy)) scale(1.08) scaleX(var(--flip)); opacity: .15; }
}
.impact-vfx {
  width: 116px;
  height: 116px;
  animation: vfx-impact .56s steps(8) forwards;
}
.support-vfx { filter: drop-shadow(0 0 12px rgba(255,255,255,.65)); }
@keyframes vfx-impact {
  0% { transform: scale(.28); opacity: 0; }
  22% { opacity: 1; }
  72% { transform: scale(1.14); opacity: 1; }
  100% { transform: scale(1.32); opacity: 0; }
}

/* ダメージポップ */
.dmg-pop {
  position: absolute;
  font-size: 24px;
  font-weight: bold;
  z-index: 16;
  pointer-events: none;
  text-shadow: 2px 2px 0 #000;
  animation: pop-up .8s steps(8) forwards;
}
.dmg-pop.super { color: #ffd54f; font-size: 30px; }
.dmg-pop.weak { color: var(--ink-dim); font-size: 19px; }
.dmg-pop.miss { color: var(--ink-dim); }
@keyframes pop-up {
  0%   { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-44px); opacity: 0; }
}

/* 進化フラッシュ */
@keyframes evo-glow {
  0%, 100% { filter: brightness(1); transform: scale(1); }
  50% { filter: brightness(4) saturate(0); transform: scale(1.2); }
}
.evolving { animation: evo-glow 1.4s steps(10) 2; display: inline-block; }

/* 画面シェイク(大技・クリティカル) */
@keyframes quake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-6px, 3px); }
  30% { transform: translate(5px, -4px); }
  45% { transform: translate(-4px, 2px); }
  60% { transform: translate(4px, -2px); }
  80% { transform: translate(-2px, 1px); }
}
#stage.quake { animation: quake .42s steps(8); }

/* ボス・伝説の登場フラッシュ */
.boss-flash {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 60, 60, .55), transparent 75%);
  animation: boss-flash .7s steps(6) forwards;
}
.boss-flash.legend-flash {
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 215, 80, .6), transparent 75%);
}
@keyframes boss-flash {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}

/* ピンチのHPバー点滅 */
@keyframes pinch-blink { 50% { opacity: .35; } }
.bar .fill.pinch { animation: pinch-blink .6s steps(2) infinite; }

/* 状態異常バッジ */
.status-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--hp-bad);
  margin-top: 3px;
}

/* 図鑑: 伝説セル */
.dex-cell.legend {
  border-color: #d4af37;
  box-shadow: inset 0 0 8px rgba(212, 175, 55, .35);
}

/* タイトルのメニュー */
.mode-menu { display: flex; flex-direction: column; gap: 8px; width: 240px; }
.mode-menu button { width: 100%; padding: 11px 16px; }
.mode-menu button.primary { padding: 12px 16px; font-size: 17px; }
.title-menu {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 94%;
}

/* コスト表示+ボックス */
#party-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
#party-cost {
  font-size: 13px;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 4px 10px;
}
#box-count {
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 12px;
}
.box-cell { cursor: pointer; }
.box-empty {
  grid-column: 1 / -1;
  color: var(--ink-dim);
  font-size: 13px;
  text-align: center;
  padding: 30px 0;
  line-height: 2;
}

/* 敵の肩書きバッジ */
.foe-badge {
  display: none;
  font-size: 10px;
  padding: 1px 6px;
  border: 1px solid currentColor;
  margin-top: 4px;
  margin-right: 4px;
}
.foe-badge.badge-dark { display: inline-block; color: #b39ddb; }
.foe-badge.badge-boss { display: inline-block; color: #ff6b6b; }
.foe-badge.badge-legend { display: inline-block; color: #d4af37; }

.boss-variant-badge {
  display: inline-block;
  color: #ff7a72;
  border: 1px solid currentColor;
  background: rgba(128,20,25,.22);
  padding: 1px 5px;
  font-size: 9px;
  line-height: 1.25;
  vertical-align: 2px;
}
.boss-scout-note { color: #ff9a8f; font-size: 11px; line-height: 1.7; }
.boss-variant-detail { border-color: #a93e43; color: #ffb0a8; background: rgba(128,20,25,.13); }

/* がんばりポイント割り振り */
#gp-head {
  font-size: 13px;
  color: var(--ink-dim);
  margin-bottom: 14px;
  line-height: 1.8;
}
#gp-head b { color: var(--exp); }
.gp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 2px solid var(--line);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.gp-label { width: 72px; font-size: 14px; flex-shrink: 0; }
.gp-val { flex: 1; font-size: 15px; }
.gp-pend { color: var(--exp); }
.gp-btn { min-width: 48px; padding: 8px 6px; font-size: 14px; }
#btn-gp-apply { margin-top: 12px; align-self: center; flex-shrink: 0; }
.gp-extra {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}
.gp-extra-title { color: var(--exp); font-size: 13px; }
.gp-extra-btn { text-align: left; }

/* 並び替え */
.order-btns { display: flex; gap: 4px; }
.order-btn { min-width: 0; flex: 1; padding: 4px 6px; font-size: 11px; }

/* キャラ詳細 */
#detail-body { font-size: 14px; line-height: 1.7; }
#detail-body .dim { color: var(--ink-dim); }
.detail-sec {
  border-bottom: 1px solid var(--line);
  padding: 8px 2px;
}
.detail-sec:last-child { border-bottom: none; }
.detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
  font-size: 14px;
}
.detail-move {
  background: var(--bg2);
  border: 1px solid var(--line);
  padding: 7px 10px;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.6;
}
.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* 技つけかえ */
.moves-head {
  font-size: 12px;
  color: var(--ink-dim);
  margin: 14px 0 4px;
}
.detail-move.clickable { cursor: pointer; }
.detail-move.clickable:active { transform: translateY(1px); }
.detail-move.clickable:hover { border-color: var(--line-bright); }
.detail-move.row-disabled { opacity: .45; }
#btn-moves-auto { margin-top: 16px; align-self: flex-start; flex-shrink: 0; }

/* カード内ボタン列 */
.card-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: center;
  flex-shrink: 0;
}
.gp-ready {
  border-color: var(--exp);
  color: var(--exp);
}

/* 奥義 */
.ougi-btn {
  grid-column: 1 / -1;
  border-color: var(--type-color);
  background: linear-gradient(90deg, var(--bg3), var(--bg2));
  font-size: 14px;
  padding: 12px;
  text-align: left;
}
.subtype-badge { font-size: 12px; }
.ougi-flash {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 70%, var(--ougi-color), transparent 70%);
  opacity: 0;
  animation: ougi-flash .8s steps(8) forwards;
}
@keyframes ougi-flash {
  0% { opacity: 0; }
  30% { opacity: .85; }
  100% { opacity: 0; }
}

/* 3体選出 */
.party-card.selected {
  border-color: #fff176;
  box-shadow: 0 0 0 1px #fff176, 3px 3px 0 var(--shadow);
}
.party-card.selected::after {
  content: "✔";
  color: #fff176;
  font-size: 20px;
  margin-left: 4px;
}
#btn-team-go {
  margin-top: 14px;
  align-self: center;
  flex-shrink: 0;
}

/* 装備ボタン */
.party-card { position: relative; }
.equip-btn {
  flex-shrink: 0;
  min-width: 52px;
  font-size: 15px;
  align-self: center;
}
.equip-list {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-dim);
  text-align: left;
  line-height: 1.7;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

/* 図鑑: 捕まえたマーク */
.dex-cell { position: relative; }
.caught-mark {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 11px;
  color: var(--hp-good);
}
.dd-caught {
  font-size: 10px;
  color: var(--hp-good);
  border: 1px solid var(--hp-good);
  padding: 1px 5px;
  vertical-align: middle;
}

/* 図鑑詳細 */
.dex-detail { text-align: left; font-size: 13px; }
.dex-detail .dd-desc {
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink);
  border-left: 3px solid var(--line-bright);
  padding-left: 8px;
  margin-bottom: 10px;
}
.dex-detail .dd-name { font-size: 17px; margin-bottom: 2px; }
.dex-detail .dd-legend {
  font-size: 10px;
  color: #d4af37;
  border: 1px solid #d4af37;
  padding: 1px 5px;
  vertical-align: middle;
}
.dex-detail .dd-type { font-size: 12px; margin-bottom: 10px; }
.dex-detail .dd-title { color: var(--ink-dim); font-size: 11px; margin-bottom: 4px; }
.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.stat-row span { width: 56px; flex-shrink: 0; font-size: 12px; }
.stat-row b { width: 26px; text-align: right; font-size: 12px; }
.stat-gauge {
  flex: 1;
  height: 8px;
  background: #0d0b18;
  border: 1px solid var(--line);
}
.stat-gauge div { height: 100%; background: var(--line-bright); }
.dex-detail .dd-ability {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  line-height: 1.5;
}
.dex-detail .dd-ability small { color: var(--ink-dim); }
.dex-detail .dd-evo { margin-top: 8px; color: var(--ink-dim); font-size: 12px; }

/* ── ストーリーモード ── */
#story-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
  background: rgba(0,0,0,.25);
  font-size: 14px;
  letter-spacing: 0;
  white-space: nowrap;
}
#story-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 300px;
  background: #0a1608;
}
#story-world {
  position: absolute;
  top: 0; left: 0;
}
.story-tile {
  position: absolute;
  width: 32px;
  height: 32px;
  text-align: center;
  line-height: 32px;
  font-size: 22px;
  user-select: none;
}
.story-tile.deco-small { font-size: 12px; color: #7fc4e8; }
.story-tile.has-pixel-sprite::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("assets/story-tiles-v1.png");
  background-repeat: no-repeat;
  background-size: 160px 128px;
  background-position: var(--sprite-left) var(--sprite-top);
  image-rendering: pixelated;
  pointer-events: none;
}
.story-object.has-pixel-sprite { font-size: 0; }
.story-object.has-pixel-sprite::after { filter: drop-shadow(0 2px 1px rgba(0,0,0,.45)); }
.story-object.switch-on::after { filter: hue-rotate(95deg) brightness(1.15) drop-shadow(0 0 4px #70ff7d); }
.story-object { z-index: 2; font-size: 24px; }
.story-object.dark-aura {
  filter: grayscale(0.65) brightness(0.72) drop-shadow(0 0 6px #7b4fd0);
  animation: dark-pulse 1.6s ease-in-out infinite;
}
@keyframes dark-pulse {
  0%, 100% { filter: grayscale(0.65) brightness(0.72) drop-shadow(0 0 4px #7b4fd0); }
  50% { filter: grayscale(0.65) brightness(0.6) drop-shadow(0 0 10px #7b4fd0); }
}
#hina-sprite {
  position: absolute;
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  z-index: 3;
  transition: left .15s linear, top .15s linear;
  pointer-events: none;
}
#story-msgbox {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 10;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--bg2);
  border: 3px solid var(--line-bright);
  box-shadow: inset 0 0 0 2px var(--bg), 4px 4px 0 var(--shadow);
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.7;
  min-height: 64px;
  cursor: pointer;
}
#story-speaker { font-size: 30px; line-height: 1.2; flex-shrink: 0; }
#story-speaker .hina-face {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
  display: block;
}
#story-text { flex: 1; }
#story-msgbox .cursor {
  position: absolute;
  right: 10px;
  bottom: 4px;
  animation: blink 0.8s steps(1) infinite;
}
#story-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 14px;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-auto-rows: 44px;
  gap: 4px;
}
.dpad button { padding: 0; font-size: 16px; }
.story-hint {
  font-size: 11px;
  color: var(--ink-dim);
  text-align: right;
  line-height: 1.8;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01s !important; transition-duration: 0.01s !important; }
}

@media (max-width: 400px) {
  #stage { height: 250px; }
  .combatant .sprite { font-size: 66px; }
  .info-plate { width: 178px; }
  #enemy-plate { left: 8px; }
  #player-plate { right: 8px; }
}

/* ── せってい ── */
.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  border: 2px solid var(--line);
  padding: 12px;
  margin-bottom: 10px;
  font-size: 14px;
  flex-wrap: wrap;
}
.setting-row label { width: 130px; flex-shrink: 0; }
.setting-row input[type="range"] { flex: 1; min-width: 120px; accent-color: var(--line-bright); }
.setting-choices { display: flex; gap: 6px; }
.setting-choices .choice-on {
  border-color: #fff176;
  color: var(--ink);
}
.setting-help {
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 2;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* ── セーブかんり ── */
.save-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 2px solid var(--line);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.slot-info { flex: 1; line-height: 1.6; }
.slot-info .dim { color: var(--ink-dim); }
.slot-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.save-io { display: flex; gap: 8px; margin-bottom: 8px; }
#save-code {
  width: 100%;
  background: #0d0b18;
  border: 2px solid var(--line);
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  padding: 8px;
  resize: vertical;
  word-break: break-all;
}

/* ── かいわりれき ── */
#log-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-line {
  background: var(--bg2);
  border: 1px solid var(--line);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.7;
}
.log-line.dim, .log-line .dim { color: var(--ink-dim); }
.log-speaker { font-size: 15px; margin-right: 4px; }

/* シーンとばす */
#btn-scene-skip {
  position: absolute;
  top: -14px;
  right: 8px;
  font-size: 11px;
  padding: 4px 10px;
  background: var(--bg3);
}

/* 低い画面ではタイトルを圧縮して1画面に収める */
@media (max-height: 780px) {
  #screen-title { gap: 8px; padding: 12px 20px; }
  #screen-title .subtitle { display: none; }
  #screen-title .logo-emoji { font-size: clamp(32px, 6vh, 48px); }
  #screen-title h1 { font-size: clamp(20px, 3.6vh, 28px); }
  #screen-title .record { font-size: 11px; padding: 5px 10px; line-height: 1.5; }
  #screen-title .record b { font-size: 14px; }
  .mode-menu { gap: 6px; width: 220px; }
  .mode-menu button { padding: 9px 12px; font-size: 15px; }
  .mode-menu button.primary { padding: 10px 12px; font-size: 16px; }
  .title-menu .ghost { padding: 6px 10px; font-size: 12px; }
}

/* そうび画面 */
.equip-now {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 2px solid var(--line-bright);
  padding: 10px 12px;
  font-size: 14px;
  flex-wrap: wrap;
}
.equip-now.dim { color: var(--ink-dim); border-color: var(--line); }
#equip-list-box { display: flex; flex-direction: column; gap: 2px; }

/* A/Bボタン */
.ab-pad {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.ab-pad button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 0;
  font-size: 18px;
  border: 2px solid var(--line-bright);
  background: var(--bg3);
}
#btn-a { border-color: #6fd66f; color: #6fd66f; margin-bottom: 14px; }
#btn-b { border-color: #ff8a8a; color: #ff8a8a; }
#story-controls { gap: 8px; }
#story-controls .story-hint { flex: 1; text-align: center; }

/* おんがくかんしょう */
#music-list { display: flex; flex-direction: column; gap: 4px; }
.detail-move.music-on { border-color: #fff176; }

/* HPバーの色はクラスで切り替える(インラインstyleのvar()が更新されない環境がある) */
.bar .fill.hp-mid { background: var(--hp-mid); }
.bar .fill.hp-bad { background: var(--hp-bad); }

/* ── ボス戦カットイン ── */
#cutin {
  display: none;
  position: fixed;
  inset: 0;
  /* ダイアログ・メニュー・バトル画面を含め、必ず最前面へ出す */
  z-index: 2147483000;
  pointer-events: none;
  overflow: hidden;
  isolation: isolate;
  /* 背面の戦闘画面を見せず、カットイン単体で一枚絵として成立させる */
  background:
    radial-gradient(circle at 50% 48%, rgba(76, 17, 38, .98) 0%, rgba(20, 8, 22, .99) 48%, #07050c 100%),
    #07050c;
}
#cutin.play { display: block; }
#cutin.out { opacity: 0; transition: opacity .25s; }
.cutin-flash { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; }
#cutin.play .cutin-flash { animation: cutin-flash .5s ease-out; }
@keyframes cutin-flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.cutin-band {
  position: absolute;
  z-index: 1;
  left: -12%;
  width: 124%;
  height: 34%;
  background: linear-gradient(90deg, #2a0812, #57101f 55%, #2a0812);
  border-top: 3px solid #ff4d6d;
  border-bottom: 3px solid #ff4d6d;
  box-shadow: 0 0 24px rgba(255, 77, 109, .5);
}
.cutin-band-top { top: 12%; transform: skewY(-7deg) translateX(-110%); }
.cutin-band-bottom { bottom: 12%; transform: skewY(-7deg) translateX(110%); }
#cutin.play .cutin-band-top { animation: cutin-in-l .3s cubic-bezier(.2,.9,.2,1) forwards; }
#cutin.play .cutin-band-bottom { animation: cutin-in-r .3s cubic-bezier(.2,.9,.2,1) forwards; }
@keyframes cutin-in-l { to { transform: skewY(-7deg) translateX(0); } }
@keyframes cutin-in-r { to { transform: skewY(-7deg) translateX(0); } }
.cutin-inner {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.cutin-emoji {
  font-size: clamp(56px, 24vw, 92px);
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, .85));
  opacity: 0;
}
#cutin.play .cutin-emoji { animation: cutin-emoji .45s .18s cubic-bezier(.2,.9,.3,1.4) forwards; }
@keyframes cutin-emoji {
  0% { opacity: 0; transform: translateX(-70px) scale(2.4); }
  100% { opacity: 1; transform: none; }
}
.cutin-text { text-align: left; opacity: 0; }
#cutin.play .cutin-text { animation: cutin-text .35s .3s ease-out forwards; }
@keyframes cutin-text {
  0% { opacity: 0; transform: translateX(60px); }
  100% { opacity: 1; transform: none; }
}
.cutin-label { font-size: clamp(11px, 4vw, 14px); letter-spacing: 2px; color: #ff8fa3; }
.cutin-name { font-size: clamp(19px, 7.5vw, 30px); font-weight: bold; text-shadow: 0 0 12px rgba(255, 77, 109, .8); }
.cutin-inner { padding: 0 10px; gap: clamp(8px, 3vw, 18px); }
#cutin.legend .cutin-band {
  background: linear-gradient(90deg, #2a2008, #5c4a10 55%, #2a2008);
  border-color: #ffd54f;
  box-shadow: 0 0 28px rgba(255, 213, 79, .55);
}
#cutin.legend {
  background:
    radial-gradient(circle at 50% 48%, rgba(104, 78, 15, .98) 0%, rgba(28, 21, 7, .99) 50%, #07050c 100%),
    #07050c;
}
#cutin.legend .cutin-label { color: #ffe082; }
#cutin.legend .cutin-name { text-shadow: 0 0 12px rgba(255, 213, 79, .9); }
#cutin.trial .cutin-band {
  background: linear-gradient(90deg, #081a2a, #103a5c 55%, #081a2a);
  border-color: #64b5f6;
  box-shadow: 0 0 24px rgba(100, 181, 246, .5);
}
#cutin.trial {
  background:
    radial-gradient(circle at 50% 48%, rgba(16, 66, 104, .98) 0%, rgba(7, 21, 32, .99) 50%, #05080c 100%),
    #05080c;
}
#cutin.trial .cutin-label { color: #90caf9; }
#cutin.trial .cutin-name { text-shadow: 0 0 12px rgba(100, 181, 246, .9); }

/* ── エンドゲーム(ハクスラ・よろずや・じっせき) ── */
.forge-btn { font-size: 11px; padding: 2px 8px; margin-left: 6px; color: #ffb74d; border-color: #ffb74d; }
.forge-plus { color: #ffb74d; }
.shop-row .shop-price { float: right; color: #ffd54f; }
.ach-toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translate(-50%, -20px);
  background: #1c1930;
  border: 1px solid #ffd54f;
  color: #efeadf;
  padding: 8px 14px;
  font-size: 13px;
  z-index: 2147483200;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  max-width: 92vw;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .5);
}
.ach-toast.show { opacity: 1; transform: translate(-50%, 0); }
.ach-row .ach-bar { height: 5px; background: #0d0b18; border: 1px solid var(--line); margin: 4px 0 3px; }
.ach-row .ach-fill { height: 100%; background: var(--exp); }
.ach-row.ach-done .ach-fill { background: #ffd54f; }
.ach-title-tag { font-size: 11px; color: #ffd54f; }
#ach-titles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
#ach-titles .title-on { border-color: #ffd54f; color: #ffd54f; }
/* カットイン: よんてんのう(紫)・らすぼす(白銀) */
#cutin.shitennou .cutin-band {
  background: linear-gradient(90deg, #1d0a2e, #45156b 55%, #1d0a2e);
  border-color: #ce93d8;
  box-shadow: 0 0 26px rgba(206, 147, 216, .55);
}
#cutin.shitennou .cutin-label { color: #e1bee7; }
#cutin.shitennou .cutin-name { text-shadow: 0 0 12px rgba(206, 147, 216, .9); }
#cutin.final .cutin-band {
  background: linear-gradient(90deg, #10131f, #2c3357 55%, #10131f);
  border-color: #e8eaf6;
  box-shadow: 0 0 30px rgba(232, 234, 246, .6);
}
#cutin.final .cutin-label { color: #c5cae9; }
#cutin.final .cutin-name { text-shadow: 0 0 14px rgba(232, 234, 246, .95); }

/* ── ぼうけんのきろく・あそびかた ── */
.record-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.record-row b { color: #ffd54f; text-align: right; }
.guide-row {
  padding: 4px 4px 4px 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
}

/* ── クオリティ: タイトルの星空と ゆらめき ── */
#screen-title::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1px 1px at 78% 12%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 30% 68%, rgba(255,244,214,.8), transparent 60%),
    radial-gradient(1px 1px at 62% 42%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1px 1px at 88% 76%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1.5px 1.5px at 45% 15%, rgba(200,220,255,.8), transparent 60%),
    radial-gradient(1px 1px at 8% 85%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1px 1px at 55% 88%, rgba(255,244,214,.6), transparent 60%);
  animation: star-twinkle 3.4s ease-in-out infinite alternate;
}
@keyframes star-twinkle { from { opacity: .45; } to { opacity: 1; } }
#screen-title .logo-emoji { animation: logo-float 3.4s ease-in-out infinite; }
@keyframes logo-float { 50% { transform: translateY(-6px); } }
#screen-title h1 {
  background: linear-gradient(180deg, #fff8e1 20%, #ffd54f 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .45));
}

/* ── クオリティ: 画面・ダイアログの登場アニメ、タップの手応え ── */
.overlay:not(.hidden) { animation: overlay-in .18s ease-out; }
@keyframes overlay-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.dialog-backdrop:not(.hidden) .dialog { animation: overlay-in .16s ease-out; }
button:active { transform: translateY(1px); }
.title-menu button, .mode-menu button { transition: transform .08s; }

.guide-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.guide-tabs .title-on { border-color: #ffd54f; color: #ffd54f; }
.guide-tip { border-bottom: 1px solid var(--line); padding-bottom: 7px; }

/* ═══════════════ Apple風マテリアル刷新(全画面) ═══════════════
   apple-designスキル準拠: 半透明マテリアルで階層を作り、押した瞬間に応え、
   角丸とソフトシャドウで浮かせ、モーションはiOSシート曲線。低透過・低モーション設定に追従 */
:root {
  --glass: rgba(28, 24, 50, 0.62);
  --glass-heavy: rgba(18, 16, 34, 0.78);
  --glass-light: rgba(60, 52, 100, 0.34);
  --glass-edge: rgba(255, 255, 255, 0.14);
  --radius-xl: 22px;
  --radius-l: 16px;
  --radius-m: 12px;
  --radius-s: 9px;
  --shadow-float: 0 10px 34px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.32);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --accent: #ffd54f;
}

/* ── ボタン: 押した瞬間に応える(§1 Response) ── */
button {
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-m);
  background: var(--glass-light);
  box-shadow: var(--shadow-card);
  transition: transform 100ms ease-out, background 150ms ease-out;
}
button:active {
  transform: scale(0.96);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
button.primary {
  background: linear-gradient(180deg, #ffe082, var(--accent));
  color: #221c08;
  border-color: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-l);
  font-weight: bold;
  text-shadow: none;
  box-shadow: 0 4px 16px rgba(255, 213, 79, 0.28), var(--shadow-card);
}
button.ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-s);
  box-shadow: none;
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── ヘッダー: 不透明バー → 浮かぶ半透明マテリアル(§12) ── */
#battle-header, #story-header {
  background: rgba(18, 16, 32, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

/* ── オーバーレイ: 画面を覆う板 → 下から上がるガラスシート ── */
.overlay {
  top: max(14px, env(safe-area-inset-top));
  background: var(--glass-heavy);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  border-top: 1px solid var(--glass-edge);
  box-shadow: var(--shadow-float);
  scrollbar-width: none;
}
.overlay::-webkit-scrollbar { display: none; }
.overlay:not(.hidden) { animation: sheet-in 0.34s var(--ease-sheet); }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}
.overlay h2 {
  letter-spacing: 1px;
  line-height: 1.15;
}

/* ── ダイアログ: scrimで背景を沈め、ガラスのカードが浮かぶ ── */
.dialog-backdrop {
  background: rgba(4, 3, 10, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.dialog {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-edge);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-float);
  scrollbar-width: none;
}
.dialog::-webkit-scrollbar { display: none; }
.dialog-backdrop:not(.hidden) .dialog { animation: dialog-in 0.28s var(--ease-sheet); }
@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ── バトル画面: プレート・メッセージ窓・コマンドをカード化 ── */
.info-plate {
  background: rgba(22, 19, 40, 0.6);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
}
#msg-window {
  background: rgba(20, 17, 36, 0.66);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-edge);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
}
#commands button { border-radius: var(--radius-l); }
.bar, .bar .fill, .bar .bar-ghost { border-radius: 99px; }
.bar { border: 1px solid rgba(255, 255, 255, 0.12); }

/* ── ストーリー画面の窓・十字キー・A/Bボタン ── */
#story-msgbox {
  background: rgba(20, 17, 36, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-float);
}
.dpad button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-m);
  box-shadow: none;
}
.ab-pad button {
  background: rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-card);
}

/* ── リスト行: 区切り線の連続 → 角丸カードの積み重ね ── */
.detail-move, .party-card, .shop-row, .ach-row, .record-row, .dex-cell {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-m);
  margin-bottom: 6px;
}
.record-row { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.detail-move.clickable:active, .shop-row.clickable:active { transform: scale(0.985); }
.moves-head {
  letter-spacing: 1px;
  color: var(--ink-dim);
  margin-top: 10px;
}

/* ── タイトルのメニュー: ガラスのグリッド ── */
.title-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(94%, 380px);
}
.title-menu button {
  font-size: 13px;
  padding: 10px 4px;
  background: rgba(255, 255, 255, 0.055);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.mode-menu button { border-radius: var(--radius-l); }
.record {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  padding: 5px 14px;
}

/* ── カットイン・トーストも角丸に合わせる ── */
.ach-toast {
  border-radius: var(--radius-l);
  background: rgba(28, 24, 50, 0.8);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 213, 79, 0.55);
  box-shadow: var(--shadow-float);
}
#cutin .cutin-band { border-radius: 4px; }

/* ── 設定・アクセシビリティ追従(§14) ── */
@media (prefers-reduced-motion: reduce) {
  .overlay:not(.hidden), .dialog-backdrop:not(.hidden) .dialog { animation: none; }
  button, .detail-move { transition: none; }
  #screen-title .logo-emoji, #screen-title::before { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .overlay, .dialog, .info-plate, #msg-window, #story-msgbox, #battle-header, #story-header, .ach-toast {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #16132a;
  }
}
@media (prefers-contrast: more) {
  .overlay, .dialog { border-color: rgba(255, 255, 255, 0.5); }
  button { border-color: rgba(255, 255, 255, 0.45); }
}

/* ── バトル画面: 2だんめのコマンドまで 1がめんに収める(スプライトとプレートは重ねない) ── */
#stage { height: clamp(225px, 33vh, 300px); }
.combatant .sprite { font-size: clamp(58px, 9vh, 84px); }
#enemy-side { top: 10px; }
#player-side { bottom: 4px; }
#enemy-plate { top: 10px; }
#player-plate { bottom: 10px; }
.info-plate { padding: 6px 10px; }
.info-plate .row1 { margin-bottom: 3px; }
#msg-window { min-height: 58px; padding: 9px 12px; font-size: 15px; }
#commands { gap: 7px; padding: 8px 10px 12px; }
#commands button { padding: 9px 8px; font-size: 14px; }
#battle-header { padding-top: 6px; padding-bottom: 6px; }
@media (max-height: 730px) {
  #stage { height: clamp(200px, 30vh, 260px); }
  .combatant .sprite { font-size: clamp(48px, 8vh, 62px); }
  .combatant .platform { width: 84px; }
  #enemy-side { top: 8px; right: 20px; }
  #player-side { bottom: 2px; left: 20px; }
  .info-plate { padding: 5px 8px; font-size: 13px; }
  .hp-num { font-size: 11px; margin-top: 2px; }
  #commands button { padding: 8px 6px; font-size: 13px; }
}

.type-chart-row {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-m);
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 13px;
}
.type-chart-row .tc-line { padding: 2px 0 0 6px; line-height: 1.6; }
.type-chart-row .dim { color: var(--ink-dim); }

/* ボスの視線に気づかれた「!」 */
.sight-mark {
  position: absolute;
  width: 32px;
  text-align: center;
  font-size: 22px;
  z-index: 5;
  animation: sight-pop .5s ease-out;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.6));
}
@keyframes sight-pop {
  0% { opacity: 0; transform: translateY(6px) scale(.5); }
  40% { opacity: 1; transform: translateY(-2px) scale(1.2); }
  100% { opacity: 1; transform: none; }
}

/* ── れんけい強化・コストなじみ ── */
#btn-cost-training { color: var(--exp); }
.cost-license-current,
.cost-license-coins,
#cost-training-next,
.cost-training-help {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  border-radius: var(--radius-m);
  padding: 12px;
  margin-bottom: 10px;
  line-height: 1.7;
}
.cost-license-current b,
.cost-license-coins b { color: var(--exp); }
#cost-training-summary small { color: var(--ink-dim); line-height: 1.7; display: block; margin-bottom: 10px; }
#cost-training-next { color: var(--ink-dim); font-size: 13px; }
#btn-cost-license-buy { align-self: center; margin: 6px 0 14px; }
.cost-training-help { color: var(--ink-dim); font-size: 12px; }
.cost-training-help b { color: var(--ink); }
.cost-tune-max {
  border: 1px solid var(--exp);
  color: var(--exp);
  border-radius: var(--radius-s);
  padding: 9px 12px;
  margin-top: 6px;
  font-size: 13px;
}
