/* ============================================================
   Runeblade — style.css
   Dark-fantasy incremental hack & slash. Layout: three columns
   (champion / arena / forge) collapsing to one on small screens.
   ============================================================ */

:root {
  --bg0: #0b0912;
  --bg1: #131022;
  --panel: rgba(26, 22, 41, 0.92);
  --panel-2: #211b36;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #ece9f6;
  --muted: #9b93b5;
  --dim: #6f6890;
  --gold: #f0c04a;
  --gold-deep: #c9952a;
  --crimson: #e5484d;
  --ember: #ff7a45;
  --soul: #58d6b4;
  --xp: #7c6cf4;
  --good: #57d98a;
  --bad: #ff6b6b;
  --radius: 14px;
  --font-display: 'Cinzel', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 700px at 18% -10%, rgba(124, 108, 244, 0.14), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(229, 72, 77, 0.1), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0) 60%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  max-width: 1600px;
  margin: 0 auto;
}

.hidden { display: none !important; }

kbd.hotkey {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--dim);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 6px;
  vertical-align: 1px;
}

/* ============================== Top bar ============================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px 10px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.brand-mark { font-size: 22px; transform: translateY(2px); }

.brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 24px;
  letter-spacing: 0.14em;
  background: linear-gradient(180deg, #ffe9b0, var(--gold) 55%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 26px rgba(240, 192, 74, 0.25);
  white-space: nowrap;
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

.topstats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.res {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 14px rgba(0, 0, 0, 0.3);
}

.res-gold { color: var(--gold); }
.res-souls { color: var(--soul); }
.res-level { color: var(--ink); }
.res-icon { font-size: 15px; }

.icon-btn {
  font-size: 17px;
  line-height: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.icon-btn:hover { transform: translateY(-1px); border-color: var(--line-strong); background: var(--panel-2); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.off { opacity: 0.55; }

/* ============================== Layout ============================== */

.layout {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr) 336px;
  gap: 14px;
  padding: 0 18px 16px;
  min-height: 0;
}

