﻿/* â”€â”€ Combat UI â€” game-style mockup (JRPG / PokÃ©mon battle screen) â”€â”€ */

:root {
  --bg-deep: #0a0605;
  --panel: #1a1210;
  --panel-edge: #3d2a22;
  --panel-highlight: #5c4034;
  --ink: #f2e8dc;
  --ink-dim: #b8a090;
  --hp-green: #58d068;
  --hp-green-dark: #2a8a38;
  --hp-yellow: #e8c040;
  --hp-red: #e84848;
  --hp-red-dark: #a02020;
  --enemy-hp: #f0a030;
  --enemy-hp-dark: #b06010;
  --accent: #e85d4c;
  --gold: #d4a574;
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Literata", Georgia, serif;
  --font-ui: "IBM Plex Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
}

/* Dev toolbar */
.dev-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.4rem 0.75rem;
  background: #1e100e;
  border-bottom: 1px solid rgba(232, 93, 76, 0.4);
  font-family: var(--font-ui);
  font-size: 0.65rem;
}

.dev-badge {
  background: #a33a2e;
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.dev-hint { color: #8a7a6a; }

.dev-scenes { display: flex; flex-wrap: wrap; gap: 0.25rem; flex: 1; }

.dev-scene {
  background: #120c0a;
  border: 1px solid #3a2e24;
  color: #9a8474;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.dev-scene:hover { border-color: var(--gold); color: var(--gold); }
.dev-scene.is-active { border-color: var(--accent); color: var(--accent); background: rgba(232,93,76,0.1); }

/* Root layout */
.battle-root {
  height: 100vh;
  padding-top: 2.4rem;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(80, 24, 16, 0.5) 0%, transparent 55%),
    var(--bg-deep);
}

.battle-frame {
  width: min(100%, calc(min(56vh, 640px) * 16 / 10), 98vw);
  max-height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 3px solid var(--panel-edge);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px #0a0605,
    0 12px 48px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
  position: relative;
}

/* â”€â”€ Stage â”€â”€ */
.battle-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: min(56vh, 640px);
  height: auto;
  flex-shrink: 0;
  overflow: hidden;
  min-height: 0;
}

.battle-sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1a0c0a 0%, #120808 35%, #0e0a08 100%);
}

.battle-floor {
  position: absolute;
  bottom: 0;
  left: -10%;
  right: -10%;
  height: 38%;
  background:
    radial-gradient(ellipse 70% 80% at 50% 100%, rgba(60, 40, 30, 0.9) 0%, transparent 70%),
    linear-gradient(180deg, transparent 0%, #1a100c 30%, #0e0806 100%);
}

.battle-vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* Turn announce */
.battle-announce {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.2rem;
  background: linear-gradient(180deg, #2a1814 0%, #1a100e 100%);
  border: 2px solid var(--panel-highlight);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
}

.battle-announce-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

body[data-scenario="foe-turn"] .battle-announce {
  color: var(--gold);
  border-color: rgba(212, 165, 116, 0.5);
}

body[data-scenario="foe-turn"] .battle-announce-dot {
  background: var(--gold);
}

/* Foe intent */
.battle-intent {
  position: absolute;
  top: 3.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  background: rgba(20, 10, 6, 0.92);
  border: 2px solid rgba(232, 192, 64, 0.45);
  border-radius: 4px;
  font-size: 0.75rem;
  color: #e8c040;
  white-space: nowrap;
}

.battle-intent-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  background: rgba(232, 192, 64, 0.2);
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
}

.battle-intent[hidden] { display: none !important; }

.battle-vignette--fp {
  box-shadow:
    inset 0 0 100px rgba(0, 0, 0, 0.65),
    inset 0 -40px 60px rgba(0, 0, 0, 0.5),
    inset 24px 0 40px rgba(0, 0, 0, 0.25),
    inset -24px 0 40px rgba(0, 0, 0, 0.25);
}

/* First-person floor — stronger perspective */
.battle-stage--fp .battle-floor {
  height: 42%;
  background:
    radial-gradient(ellipse 85% 70% at 50% 100%, rgba(50, 32, 24, 0.95) 0%, transparent 65%),
    linear-gradient(180deg, transparent 0%, #1a100c 25%, #0e0806 100%);
}

/* Sprites — uniform foe slots; stature/elevation modifiers only */
.battle-enemy-wrap {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 26%;
  max-width: 11.5rem;
  transition: opacity 0.4s, transform 0.4s, filter 0.25s, box-shadow 0.25s;
}

/* Slot positions (FP camera) */
.battle-enemy-wrap[data-slot="center"] {
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
}

.battle-enemy-wrap[data-slot="flank-left"] {
  top: 20%;
  left: 10%;
  z-index: 4;
}

.battle-enemy-wrap[data-slot="flank-right"] {
  top: 20%;
  right: 8%;
  z-index: 4;
}

.battle-enemy-wrap[data-slot="rear"] {
  top: 26%;
  left: 50%;
  transform: translateX(-50%) scale(0.88);
  opacity: 0.82;
  z-index: 3;
  filter: brightness(0.9);
}

/* Elevation — flying / elevated foes */
.battle-enemy-wrap[data-elevation="flying"] {
  top: 4%;
}

.battle-enemy-wrap[data-elevation="flying"][data-slot="center"] {
  transform: translateX(-50%) translateY(-4%);
}

.battle-enemy-wrap[data-elevation="flying"][data-slot="flank-left"],
.battle-enemy-wrap[data-elevation="flying"][data-slot="flank-right"] {
  transform: translateY(-6%);
}

/* Stature — large creatures only (ogres, dragons); normal humanoids share default slot */
.battle-enemy-wrap[data-stature="large"] {
  width: 34%;
  max-width: 15rem;
}

.battle-enemy-wrap[data-stature="large"][data-slot="center"] {
  top: 8%;
}

/* Clickable foe targets */
button.battle-target {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: inherit;
  outline: none;
  border-radius: 8px;
}

button.battle-target:hover:not(:disabled) .battle-sprite--enemy {
  transform: scale(1.03);
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.75)) brightness(1.08);
}

