/* ═══════════════════════════════════════════════════
   ELEMENTIUM — Periodic Table Monster RPG
   Chemistry-based type system visual theme
   ═══════════════════════════════════════════════════ */

:root {
  --bg-dark: #080c14;
  --bg-panel: #0f1825;
  --bg-panel-light: #172030;
  --bg-accent: #1a2840;
  --border: #1e3050;
  --border-glow: #3b82f6;
  --text: #d4e0f0;
  --text-dim: #4a6080;
  --text-bright: #eef4ff;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #eab308;
  --gold: #fbbf24;

  /* Chemistry type colors */
  --type-alkali:      #a855f7;
  --type-earth:       #b45309;
  --type-noble:       #3b82f6;
  --type-halogen:     #22c55e;
  --type-organic:     #eab308;
  --type-radioactive: #ef4444;
  --type-metalloid:   #f97316;
  --type-gas:         #94a3b8;

  --hp-bar:     #22c55e;
  --hp-bar-mid: #eab308;
  --hp-bar-low: #ef4444;
  --xp-bar:     #3b82f6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Chakra Petch', 'Courier New', monospace;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100vw; height: 100vh;
  max-width: 920px; max-height: 720px;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg-dark);
}

@media (max-width: 920px) {
  #app { border: none; border-radius: 0; max-width: 100%; max-height: 100%; }
}

#scanlines {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px);
  pointer-events: none; z-index: 1000;
}

#screen { position: relative; width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden; }

/* ── Typography ────────────────────────────── */
.title-text {
  font-family: 'Silkscreen', 'Courier New', monospace;
  font-size: 3rem; letter-spacing: 6px; text-align: center;
  background: linear-gradient(135deg, #60a5fa, #a855f7, #22c55e, #eab308);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: title-pulse 3s ease-in-out infinite;
}
@keyframes title-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.3); } }

.subtitle   { text-align: center; color: var(--text-dim); font-size: 0.85rem; letter-spacing: 3px; margin-top: 4px; }
.title-tagline { text-align: center; color: var(--accent-light); font-size: 0.75rem; margin-top: 8px; }

/* ── Scrolling periodic parade ──────────────── */
.periodic-parade {
  text-align: center; font-size: 0.9rem; letter-spacing: 8px;
  color: var(--text-dim); margin-bottom: 8px;
  animation: parade 20s linear infinite;
  white-space: nowrap; overflow: hidden;
}
@keyframes parade { 0% { letter-spacing: 8px; color: #4a6080; } 50% { letter-spacing: 12px; color: var(--accent-light); } 100% { letter-spacing: 8px; color: #4a6080; } }

/* ── Cards & Panels ──────────────────────────── */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 16px;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
  background: var(--bg-accent); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 14px; cursor: pointer; font-family: inherit;
  font-size: 0.82rem; transition: all 0.15s; text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--bg-panel-light); border-color: var(--accent); color: var(--text-bright); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: #2563eb; }
.btn-warning { background: var(--warning); color: #000; border-color: var(--warning); }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }

/* ── Forms ────────────────────────────────────── */
.name-input {
  width: 100%; background: var(--bg-dark); color: var(--text-bright);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 14px; font-family: inherit; font-size: 0.9rem; display: block;
}
.name-input:focus { outline: none; border-color: var(--accent); }

/* ── Screen Enter Animation ────────────────────── */
.screen-enter { animation: fade-in 0.3s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Title Screen ─────────────────────────────── */
.title-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh; padding: 24px;
  gap: 12px;
}
.title-buttons { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 280px; }
.title-type-legend { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 420px; margin-top: 8px; }
.auth-form { display: flex; flex-direction: column; }

/* ── Type Badges ─────────────────────────────── */
.type-badge {
  display: inline-block; border-radius: 4px; color: #fff;
  font-size: 0.72rem; padding: 2px 7px; font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5); letter-spacing: 0.5px;
}

/* ── Element Card ────────────────────────────── */
.element-card {
  border-radius: 8px; padding: 12px;
  border: 1px solid var(--border);
  background: var(--bg-panel-light);
}
.element-card.alkali-type      { border-color: var(--type-alkali); }
.element-card.earth-type       { border-color: var(--type-earth); }
.element-card.noble-type       { border-color: var(--type-noble); }
.element-card.halogen-type     { border-color: var(--type-halogen); }
.element-card.organic-type     { border-color: var(--type-organic); }
.element-card.radioactive-type { border-color: var(--type-radioactive); box-shadow: 0 0 8px rgba(239,68,68,0.3); }
.element-card.metalloid-type   { border-color: var(--type-metalloid); }
.element-card.gas-type         { border-color: var(--type-gas); }

.element-header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.element-symbol-block {
  background: var(--bg-dark); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; text-align: center; min-width: 60px;
}
.element-atomic-num { font-size: 0.68rem; color: var(--text-dim); }
.element-symbol { font-size: 1.6rem; font-weight: 700; color: var(--text-bright); line-height: 1.1; }
.element-mass { font-size: 0.65rem; color: var(--text-dim); }
.element-meta { flex: 1; }
.element-sprite { font-size: 1.8rem; display: flex; align-items: center; }
.element-sprite svg { display: block; border-radius: 6px; }
.element-name { font-size: 1rem; font-weight: 600; color: var(--text-bright); }
.element-state-badge { font-size: 0.68rem; color: var(--text-dim); margin-top: 3px; }
.element-electron-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 0.72rem; }
.electron-label { color: var(--text-dim); font-size: 0.65rem; }
.electron-config-text { font-family: 'Courier New', monospace; font-size: 0.72rem; }
.element-fact { font-size: 0.75rem; color: var(--accent-light); font-style: italic; padding-top: 6px; border-top: 1px solid var(--border); }
.compound-eq { font-size: 0.85rem; color: var(--type-organic); font-family: 'Courier New', monospace; padding: 4px 8px; background: var(--bg-dark); border-radius: 4px; margin-bottom: 6px; }
.compound-badge { font-size: 0.7rem; background: var(--type-organic); color: #000; padding: 2px 6px; border-radius: 4px; display: inline-block; }

/* ── Character Create ─────────────────────────── */
.char-create { padding: 20px; overflow-y: auto; min-height: 100vh; }
.class-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.class-card {
  background: var(--bg-panel); border: 2px solid var(--border);
  border-radius: 8px; padding: 12px; cursor: pointer; text-align: center; transition: all 0.15s;
}
.class-card:hover  { border-color: var(--accent); background: var(--bg-panel-light); }
.class-card.selected { border-color: var(--accent); background: rgba(59,130,246,0.15); }
.class-icon   { font-size: 2rem; margin-bottom: 6px; }
.class-name   { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.class-desc   { font-size: 0.72rem; color: var(--text-dim); margin-bottom: 4px; }
.class-starter{ font-size: 0.72rem; color: var(--accent-light); }

/* ── Game Screen ─────────────────────────────── */
.game-screen { display: flex; flex-direction: column; height: 100vh; }
.game-header {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-panel); border-bottom: 1px solid var(--border);
  padding: 8px 14px; flex-shrink: 0;
}
.player-info { display: flex; gap: 10px; align-items: center; }
.player-name  { font-weight: 700; color: var(--text-bright); }
.player-class { font-size: 0.75rem; color: var(--text-dim); }
.player-badges{ font-size: 0.78rem; color: var(--gold); }
.player-resources { display: flex; gap: 10px; font-size: 0.8rem; }
.gold-display { color: var(--gold); font-weight: 600; }

.tab-bar {
  display: flex; background: var(--bg-panel); border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0;
}
.tab-btn {
  background: none; border: none; color: var(--text-dim);
  padding: 10px 14px; cursor: pointer; font-family: inherit; font-size: 0.78rem;
  white-space: nowrap; border-bottom: 2px solid transparent; transition: all 0.15s;
}
.tab-btn:hover  { color: var(--text); background: var(--bg-panel-light); }
.tab-btn.active { color: var(--accent-light); border-bottom-color: var(--accent); }

.tab-content { flex: 1; overflow-y: auto; padding: 14px; }

/* ── Explore Tab ─────────────────────────────── */
.explore-tab { }
.area-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.area-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; transition: border-color 0.15s;
}
.area-card:hover:not(.locked) { border-color: var(--accent); }
.area-card.locked { opacity: 0.55; }
.area-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.area-name   { font-weight: 600; font-size: 0.9rem; }
.area-desc   { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 6px; }
.area-levels { font-size: 0.7rem; color: var(--text-dim); margin-bottom: 8px; }
.area-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.area-locked-msg { font-size: 0.72rem; color: var(--text-dim); }
.compound-alert { animation: pulse-border 1.5s ease-in-out infinite; }
@keyframes pulse-border { 0%,100%{box-shadow:0 0 0 0 rgba(234,179,8,0);} 50%{box-shadow:0 0 0 4px rgba(234,179,8,0.3);} }