.panel {
  background: linear-gradient(180deg, rgba(30, 25, 48, 0.96), rgba(19, 15, 33, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 14px;
  overflow-y: auto;
  min-height: 0;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2px 0 12px;
}

.panel-subtitle {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 18px 0 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* ============================== Bars ============================== */

.bar {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: #0d0a18;
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: 999px;
  transition: width 0.15s linear;
}

.bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  color: #fff;
}

.bar-hp { height: 22px; }
.bar-hp .bar-fill { background: linear-gradient(180deg, #ff8a8a, var(--crimson) 60%); }
.bar-hp .bar-fill.low { animation: hpPulse 0.9s ease-in-out infinite; }

.bar-enemy { height: 20px; }
.bar-enemy .bar-fill { background: linear-gradient(180deg, #ff9d6b, var(--ember) 50%, #c2411f); }

.bar-xp { height: 20px; }
.bar-xp .bar-fill {
  background: linear-gradient(180deg, #a99bff, var(--xp) 60%);
  box-shadow: 0 0 14px rgba(124, 108, 244, 0.5);
}

/* ============================== Stat lists ============================== */

.statlist {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  font-variant-numeric: tabular-nums;
}

.statlist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6.5px 2px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.statlist li span { color: var(--muted); }
.statlist li b { color: var(--ink); font-weight: 700; }
.statlist-small li { padding: 4.5px 2px; font-size: 12.5px; }

/* ============================== Arena ============================== */

.arena-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.zone-banner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 0 4px;
}

.zone-line {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.08em;
}

.zone-sep { color: var(--dim); margin: 0 4px; }
.zone-sub { font-size: 12px; color: var(--dim); white-space: nowrap; }

.boss-tag {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 9px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: #fff;
  background: linear-gradient(180deg, #ff5b60, #a51f24);
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(229, 72, 77, 0.55);
  animation: bossPulse 1.4s ease-in-out infinite;
  vertical-align: 2px;
}

.arena {
  position: relative;
  flex: 1;
  min-height: 340px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-a, #221021), var(--sky-b, #3a1420));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: background 0.6s ease;
  cursor: crosshair;
  --shakeAmp: 4px;
  user-select: none;
  -webkit-user-select: none;
}

.arena-sky {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 10%, transparent 40%, rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.arena-fog {
  position: absolute;
  width: 70%;
  height: 60%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--fog, #ff5e3a) 0%, transparent 65%);
  opacity: 0.14;
  filter: blur(30px);
  pointer-events: none;
}

.fog-a { top: -10%; left: -15%; animation: fogDrift 26s ease-in-out infinite alternate; }
.fog-b { bottom: -18%; right: -12%; animation: fogDrift 34s ease-in-out infinite alternate-reverse; }

.arena-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background: linear-gradient(180deg, transparent, var(--ground, #2a1520) 70%);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

/* fighters */

.fighter {
  position: absolute;
  bottom: 17%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  isolation: isolate; /* keep the boss aura behind the emoji, above the arena */
}

.fighter-move { display: flex; }

.fighter .fighter-emoji {
  font-size: clamp(56px, 9vh, 96px);
  line-height: 1;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.55));
}

.player { left: 14%; animation: bob 2.6s ease-in-out infinite; }
.player .fighter-emoji { font-size: clamp(48px, 7.6vh, 82px); transform: scaleX(-1); }

.enemy { right: 14%; animation: bob 2.2s ease-in-out infinite reverse; }
.enemy .fighter-emoji {
  transition: transform 0.2s ease, font-size 0.2s ease, filter 0.3s ease;
}

.enemy.boss .fighter-emoji {
  font-size: clamp(84px, 13vh, 140px);
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 26px var(--accent, #ff8a5c));
}

.enemy.boss::after {
  content: '';
  position: absolute;
  bottom: -6%;
  width: 160%;
  height: 160%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(229, 72, 77, 0.35) 0%, transparent 60%);
  animation: bossAura 1.8s ease-in-out infinite;
  z-index: -1;
}

.fighter-shadow {
  width: 74%;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.6), transparent 70%);
}

/* enemy attack windup */
.enemy-atkbar {
  position: absolute;
  top: -22px;
  width: 64px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.enemy-atkbar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ember), var(--crimson));
  transition: width 0.08s linear;
}

.enemy-info {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 74%);
  text-align: center;
  pointer-events: none;
}

.enemy-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* combo meter */
.combo {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 8, 18, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.combo.combo-fade { opacity: 0; transform: translateY(6px); }
.combo-label { font-size: 10px; letter-spacing: 0.22em; color: var(--muted); }
.combo-val { font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }

.combo-track {
  width: 64px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.combo-track span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--ember));
  transition: width 0.1s linear;
}

/* death overlay */
.death-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(60% 60% at 50% 50%, rgba(60, 6, 8, 0.55), rgba(8, 4, 14, 0.86));
  backdrop-filter: blur(2px);
  z-index: 30;
  animation: fadeIn 0.25s ease;
}

.death-icon { font-size: 52px; animation: deathFloat 2s ease-in-out infinite; }
.death-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #ff9d9d;
  text-shadow: 0 0 30px rgba(229, 72, 77, 0.8);
}
.death-sub { color: var(--muted); }
.death-sub b { color: var(--ink); font-size: 16px; }

/* ============================== Arena footer ============================== */

.arena-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'attack auto' 'xp xp';
  gap: 10px;
}

.attack-btn {
  grid-area: attack;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 140, 120, 0.35);
  border-radius: var(--radius);
  padding: 16px 20px 30px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 21px;
  letter-spacing: 0.14em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #7a1d22, #4a0f13 60%, #350a0d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, box-shadow 0.2s ease, filter 0.2s ease;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.attack-btn:hover { filter: brightness(1.12); }
.attack-btn:active { transform: translateY(2px) scale(0.995); }

.attack-btn.ready {
  animation: attackGlow 1.6s ease-in-out infinite;
}

.attack-btn.dead { filter: grayscale(0.8) brightness(0.6); cursor: not-allowed; animation: none; }

.attack-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.attack-cd {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: rgba(5, 2, 8, 0.62);
  pointer-events: none;
}

.auto-btn {
  grid-area: auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
  font-size: 11.5px;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: all 0.15s ease;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.auto-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.auto-btn .auto-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dim);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.auto-btn.on { color: var(--good); border-color: rgba(87, 217, 138, 0.4); }
.auto-btn.on .auto-dot { background: var(--good); box-shadow: 0 0 10px var(--good); animation: bossPulse 1.6s ease-in-out infinite; }

.xp-block { grid-area: xp; }

/* ============================== Shop panel ============================== */

.panel-shop { display: flex; flex-direction: column; padding: 10px; overflow: hidden; }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: rgba(8, 6, 16, 0.6);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 4px;
}