button.battle-target:focus-visible {
  box-shadow: 0 0 0 2px rgba(232, 192, 64, 0.55);
}

button.battle-target.is-targeted {
  box-shadow: 0 0 0 2px rgba(232, 192, 64, 0.45);
}

button.battle-target.is-menu-open {
  box-shadow:
    0 0 0 2px rgba(232, 192, 64, 0.75),
    0 0 24px rgba(232, 192, 64, 0.15);
}

button.battle-target:disabled {
  cursor: default;
  opacity: 0.55;
}

body[data-scenario="foe-turn"] button.battle-target,
body[data-scenario="victory"] button.battle-target {
  cursor: default;
  pointer-events: none;
}

/* Target context menu on stage */
.target-menu {
  position: absolute;
  z-index: 20;
  min-width: 11rem;
  max-width: 14rem;
  padding: 0.35rem 0;
  background: linear-gradient(180deg, rgba(24, 18, 14, 0.98) 0%, rgba(12, 9, 7, 0.98) 100%);
  border: 2px solid rgba(232, 192, 64, 0.45);
  border-radius: 8px;
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(6px);
}

.target-menu[hidden] {
  display: none !important;
}

.target-menu-title {
  margin: 0;
  padding: 0.35rem 0.75rem 0.45rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  border-bottom: 1px solid rgba(232, 192, 64, 0.2);
}

.target-menu-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
}

.target-menu-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.target-menu-item:hover,
.target-menu-item:focus-visible {
  background: rgba(232, 192, 64, 0.12);
  color: var(--gold);
  outline: none;
}

.target-menu-item--details {
  color: rgba(168, 208, 255, 0.95);
}

.target-menu-item--details:hover,
.target-menu-item--details:focus-visible {
  background: rgba(88, 160, 232, 0.12);
  color: #b8dcff;
}

.target-menu-divider {
  height: 1px;
  margin: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.08);
}

.target-menu-hint {
  margin: 0;
  padding: 0.35rem 0.75rem 0.45rem;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}


.battle-sprite {
  font-size: clamp(3rem, 9vw, 5.25rem);
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.75));
  line-height: 1;
  user-select: none;
  transition: transform 0.3s ease;
}

.battle-sprite--enemy {
  margin-top: 0.35rem;
}

.battle-enemy-wrap[data-stature="large"] .battle-sprite--enemy {
  font-size: clamp(4.2rem, 13vw, 7rem);
}