/* ── Party Tab ───────────────────────────────── */
.party-tab { }
.party-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.party-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; cursor: pointer; transition: all 0.15s;
}
.party-card:hover  { border-color: var(--accent); }
.party-card.fainted { opacity: 0.5; }
.party-card-header { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.party-sprite { font-size: 2rem; }
.party-name   { font-weight: 600; font-size: 0.9rem; }
.party-symbol { font-size: 0.75rem; color: var(--text-dim); }
.party-level  { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }
.party-stats  { font-size: 0.72rem; color: var(--text-dim); margin-top: 4px; }
.storage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.storage-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px; font-size: 0.78rem; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: border-color 0.15s;
}
.storage-card:hover { border-color: var(--accent); }

/* ── HP/XP Bars ──────────────────────────────── */
.hp-row, .xp-row {
  display: flex; align-items: center; gap: 6px; font-size: 0.72rem; margin-bottom: 4px;
}
.bar-track { flex: 1; height: 8px; background: var(--bg-dark); border-radius: 4px; overflow: hidden; }
.bar-track.wide { height: 10px; }
.bar-hp     { height: 100%; background: var(--hp-bar);     border-radius: 4px; transition: width 0.8s cubic-bezier(0.25,0.46,0.45,0.94), background-color 0.3s; position: relative; overflow: hidden; }
.bar-hp.mid { background: var(--hp-bar-mid); }
.bar-hp.low { background: var(--hp-bar-low); }
.bar-xp     { height: 100%; background: var(--xp-bar);     border-radius: 4px; transition: width 0.5s cubic-bezier(0.25,0.46,0.45,0.94); position: relative; overflow: hidden; }

/* ── Status & Held Item ──────────────────────── */
.status-badge {
  display: inline-block; font-size: 0.65rem; padding: 2px 6px;
  border-radius: 4px; font-weight: 600; margin-top: 3px;
}
.status-badge.burn     { background: #f97316; color: #fff; }
.status-badge.poison   { background: #a855f7; color: #fff; }
.status-badge.paralysis{ background: #eab308; color: #000; }
.status-badge.sleep    { background: #3b82f6; color: #fff; }
.held-item-badge { font-size: 0.68rem; color: var(--gold); margin-top: 2px; }
.atomic-info { font-size: 0.68rem; color: var(--text-dim); margin-top: 2px; font-family: 'Courier New', monospace; }
.state-chip { font-size: 0.65rem; background: var(--bg-dark); padding: 1px 5px; border-radius: 3px; color: var(--text-dim); }

/* ── Inventory Tab ───────────────────────────── */
.inventory-tab { }
.item-group { margin-bottom: 16px; }
.item-group-label { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.item-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; text-align: center;
}
.item-icon  { font-size: 1.6rem; margin-bottom: 4px; }
.item-name  { font-size: 0.8rem; font-weight: 600; }
.item-qty   { font-size: 1rem; color: var(--gold); font-weight: 700; }
.item-desc  { font-size: 0.68rem; color: var(--text-dim); margin: 4px 0; }

/* ── Journal Tab ─────────────────────────────── */
.journal-tab { }
.journal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.journal-stats { font-size: 0.78rem; color: var(--text-dim); display: flex; gap: 12px; }
.journal-progress-bar { height: 6px; background: var(--bg-dark); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.journal-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--type-organic)); border-radius: 3px; transition: width 0.5s; }
.journal-group { margin-bottom: 16px; }
.journal-group-header { font-size: 0.8rem; font-weight: 600; padding: 6px 10px; border-radius: 6px; margin-bottom: 8px; }
.journal-element-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.journal-entry {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px; text-align: center; cursor: pointer;
  transition: all 0.15s;
}
.journal-entry:hover { border-color: var(--accent); transform: scale(1.03); }
.journal-entry.caught { border-color: rgba(34,197,94,0.4); }
.journal-entry.seen   { border-color: rgba(59,130,246,0.3); opacity: 0.8; }
.journal-entry.unknown{ opacity: 0.4; }
.journal-sprite        { font-size: 1.4rem; }
.journal-element-symbol{ font-size: 0.85rem; font-weight: 700; }
.journal-element-name  { font-size: 0.6rem; color: var(--text-dim); }
.journal-atomic        { font-size: 0.58rem; color: var(--text-dim); }
.journal-fact-snippet  { font-size: 0.7rem; }
.achievement-entry {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; margin-bottom: 4px;
  background: var(--bg-panel); border: 1px solid var(--border);
  font-size: 0.78rem;
}
.achievement-entry.earned { border-color: rgba(234,179,8,0.5); background: rgba(234,179,8,0.06); }
.achievement-entry.locked { opacity: 0.5; }
.quest-entry {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; margin-bottom: 4px;
  background: var(--bg-panel); border: 1px solid var(--border);
  font-size: 0.78rem;
}
.quest-entry.completed { border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.05); }

/* ── Shop Tab ────────────────────────────────── */
.shop-tab { }
.shop-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.shop-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px;
}
.shop-icon       { font-size: 1.5rem; }
.shop-item-info  { flex: 1; }
.shop-item-name  { font-size: 0.85rem; font-weight: 600; }
.shop-item-desc  { font-size: 0.7rem; color: var(--text-dim); }
.shop-owned      { font-size: 0.7rem; color: var(--gold); }

/* ── Save Tab ────────────────────────────────── */
.save-tab { }
.save-slot {
  margin-bottom: 10px; padding: 12px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px;
}
.save-slot-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-weight: 600; }