.tab-btn {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  background: linear-gradient(180deg, #2c2447, #221b38);
  color: var(--gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 10px rgba(0, 0, 0, 0.4);
}

.tab-btn.fx-tab-ping { animation: tabPing 0.5s ease; }

.badge {
  position: absolute;
  top: -5px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--crimson);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(229, 72, 77, 0.6);
}

.mode-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 2px 7px;
}

.mode-label { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); margin-right: auto; }

.mode-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-weight: 700;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.mode-btn:hover { color: var(--ink); }
.mode-btn.active { background: rgba(240, 192, 74, 0.14); border-color: rgba(240, 192, 74, 0.45); color: var(--gold); }

.tab-panes { flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; }
.pane-hint { font-size: 12px; color: var(--muted); margin: 4px 2px 10px; line-height: 1.5; }
.pane-hint b { color: var(--ink); }

/* rows */

.list { display: flex; flex-direction: column; gap: 6px; }

.row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
  color: var(--ink);
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.13s ease, background 0.13s ease, transform 0.08s ease;
}

.row:hover { background: rgba(255, 255, 255, 0.05); transform: translateX(2px); }
.row:active { transform: translateX(2px) scale(0.99); }

.row.affordable { border-color: rgba(240, 192, 74, 0.5); box-shadow: 0 0 0 1px rgba(240, 192, 74, 0.12), 0 4px 16px rgba(0, 0, 0, 0.3); }
.row.affordable .row-cost { color: var(--gold); }
.row.unaffordable { opacity: 0.55; }
.row.unaffordable .row-cost { color: var(--bad); }
.row.maxed { opacity: 0.4; cursor: default; }

.row-icon { font-size: 22px; text-align: center; }