/* Player HUD — bottom-left of stage, compact, no portrait */
.battle-player-hud {
  position: absolute;
  bottom: 0.65rem;
  left: 0.65rem;
  z-index: 12;
  min-width: 10.5rem;
  max-width: 14rem;
  padding: 0.5rem 0.65rem;
  background: linear-gradient(180deg, rgba(20, 14, 12, 0.94) 0%, rgba(10, 8, 6, 0.92) 100%);
  border: 2px solid rgba(88, 208, 104, 0.35);
  border-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 16px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.battle-player-hud-name {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.battle-player-hud .battle-hp-label {
  color: var(--hp-green);
}

.battle-player-hud .battle-status-row {
  margin-top: 0.35rem;
}

body[data-scenario="foe-turn"] .battle-enemy-wrap[data-slot="center"] .battle-sprite--enemy {
  transform: scale(1.06) translateX(-4px);
}

body[data-scenario="hit"] .battle-enemy-wrap[data-slot="center"] .battle-sprite--enemy {
  animation: enemy-hit 0.45s ease;
}

@keyframes enemy-hit {
  0%, 100% { transform: translateX(0); filter: drop-shadow(0 12px 24px rgba(0,0,0,0.7)); }
  25% { transform: translateX(8px); filter: drop-shadow(0 12px 24px rgba(0,0,0,0.7)) brightness(1.8); }
  50% { transform: translateX(-4px); }
}

/* Damage pop — on primary foe */
.battle-damage {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, 0);
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: #ffe080;
  text-shadow: 0 2px 0 #a06010, 0 4px 12px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  z-index: 15;
}

.battle-damage[hidden] { display: none !important; }

body[data-scenario="hit"] .battle-damage {
  animation: dmg-float 1.1s ease forwards;
}

@keyframes dmg-float {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.6); }
  15% { opacity: 1; transform: translate(-50%, -8px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -48px) scale(1); }
}

/* â”€â”€ HUD panels (PokÃ©mon-style boxes) â”€â”€ */
.battle-hud {
  background: linear-gradient(180deg, #2a201c 0%, #1a1410 50%, #12100e 100%);
  border: 3px solid var(--panel-edge);
  border-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.45);
  padding: 0.55rem 0.75rem;
  min-width: 14rem;
}

.battle-hud--enemy {
  align-self: flex-start;
  width: 100%;
  min-width: 10.5rem;
  max-width: 11.5rem;
  border-color: rgba(232, 93, 76, 0.35);
}

.battle-hud-name {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.battle-hud-lv {
  font-size: 0.62rem;
  color: var(--ink-dim);
  font-family: var(--font-ui);
}

/* HP bars */
.battle-hp-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.4rem;
}

.battle-hp-label {
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--hp-green);
}

.battle-hud--enemy .battle-hp-label { color: var(--enemy-hp); }

.battle-hp-track {
  position: relative;
  height: 10px;
  background: #0a0604;
  border: 2px solid #0a0604;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.battle-hp-fill {
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--enemy-hp) 0%, var(--enemy-hp-dark) 100%);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.battle-hp-fill--player {
  background: linear-gradient(180deg, var(--hp-green) 0%, var(--hp-green-dark) 100%);
}

.battle-hp-fill.is-low {
  background: linear-gradient(180deg, var(--hp-red) 0%, var(--hp-red-dark) 100%);
}

.battle-hp-shine {
  position: absolute;
  top: 1px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, transparent 100%);
  pointer-events: none;
}

.battle-hp-num {
  font-family: var(--font-ui);
  font-size: 0.58rem;
  color: var(--ink-dim);
  min-width: 3.2rem;
  text-align: right;
}

/* Status icons */
.battle-status-row {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  font-size: 0.85rem;
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: default;
}