/* ── Battle Screen ───────────────────────────── */
.battle-screen {
  display: grid;
  grid-template-columns: 158px 1fr 148px;
  grid-template-rows: 100vh;
  height: 100vh;
  background: linear-gradient(180deg, var(--bg-dark) 0%, #0a1525 60%, #060e1a 100%);
  overflow: hidden;
}

/* Left margin — Moves */
.battle-left-panel {
  grid-column: 1;
  display: flex; flex-direction: column;
  background: rgba(8,12,20,0.90);
  border-right: 1px solid var(--border);
  padding: 8px 6px;
  overflow-y: auto;
  gap: 5px;
}

/* Center — field + log */
.battle-center {
  grid-column: 2;
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Right margin — Items + Options */
.battle-right-panel {
  grid-column: 3;
  display: flex; flex-direction: column;
  background: rgba(8,12,20,0.90);
  border-left: 1px solid var(--border);
  padding: 8px 6px;
  overflow-y: auto;
  gap: 4px;
}

/* Panel section headers */
.battle-panel-label {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 2px;
  color: var(--text-dim); text-transform: uppercase;
  padding: 3px 2px 4px; margin-top: 4px;
  border-bottom: 1px solid var(--border);
}
.battle-panel-label:first-child { margin-top: 0; }
.battle-panel-section {
  display: flex; flex-direction: column; gap: 3px;
}

/* Buttons inside the side panels fill full width */
.battle-left-panel .btn,
.battle-right-panel .btn {
  width: 100%;
}

.battle-field {
  flex: 1; display: flex; flex-direction: column; justify-content: space-around;
  padding: 12px; gap: 8px; min-height: 0; position: relative;
}
.battle-enemy-side {
  display: flex; align-items: center; gap: 12px; justify-content: flex-end;
}
.battle-player-side {
  display: flex; align-items: center; gap: 12px;
}
.battle-info-card {
  background: rgba(15,24,37,0.92); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; min-width: 0; flex: 1;
}
.battle-name   { font-size: 0.95rem; font-weight: 700; color: var(--text-bright); }
.battle-symbol { font-size: 0.75rem; color: var(--text-dim); }
.battle-sprite {
  font-size: 3.5rem; text-align: center;
  filter: drop-shadow(0 0 10px rgba(59,130,246,0.4));
  transition: transform 0.2s, filter 0.2s;
  display: flex; align-items: center; justify-content: center;
  min-width: 72px; min-height: 72px;
  will-change: transform, filter, opacity;
  position: relative;
}
.battle-sprite svg { display: block; border-radius: 8px; }
.battle-sprite.attack-right { animation: attack-r 0.4s ease-out; }
.battle-sprite.attack-left  { animation: attack-l 0.4s ease-out; }
.battle-sprite.shake        { animation: shake   0.35s ease-out; }
@keyframes attack-r { 0%{transform:translateX(0);} 40%{transform:translateX(20px) scale(1.1);} 100%{transform:translateX(0);} }
@keyframes attack-l { 0%{transform:translateX(0);} 40%{transform:translateX(-20px) scale(1.1);} 100%{transform:translateX(0);} }
@keyframes shake    { 0%,100%{transform:translateX(0);} 20%{transform:translateX(-6px);} 40%{transform:translateX(6px);} 60%{transform:translateX(-4px);} 80%{transform:translateX(4px);} }

.battle-log {
  height: 130px; overflow-y: auto; background: rgba(8,12,20,0.9);
  border-top: 1px solid var(--border); padding: 8px 10px;
  font-size: 0.78rem; flex-shrink: 0;
}
.log-line { padding: 2px 0; line-height: 1.5; border-bottom: 1px solid rgba(255,255,255,0.03); }
.effective     { color: var(--danger); font-weight: 700; }
.not-effective { color: var(--text-dim); }
.crit          { color: var(--warning); font-weight: 700; }
.edu-note      { color: var(--accent-light); font-size: 0.72rem; font-style: italic; }
.chem-concept  { color: var(--type-organic); font-size: 0.75rem; cursor: help; }
.radioactive-dmg { color: var(--type-radioactive); font-weight: 600; }

/* Legacy — hidden in new layout, kept for any fallback renders */
.battle-action-area { display: none; }
.battle-actions { display: flex; gap: 8px; }
.battle-side-actions { display: none; }

/* Move buttons — full-width in left panel */
.move-grid { display: flex; flex-direction: column; gap: 5px; }
.move-btn {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 2px; padding: 8px 8px; font-size: 0.78rem; border-width: 2px;
  background: var(--bg-dark); min-height: 52px;
}
.move-btn:hover:not(:disabled) { background: var(--bg-panel-light); }
.move-btn-name  { font-weight: 700; font-size: 0.8rem; }
.move-btn-type  { font-size: 0.62rem; font-weight: 600; }
.move-btn-power { font-size: 0.62rem; color: var(--text-dim); }

/* ── Modals ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  max-width: 420px; width: 100%; max-height: 90vh;
  overflow-y: auto; animation: fade-in 0.2s ease-out;
}
.monster-detail { }
.move-entry {
  display: flex; align-items: center; gap: 6px; padding: 5px 6px;
  border-radius: 5px; margin-bottom: 4px; background: var(--bg-dark);
  font-size: 0.78rem;
}
.move-name  { font-weight: 600; min-width: 110px; }
.move-power { font-size: 0.68rem; color: var(--text-dim); }
.move-desc  { font-size: 0.68rem; color: var(--accent-light); font-style: italic; flex: 1; }

/* ── Compound Animation ──────────────────────── */
.compound-animation {
  text-align: center; animation: fade-in 0.3s ease-out;
  background: linear-gradient(135deg, var(--bg-panel), #0a2515);
  border: 2px solid var(--type-organic);
}
.compound-flash {
  font-size: 1rem; font-weight: 700; color: var(--type-organic);
  letter-spacing: 2px; animation: pulse-glow 1s ease-in-out infinite;
  padding: 8px 0;
}
@keyframes pulse-glow { 0%,100%{text-shadow:0 0 5px var(--type-organic);} 50%{text-shadow:0 0 20px var(--type-organic);} }
.compound-equation { font-family: 'Courier New', monospace; color: var(--text-bright); font-size: 1.3rem; }
.compound-explanation { color: var(--accent-light); font-size: 0.85rem; }

/* ── Evolution Flash ─────────────────────────── */
.evo-flash {
  position: fixed; inset: 0; background: #fff; z-index: 999;
  animation: evo-flash-anim 1.2s ease-out forwards;
}
@keyframes evo-flash-anim { 0%{opacity:0;} 20%{opacity:1;} 100%{opacity:0;} }

/* ── Notifications ────────────────────────────── */
.notification {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 20px; font-size: 0.85rem;
  z-index: 990; animation: notif-in 0.3s ease-out;
  max-width: 340px; text-align: center;
}
@keyframes notif-in { from{opacity:0;transform:translateX(-50%) translateY(10px);} to{opacity:1;transform:translateX(-50%) translateY(0);} }
.notification.success { border-color: var(--success); color: var(--success); }
.notification.error   { border-color: var(--danger);  color: var(--danger); }
.notification.info    { border-color: var(--accent);  color: var(--accent-light); }

/* ── Achievement Toast ───────────────────────── */
.achievement-toast {
  position: fixed; top: 20px; right: 16px; z-index: 980;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-panel); border: 2px solid var(--gold);
  border-radius: 10px; padding: 12px 16px;
  animation: slide-in-right 0.4s ease-out;
  box-shadow: 0 0 16px rgba(251,191,36,0.3);
}
.ach-icon { font-size: 1.5rem; }
@keyframes slide-in-right { from{opacity:0;transform:translateX(80px);} to{opacity:1;transform:none;} }

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar       { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ══════════════════════════════════════════════════
   BATTLE MAPS — Area-specific backgrounds
   ══════════════════════════════════════════════════ */

/* Base battle field gets background set by JS class */
.battle-screen.map-freshman_lab {
  background: linear-gradient(180deg, #0a1020 0%, #0d1a2e 40%, #071220 100%);
}
.battle-screen.map-freshman_lab .battle-field::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(59,130,246,0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(34,197,94,0.06) 0%, transparent 35%),
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><text y='30' font-size='16' fill='rgba(59,130,246,0.08)'>H He Li Be</text><text y='60' font-size='16' fill='rgba(59,130,246,0.06)'>B  C  N  O</text><text y='90' font-size='16' fill='rgba(59,130,246,0.04)'>F  Ne Na Mg</text></svg>") repeat;
}

.battle-screen.map-salt_flats {
  background: linear-gradient(180deg, #1a0e08 0%, #2d1505 40%, #0e0a05 100%);
}
.battle-screen.map-salt_flats .battle-field::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 50% 90%, rgba(251,191,36,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 60%, rgba(168,85,247,0.08) 0%, transparent 30%);
}

.battle-screen.map-iron_mines {
  background: linear-gradient(180deg, #0a0a0a 0%, #1a0f08 40%, #100808 100%);
}
.battle-screen.map-iron_mines .battle-field::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 30% 70%, rgba(180,83,9,0.15) 0%, transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(120,53,15,0.10) 0%, transparent 35%);
  animation: forge-pulse 3s ease-in-out infinite;
}
@keyframes forge-pulse { 0%,100%{opacity:0.7;} 50%{opacity:1;} }

.battle-screen.map-crystal_caverns {
  background: linear-gradient(180deg, #050a14 0%, #0a1530 40%, #050a20 100%);
}
.battle-screen.map-crystal_caverns .battle-field::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 25% 40%, rgba(147,197,253,0.12) 0%, transparent 30%),
    radial-gradient(circle at 75% 60%, rgba(196,181,253,0.10) 0%, transparent 25%),
    radial-gradient(circle at 50% 80%, rgba(34,197,94,0.08) 0%, transparent 20%);
  animation: crystal-shimmer 4s ease-in-out infinite;
}
@keyframes crystal-shimmer { 0%,100%{opacity:0.8;} 50%{opacity:1;} }

.battle-screen.map-volcanic_vents {
  background: linear-gradient(180deg, #150508 0%, #2a0a05 40%, #150305 100%);
}
.battle-screen.map-volcanic_vents .battle-field::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 30% 90%, rgba(239,68,68,0.18) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 85%, rgba(249,115,22,0.14) 0%, transparent 35%);
  animation: lava-glow 2s ease-in-out infinite;
}
@keyframes lava-glow { 0%,100%{opacity:0.8;} 50%{opacity:1;filter:brightness(1.2);} }