.row-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-title { font-weight: 700; font-size: 13.5px; }
.row-lvl { color: var(--gold); font-weight: 800; }
.row-desc { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

.row-cost { font-weight: 800; font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cost-count { display: block; font-size: 10.5px; color: var(--dim); }
.cost-sp { color: var(--xp); }
.cost-soul { color: var(--soul); }

/* feats */

.feat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.feat {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 9px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0.45;
  filter: grayscale(0.9);
  transition: all 0.2s ease;
}

.feat.unlocked {
  opacity: 1;
  filter: none;
  border-color: rgba(240, 192, 74, 0.4);
  background: linear-gradient(180deg, rgba(240, 192, 74, 0.08), rgba(240, 192, 74, 0.02));
}

.feat-icon { font-size: 20px; }
.feat-name { font-weight: 700; font-size: 12.5px; }
.feat.unlocked .feat-name { color: var(--gold); }
.feat-desc { font-size: 11px; color: var(--muted); line-height: 1.35; }

/* prestige */

.prestige-box {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-prestige {
  width: 100%;
  border-radius: 11px;
  border: 1px solid rgba(88, 214, 180, 0.4);
  background: linear-gradient(180deg, rgba(88, 214, 180, 0.16), rgba(88, 214, 180, 0.05));
  color: var(--soul);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 13px;
  padding: 11px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-prestige b { font-size: 15px; }
.btn-prestige:disabled { cursor: not-allowed; border-color: var(--line); background: rgba(255, 255, 255, 0.02); color: var(--dim); }
.btn-prestige.ready { animation: soulGlow 2s ease-in-out infinite; }
.btn-prestige.ready:hover { filter: brightness(1.15); }

.prestige-hint { font-size: 11px; color: var(--dim); text-align: center; }

/* ============================== Toasts ============================== */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
  max-width: 320px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  background: linear-gradient(180deg, rgba(38, 31, 60, 0.98), rgba(22, 17, 38, 0.98));
  border: 1px solid rgba(240, 192, 74, 0.35);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  padding: 11px 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  animation: toastIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.toast-icon { font-size: 22px; }
.toast-body { display: flex; flex-direction: column; gap: 2px; }
.toast-body b { font-size: 13px; }
.toast-sub { font-size: 11.5px; color: var(--muted); }

.toast-prestige { border-color: rgba(88, 214, 180, 0.4); border-left-color: var(--soul); }
.toast-danger { border-color: rgba(255, 107, 107, 0.4); border-left-color: var(--bad); }

/* ============================== Log feed ============================== */

.log-feed {
  position: fixed;
  left: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 60;
  pointer-events: none;
  max-width: 340px;
}

.log-item {
  font-size: 12px;
  color: var(--muted);
  background: rgba(10, 8, 18, 0.72);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 11px;
  animation: logIn 0.25s ease;
}

.log-item:nth-child(n+3) { opacity: 0.65; }
.log-item:nth-child(n+5) { opacity: 0.4; }

.log-boss { color: var(--ember); }
.log-zone { color: var(--soul); }
.log-level { color: var(--xp); }
.log-feat { color: var(--gold); }
.log-death { color: var(--bad); }
.log-prestige { color: var(--soul); font-weight: 700; }
.log-hint { color: #c9c3e0; border-color: rgba(240, 192, 74, 0.35); }

/* ============================== Modals ============================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 10, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.18s ease;
  padding: 20px;
}

.modal {
  width: min(460px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #221b39, #161129);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 20px 20px 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
  color: var(--gold);
}

.modal-body { font-size: 13.5px; line-height: 1.6; }
.modal-text p { margin: 0 0 10px; }
.modal-highlight { color: var(--gold); font-weight: 700; }
.modal-note { color: var(--dim); font-size: 11.5px; margin-top: 14px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.btn {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.13s ease;
}

.btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
.btn-primary { background: linear-gradient(180deg, #8a2529, #5a1418); border-color: rgba(255, 140, 120, 0.4); color: #fff; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-danger { border-color: rgba(255, 107, 107, 0.5); color: var(--bad); }

.settings-grid { display: flex; flex-direction: column; gap: 8px; }
.settings-grid h4 { margin: 12px 0 2px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.settings-grid h4.danger-title { color: var(--bad); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.toggle-row input { width: 17px; height: 17px; accent-color: var(--gold); cursor: pointer; }

.save-area {
  width: 100%;
  resize: vertical;
  background: #0d0a18;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px;
  line-height: 1.45;
  word-break: break-all;
}

.save-area:focus { outline: 1px solid var(--gold); }

/* ============================== FX ============================== */

.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }

.fx-float {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  animation: floatUp 0.9s ease-out forwards;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fx-dmg { font-size: 16px; color: #f3f0ff; }
.fx-crit { font-size: 25px; color: var(--gold); text-shadow: 0 0 14px rgba(240, 192, 74, 0.85), 0 2px 6px rgba(0, 0, 0, 0.9); animation: critPop 0.95s cubic-bezier(0.2, 0.9, 0.3, 1.3) forwards; }
.fx-gold { color: var(--gold); font-size: 15px; animation-delay: 0.08s; }
.fx-hurt { color: #ff7b7b; font-size: 15px; }
.fx-boss { color: var(--crimson); font-size: 21px; letter-spacing: 0.2em; animation-duration: 1.2s; }

.fx-spark {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: sparkFly 0.6s ease-out forwards;
  filter: blur(0.3px) drop-shadow(0 0 6px currentColor);
}

.fx-slash {
  position: absolute;
  width: 130px;
  height: 7px;
  border-radius: 999px;
  transform-origin: center;
  background: linear-gradient(90deg, transparent, #fff 30%, #fff 45%, transparent 80%);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.9);
  animation: slashSweep 0.16s ease-out forwards;
  opacity: 0.95;
}

.fx-slash-crit { height: 11px; background: linear-gradient(90deg, transparent, var(--gold) 30%, #fff 50%, transparent 80%); box-shadow: 0 0 24px rgba(240, 192, 74, 0.95); }

.fx-poof {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 42px;
  animation: poofUp 0.7s ease-out forwards;
  filter: drop-shadow(0 0 16px rgba(255, 200, 120, 0.7));
}

.fx-poof-boss { font-size: 68px; animation-duration: 0.9s; }

/* ============================== Keyframes ============================== */

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes hpPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

@keyframes bossPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.68; }
}

@keyframes bossAura {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.95; transform: scale(1.12); }
}

@keyframes fogDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(9%, 6%, 0) scale(1.18); }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes deathFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes attackGlow {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(229, 72, 77, 0.45); }
  50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 26px 4px rgba(229, 72, 77, 0.38); }
}

@keyframes soulGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 214, 180, 0.35); }
  50% { box-shadow: 0 0 22px 3px rgba(88, 214, 180, 0.35); }
}

@keyframes tabPing {
  0% { transform: scale(1); }
  40% { transform: scale(1.09); }
  100% { transform: scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes logIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.85); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -190%) scale(0.92); }
}