.status-icon--burn {
  background: linear-gradient(180deg, #4a1810 0%, #2a0c08 100%);
  border-color: rgba(232, 93, 76, 0.5);
}

.status-icon--buff {
  background: linear-gradient(180deg, #2a2818 0%, #1a1808 100%);
  border-color: rgba(232, 192, 64, 0.45);
}

.battle-order,
.battle-console,
.battle-cmd {
  flex-shrink: 0;
}

.battle-order {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.4rem 0.75rem;
  background: #100c0a;
  border-top: 2px solid var(--panel-edge);
  font-family: var(--font-ui);
  font-size: 0.62rem;
}

.order-chip {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #3a2e24;
  color: #8a7a6a;
  background: #0a0806;
}

.order-chip--active {
  border-color: rgba(232, 93, 76, 0.55);
  background: rgba(232, 93, 76, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.order-arrow { color: #5a4a3a; font-size: 0.7rem; }


/* â”€â”€ Cascade console: vertical main â†’ columns right â”€â”€ */
.battle-console {
  display: flex;
  align-items: stretch;
  min-height: 10.5rem;
  max-height: 12.5rem;
  background: linear-gradient(180deg, #1a1410 0%, #100c0a 100%);
  border-top: 3px solid var(--panel-edge);
  overflow: hidden;
}

.battle-console.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.cascade-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 2px solid var(--panel-edge);
  background: rgba(0, 0, 0, 0.15);
}

.cascade-col[hidden] { display: none !important; }

.cascade-col--main {
  flex: 0 0 5.5rem;
  background: linear-gradient(180deg, #221814 0%, #181210 100%);
}

.cascade-col--choice { flex: 1 1 9rem; min-width: 7rem; }
.cascade-col--modifier { flex: 0 0 7.5rem; }
.cascade-col--target { flex: 0 0 8.5rem; }

.cascade-head {
  flex-shrink: 0;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
}

.cascade-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.25rem;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: #5c4034 #0a0604;
}

.cascade-list--main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.35rem 0.3rem;
  overflow: hidden;
}

.cascade-list::-webkit-scrollbar { width: 6px; }
.cascade-list::-webkit-scrollbar-thumb { background: #5c4034; border-radius: 3px; }

.cascade-btn {
  display: block;
  width: 100%;
  padding: 0.45rem 0.35rem;
  background: linear-gradient(180deg, #2a201c 0%, #1a1410 100%);
  border: 2px solid var(--panel-edge);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}

.cascade-btn:hover:not(:disabled) {
  border-color: rgba(212, 165, 116, 0.45);
  color: var(--gold);
}

.cascade-btn.is-active {
  border-color: rgba(232, 93, 76, 0.55);
  background: linear-gradient(180deg, rgba(232, 93, 76, 0.2) 0%, #2a1814 100%);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(232, 93, 76, 0.2);
}

.cascade-btn--flee.is-active { border-color: rgba(212, 165, 116, 0.5); color: var(--gold); }
.cascade-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.cascade-tabs {
  display: flex;
  gap: 0.15rem;
  padding: 0.25rem 0.35rem 0;
  flex-shrink: 0;
}

.cascade-tabs[hidden] { display: none !important; }

.cascade-tab {
  flex: 1;
  padding: 0.2rem 0.25rem;
  background: #0e0a08;
  border: 1px solid #3a2e24;
  border-radius: 3px 3px 0 0;
  color: #7a6a5a;
  font-family: var(--font-ui);
  font-size: 0.52rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.cascade-tab.is-active {
  border-color: rgba(212, 165, 116, 0.45);
  background: rgba(212, 165, 116, 0.1);
  color: var(--gold);
}

.cascade-filter {
  flex-shrink: 0;
  padding: 0.25rem 0.35rem;
}

.cascade-filter input {
  width: 100%;
  padding: 0.22rem 0.4rem;
  background: #0a0604;
  border: 1px solid #3a2e24;
  border-radius: 3px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.58rem;
}

.cascade-filter input:focus {
  outline: none;
  border-color: rgba(212, 165, 116, 0.4);
}

.cascade-opt {
  display: block;
  width: 100%;
  padding: 0.38rem 0.4rem;
  margin-bottom: 0.15rem;
  background: linear-gradient(180deg, #221814 0%, #181210 100%);
  border: 2px solid transparent;
  border-radius: 4px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.1s, background 0.1s;
}

.cascade-opt:hover,
.cascade-opt.is-active {
  border-color: rgba(212, 165, 116, 0.4);
  background: linear-gradient(180deg, #2a2018 0%, #1e1612 100%);
}

.cascade-opt.is-active {
  border-color: rgba(232, 93, 76, 0.45);
}

.cascade-opt--target {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.opt-icon { font-size: 1.1rem; flex-shrink: 0; }
.opt-body { min-width: 0; flex: 1; }

.opt-name {
  display: block;
  font-family: var(--font-display);
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opt-meta {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.5rem;
  color: #7a6a5a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cascade-empty {
  padding: 0.75rem 0.4rem;
  font-size: 0.68rem;
  color: #6a5a4a;
  font-style: italic;
  text-align: center;
}

.cascade-preview {
  flex: 0 0 11rem;
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.55rem;
  background: rgba(0, 0, 0, 0.3);
  border-right: none;
  min-width: 0;
}

.preview-kicker {
  font-family: var(--font-ui);
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6a5a4a;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.preview-name {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

.preview-desc {
  font-size: 0.62rem;
  line-height: 1.4;
  color: var(--ink-dim);
  flex: 1;
  overflow-y: auto;
}

.preview-meta {
  font-family: var(--font-ui);
  font-size: 0.52rem;
  color: #7a6a5a;
  margin: 0.3rem 0;
}

.preview-confirm {
  margin-top: auto;
  padding: 0.35rem;
  background: linear-gradient(180deg, rgba(232, 93, 76, 0.28) 0%, rgba(232, 93, 76, 0.12) 100%);
  border: 2px solid rgba(232, 93, 76, 0.5);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.68rem;
  cursor: pointer;
}

.preview-confirm:hover:not(:disabled) { filter: brightness(1.12); }
.preview-confirm:disabled { opacity: 0.35; cursor: not-allowed; }
/* â”€â”€ Typed command bar â”€â”€ */
.battle-cmd {
  display: flex;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  background: #0a0806;
  border-top: 2px solid var(--panel-edge);
}

.battle-cmd-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  background: #120e0c;
  border: 2px solid #3a2e24;
  border-radius: 4px;
  padding: 0 0.45rem;
}

.battle-cmd-label:focus-within {
  border-color: rgba(212, 165, 116, 0.4);
}

.battle-cmd-prompt {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--accent);
  flex-shrink: 0;
}

.battle-cmd-label input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.72rem;
}

.battle-cmd-label input::placeholder { color: #5a4a3a; }
.battle-cmd-label input:focus { outline: none; }

.battle-cmd-go {
  padding: 0 1rem;
  background: linear-gradient(180deg, #3a2a24 0%, #2a201c 100%);
  border: 2px solid var(--panel-highlight);
  border-radius: 4px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  flex-shrink: 0;
}

.battle-cmd-go:hover:not(:disabled) {
  border-color: var(--gold);
  color: #ffe0b0;
}

.battle-cmd-go:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* â”€â”€ Battle log (below command input) â”€â”€ */
.battle-logbox {
  padding: 0.55rem 0.85rem;
  min-height: 3.2rem;
  max-height: 4.5rem;
  overflow-y: auto;
  background: #080604;
  border-top: 2px solid var(--panel-edge);
  font-size: 0.78rem;
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: #5c4034 #080604;
}

.battle-logline {
  margin-bottom: 0.2rem;
  color: var(--ink-dim);
}

.battle-logline--hit { color: var(--ink); }
.battle-logline--hit strong { color: #ffe080; }
.battle-logline--fx { color: var(--accent); }
.battle-logline--fx strong { color: #ff9060; }
.battle-logline--miss { color: #6a5a4a; font-style: italic; }
.battle-logline--cmd { color: var(--gold); font-family: var(--font-ui); font-size: 0.72rem; }

/* â”€â”€ Victory â”€â”€ */
.battle-victory {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  background: rgba(5, 3, 2, 0.82);
  backdrop-filter: blur(4px);
}

.battle-victory.is-open { display: grid; }
.battle-victory[hidden] { display: none !important; }

.battle-victory-panel {
  text-align: center;
  padding: 2rem 2.5rem;
  background: linear-gradient(180deg, #2a2018 0%, #1a1410 100%);
  border: 3px solid rgba(88, 208, 104, 0.4);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.battle-victory-tag {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hp-green);
  margin-bottom: 0.35rem;
}

.battle-victory-panel h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.battle-loot {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.loot-chip {
  padding: 0.3rem 0.75rem;
  background: rgba(212, 165, 116, 0.12);
  border: 2px solid rgba(212, 165, 116, 0.35);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--gold);
}

.battle-victory-btn {
  padding: 0.55rem 1.5rem;
  background: linear-gradient(180deg, var(--hp-green) 0%, var(--hp-green-dark) 100%);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #0a0604;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.battle-victory-btn:hover {
  filter: brightness(1.1);
}

/* Victory scenario */
body[data-scenario="victory"] .battle-enemy-wrap {
  opacity: 0;
  transform: translateY(12px);
}

body[data-scenario="victory"] .battle-enemy-wrap[data-slot="center"] {
  transform: translateX(-50%) translateY(12px);
}

/* Mobile */
@media (max-width: 600px) {
  .battle-frame { max-height: calc(100vh - 3.5rem); border-radius: 0; border-left: none; border-right: none; }
  .battle-stage { max-height: min(48vh, 520px); }
  .battle-enemy-wrap { width: 30%; max-width: none; }
  .battle-player-hud { max-width: 11rem; bottom: 0.4rem; left: 0.4rem; }
  .battle-console { flex-wrap: wrap; max-height: none; min-height: auto; }
  .cascade-col--main { flex: 0 0 100%; flex-direction: row; border-right: none; border-bottom: 2px solid var(--panel-edge); }
  .cascade-list--main { flex-direction: row; overflow-x: auto; }
  .cascade-btn { min-width: 4.5rem; }
  .cascade-col--choice,
  .cascade-col--modifier,
  .cascade-col--target { flex: 1 1 45%; max-height: 6rem; }
  .cascade-preview { flex: 1 1 100%; max-height: 5rem; border-top: 2px solid var(--panel-edge); }
}