.battle-screen.map-noble_heights {
  background: linear-gradient(180deg, #050810 0%, #081020 40%, #030610 100%);
}
.battle-screen.map-noble_heights .battle-field::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(59,130,246,0.15) 0%, transparent 50%),
    radial-gradient(circle at 20% 70%, rgba(147,197,253,0.08) 0%, transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(196,181,253,0.08) 0%, transparent 30%);
  animation: noble-float 6s ease-in-out infinite;
}
@keyframes noble-float { 0%,100%{transform:translateY(0);opacity:0.9;} 50%{transform:translateY(-8px);opacity:1;} }

.battle-screen.map-the_reactor {
  background: linear-gradient(180deg, #020408 0%, #050a08 40%, #020804 100%);
}
.battle-screen.map-the_reactor .battle-field::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(34,197,94,0.06) 0%, transparent 60%),
    radial-gradient(circle at 30% 80%, rgba(239,68,68,0.10) 0%, transparent 30%),
    radial-gradient(circle at 70% 80%, rgba(239,68,68,0.10) 0%, transparent 30%);
  animation: reactor-pulse 1.5s ease-in-out infinite;
}
@keyframes reactor-pulse { 0%,100%{opacity:0.6;} 50%{opacity:1;} }

/* battle-field position:relative already set above; children above ::before overlay */
.battle-field > * { position: relative; z-index: 1; }