@keyframes critPop {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.5); }
  25% { opacity: 1; transform: translate(-50%, -60%) scale(1.45); }
  45% { transform: translate(-50%, -70%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -230%) scale(0.9); }
}

@keyframes sparkFly {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.4) rotate(var(--rot, 0deg)); }
}

@keyframes slashSweep {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot, -30deg)) scaleX(0.25); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot, -30deg)) scaleX(1.35); }
}

@keyframes poofUp {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.7); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1.5) rotate(14deg); filter: blur(5px); }
}

/* fighter action animations */
@keyframes lungeRight {
  0% { transform: translateX(0); }
  35% { transform: translateX(30px) translateY(-4px); }
  100% { transform: translateX(0); }
}

@keyframes lungeLeft {
  0% { transform: translateX(0); }
  35% { transform: translateX(-30px) translateY(-4px); }
  100% { transform: translateX(0); }
}

@keyframes flinch {
  0% { transform: translateX(0) rotate(0); filter: brightness(1); }
  30% { transform: translateX(9px) rotate(5deg); filter: brightness(2.4) saturate(0.4); }
  100% { transform: translateX(0) rotate(0); filter: brightness(1); }
}

@keyframes flinchLeft {
  0% { transform: translateX(0) rotate(0); filter: brightness(1); }
  30% { transform: translateX(-9px) rotate(-5deg); filter: brightness(2.4) saturate(0.4); }
  100% { transform: translateX(0) rotate(0); filter: brightness(1); }
}

@keyframes spawnIn {
  0% { opacity: 0; transform: translateY(-26px) scale(0.55); }
  60% { opacity: 1; transform: translateY(3px) scale(1.06); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.player.fx-attack .fighter-move { animation: lungeRight 0.22s ease-out; }
.enemy.fx-hit .fighter-move { animation: flinch 0.22s ease-out; }
.enemy.fx-enemy-attack .fighter-move { animation: lungeLeft 0.26s ease-out; }
.player.fx-hurt .fighter-move { animation: flinchLeft 0.24s ease-out; }
.enemy.fx-spawn .fighter-move { animation: spawnIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.25); }

@keyframes arenaShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(calc(var(--shakeAmp) * -1), calc(var(--shakeAmp) * 0.4)); }
  40% { transform: translate(var(--shakeAmp), calc(var(--shakeAmp) * -0.3)); }
  60% { transform: translate(calc(var(--shakeAmp) * -0.6), calc(var(--shakeAmp) * 0.2)); }
  80% { transform: translate(calc(var(--shakeAmp) * 0.4), 0); }
}

.arena.fx-shake { animation: arenaShake 0.24s ease-out; }

@keyframes deathFlash {
  0% { box-shadow: inset 0 0 0 0 rgba(229, 72, 77, 0); }
  35% { box-shadow: inset 0 0 120px 40px rgba(229, 72, 77, 0.55); }
  100% { box-shadow: inset 0 0 0 0 rgba(229, 72, 77, 0); }
}

.arena.fx-death-flash { animation: deathFlash 0.6s ease-out; }

@keyframes hpflash {
  0% { filter: brightness(1); }
  35% { filter: brightness(2.6); }
  100% { filter: brightness(1); }
}

.bar-fill.fx-hpflash { animation: hpflash 0.3s ease-out; }

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.fx-shake-x { animation: shakeX 0.3s ease; }

/* ============================== Scrollbars ============================== */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid rgba(240, 192, 74, 0.7); outline-offset: 2px; }

/* ============================== Responsive ============================== */

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: 230px minmax(0, 1fr) 300px;
    padding: 0 12px 12px;
    gap: 10px;
  }
  .brand-sub { display: none; }
}

@media (max-width: 1020px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100dvh; }
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas: 'arena' 'stats' 'shop';
  }
  .panel-stats { grid-area: stats; }
  .panel-shop { grid-area: shop; max-height: none; }
  .arena-wrap { grid-area: arena; }
  .panel { max-height: none; }
  .arena { min-height: 330px; }
  .log-feed { display: none; }
  .toasts { left: 12px; right: 12px; max-width: none; bottom: 12px; }
}

@media (max-width: 620px) {
  .brand-name { font-size: 19px; }
  .zone-line { font-size: 14.5px; }
  .attack-btn { font-size: 18px; }
  .panel-stats, .panel-shop { padding: 12px 10px; }
  .feat-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 10px 12px 8px; }
}