/* Floating particles in battle */
.battle-particle {
  position: absolute; pointer-events: none; border-radius: 50%;
  animation: particle-float linear forwards;
  z-index: 2;
}
@keyframes particle-float {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ══════════════════════════════════════════════════
   BATTLE ANIMATIONS — Move effects (Enhanced)
   ══════════════════════════════════════════════════ */

/* Battle field position context for effects */
.battle-field { position: relative; overflow: hidden; }

/* Hit flash on defender — enhanced with intensity */
.battle-sprite.hit-flash { animation: hit-flash-anim 0.45s ease-out; }
@keyframes hit-flash-anim {
  0%   { filter: drop-shadow(0 0 10px rgba(59,130,246,0.4)); }
  15%  { filter: brightness(4) drop-shadow(0 0 24px #fff); }
  30%  { filter: brightness(0.3) drop-shadow(0 0 8px rgba(255,0,0,0.6)); }
  50%  { filter: brightness(2.5) drop-shadow(0 0 16px #fff); }
  100% { filter: drop-shadow(0 0 10px rgba(59,130,246,0.4)); }
}

/* Type-colored attack glows — enhanced with unique motions per type */
.battle-sprite.attack-alkali      { animation: attack-alkali-fx 0.5s cubic-bezier(0.5,0,0.75,0); filter: drop-shadow(0 0 16px #a855f7) !important; }
.battle-sprite.attack-earth       { animation: attack-earth-fx 0.5s cubic-bezier(0.36,0.07,0.19,0.97); filter: drop-shadow(0 0 14px #b45309) !important; }
.battle-sprite.attack-noble       { animation: attack-noble-fx 0.5s cubic-bezier(0.68,-0.55,0.27,1.55); filter: drop-shadow(0 0 16px #3b82f6) !important; }
.battle-sprite.attack-halogen     { animation: attack-halogen-fx 0.45s ease-out; filter: drop-shadow(0 0 14px #22c55e) !important; }
.battle-sprite.attack-organic     { animation: attack-organic-fx 0.5s ease-out; filter: drop-shadow(0 0 14px #eab308) !important; }
.battle-sprite.attack-radioactive { animation: attack-radio-fx 0.55s cubic-bezier(0.36,0.07,0.19,0.97); filter: drop-shadow(0 0 18px #ef4444) brightness(1.4) !important; }
.battle-sprite.attack-metalloid   { animation: attack-metal-fx 0.5s ease-out; filter: drop-shadow(0 0 14px #f97316) !important; }
.battle-sprite.attack-gas         { animation: attack-gas-fx 0.5s ease-out; filter: drop-shadow(0 0 14px #94a3b8) !important; }

/* Alkali: explosive slam forward */
@keyframes attack-alkali-fx {
  0%   { transform: translateX(0) scale(1); }
  25%  { transform: translateX(8px) scale(1.15); }
  45%  { transform: translateX(28px) scale(1.25); }
  60%  { transform: translateX(12px) scale(0.9); }
  100% { transform: translateX(0) scale(1); }
}
/* Earth: heavy ground pound */
@keyframes attack-earth-fx {
  0%   { transform: translate(0, 0) scale(1); }
  20%  { transform: translate(0, -14px) scale(1.1); }
  50%  { transform: translate(12px, 8px) scale(1.2); }
  70%  { transform: translate(6px, 0) scale(0.95); }
  100% { transform: translate(0, 0) scale(1); }
}
/* Noble: swift dash */
@keyframes attack-noble-fx {
  0%   { transform: translateX(0) scale(1); opacity: 1; }
  10%  { transform: translateX(0) scale(0.9); opacity: 0.7; }
  40%  { transform: translateX(35px) scale(1.15); opacity: 1; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
/* Halogen: toxic lunge */
@keyframes attack-halogen-fx {
  0%   { transform: translateX(0) rotate(0deg); }
  30%  { transform: translateX(20px) rotate(8deg) scale(1.1); }
  60%  { transform: translateX(10px) rotate(-3deg); }
  100% { transform: translateX(0) rotate(0deg); }
}
/* Organic: combustion burst */
@keyframes attack-organic-fx {
  0%   { transform: translate(0, 0) scale(1); }
  30%  { transform: translate(16px, -6px) scale(1.2); }
  50%  { transform: translate(20px, 0) scale(1.3); }
  70%  { transform: translate(8px, 2px) scale(0.95); }
  100% { transform: translate(0, 0) scale(1); }
}
/* Radioactive: unstable pulse */
@keyframes attack-radio-fx {
  0%   { transform: scale(1); }
  15%  { transform: scale(1.3); }
  30%  { transform: scale(0.85) translateX(10px); }
  50%  { transform: scale(1.35) translateX(20px); }
  70%  { transform: scale(0.9) translateX(5px); }
  100% { transform: scale(1) translateX(0); }
}
/* Metalloid: magnetic lunge */
@keyframes attack-metal-fx {
  0%   { transform: translateX(0) skewX(0deg); }
  30%  { transform: translateX(24px) skewX(-5deg) scale(1.1); }
  60%  { transform: translateX(16px) skewX(3deg); }
  100% { transform: translateX(0) skewX(0deg); }
}
/* Gas: diffusion wave */
@keyframes attack-gas-fx {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  20%  { transform: translate(5px, -8px) scale(1.05); opacity: 0.8; }
  45%  { transform: translate(25px, 0) scale(1.15); opacity: 0.6; }
  60%  { transform: translate(15px, 4px) scale(1.05); opacity: 0.85; }
  100% { transform: translate(0, 0) scale(1); opacity: 1; }
}

/* Radioactive glow always-on for radioactive type */
.battle-sprite.radioactive-type {
  filter: drop-shadow(0 0 8px rgba(239,68,68,0.6));
  animation: radioactive-idle 2s ease-in-out infinite;
}
@keyframes radioactive-idle {
  0%,100% { filter: drop-shadow(0 0 6px rgba(239,68,68,0.5)); }
  50%     { filter: drop-shadow(0 0 18px rgba(239,68,68,0.95)) brightness(1.1); }
}

/* Gas-type floating animation */
.battle-sprite.gas-type { animation: gas-float 2.5s ease-in-out infinite; }
@keyframes gas-float {
  0%,100% { transform: translateY(0); }
  25%     { transform: translateY(-6px) translateX(2px); }
  50%     { transform: translateY(-12px); }
  75%     { transform: translateY(-6px) translateX(-2px); }
}

/* Noble-type shimmer — enhanced with rotation */
.battle-sprite.noble-type { animation: noble-shimmer 3s ease-in-out infinite; }
@keyframes noble-shimmer {
  0%,100% { filter: drop-shadow(0 0 8px rgba(59,130,246,0.4)); transform: rotate(0deg); }
  50%     { filter: drop-shadow(0 0 20px rgba(59,130,246,0.9)) brightness(1.2); transform: rotate(1deg); }
}

/* Alkali-type pulsing glow */
.battle-sprite.alkali-type { animation: alkali-pulse 2.5s ease-in-out infinite; }
@keyframes alkali-pulse {
  0%,100% { filter: drop-shadow(0 0 6px rgba(168,85,247,0.4)); }
  50%     { filter: drop-shadow(0 0 14px rgba(168,85,247,0.8)) brightness(1.1); }
}

/* Earth-type subtle rumble */
.battle-sprite.earth-type { animation: earth-rumble 3s ease-in-out infinite; }
@keyframes earth-rumble {
  0%,100% { transform: translateY(0); filter: drop-shadow(0 0 4px rgba(180,83,9,0.3)); }
  25%     { transform: translateY(1px); }
  50%     { transform: translateY(-1px); filter: drop-shadow(0 0 8px rgba(180,83,9,0.5)); }
  75%     { transform: translateY(1px); }
}

/* Halogen-type toxic shimmer */
.battle-sprite.halogen-type { animation: halogen-toxic 2s ease-in-out infinite; }
@keyframes halogen-toxic {
  0%,100% { filter: drop-shadow(0 0 6px rgba(34,197,94,0.3)); }
  30%     { filter: drop-shadow(0 0 10px rgba(34,197,94,0.6)) brightness(1.05); }
  60%     { filter: drop-shadow(0 0 14px rgba(34,197,94,0.7)) hue-rotate(10deg); }
}

/* Organic-type warm glow */
.battle-sprite.organic-type { animation: organic-glow 2.5s ease-in-out infinite; }
@keyframes organic-glow {
  0%,100% { filter: drop-shadow(0 0 6px rgba(234,179,8,0.3)); }
  50%     { filter: drop-shadow(0 0 12px rgba(234,179,8,0.7)) brightness(1.08); }
}

/* Metalloid-type electric crackle */
.battle-sprite.metalloid-type { animation: metalloid-crackle 1.8s ease-in-out infinite; }
@keyframes metalloid-crackle {
  0%,100% { filter: drop-shadow(0 0 6px rgba(249,115,22,0.3)); transform: translateX(0); }
  25%     { filter: drop-shadow(0 0 10px rgba(249,115,22,0.6)); transform: translateX(-1px); }
  50%     { filter: drop-shadow(0 0 14px rgba(249,115,22,0.8)) brightness(1.1); transform: translateX(1px); }
  75%     { filter: drop-shadow(0 0 8px rgba(249,115,22,0.5)); transform: translateX(0); }
}

/* Move effect overlay flash */
.move-effect-overlay {
  position: absolute; inset: 0; z-index: 5;
  pointer-events: none; border-radius: 8px;
  animation: move-flash 0.5s ease-out forwards;
}
@keyframes move-flash { 0%{opacity:0.7;} 100%{opacity:0;} }

/* ── Capture animation — enhanced with wobble ── */
.capture-anim {
  animation: capture-shrink 1.8s cubic-bezier(0.36,0.07,0.19,0.97) forwards;
}
@keyframes capture-shrink {
  0%   { transform: scale(1) rotate(0deg); filter: none; }
  15%  { transform: scale(0.7) rotate(10deg); filter: brightness(1.5) saturate(2); }
  30%  { transform: scale(0.3) rotate(-10deg); filter: brightness(3) hue-rotate(90deg); }
  45%  { transform: scale(0.15) rotate(0deg); filter: brightness(0.2); }
  55%  { transform: scale(0.2) rotate(15deg); filter: brightness(1.5); }
  65%  { transform: scale(0.2) rotate(-15deg); filter: brightness(1); }
  75%  { transform: scale(0.2) rotate(8deg); filter: brightness(1.2); }
  85%  { transform: scale(0.2) rotate(-4deg); filter: brightness(1); }
  95%  { transform: scale(0.6) rotate(0deg); filter: brightness(2) saturate(3); }
  100% { transform: scale(1) rotate(0deg); filter: none; }
}

/* Capture success burst */
.capture-success {
  animation: capture-success-burst 0.8s ease-out forwards;
}
@keyframes capture-success-burst {
  0%   { transform: scale(0.2); filter: brightness(3); opacity: 1; }
  40%  { transform: scale(1.3); filter: brightness(1.5); opacity: 1; }
  70%  { transform: scale(0.95); filter: brightness(1); opacity: 1; }
  100% { transform: scale(1); filter: none; opacity: 1; }
}

/* ── Status effect visual pulses — enhanced ── */
.battle-sprite.status-burn     { animation: burn-anim 0.8s ease-in-out infinite; }
.battle-sprite.status-poison   { animation: poison-anim 1.5s ease-in-out infinite; }
.battle-sprite.status-paralysis{ animation: para-anim 0.4s step-end infinite; }
.battle-sprite.status-sleep    { animation: sleep-anim 2s ease-in-out infinite; }
@keyframes burn-anim {
  0%,100% { filter: drop-shadow(0 0 6px #f97316); }
  25%     { filter: drop-shadow(0 0 12px #ef4444) brightness(1.15); }
  50%     { filter: drop-shadow(0 0 18px #ff3300) brightness(1.3); }
  75%     { filter: drop-shadow(0 0 10px #f97316) brightness(1.1); }
}
@keyframes poison-anim {
  0%,100% { filter: drop-shadow(0 0 6px #a855f7); }
  33%     { filter: drop-shadow(0 0 14px #7c3aed) hue-rotate(20deg); }
  66%     { filter: drop-shadow(0 0 10px #9333ea) hue-rotate(-10deg); }
}
@keyframes para-anim {
  0%,100% { filter: none; opacity: 1; }
  25%     { filter: brightness(3) sepia(1) hue-rotate(40deg); opacity: 0.7; }
  50%     { filter: none; opacity: 1; }
  75%     { filter: brightness(2.5) sepia(1) hue-rotate(40deg); opacity: 0.5; }
}
@keyframes sleep-anim {
  0%,100% { transform: translateY(0) rotate(0deg); opacity: 1; }
  50%     { transform: translateY(8px) rotate(-8deg); opacity: 0.6; }
}

/* SVG element icon base */
.element-svg-icon {
  width: 64px; height: 64px;
  display: inline-block; flex-shrink: 0;
}
.element-svg-icon-sm { width: 40px; height: 40px; display: inline-block; }

/* ══════════════════════════════════════════════════
   SCREEN SHAKE & IMPACT EFFECTS
   ══════════════════════════════════════════════════ */

/* Variable-intensity screen shake */
.battle-screen.screen-shake {
  --shake-intensity: 6px;
  animation: screen-shake 0.6s cubic-bezier(0.36,0.07,0.19,0.97) both;
}
.battle-screen.screen-shake-light  { --shake-intensity: 3px; }
.battle-screen.screen-shake-heavy  { --shake-intensity: 10px; }
.battle-screen.screen-shake-crit   { --shake-intensity: 16px; }

@keyframes screen-shake {
  0%,100% { transform: translate3d(0, 0, 0); }
  10%     { transform: translate3d(calc(-0.5 * var(--shake-intensity)), calc(0.2 * var(--shake-intensity)), 0); }
  20%     { transform: translate3d(calc(0.7 * var(--shake-intensity)), calc(-0.3 * var(--shake-intensity)), 0); }
  30%     { transform: translate3d(calc(-1 * var(--shake-intensity)), calc(0.1 * var(--shake-intensity)), 0); }
  40%     { transform: translate3d(calc(0.8 * var(--shake-intensity)), calc(0.3 * var(--shake-intensity)), 0); }
  50%     { transform: translate3d(calc(-0.6 * var(--shake-intensity)), calc(-0.2 * var(--shake-intensity)), 0); }
  60%     { transform: translate3d(calc(0.4 * var(--shake-intensity)), calc(0.15 * var(--shake-intensity)), 0); }
  70%     { transform: translate3d(calc(-0.3 * var(--shake-intensity)), calc(-0.1 * var(--shake-intensity)), 0); }
  80%     { transform: translate3d(calc(0.2 * var(--shake-intensity)), calc(0.05 * var(--shake-intensity)), 0); }
  90%     { transform: translate3d(calc(-0.1 * var(--shake-intensity)), 0, 0); }
}

/* Hit flash overlays */
.battle-flash-overlay {
  position: absolute; inset: 0; z-index: 10;
  pointer-events: none; opacity: 0;
  border-radius: 8px;
  transition: opacity 0.05s;
}
.battle-flash-overlay.active { animation: battle-flash 0.2s ease-out forwards; }
.battle-flash-overlay.flash-white   { background: rgba(255,255,255,0.8); }
.battle-flash-overlay.flash-fire    { background: rgba(255,100,0,0.5); }
.battle-flash-overlay.flash-ice     { background: rgba(100,200,255,0.5); }
.battle-flash-overlay.flash-poison  { background: rgba(168,85,247,0.4); }
.battle-flash-overlay.flash-earth   { background: rgba(180,83,9,0.4); }
.battle-flash-overlay.flash-radio   { background: rgba(239,68,68,0.5); }
.battle-flash-overlay.flash-noble   { background: rgba(59,130,246,0.5); }
.battle-flash-overlay.flash-metal   { background: rgba(249,115,22,0.4); }
.battle-flash-overlay.flash-gas     { background: rgba(148,163,184,0.4); }
.battle-flash-overlay.flash-organic { background: rgba(234,179,8,0.4); }
.battle-flash-overlay.flash-halogen { background: rgba(34,197,94,0.4); }
.battle-flash-overlay.flash-alkali  { background: rgba(168,85,247,0.5); }

@keyframes battle-flash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ══════════════════════════════════════════════════
   FLOATING DAMAGE NUMBERS
   ══════════════════════════════════════════════════ */
.damage-number {
  --float-x: 0px;
  --float-y: -70px;
  position: absolute;
  font-family: 'Silkscreen', 'Courier New', monospace;
  font-weight: 900;
  font-size: 1.6rem;
  color: #ff4444;
  text-shadow: 0 0 8px rgba(255,68,68,0.8), 2px 2px 0 #000, -1px -1px 0 #000;
  z-index: 20;
  pointer-events: none;
  animation: dmg-float 1.2s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
  will-change: transform, opacity;
}
.damage-number.crit {
  font-size: 2.2rem;
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251,191,36,0.9), 0 0 24px rgba(255,200,0,0.5), 2px 2px 0 #000;
  animation: dmg-float-crit 1.4s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}
.damage-number.super-effective {
  color: #ff6622;
  text-shadow: 0 0 10px rgba(255,100,34,0.9), 2px 2px 0 #000;
}
.damage-number.not-effective {
  font-size: 1.1rem;
  color: #94a3b8;
  text-shadow: 1px 1px 0 #000;
}
.damage-number.heal {
  color: #22c55e;
  text-shadow: 0 0 8px rgba(34,197,94,0.8), 2px 2px 0 #000;
}
.damage-number.miss {
  color: #94a3b8;
  font-size: 1rem;
  font-style: italic;
  text-shadow: 1px 1px 0 #000;
}
.damage-number.status-text {
  font-size: 0.9rem;
  color: #eab308;
  text-shadow: 0 0 6px rgba(234,179,8,0.6), 1px 1px 0 #000;
}

@keyframes dmg-float {
  0%   { transform: translate(var(--float-x), 0) scale(0.3); opacity: 0; }
  15%  { transform: translate(var(--float-x), calc(var(--float-y) * 0.2)) scale(1.3); opacity: 1; }
  30%  { transform: translate(var(--float-x), calc(var(--float-y) * 0.4)) scale(1); opacity: 1; }
  100% { transform: translate(var(--float-x), var(--float-y)) scale(0.7); opacity: 0; }
}
@keyframes dmg-float-crit {
  0%   { transform: translate(var(--float-x), 0) scale(0.2) rotate(-10deg); opacity: 0; }
  10%  { transform: translate(var(--float-x), calc(var(--float-y) * 0.1)) scale(1.8) rotate(5deg); opacity: 1; }
  25%  { transform: translate(var(--float-x), calc(var(--float-y) * 0.3)) scale(1.2) rotate(-3deg); opacity: 1; }
  100% { transform: translate(var(--float-x), var(--float-y)) scale(0.6) rotate(0deg); opacity: 0; }
}

/* ══════════════════════════════════════════════════
   ATTACK EFFECT PARTICLES
   ══════════════════════════════════════════════════ */

/* Generic attack particle */
.attack-particle {
  position: absolute;
  pointer-events: none;
  z-index: 8;
  border-radius: 50%;
  will-change: transform, opacity;
}

/* Fire particles */
.fire-particle {
  background: radial-gradient(circle, #ffcc00 0%, #ff6600 40%, #ff3300 70%, transparent 100%);
  box-shadow: 0 0 6px #ff6600, 0 0 12px rgba(255,100,0,0.5);
  animation: fire-particle-rise var(--duration, 0.8s) ease-out forwards;
}
@keyframes fire-particle-rise {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  50%  { transform: translate(var(--dx, 10px), var(--dy, -30px)) scale(0.7); opacity: 0.8; }
  100% { transform: translate(calc(var(--dx, 10px) * 1.5), calc(var(--dy, -30px) * 2)) scale(0.1); opacity: 0; }
}

/* Ice particles */
.ice-particle {
  background: radial-gradient(circle, #ffffff 0%, #a8d8ea 50%, #66bbff 100%);
  box-shadow: 0 0 6px #66ccff, 0 0 10px rgba(100,200,255,0.5);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  animation: ice-particle-form var(--duration, 0.7s) ease-out forwards;
}
@keyframes ice-particle-form {
  0%   { transform: translate(0, 0) scale(0) rotate(0deg); opacity: 0; }
  30%  { transform: translate(var(--dx, 5px), var(--dy, -5px)) scale(1.3) rotate(45deg); opacity: 1; }
  60%  { transform: translate(calc(var(--dx, 5px) * 1.5), calc(var(--dy, -5px) * 1.5)) scale(1) rotate(90deg); opacity: 0.8; }
  100% { transform: translate(calc(var(--dx, 5px) * 2), calc(var(--dy, -5px) * 2)) scale(0.5) rotate(135deg); opacity: 0; }
}

/* Lightning particles */
.lightning-particle {
  background: linear-gradient(135deg, #fff 0%, #88ccff 50%, #4488ff 100%);
  box-shadow: 0 0 8px #4488ff, 0 0 16px rgba(68,136,255,0.6);
  animation: lightning-particle-strike var(--duration, 0.35s) steps(2) forwards;
}
@keyframes lightning-particle-strike {
  0%   { transform: translate(0, 0) scaleY(1); opacity: 0; }
  25%  { transform: translate(var(--dx, 0), var(--dy, 0)) scaleY(3); opacity: 1; }
  50%  { transform: translate(calc(var(--dx, 0) * 0.5), calc(var(--dy, 0) * 0.5)) scaleY(1); opacity: 0.3; }
  75%  { transform: translate(var(--dx, 0), var(--dy, 0)) scaleY(2); opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, 0)) scaleY(0); opacity: 0; }
}

/* Poison particles */
.poison-particle {
  background: radial-gradient(circle, #d946ef 0%, #a855f7 40%, #7c3aed 80%, transparent 100%);
  box-shadow: 0 0 6px #a855f7;
  animation: poison-particle-bubble var(--duration, 1s) ease-out forwards;
}
@keyframes poison-particle-bubble {
  0%   { transform: translate(0, 0) scale(0.3); opacity: 0.5; }
  30%  { transform: translate(var(--dx, 3px), var(--dy, -15px)) scale(1.2); opacity: 1; }
  70%  { transform: translate(calc(var(--dx, 3px) * 2), calc(var(--dy, -15px) * 2)) scale(1); opacity: 0.6; }
  100% { transform: translate(calc(var(--dx, 3px) * 2.5), calc(var(--dy, -15px) * 3)) scale(0.4); opacity: 0; }
}

/* Explosion particles (for radioactive / high-damage) */
.explosion-particle {
  --angle: 0deg;
  --distance: 60px;
  background: radial-gradient(circle, #ffcc00 0%, #ff4400 50%, #cc0000 100%);
  box-shadow: 0 0 8px #ff6600, 0 0 16px rgba(255,100,0,0.4);
  animation: explosion-burst var(--duration, 0.6s) ease-out forwards;
}
@keyframes explosion-burst {
  0%   { transform: translate(0, 0) rotate(var(--angle)) translateY(0) scale(1); opacity: 1; }
  50%  { transform: translate(0, 0) rotate(var(--angle)) translateY(calc(-0.6 * var(--distance))) scale(0.8); opacity: 0.8; }
  100% { transform: translate(0, 0) rotate(var(--angle)) translateY(calc(-1 * var(--distance))) scale(0.1); opacity: 0; }
}

/* Sparkle particles (for crits, noble, evolution) */
.sparkle-particle {
  background: radial-gradient(circle, #fff 0%, #fbbf24 60%, transparent 100%);
  box-shadow: 0 0 4px #fbbf24, 0 0 8px rgba(251,191,36,0.6);
  animation: sparkle-twinkle var(--duration, 0.8s) ease-out forwards;
}
@keyframes sparkle-twinkle {
  0%   { transform: translate(0, 0) scale(0) rotate(0deg); opacity: 0; }
  20%  { transform: translate(var(--dx, 5px), var(--dy, -10px)) scale(1.5) rotate(72deg); opacity: 1; }
  50%  { transform: translate(calc(var(--dx, 5px) * 1.5), calc(var(--dy, -10px) * 1.5)) scale(0.8) rotate(144deg); opacity: 0.8; }
  100% { transform: translate(calc(var(--dx, 5px) * 2), calc(var(--dy, -10px) * 2)) scale(0) rotate(360deg); opacity: 0; }
}

/* Dissolution particles (for halogen, acid) */
.dissolve-particle {
  background: radial-gradient(circle, #22c55e 0%, #16a34a 50%, transparent 100%);
  box-shadow: 0 0 4px #22c55e;
  animation: dissolve-drip var(--duration, 1s) ease-in forwards;
}
@keyframes dissolve-drip {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  40%  { transform: translate(var(--dx, 2px), var(--dy, 20px)) scale(0.9); opacity: 0.9; }
  70%  { transform: translate(calc(var(--dx, 2px) * 1.5), calc(var(--dy, 20px) * 2)) scale(0.6); opacity: 0.5; }
  100% { transform: translate(calc(var(--dx, 2px) * 2), calc(var(--dy, 20px) * 3)) scale(0.2); opacity: 0; }
}

/* ══════════════════════════════════════════════════
   MONSTER ENTRY / EXIT ANIMATIONS
   ══════════════════════════════════════════════════ */
.battle-sprite.monster-enter {
  animation: monster-enter 0.7s cubic-bezier(0.68,-0.55,0.27,1.55) both;
}
@keyframes monster-enter {
  0%   { transform: scale(0) translateY(30px) rotate(-15deg); opacity: 0; filter: brightness(3); }
  40%  { transform: scale(1.2) translateY(-8px) rotate(3deg); opacity: 1; filter: brightness(1.5); }
  70%  { transform: scale(0.9) translateY(2px) rotate(-1deg); opacity: 1; filter: brightness(1); }
  100% { transform: scale(1) translateY(0) rotate(0deg); opacity: 1; filter: none; }
}

.battle-sprite.monster-exit {
  animation: monster-exit 0.5s ease-in forwards;
}
@keyframes monster-exit {
  0%   { transform: scale(1); opacity: 1; filter: none; }
  50%  { transform: scale(0.5) translateY(10px); opacity: 0.5; filter: brightness(0.5) saturate(0); }
  100% { transform: scale(0) translateY(30px); opacity: 0; filter: brightness(0); }
}

/* Fainted animation */
.battle-sprite.monster-fainted {
  animation: monster-faint 0.8s ease-in forwards;
}
@keyframes monster-faint {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; filter: none; }
  30%  { transform: translateY(-10px) rotate(5deg); opacity: 1; filter: brightness(0.5); }
  60%  { transform: translateY(5px) rotate(-15deg); opacity: 0.7; filter: saturate(0) brightness(0.4); }
  100% { transform: translateY(20px) rotate(-25deg); opacity: 0; filter: saturate(0) brightness(0); }
}

/* Victory bounce */
.battle-sprite.monster-victory {
  animation: monster-victory 1s ease-in-out;
}
@keyframes monster-victory {
  0%,100% { transform: translateY(0) scale(1); }
  20%     { transform: translateY(-15px) scale(1.1); }
  40%     { transform: translateY(0) scale(1); }
  60%     { transform: translateY(-10px) scale(1.05); }
  80%     { transform: translateY(0) scale(1); }
}

/* ══════════════════════════════════════════════════
   WEATHER VISUAL OVERLAYS
   ══════════════════════════════════════════════════ */
.weather-overlay {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 3;
  overflow: hidden;
}

/* Sunny — warm golden rays */
.weather-overlay.weather-sunny {
  background:
    radial-gradient(ellipse at 80% 10%, rgba(251,191,36,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 30%, rgba(255,200,0,0.08) 0%, transparent 40%);
  animation: weather-sunny-pulse 4s ease-in-out infinite;
}
@keyframes weather-sunny-pulse {
  0%,100% { opacity: 0.7; }
  50%     { opacity: 1; }
}

/* Rainy — falling lines */
.weather-overlay.weather-rainy {
  background: repeating-linear-gradient(
    100deg,
    transparent,
    transparent 4px,
    rgba(100,180,255,0.07) 4px,
    rgba(100,180,255,0.07) 5px
  );
  animation: weather-rain-fall 0.3s linear infinite;
}
@keyframes weather-rain-fall {
  0%   { background-position: 0 0; }
  100% { background-position: -10px 30px; }
}

/* Stormy — electric flickers */
.weather-overlay.weather-stormy {
  background:
    repeating-linear-gradient(100deg, transparent, transparent 4px, rgba(100,180,255,0.08) 4px, rgba(100,180,255,0.08) 5px),
    radial-gradient(circle at 50% 30%, rgba(100,150,255,0.05) 0%, transparent 60%);
  animation: weather-storm-flash 3s steps(1) infinite;
}
@keyframes weather-storm-flash {
  0%,18%,21%,58%,61%,100% { background-color: transparent; }
  19%    { background-color: rgba(200,220,255,0.2); }
  20%    { background-color: transparent; }
  59%    { background-color: rgba(200,220,255,0.15); }
  60%    { background-color: rgba(200,220,255,0.08); }
}

/* Foggy — drifting mist */
.weather-overlay.weather-foggy {
  background:
    radial-gradient(ellipse at 30% 60%, rgba(200,200,220,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 40%, rgba(200,200,220,0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(200,200,220,0.1) 0%, transparent 45%);
  animation: weather-fog-drift 8s ease-in-out infinite;
}
@keyframes weather-fog-drift {
  0%,100% { transform: translateX(0); opacity: 0.7; }
  25%     { transform: translateX(10px); opacity: 0.9; }
  50%     { transform: translateX(-5px); opacity: 1; }
  75%     { transform: translateX(8px); opacity: 0.8; }
}

/* Dark — ominous shadow */
.weather-overlay.weather-dark {
  background:
    radial-gradient(ellipse at 50% 50%, transparent 20%, rgba(0,0,0,0.4) 70%),
    radial-gradient(circle at 30% 70%, rgba(80,0,120,0.08) 0%, transparent 40%),
    radial-gradient(circle at 70% 30%, rgba(60,0,100,0.06) 0%, transparent 30%);
  animation: weather-dark-pulse 5s ease-in-out infinite;
}
@keyframes weather-dark-pulse {
  0%,100% { opacity: 0.8; }
  50%     { opacity: 1; }
}

/* ══════════════════════════════════════════════════
   BATTLE LOG ENHANCEMENTS
   ══════════════════════════════════════════════════ */
.log-line {
  padding: 2px 0; line-height: 1.5;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  animation: log-slide-in 0.25s ease-out;
}
@keyframes log-slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════════════════
   HP BAR ANIMATION ENHANCEMENTS
   ══════════════════════════════════════════════════ */
.bar-hp {
  transition: width 0.8s cubic-bezier(0.25,0.46,0.45,0.94);
  position: relative;
}
.bar-hp::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  animation: hp-shimmer 2s linear infinite;
}
@keyframes hp-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.bar-hp.low {
  animation: hp-low-pulse 0.8s ease-in-out infinite;
}
@keyframes hp-low-pulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.6; }
}

/* ══════════════════════════════════════════════════
   EFFECTIVENESS TEXT ANIMATIONS
   ══════════════════════════════════════════════════ */
.effectiveness-popup {
  position: absolute;
  font-family: 'Silkscreen', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 15;
  pointer-events: none;
  animation: effectiveness-show 1.5s ease-out forwards;
  text-shadow: 1px 1px 2px #000;
}
.effectiveness-popup.super {
  color: #ff4444;
  text-shadow: 0 0 8px rgba(255,68,68,0.6), 1px 1px 2px #000;
}
.effectiveness-popup.not-very {
  color: #94a3b8;
}
.effectiveness-popup.immune {
  color: #666;
  font-style: italic;
}
@keyframes effectiveness-show {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  15%  { opacity: 1; transform: translateY(-10px) scale(1.2); }
  70%  { opacity: 1; transform: translateY(-25px) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(0.8); }
}

/* ══════════════════════════════════════════════════
   ENHANCED SVG SPRITE GRAPHICS
   ══════════════════════════════════════════════════ */
.battle-sprite svg {
  display: block; border-radius: 8px;
  transition: filter 0.2s ease;
}

/* Sprite shadow base */
.battle-sprite::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 8px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.3) 0%, transparent 70%);
  border-radius: 50%;
  animation: sprite-shadow 2.5s ease-in-out infinite;
}
@keyframes sprite-shadow {
  0%,100% { transform: translateX(-50%) scaleX(1); opacity: 0.6; }
  50%     { transform: translateX(-50%) scaleX(0.85); opacity: 0.4; }
}

/* ══════════════════════════════════════════════════
   SCREEN TRANSITION EFFECTS
   ══════════════════════════════════════════════════ */
.screen-enter {
  animation: screen-enter-fx 0.4s cubic-bezier(0.25,0.46,0.45,0.94) both;
}
@keyframes screen-enter-fx {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* Battle intro transition */
.battle-intro {
  animation: battle-intro-fx 0.6s cubic-bezier(0.36,0.07,0.19,0.97) both;
}
@keyframes battle-intro-fx {
  0%   { opacity: 0; transform: scale(1.1); filter: brightness(2) contrast(1.5); }
  40%  { opacity: 1; transform: scale(0.98); filter: brightness(1.2); }
  100% { opacity: 1; transform: scale(1); filter: none; }
}

/* Tab content transition */
.tab-content {
  animation: tab-fade 0.2s ease-out;
}
@keyframes tab-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ══════════════════════════════════════════════════
   BACKGROUND AMBIENT PARTICLES
   ══════════════════════════════════════════════════ */
.ambient-particle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  z-index: 2;
  opacity: 0;
  animation: ambient-drift var(--drift-duration, 6s) var(--drift-delay, 0s) ease-in-out infinite;
}
@keyframes ambient-drift {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.5); }
  15%  { opacity: var(--max-opacity, 0.4); }
  50%  { transform: translate(var(--drift-x, 20px), var(--drift-y, -40px)) scale(1); }
  85%  { opacity: var(--max-opacity, 0.4); }
  100% { opacity: 0; transform: translate(calc(var(--drift-x, 20px) * 1.5), calc(var(--drift-y, -40px) * 1.5)) scale(0.3); }
}

/* ══════════════════════════════════════════════════
   MOVE NAME ANNOUNCEMENT
   ══════════════════════════════════════════════════ */
.move-announce {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Silkscreen', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  z-index: 25;
  pointer-events: none;
  padding: 6px 18px;
  border-radius: 6px;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--announce-color, var(--accent));
  color: var(--announce-color, var(--accent-light));
  text-shadow: 0 0 8px var(--announce-color, var(--accent));
  animation: move-announce 1s ease-out forwards;
  white-space: nowrap;
}
@keyframes move-announce {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5) translateY(10px); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  30%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9) translateY(-15px); }
}

/* ══════════════════════════════════════════════════
   EVOLUTION ANIMATION (Enhanced)
   ══════════════════════════════════════════════════ */
.evo-flash {
  position: fixed; inset: 0; z-index: 999;
  animation: evo-flash-enhanced 2s ease-out forwards;
}
@keyframes evo-flash-enhanced {
  0%   { background: transparent; }
  10%  { background: rgba(255,255,255,0.3); }
  20%  { background: rgba(255,255,255,0.9); }
  30%  { background: rgba(255,255,255,1); }
  50%  { background: rgba(255,255,255,0.8); }
  65%  { background: rgba(200,180,255,0.4); }
  80%  { background: rgba(100,200,255,0.2); }
  100% { background: transparent; opacity: 0; }
}

/* ══════════════════════════════════════════════════
   BATTLE INTRO WIPE
   ══════════════════════════════════════════════════ */
.battle-wipe {
  position: fixed; inset: 0; z-index: 950;
  pointer-events: none;
  animation: battle-wipe-fx 0.8s ease-in-out forwards;
}
.battle-wipe::before, .battle-wipe::after {
  content: '';
  position: absolute;
  width: 100%; height: 50%;
  background: var(--bg-dark);
}
.battle-wipe::before { top: 0; animation: wipe-top 0.8s ease-in-out forwards; }
.battle-wipe::after  { bottom: 0; animation: wipe-bottom 0.8s ease-in-out forwards; }
@keyframes wipe-top {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(0); }
  100% { transform: translateY(-100%); }
}
@keyframes wipe-bottom {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* ══════════════════════════════════════════════════
   STORY PROGRESSION — Dialogue & Chapter UI
   ══════════════════════════════════════════════════ */

.dialogue-overlay {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 16px 24px;
}
.dialogue-box {
  background: var(--bg-panel);
  border: 2px solid var(--accent);
  border-radius: 12px; padding: 20px 24px;
  width: 100%; max-width: 640px;
  position: relative;
  animation: slide-up 0.3s ease-out;
}
@keyframes slide-up { from{transform:translateY(40px);opacity:0;} to{transform:none;opacity:1;} }
.dialogue-speaker {
  position: absolute; top: -14px; left: 20px;
  background: var(--accent); color: #fff;
  border-radius: 6px; padding: 2px 12px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 1px;
}
.dialogue-portrait {
  font-size: 2.5rem; float: left; margin-right: 16px; margin-top: 4px;
}
.dialogue-text {
  font-size: 0.9rem; line-height: 1.7; color: var(--text-bright);
  min-height: 48px;
}
.dialogue-text .typewriter { border-right: 2px solid var(--accent); animation: blink-cursor 0.7s step-end infinite; }
@keyframes blink-cursor { 0%,100%{border-color:transparent;} 50%{border-color:var(--accent);} }
.dialogue-advance {
  text-align: right; margin-top: 12px;
}
.dialogue-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.dialogue-choice {
  background: var(--bg-accent); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 14px; cursor: pointer;
  font-family: inherit; font-size: 0.82rem; color: var(--text); text-align: left;
  transition: all 0.15s;
}
.dialogue-choice:hover { border-color: var(--accent); color: var(--text-bright); background: var(--bg-panel-light); }

/* Chapter banner */
.chapter-banner {
  position: fixed; inset: 0; z-index: 850;
  background: rgba(0,0,0,0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  animation: chapter-fade 3.5s ease-in-out forwards;
}
@keyframes chapter-fade { 0%{opacity:0;} 15%{opacity:1;} 75%{opacity:1;} 100%{opacity:0;pointer-events:none;} }
.chapter-number { font-size: 0.9rem; letter-spacing: 8px; color: var(--text-dim); margin-bottom: 8px; }
.chapter-title  { font-size: 2rem; font-weight: 700; color: var(--text-bright); text-align: center; letter-spacing: 2px; }
.chapter-subtitle { font-size: 0.85rem; color: var(--accent-light); margin-top: 8px; font-style: italic; }

/* Story progress indicator in header */
.story-chapter-badge {
  font-size: 0.7rem; background: rgba(59,130,246,0.2);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 2px 8px; color: var(--accent-light);
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 600px) {
  .title-text          { font-size: 2rem; }
  .battle-field        { padding: 8px; }
  .battle-sprite       { font-size: 2.8rem; }
  .party-grid          { grid-template-columns: 1fr; }
  .area-grid           { grid-template-columns: 1fr; }
  .dialogue-portrait   { font-size: 1.8rem; }
  .chapter-title       { font-size: 1.4rem; }

  /* Battle: collapse to vertical layout on small screens */
  .battle-screen {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
    height: auto; min-height: 100vh;
    overflow-y: auto;
  }
  .battle-center  { grid-column: 1; grid-row: 1; }
  .battle-left-panel {
    grid-column: 1; grid-row: 2;
    border-right: none; border-top: 1px solid var(--border);
    flex-direction: row; flex-wrap: wrap; padding: 6px;
  }
  .battle-right-panel {
    grid-column: 1; grid-row: 3;
    border-left: none; border-top: 1px solid var(--border);
    flex-direction: row; flex-wrap: wrap; padding: 6px;
  }
  .battle-left-panel .move-grid { flex-direction: row; flex-wrap: wrap; }
  .battle-left-panel .btn       { width: calc(50% - 3px); }
  .battle-right-panel .btn      { width: calc(50% - 3px); }
  .battle-panel-label           { width: 100%; }
  .battle-log                   { height: 100px; }
}
