@import url("https://fonts.googleapis.com/css2?family=Lalezar&family=Vazirmatn:wght@300;400;500;600;700&display=swap");

:root {
  --bg: #0a0f1f;
  --bg-2: #0f1a2f;
  --panel: #151f38;
  --panel-2: #0e1628;
  --text: #f6f7ff;
  --muted: #b7c2d6;
  --accent: #f6c24a;
  --accent-2: #3bc8ff;
  --success: #35e089;
  --danger: #ff6b6b;
  --shadow: rgba(4, 6, 12, 0.55);
  --tile: #192440;
  --border: #273252;
  --game-logo-url: url("/static/assets/logo.png");
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at -10% -10%, rgba(74, 110, 255, 0.32) 0%, transparent 60%),
    radial-gradient(900px 600px at 120% 0%, rgba(246, 194, 74, 0.25) 0%, transparent 60%),
    radial-gradient(900px 800px at 50% 120%, rgba(30, 180, 255, 0.18) 0%, transparent 60%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 60%);
  opacity: 0.35;
}

html.boot-loading .wrap {
  visibility: hidden;
}

html.app-ready .wrap {
  visibility: visible;
}


.app-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(7, 10, 20, 0.82);
  backdrop-filter: blur(6px);
  z-index: 9999;
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0.2px;
  text-align: center;
  padding: 24px;
}

.app-loading .spinner {
  width: 96px;
  height: 96px;
  margin-bottom: 16px;
  position: relative;
  display: grid;
  place-items: center;
}

.app-loading .spinner::before,
.app-loading .spinner::after {
  content: none;
}

.app-loading .loading-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px 18px 22px 22px;
  background-image: var(--game-logo-url);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  z-index: 2;
  animation: logo-spin 2.8s linear infinite;
}

.app-loading .loading-text {
  color: transparent;
  font-size: 13px;
  position: relative;
  text-align: center;
  width: 100%;
}

.app-loading .loading-text::before {
  content: attr(data-fa);
  color: var(--muted);
  font-size: 13px;
  display: block;
  text-align: center;
}

html[lang="en"] .app-loading .loading-text::before {
  content: attr(data-en);
}

.app-loading .loading-progress {
  width: min(220px, 70vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  overflow: hidden;
  margin-top: 10px;
  display: none;
}

.app-loading .loading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5ad8ff, #f6c24a);
  box-shadow: 0 0 10px rgba(90, 216, 255, 0.6);
  transition: width 0.2s ease;
}

.app-loading .loading-progress-text {
  margin-top: 6px;
  font-size: 12px;
  color: #b7c2d6;
  letter-spacing: 0.5px;
  display: none;
}

html.booting .app-loading .loading-progress,
html.booting .app-loading .loading-progress-text {
  display: block;
}

html.boot-loading .app-loading,
html.nav-loading .app-loading {
  display: flex;
  flex-direction: column;
}

html.app-ready .app-loading {
  display: none;
}

html.app-ready.nav-loading .app-loading {
  display: flex;
  flex-direction: column;
}

html[dir="ltr"] body {
  direction: ltr;
}

html[dir="ltr"] .wrap {
  text-align: left;
}

a { text-decoration: none; color: inherit; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 120px;
}

header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 16px 16px 20px 20px;
  background-image:
    var(--game-logo-url),
    linear-gradient(160deg, #f6c24a 0%, #ff9f3f 40%, #5ad8ff 100%);
  background-size: cover, cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 12px 28px var(--shadow);
  position: relative;
}

.logo::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.6), transparent 60%);
  opacity: 0.7;
}

.brand h1 {
  font-family: "Lalezar", cursive;
  font-size: 22px;
  margin: 0;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 10px 30px var(--shadow);
}

.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.top-menu {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #141a2b 0%, #111827 100%);
  border: 1px solid #1f2a47;
  border-radius: 14px;
  padding: 6px 8px;
  margin-bottom: 12px;
  box-shadow: 0 10px 24px var(--shadow);
}

.top-menu .group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.top-chip {
  padding: 6px 8px;
  background: #1a2138;
  border: 1px solid #2a355a;
  border-radius: 10px;
  font-size: 11px;
  color: #cdd6e6;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  position: relative;
  white-space: nowrap;
}

.top-chip:hover {
  border-color: #3a4a7a;
  color: #e6edf9;
}

.top-chip:visited {
  color: #cdd6e6;
}

.btn,
.back-btn,
.top-chip,
.menu-card,
.action-btn,
.bottom-btn,
.nav-item,
.seg-btn,
.skill-card {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible,
.back-btn:focus-visible,
.top-chip:focus-visible,
.menu-card:focus-visible,
.action-btn:focus-visible,
.bottom-btn:focus-visible,
.nav-item:focus-visible,
.seg-btn:focus-visible,
.skill-card:focus-visible {
  box-shadow: 0 0 0 2px rgba(246, 194, 74, 0.35);
}

.btn:active,
.back-btn:active,
.top-chip:active,
.menu-card:active,
.action-btn:active,
.bottom-btn:active,
.nav-item:active,
.seg-btn:active,
.skill-card:active {
  transform: translateY(1px) scale(0.98);
  filter: brightness(1.05);
}

.top-chip .chip-badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff4d5e;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(255, 77, 94, 0.45);
}

.top-chip .chip-badge.show {
  display: inline-flex;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
}

.sidebar {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 20px 40px var(--shadow);
  position: sticky;
  top: 16px;
  height: fit-content;
}

.menu-title {
  font-weight: 600;
  margin-bottom: 10px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.nav-item {
  border: 1px solid #263253;
  background: linear-gradient(160deg, #1b2542, #141b31);
  color: #cbd6ee;
  padding: 10px;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  text-align: right;
  font-size: 12px;
  min-height: 64px;
  position: relative;
  overflow: hidden;
}

html[dir="ltr"] .nav-item {
  text-align: left;
}

.nav-item strong {
  font-size: 13px;
  color: #e7ecf7;
}

.nav-item.active {
  background: linear-gradient(140deg, #f6c24a, #ff8a4b);
  border-color: transparent;
  color: #2b1a10;
  box-shadow: 0 12px 24px rgba(246, 194, 74, 0.35);
}

.card {
  background: linear-gradient(180deg, #182342 0%, #121a2f 100%);
  border: 1px solid #2a375c;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 20px 40px var(--shadow);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  animation: float-in 0.45s ease-out;
}

.card h2 {
  font-family: "Lalezar", cursive;
  margin: 0 0 6px;
  font-size: 22px;
}

.muted { color: var(--muted); font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.tile {
  background: linear-gradient(160deg, #1b2a4d, #171f37);
  border: 1px solid #2a3c66;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.stat-tile {
  min-height: 86px;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #cbd6ee;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #f8f9ff;
}

.base-overview {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(51, 79, 130, 0.55);
  background:
    radial-gradient(120% 120% at 10% -20%, rgba(90, 140, 255, 0.18) 0%, rgba(10, 15, 31, 0.0) 55%),
    radial-gradient(80% 80% at 100% 0%, rgba(246, 194, 74, 0.16) 0%, rgba(10, 15, 31, 0.0) 55%),
    linear-gradient(180deg, rgba(16, 24, 45, 0.96) 0%, rgba(11, 18, 35, 0.98) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 18px 45px rgba(2, 8, 22, 0.35);
}

.base-overview::before,
.base-overview::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.base-overview::before {
  inset: -20% auto auto -10%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(120, 182, 255, 0.28) 0%, rgba(120, 182, 255, 0.0) 70%);
  opacity: 0.6;
}

.base-overview::after {
  inset: auto -20% -10% auto;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(255, 210, 120, 0.22) 0%, rgba(255, 210, 120, 0.0) 70%);
  opacity: 0.5;
}

.base-overview .section-head h2 {
  letter-spacing: 0.4px;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.base-overview .stats-grid {
  margin-top: 14px;
}

.base-overview .stat-tile {
  position: relative;
  background: linear-gradient(160deg, rgba(24, 34, 58, 0.95) 0%, rgba(12, 18, 36, 0.96) 100%);
  border: 1px solid rgba(46, 62, 100, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 12px 24px rgba(0, 0, 0, 0.3);
}

.base-overview .stat-tile::after {
  content: none;
}

.base-overview .stat-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #d7e2f7;
  text-transform: none;
  letter-spacing: 0.2px;
}

.base-overview .stat-label .ico {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 214, 125, 0.4), rgba(255, 214, 125, 0.05) 70%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.base-overview .stat-value {
  font-size: 23px;
  font-weight: 700;
  color: #f2f6ff;
  text-align: left;
}

.base-overview .stat-sub {
  font-size: 11px;
  color: #9eb0d2;
  text-align: left;
}

@media (max-width: 700px) {
  .base-overview .stat-value {
    font-size: 20px;
  }
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #233155;
  background: #162039;
  color: #dfe7f6;
  cursor: pointer;
  font-size: 13px;
  position: relative;
  overflow: visible;
}

.action-btn.primary {
  background: linear-gradient(140deg, #f6c24a, #ff9a47);
  border: none;
  color: #2b1b0f;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(246, 194, 74, 0.35);
}

.collect-toast {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 18, 34, 0.92);
  border: 1px solid #28365a;
  color: #e8f0ff;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
  animation: collect-pop 0.25s ease-out;
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
}

.collect-fx {
  position: absolute;
  width: 18px;
  height: 18px;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.9;
  animation: collect-burst 0.9s ease-out forwards;
  pointer-events: none;
  z-index: 4;
}

@keyframes collect-burst {
  from { transform: translate(0, 0) scale(1); opacity: 0.95; }
  to { transform: translate(var(--dx), var(--dy)) scale(0.5); opacity: 0; }
}

@keyframes collect-pop {
  from { transform: translateX(-50%) translateY(6px); opacity: 0.4; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.row-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.row-main .muted {
  margin-inline-start: 6px;
}

.btn.ghost {
  background: #162039;
  border: 1px solid #233155;
  color: #dfe7f6;
}

.layout-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
  margin-top: 16px;
}

.layout-board {
  --layout-size: 5;
  display: grid;
  grid-template-columns: repeat(var(--layout-size), minmax(0, 1fr));
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  background: #0d1528;
  border: 1px solid #243153;
  max-height: 520px;
  overflow: auto;
}

.layout-cell {
  aspect-ratio: 1;
  background: #111a31;
  border: 1px solid #223152;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.layout-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.35);
}

.layout-cell.active {
  border-color: #f6c24a;
  box-shadow: 0 0 0 2px rgba(246, 194, 74, 0.35);
}

.layout-cell.drag-source {
  opacity: 0.6;
  border-color: #5ad8ff;
  box-shadow: 0 0 0 2px rgba(90, 216, 255, 0.35);
}

.layout-cell.drag-over {
  border-color: #ffb454;
  box-shadow: 0 0 0 2px rgba(255, 180, 84, 0.4);
}

.layout-cell .ico-lg {
  width: 70%;
  height: 70%;
}

.cell-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2a3a62;
  opacity: 0.6;
}

.layout-palette {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.token-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #162039;
  border: 1px solid #223152;
  border-radius: 12px;
  padding: 8px 10px;
  color: #dfe7f6;
  cursor: pointer;
  font-size: 12px;
}

.token-btn.active {
  background: linear-gradient(140deg, #f6c24a, #ff9a47);
  border: none;
  color: #2b1b0f;
  box-shadow: 0 10px 20px rgba(246, 194, 74, 0.35);
}

.token-btn.active .token-count {
  color: #2b1b0f;
}

.token-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.token-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.token-count {
  font-size: 11px;
  color: #9fb0d0;
}

.layout-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
  text-align: center;
}

.layout-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.base-note {
  margin-top: 10px;
}

/* King Battle */
.battle-card {
  display: grid;
  gap: 14px;
}
.battle-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.battle-title {
  font-weight: 700;
}
.battle-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.battle-economy {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.economy-card {
  border: 1px solid #243153;
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(160deg, #111a34, #0b1227);
  display: grid;
  gap: 6px;
}
.economy-title {
  font-weight: 700;
  font-size: 12px;
  color: #dbe3f5;
}
.economy-row {
  font-size: 12px;
  color: #cbd5f5;
}
.battle-tactics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 10px;
  border: 1px dashed #26304a;
  border-radius: 12px;
  background: #0d1629;
}
.daily-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed #26304a;
  border-radius: 12px;
  background: #0b1426;
}
.daily-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.daily-title {
  font-weight: 700;
  font-size: 13px;
}
.daily-list {
  display: grid;
  gap: 6px;
}
.daily-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #0f172a;
  border: 1px solid #1f2a44;
  font-size: 12px;
}
.daily-item.done {
  border-color: #22c55e;
  color: #d9fbe7;
}
.daily-item .reward {
  color: #f2e9a7;
}
.gambit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 20, 0.72);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 16px;
}
.gambit-card {
  width: min(420px, 96vw);
  background: #0b1426;
  border: 1px solid #23304a;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 10px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.gambit-title {
  font-weight: 800;
  font-size: 16px;
}
.gambit-sub {
  font-size: 12px;
  color: #9fb0d6;
}
.gambit-timer {
  font-size: 36px;
  font-weight: 800;
  color: #7dd3fc;
}
.gambit-hint {
  font-size: 11px;
  color: #96a8cc;
}
.gambit-status {
  font-size: 12px;
  color: #7dd3fc;
  margin-top: 6px;
}
.tactic-block {
  display: grid;
  gap: 8px;
}
.tactic-title {
  font-weight: 700;
  font-size: 13px;
}
.tactic-desc {
  font-size: 11px;
  color: #9db0d3;
}
.seg {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.seg-btn {
  background: #0f172a;
  border: 1px solid #1f2a44;
  color: #d3def3;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.seg-btn.active {
  border-color: #38bdf8;
  color: #e6f6ff;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
  transform: translateY(-1px);
}
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.skill-grid:empty {
  display: none;
}
.skill-card {
  background: #0f172a;
  border: 1px solid #1f2a44;
  border-radius: 12px;
  padding: 10px;
  text-align: right;
  color: #e2e8f0;
}

html[dir="ltr"] .skill-card {
  text-align: left;
}
.skill-card--mini {
  padding: 8px;
}
.skill-card--mini .skill-title {
  font-size: 12px;
  margin-bottom: 4px;
}
.skill-card--mini .skill-meta {
  font-size: 10px;
  margin-top: 2px;
}
.skill-card--mini .skill-note {
  margin-top: 4px;
  font-size: 10px;
  color: #ffb38a;
}
.skill-card--mini .skill-desc,
.skill-card--mini .skill-price {
  display: none;
}
.skill-card.active {
  outline: 2px solid #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}
.skill-card:disabled {
  opacity: 0.45;
}
.skill-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.skill-desc {
  font-size: 12px;
  color: #b6c2dd;
  min-height: 34px;
}
.skill-meta {
  font-size: 11px;
  color: #93a3c7;
  margin-top: 6px;
}
.skill-price {
  font-size: 12px;
  margin-top: 6px;
}
.battle-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.battle-match {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 12px;
  border: 1px dashed #26304a;
  border-radius: 12px;
  background: #0f172a;
}
.battle-result {
  border: 1px solid #1f2a44;
  border-radius: 12px;
  padding: 12px;
  background: #0b1220;
  display: grid;
  gap: 8px;
}
.battle-loading {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 18px 10px;
  border: 1px dashed #26304a;
  border-radius: 12px;
  background: #0f172a;
}
.battle-countdown {
  font-size: 34px;
  font-weight: 800;
  color: #7dd3fc;
  animation: fadePop 0.9s ease-in-out infinite;
}
@keyframes fadePop {
  0% { opacity: 0.2; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0.2; transform: scale(0.9); }
}
.battle-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: linear-gradient(120deg, #0f172a, #111827);
  border: 1px solid #1f2a44;
  border-radius: 12px;
}
.arena-side {
  display: grid;
  gap: 6px;
  text-align: center;
}
.arena-name {
  font-weight: 700;
  font-size: 14px;
}
.arena-name.you {
  color: #38bdf8;
}
.arena-name.enemy {
  color: #fca5a5;
}
.arena-meta {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.hp-wrap {
  width: 100%;
  max-width: 220px;
  height: 10px;
  margin: 2px auto 0;
  border-radius: 999px;
  background: #121a2f;
  border: 1px solid #243153;
  overflow: hidden;
}
.hp-bar {
  height: 100%;
  width: 100%;
  transition: width 0.35s ease;
}
.hp-bar.you {
  background: linear-gradient(90deg, #22d3ee, #38bdf8);
}
.hp-bar.enemy {
  background: linear-gradient(90deg, #fb7185, #ef4444);
}
.arena-divider {
  font-size: 18px;
  color: #93a3c7;
}
.battle-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #1f2a44;
  border-radius: 12px;
  background: linear-gradient(180deg, #121a30, #0a0f1d);
  overflow: hidden;
}
.battle-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--scene-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.35;
  filter: saturate(1.2) contrast(1.05);
  pointer-events: none;
}
.battle-stage.scene-dawn .scene-sky {
  background: radial-gradient(600px 180px at 30% -40%, rgba(255, 210, 145, 0.45), transparent 60%),
              radial-gradient(420px 160px at 80% 0%, rgba(253, 186, 116, 0.3), transparent 60%),
              linear-gradient(180deg, rgba(20, 26, 48, 0.95), rgba(8, 12, 24, 0.98));
}
.battle-stage.scene-storm .scene-sky {
  background: radial-gradient(600px 180px at 50% -40%, rgba(94, 234, 212, 0.2), transparent 60%),
              linear-gradient(180deg, rgba(11, 15, 26, 0.98), rgba(5, 8, 18, 1));
}
.battle-stage.scene-snow .scene-sky {
  background: radial-gradient(600px 200px at 30% -40%, rgba(224, 231, 255, 0.5), transparent 60%),
              linear-gradient(180deg, rgba(16, 24, 48, 0.95), rgba(7, 10, 20, 1));
}
.battle-stage.scene-desert .scene-sky {
  background: radial-gradient(600px 180px at 30% -40%, rgba(254, 215, 170, 0.45), transparent 60%),
              linear-gradient(180deg, rgba(25, 18, 12, 0.96), rgba(10, 8, 6, 1));
}
.battle-stage.scene-twilight .scene-sky {
  background: radial-gradient(600px 180px at 60% -40%, rgba(196, 181, 253, 0.35), transparent 60%),
              linear-gradient(180deg, rgba(14, 12, 30, 0.98), rgba(7, 8, 20, 1));
}
.battle-stage.scene-storm .scene-fog {
  animation-duration: 3.8s;
  opacity: 0.9;
}
.battle-stage.scene-snow .scene-fog {
  opacity: 0.6;
}
.battle-stage.scene-desert .scene-fog {
  background: radial-gradient(120px 28px at 15% 80%, rgba(253, 230, 138, 0.12), transparent 70%),
              radial-gradient(120px 28px at 85% 70%, rgba(253, 230, 138, 0.1), transparent 70%);
}
.battle-scene {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.scene-sky {
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 160px at 30% -40%, rgba(76, 175, 255, 0.25), transparent 60%),
              radial-gradient(400px 140px at 80% 0%, rgba(255, 153, 102, 0.2), transparent 60%),
              linear-gradient(180deg, rgba(10, 17, 38, 0.95), rgba(8, 12, 24, 0.98));
}
.scene-ground {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: -10px;
  height: 55px;
  background: radial-gradient(120px 18px at 20% 10%, rgba(56, 189, 248, 0.2), transparent 70%),
              radial-gradient(160px 18px at 80% 10%, rgba(251, 113, 133, 0.2), transparent 70%),
              linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(8, 12, 24, 1));
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  display: none;
}
.scene-banners {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  font-size: 16px;
  opacity: 0.8;
}
.scene-fog {
  position: absolute;
  inset: 0;
  background: radial-gradient(120px 28px at 15% 80%, rgba(226, 232, 240, 0.08), transparent 70%),
              radial-gradient(120px 28px at 85% 70%, rgba(226, 232, 240, 0.07), transparent 70%);
  animation: fogDrift 6s ease-in-out infinite;
}
.battle-stage.shake {
  animation: stageShake 0.35s ease;
}
.battle-stage.hitpause {
  animation: hitPause 0.18s ease;
}
.battle-stage.flash-hit {
  animation: stageFlashHit 0.45s ease;
}
.battle-stage.flash-crit {
  animation: stageFlashCrit 0.5s ease;
}
.battle-stage.flash-ult {
  animation: stageFlashUlt 0.6s ease;
}
.battle-stage.flash-heal {
  animation: stageFlashHeal 0.45s ease;
}
.battle-stage.flash-round {
  animation: stageFlashRound 0.4s ease;
}
.battle-stage.flash-end {
  animation: stageFlashEnd 0.45s ease;
}
.fighter {
  position: absolute;
  bottom: 18px;
  font-size: 28px;
  transition: transform 0.18s ease;
  user-select: none;
  display: grid;
  justify-items: center;
  gap: 2px;
}
.fighter.you {
  left: 16%;
}
.fighter.enemy {
  right: 16%;
}
.fighter-body {
  font-size: 32px;
  filter: drop-shadow(0 0 10px rgba(129, 140, 248, 0.45));
}
.fighter-weapon {
  font-size: 22px;
  transform-origin: 30% 70%;
  animation: weaponIdle 1.8s ease-in-out infinite;
}
.fighter-weapon.weapon-burst {
  animation: weaponBurst 0.35s ease;
}
.fighter-shadow {
  width: 36px;
  height: 10px;
  border-radius: 50%;
  background: rgba(2, 6, 23, 0.65);
  filter: blur(2px);
}
.fighter.atk {
  transform: translateX(20px) scale(1.06);
}
.fighter.enemy.atk {
  transform: translateX(-20px) scale(1.06);
}
.fighter.dash {
  animation: dashIn 0.3s ease;
}
.fighter.enemy.dash {
  animation: dashInEnemy 0.3s ease;
}
.fighter.windup {
  animation: windup 0.22s ease;
}
.fighter.enemy.windup {
  animation: windupEnemy 0.22s ease;
}
.fighter.contact {
  animation: contactHit 0.22s ease;
}
.fighter.enemy.contact {
  animation: contactHitEnemy 0.22s ease;
}
.fighter.stagger-light {
  animation: staggerLight 0.22s ease;
}
.fighter.stagger-medium {
  animation: staggerMedium 0.26s ease;
}
.fighter.stagger-heavy {
  animation: staggerHeavy 0.3s ease;
}
.contact-flash {
  position: absolute;
  top: 64px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.95), rgba(255,255,255,0.1) 65%, transparent 70%);
  opacity: 0;
  animation: flashPop 0.25s ease;
  pointer-events: none;
}
.contact-flash.you {
  left: 40%;
}
.contact-flash.enemy {
  left: 60%;
}
.fighter.hit {
  filter: drop-shadow(0 0 8px rgba(251, 113, 133, 0.8));
}
.damage-fx {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translate(-50%, 8px) scale(0.94);
  opacity: 0;
  font-size: 22px;
  font-weight: 800;
  pointer-events: none;
}
.effect-toast {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 16, 32, 0.85);
  border: 1px solid #2a355a;
  font-size: 11px;
  color: #e2e8f0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.effect-toast.show {
  opacity: 1;
}
.effect-toast.fire { border-color: rgba(251, 113, 133, 0.7); }
.effect-toast.shock { border-color: rgba(56, 189, 248, 0.7); }
.effect-toast.shadow { border-color: rgba(148, 163, 184, 0.7); }
.effect-toast.earth { border-color: rgba(34, 197, 94, 0.7); }
.effect-toast.steel { border-color: rgba(226, 232, 240, 0.7); }
.effect-toast.wind { border-color: rgba(125, 211, 252, 0.7); }
.effect-toast.decision { border-color: rgba(167, 139, 250, 0.7); }
.spark {
  position: absolute;
  top: 78px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.95), rgba(255,255,255,0.2) 60%, transparent 70%);
  box-shadow: 0 0 10px rgba(255, 241, 118, 0.6);
  animation: sparkFly 0.5s ease;
}
.spark.you-to-enemy {
  left: 28%;
  animation-name: sparkFlyRight;
}
.spark.enemy-to-you {
  left: 72%;
  animation-name: sparkFlyLeft;
}
.rune-burst {
  position: absolute;
  bottom: 26px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px dashed rgba(226, 232, 240, 0.7);
  opacity: 0;
  animation: runePulse 0.7s ease;
  pointer-events: none;
}
.rune-burst.you { left: 18%; }
.rune-burst.enemy { left: 64%; }
.rune-burst.fire { border-color: rgba(251, 113, 133, 0.8); }
.rune-burst.shock { border-color: rgba(56, 189, 248, 0.8); }
.rune-burst.shadow { border-color: rgba(148, 163, 184, 0.7); }
.rune-burst.earth { border-color: rgba(34, 197, 94, 0.7); }
.rune-burst.steel { border-color: rgba(226, 232, 240, 0.8); }
.rune-burst.wind { border-color: rgba(125, 211, 252, 0.8); }
.magic-trail {
  position: absolute;
  top: 78px;
  width: 160px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.9), rgba(226, 232, 240, 0.0));
  opacity: 0;
  animation: trailFly 0.45s ease;
}
.magic-trail.you-to-enemy {
  left: 30%;
  animation-name: trailFlyRight;
}
.magic-trail.enemy-to-you {
  left: 52%;
  animation-name: trailFlyLeft;
}
.magic-trail.fire {
  background: linear-gradient(90deg, rgba(251, 113, 133, 0.9), rgba(251, 113, 133, 0));
}
.magic-trail.shock {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.9), rgba(56, 189, 248, 0));
}
.magic-trail.shadow {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.9), rgba(148, 163, 184, 0));
}
.magic-trail.earth {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.9), rgba(34, 197, 94, 0));
}
.magic-trail.steel {
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.9), rgba(226, 232, 240, 0));
}
.magic-trail.wind {
  background: linear-gradient(90deg, rgba(125, 211, 252, 0.9), rgba(125, 211, 252, 0));
}
.glyph-ring {
  position: absolute;
  bottom: 18px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(226, 232, 240, 0.5);
  opacity: 0;
  animation: glyphSpin 0.8s ease;
  pointer-events: none;
}
.glyph-ring.you { left: 16%; }
.glyph-ring.enemy { left: 62%; }
.glyph-ring.fire { border-color: rgba(251, 113, 133, 0.7); }
.glyph-ring.shock { border-color: rgba(56, 189, 248, 0.7); }
.glyph-ring.shadow { border-color: rgba(148, 163, 184, 0.6); }
.glyph-ring.earth { border-color: rgba(34, 197, 94, 0.6); }
.glyph-ring.steel { border-color: rgba(226, 232, 240, 0.7); }
.glyph-ring.wind { border-color: rgba(125, 211, 252, 0.7); }
.sparkle {
  position: absolute;
  bottom: 40px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 232, 240, 0.95), transparent 70%);
  opacity: 0;
  animation: sparklePop 0.45s ease;
  pointer-events: none;
}
.sparkle.you { left: 24%; }
.sparkle.enemy { left: 68%; }
.sparkle.fire { background: radial-gradient(circle, rgba(251, 113, 133, 0.95), transparent 70%); }
.sparkle.shock { background: radial-gradient(circle, rgba(56, 189, 248, 0.95), transparent 70%); }
.sparkle.shadow { background: radial-gradient(circle, rgba(148, 163, 184, 0.85), transparent 70%); }
.sparkle.earth { background: radial-gradient(circle, rgba(34, 197, 94, 0.85), transparent 70%); }
.sparkle.steel { background: radial-gradient(circle, rgba(226, 232, 240, 0.95), transparent 70%); }
.sparkle.wind { background: radial-gradient(circle, rgba(125, 211, 252, 0.95), transparent 70%); }
.spark.fire {
  box-shadow: 0 0 14px rgba(251, 113, 133, 0.8);
  background: radial-gradient(circle, rgba(251, 113, 133, 0.95), rgba(253, 186, 116, 0.35) 60%, transparent 70%);
}
.spark.shock {
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.85);
  background: radial-gradient(circle, rgba(56, 189, 248, 0.95), rgba(191, 219, 254, 0.4) 60%, transparent 70%);
}
.spark.shadow {
  box-shadow: 0 0 14px rgba(148, 163, 184, 0.6);
  background: radial-gradient(circle, rgba(148, 163, 184, 0.9), rgba(71, 85, 105, 0.4) 60%, transparent 70%);
}
.spark.earth {
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.6);
  background: radial-gradient(circle, rgba(34, 197, 94, 0.9), rgba(187, 247, 208, 0.4) 60%, transparent 70%);
}
.spark.steel {
  box-shadow: 0 0 12px rgba(226, 232, 240, 0.7);
  background: radial-gradient(circle, rgba(226, 232, 240, 0.95), rgba(148, 163, 184, 0.35) 60%, transparent 70%);
}
.spark.wind {
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.75);
  background: radial-gradient(circle, rgba(125, 211, 252, 0.95), rgba(224, 231, 255, 0.35) 60%, transparent 70%);
}
.impact-ring {
  position: absolute;
  bottom: 22px;
  width: 38px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(248, 250, 252, 0.5);
  opacity: 0;
  animation: ringPop 0.45s ease;
}
.impact-ring.you {
  left: 24%;
  border-color: rgba(56, 189, 248, 0.6);
}
.impact-ring.enemy {
  left: 68%;
  border-color: rgba(251, 113, 133, 0.6);
}
.impact-ring.fire {
  border-color: rgba(251, 113, 133, 0.8);
  box-shadow: 0 0 12px rgba(251, 113, 133, 0.45);
}
.impact-ring.shock {
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}
.impact-ring.shadow {
  border-color: rgba(148, 163, 184, 0.7);
  box-shadow: 0 0 10px rgba(148, 163, 184, 0.35);
}
.impact-ring.earth {
  border-color: rgba(34, 197, 94, 0.8);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.35);
}
.impact-ring.steel {
  border-color: rgba(226, 232, 240, 0.8);
  box-shadow: 0 0 10px rgba(226, 232, 240, 0.35);
}
.impact-ring.wind {
  border-color: rgba(125, 211, 252, 0.8);
  box-shadow: 0 0 10px rgba(125, 211, 252, 0.35);
}
.dust {
  position: absolute;
  bottom: 24px;
  width: 22px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 232, 240, 0.45), transparent 70%);
  filter: blur(1px);
  animation: dustPuff 0.45s ease;
}
.dust.you {
  left: 26%;
}
.dust.enemy {
  left: 70%;
}
.dust.fire {
  background: radial-gradient(circle, rgba(251, 113, 133, 0.6), transparent 70%);
}
.dust.shock {
  background: radial-gradient(circle, rgba(56, 189, 248, 0.6), transparent 70%);
}
.dust.shadow {
  background: radial-gradient(circle, rgba(148, 163, 184, 0.5), transparent 70%);
}
.dust.earth {
  background: radial-gradient(circle, rgba(34, 197, 94, 0.55), transparent 70%);
}
.dust.steel {
  background: radial-gradient(circle, rgba(226, 232, 240, 0.55), transparent 70%);
}
.dust.wind {
  background: radial-gradient(circle, rgba(125, 211, 252, 0.55), transparent 70%);
}
.slash-arc {
  position: absolute;
  top: 70px;
  width: 80px;
  height: 30px;
  border-radius: 50%;
  border-top: 2px solid rgba(248, 250, 252, 0.8);
  border-right: 2px solid rgba(248, 250, 252, 0.2);
  opacity: 0;
  animation: arcSlash 0.45s ease;
  pointer-events: none;
}
.slash-arc.you {
  left: 20%;
  transform: rotate(-20deg);
}
.slash-arc.enemy {
  left: 62%;
  transform: rotate(20deg);
}
.slash-arc.fire { border-top-color: rgba(251, 113, 133, 0.9); }
.slash-arc.shock { border-top-color: rgba(56, 189, 248, 0.9); }
.slash-arc.shadow { border-top-color: rgba(148, 163, 184, 0.8); }
.slash-arc.earth { border-top-color: rgba(34, 197, 94, 0.8); }
.slash-arc.steel { border-top-color: rgba(226, 232, 240, 0.9); }
.slash-arc.wind { border-top-color: rgba(125, 211, 252, 0.9); }
.burst {
  position: absolute;
  bottom: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(248, 250, 252, 0.8), transparent 65%);
  opacity: 0;
  animation: burstPop 0.45s ease;
  pointer-events: none;
}
.burst.you { left: 20%; }
.burst.enemy { left: 66%; }
.burst.fire { background: radial-gradient(circle, rgba(251, 113, 133, 0.85), transparent 65%); }
.burst.shock { background: radial-gradient(circle, rgba(56, 189, 248, 0.85), transparent 65%); }
.burst.shadow { background: radial-gradient(circle, rgba(148, 163, 184, 0.7), transparent 65%); }
.burst.earth { background: radial-gradient(circle, rgba(34, 197, 94, 0.7), transparent 65%); }
.burst.steel { background: radial-gradient(circle, rgba(226, 232, 240, 0.85), transparent 65%); }
.burst.wind { background: radial-gradient(circle, rgba(125, 211, 252, 0.8), transparent 65%); }
.heal-aura {
  position: absolute;
  bottom: 20px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(52, 211, 153, 0.7);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.4);
  opacity: 0;
  animation: auraPulse 0.6s ease;
  pointer-events: none;
}
.heal-aura.you { left: 18%; }
.heal-aura.enemy { left: 64%; }
.shield-bubble {
  position: absolute;
  bottom: 18px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid rgba(167, 139, 250, 0.75);
  box-shadow: inset 0 0 20px rgba(167, 139, 250, 0.3);
  opacity: 0;
  animation: bubblePop 0.7s ease;
  pointer-events: none;
}
.shield-bubble.you { left: 16%; }
.shield-bubble.enemy { left: 62%; }
.shock-wave {
  position: absolute;
  bottom: 24px;
  width: 60px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.6);
  opacity: 0;
  animation: wavePop 0.45s ease;
  pointer-events: none;
}
.shock-wave.you { left: 20%; }
.shock-wave.enemy { left: 64%; }
.shock-wave.fire { border-color: rgba(251, 113, 133, 0.7); }
.shock-wave.shock { border-color: rgba(56, 189, 248, 0.8); }
.shock-wave.shadow { border-color: rgba(148, 163, 184, 0.6); }
.shock-wave.earth { border-color: rgba(34, 197, 94, 0.6); }
.shock-wave.steel { border-color: rgba(226, 232, 240, 0.7); }
.shock-wave.wind { border-color: rgba(125, 211, 252, 0.7); }
.damage-fx.you {
  color: #fb7185;
  left: 32%;
}
.damage-fx.enemy {
  color: #7dd3fc;
  left: 68%;
}
.damage-fx.show {
  animation: dmgPop 0.5s ease;
}
.hp-bar.hp-flash-light {
  animation: hpFlashLight 0.22s ease;
}
.hp-bar.hp-flash-medium {
  animation: hpFlashMedium 0.26s ease;
}
.hp-bar.hp-flash-heavy {
  animation: hpFlashHeavy 0.3s ease;
}
@keyframes dmgPop {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.88); }
  25% { opacity: 1; transform: translate(-50%, -2px) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(1.04); }
}
@keyframes fogDrift {
  0% { opacity: 0.55; transform: translateX(0); }
  50% { opacity: 0.8; transform: translateX(6px); }
  100% { opacity: 0.55; transform: translateX(0); }
}
@keyframes stageShake {
  0% { transform: translateX(0); }
  35% { transform: translateX(-2px); }
  70% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}
@keyframes hitPause {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(0.995); filter: brightness(1.08); }
  100% { transform: scale(1); filter: brightness(1); }
}
@keyframes weaponIdle {
  0% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
  100% { transform: rotate(-8deg); }
}
@keyframes dashIn {
  0% { transform: translateX(0) scale(1); }
  60% { transform: translateX(46px) scale(1.1); }
  100% { transform: translateX(0) scale(1); }
}
@keyframes dashInEnemy {
  0% { transform: translateX(0) scale(1); }
  60% { transform: translateX(-46px) scale(1.1); }
  100% { transform: translateX(0) scale(1); }
}
@keyframes windup {
  0% { transform: translateX(0) scale(1); }
  60% { transform: translateX(-10px) scale(0.98); }
  100% { transform: translateX(0) scale(1); }
}
@keyframes windupEnemy {
  0% { transform: translateX(0) scale(1); }
  60% { transform: translateX(10px) scale(0.98); }
  100% { transform: translateX(0) scale(1); }
}
@keyframes contactHit {
  0% { transform: translateX(0) scale(1); }
  60% { transform: translateX(30px) scale(1.08); }
  100% { transform: translateX(0) scale(1); }
}
@keyframes contactHitEnemy {
  0% { transform: translateX(0) scale(1); }
  60% { transform: translateX(-30px) scale(1.08); }
  100% { transform: translateX(0) scale(1); }
}
@keyframes staggerLight {
  0% { transform: translateX(0); }
  50% { transform: translateX(-6px); }
  100% { transform: translateX(0); }
}
@keyframes staggerMedium {
  0% { transform: translateX(0); }
  40% { transform: translateX(-10px); }
  100% { transform: translateX(0); }
}
@keyframes staggerHeavy {
  0% { transform: translateX(0); }
  35% { transform: translateX(-14px); }
  100% { transform: translateX(0); }
}
@keyframes hpFlashLight {
  0% { box-shadow: 0 0 0 rgba(255,255,255,0); }
  50% { box-shadow: 0 0 8px rgba(255,255,255,0.25); }
  100% { box-shadow: 0 0 0 rgba(255,255,255,0); }
}
@keyframes hpFlashMedium {
  0% { box-shadow: 0 0 0 rgba(255,255,255,0); }
  50% { box-shadow: 0 0 10px rgba(255,255,255,0.35); }
  100% { box-shadow: 0 0 0 rgba(255,255,255,0); }
}
@keyframes hpFlashHeavy {
  0% { box-shadow: 0 0 0 rgba(255,255,255,0); }
  50% { box-shadow: 0 0 14px rgba(255,255,255,0.45); }
  100% { box-shadow: 0 0 0 rgba(255,255,255,0); }
}
@keyframes flashPop {
  0% { opacity: 0; transform: scale(0.6); }
  40% { opacity: 0.9; transform: scale(1.0); }
  100% { opacity: 0; transform: scale(1.4); }
}
@keyframes weaponBurst {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(18deg) scale(1.15); }
  100% { transform: rotate(0deg) scale(1); }
}
@keyframes sparkFlyRight {
  0% { transform: translate(0, 0) scale(0.7); opacity: 0.5; }
  30% { opacity: 1; }
  100% { transform: translate(calc(180px + var(--spark-offset, 0px)), calc(-12px - var(--spark-rise, 0px))) scale(1.1); opacity: 0; }
}
@keyframes sparkFlyLeft {
  0% { transform: translate(0, 0) scale(0.7); opacity: 0.5; }
  30% { opacity: 1; }
  100% { transform: translate(calc(-180px + var(--spark-offset, 0px)), calc(-12px - var(--spark-rise, 0px))) scale(1.1); opacity: 0; }
}
@keyframes runePulse {
  0% { opacity: 0; transform: scale(0.6) rotate(0deg); }
  40% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.2) rotate(30deg); }
}
@keyframes trailFlyRight {
  0% { transform: translate(0, 0); opacity: 0.2; }
  100% { transform: translate(160px, -4px); opacity: 0; }
}
@keyframes trailFlyLeft {
  0% { transform: translate(0, 0); opacity: 0.2; }
  100% { transform: translate(-160px, -4px); opacity: 0; }
}
@keyframes glyphSpin {
  0% { opacity: 0; transform: scale(0.7) rotate(0deg); }
  30% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.2) rotate(45deg); }
}
@keyframes sparklePop {
  0% { opacity: 0; transform: scale(0.6); }
  40% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.2); }
}
@keyframes ringPop {
  0% { transform: scale(0.6); opacity: 0; }
  30% { opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}
@keyframes dustPuff {
  0% { transform: translateY(0) scale(0.8); opacity: 0.0; }
  30% { opacity: 0.6; }
  100% { transform: translateY(-6px) scale(1.1); opacity: 0; }
}
@keyframes arcSlash {
  0% { opacity: 0; transform: translateY(6px) rotate(0deg); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px) rotate(10deg); }
}
@keyframes burstPop {
  0% { opacity: 0; transform: scale(0.7); }
  30% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.3); }
}
@keyframes auraPulse {
  0% { opacity: 0; transform: scale(0.7); }
  50% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.15); }
}
@keyframes bubblePop {
  0% { opacity: 0; transform: scale(0.8); }
  30% { opacity: 0.8; }
  100% { opacity: 0; transform: scale(1.1); }
}
@keyframes wavePop {
  0% { opacity: 0; transform: scale(0.7); }
  30% { opacity: 0.8; }
  100% { opacity: 0; transform: scale(1.2); }
}
.fx-bubble {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 0);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid #334364;
  background: rgba(12, 18, 34, 0.85);
  color: #e2e8f0;
  white-space: nowrap;
  pointer-events: none;
  animation: fxFloat 0.9s ease;
}
.fx-bubble.center {
  top: 10px;
  bottom: auto;
}
.fx-bubble.crit {
  border-color: #facc15;
  color: #fde68a;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.25);
}
.fx-bubble.ult {
  border-color: #fb7185;
  color: #fecdd3;
  box-shadow: 0 0 14px rgba(251, 113, 133, 0.25);
}
.fx-bubble.heal {
  border-color: #34d399;
  color: #bbf7d0;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.2);
}
.fx-bubble.effect {
  border-color: #7dd3fc;
  color: #bae6fd;
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.2);
}
.fx-bubble.shield {
  border-color: #a78bfa;
  color: #ddd6fe;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.2);
}
.fx-bubble.round {
  border-color: #60a5fa;
  color: #bfdbfe;
}
@keyframes fxFloat {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.95); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -14px) scale(1.02); }
}
@keyframes stageFlashHit {
  0% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
  40% { box-shadow: inset 0 0 28px rgba(248, 113, 113, 0.28); }
  100% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
}
@keyframes stageFlashCrit {
  0% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
  45% { box-shadow: inset 0 0 32px rgba(250, 204, 21, 0.32); }
  100% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
}
@keyframes stageFlashUlt {
  0% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
  45% { box-shadow: inset 0 0 36px rgba(251, 113, 133, 0.32); }
  100% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
}
@keyframes stageFlashHeal {
  0% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
  45% { box-shadow: inset 0 0 28px rgba(52, 211, 153, 0.28); }
  100% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
}
@keyframes stageFlashRound {
  0% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
  45% { box-shadow: inset 0 0 24px rgba(96, 165, 250, 0.3); }
  100% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
}
@keyframes stageFlashEnd {
  0% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
  45% { box-shadow: inset 0 0 28px rgba(78, 226, 138, 0.28); }
  100% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
}
.battle-outcome {
  font-weight: 800;
  font-size: 18px;
}
.battle-controls {
  display: flex;
  justify-content: flex-end;
}
.battle-rewards {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
.battle-log {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
  padding: 6px 4px;
}
.log-card {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #1f2a44;
  background: #0f172a;
  font-size: 12px;
  color: #d3def3;
  animation: logPop 0.4s ease;
}
.log-card.round {
  background: #121d38;
  border-color: #2c3a63;
  font-weight: 700;
}
.log-card.crit {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.08);
}
.log-card.ult {
  border-color: #fb7185;
  background: rgba(251, 113, 133, 0.10);
}
.log-card.end {
  border-color: #4ee28a;
  background: rgba(78, 226, 138, 0.08);
}
.log-card.effect {
  border-color: #7dd3fc;
  background: rgba(125, 211, 252, 0.08);
}
.log-card.status {
  border-color: #a78bfa;
  background: rgba(167, 139, 250, 0.08);
}
.log-icon {
  font-size: 18px;
  text-align: center;
}
.log-text {
  line-height: 1.6;
}
@keyframes logPop {
  0% { transform: translateY(6px) scale(0.98); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.hidden {
  display: none !important;
}

/* King Battle - Royal Fantasy UI */
body[data-page="king-battle"] {
  --kb-ink: #0b0f1e;
  --kb-deep: #0a1224;
  --kb-mid: #121b33;
  --kb-gold: #6fa6c9;
  --kb-gold-soft: rgba(111, 166, 201, 0.35);
  --kb-gold-bright: #d6f0ff;
  --kb-cyan: #8ee7ff;
  --kb-blue: #3a6fb5;
  --kb-text: #eef2ff;
  --kb-muted: #b7c6e6;
  background:
    radial-gradient(1200px 900px at 20% 0%, rgba(40, 92, 150, 0.35), transparent 60%),
    radial-gradient(900px 700px at 80% 20%, rgba(20, 130, 150, 0.25), transparent 60%),
    radial-gradient(1400px 1000px at 50% 120%, rgba(10, 22, 46, 0.9), transparent 60%),
    radial-gradient(2px 2px at 30% 20%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(2px 2px at 70% 35%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(2px 2px at 40% 75%, rgba(255, 255, 255, 0.5), transparent 60%),
    linear-gradient(180deg, #0a0f1d 0%, #090d1a 100%);
  color: var(--kb-text);
}

body[data-page="king-battle"] header {
  border-radius: 20px;
  padding: 12px 14px;
  background: linear-gradient(160deg, rgba(15, 22, 44, 0.9), rgba(9, 13, 26, 0.95));
  border: 1px solid rgba(111, 166, 201, 0.25);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

body[data-page="king-battle"] header h1 {
  font-family: "Fraunces", serif;
  letter-spacing: 1px;
  color: var(--kb-gold-bright);
  text-shadow: 0 0 18px rgba(214, 240, 255, 0.18);
}

body[data-page="king-battle"] header .brand p {
  color: var(--kb-muted);
}

body[data-page="king-battle"] .back-btn {
  border: 1px solid rgba(111, 166, 201, 0.3);
  background: linear-gradient(160deg, rgba(17, 26, 48, 0.9), rgba(10, 16, 32, 0.95));
  color: var(--kb-gold-bright);
}

body[data-page="king-battle"] .status {
  background: rgba(8, 12, 24, 0.65);
  border: 1px solid rgba(111, 166, 201, 0.2);
  padding: 8px 12px;
  border-radius: 14px;
}

body[data-page="king-battle"] .battle-card {
  padding: 22px;
  border-radius: 26px;
  border: 1px solid rgba(111, 166, 201, 0.45);
  background:
    radial-gradient(900px 280px at 50% -15%, rgba(214, 240, 255, 0.16), transparent 60%),
    linear-gradient(160deg, rgba(12, 20, 40, 0.96), rgba(7, 12, 24, 0.98));
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(14, 28, 52, 0.45);
  position: relative;
  overflow: hidden;
}

body[data-page="king-battle"] .battle-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 20px;
  border: 1px solid rgba(111, 166, 201, 0.25);
  pointer-events: none;
  box-shadow: inset 0 0 40px rgba(14, 26, 48, 0.5);
}

body[data-page="king-battle"] .battle-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(400px 160px at 50% 0%, rgba(142, 231, 255, 0.12), transparent 60%),
    radial-gradient(200px 120px at 15% 15%, rgba(214, 240, 255, 0.15), transparent 70%),
    radial-gradient(200px 120px at 85% 20%, rgba(214, 240, 255, 0.15), transparent 70%);
  pointer-events: none;
}

body[data-page="king-battle"] .battle-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 6px 14px;
  border-bottom: 1px solid rgba(111, 166, 201, 0.25);
  position: relative;
  z-index: 1;
}

body[data-page="king-battle"] .battle-title {
  font-family: "Fraunces", serif;
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--kb-gold-bright);
  text-shadow: 0 0 14px rgba(214, 240, 255, 0.2);
}

body[data-page="king-battle"] .muted {
  color: var(--kb-muted);
}

body[data-page="king-battle"] .battle-stats .badge {
  background: linear-gradient(180deg, rgba(16, 26, 50, 0.95), rgba(10, 16, 32, 0.98));
  border: 1px solid rgba(111, 166, 201, 0.35);
  color: var(--kb-text);
  box-shadow: inset 0 0 12px rgba(10, 18, 36, 0.8);
}

body[data-page="king-battle"] .battle-layout {
  display: grid;
  gap: 18px;
  position: relative;
  z-index: 1;
}

body[data-page="king-battle"] .battle-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
}

body[data-page="king-battle"] .battle-left,
body[data-page="king-battle"] .battle-right {
  display: grid;
  gap: 16px;
}

body[data-page="king-battle"] .panel {
  border: 1px solid rgba(111, 166, 201, 0.25);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(165deg, rgba(12, 20, 40, 0.95), rgba(7, 12, 24, 0.98));
  box-shadow: inset 0 0 28px rgba(12, 22, 42, 0.6);
  position: relative;
  overflow: hidden;
}

body[data-page="king-battle"] .panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(111, 166, 201, 0.18);
  pointer-events: none;
}

body[data-page="king-battle"] .panel-title {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--kb-gold-bright);
  letter-spacing: 1px;
}

body[data-page="king-battle"] .economy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

body[data-page="king-battle"] .economy-card,
body[data-page="king-battle"] .tactic-block,
body[data-page="king-battle"] .daily-box {
  border: 1px solid rgba(111, 166, 201, 0.2);
  border-radius: 14px;
  padding: 10px 12px;
  background: linear-gradient(160deg, rgba(14, 24, 46, 0.92), rgba(8, 14, 28, 0.98));
  box-shadow: inset 0 0 18px rgba(10, 18, 34, 0.7);
}

body[data-page="king-battle"] .economy-title {
  font-weight: 700;
  font-size: 11px;
  color: var(--kb-gold-bright);
  margin-bottom: 6px;
}

body[data-page="king-battle"] .economy-row {
  font-size: 12px;
  color: #dbe6ff;
}

body[data-page="king-battle"] .tactics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

body[data-page="king-battle"] .tactic-title {
  color: var(--kb-gold-bright);
  font-weight: 700;
}

body[data-page="king-battle"] .tactic-desc {
  color: var(--kb-muted);
}

body[data-page="king-battle"] .seg-btn {
  background: linear-gradient(160deg, rgba(12, 20, 40, 0.96), rgba(8, 14, 28, 0.98));
  border: 1px solid rgba(111, 166, 201, 0.25);
  color: #dfe8fb;
  font-weight: 600;
}

body[data-page="king-battle"] .seg-btn.active {
  border-color: rgba(214, 240, 255, 0.85);
  color: #e9f7ff;
  box-shadow: 0 0 0 2px rgba(214, 240, 255, 0.18);
}

body[data-page="king-battle"] .skill-card {
  padding: 10px;
  border: 1px solid rgba(111, 166, 201, 0.25);
  border-radius: 14px;
  background: linear-gradient(155deg, rgba(16, 26, 52, 0.95), rgba(8, 14, 28, 0.98));
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

body[data-page="king-battle"] .skill-card:hover {
  transform: translateY(-2px);
  border-color: rgba(214, 240, 255, 0.8);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.35);
}

body[data-page="king-battle"] .skill-card.active {
  border-color: rgba(214, 240, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(214, 240, 255, 0.2), 0 12px 24px rgba(0, 0, 0, 0.35);
}

body[data-page="king-battle"] .battle-actions .btn.primary {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
  background: linear-gradient(150deg, #9ed9ff, #4aa3d9);
  color: #08131f;
  border: 1px solid rgba(214, 240, 255, 0.9);
  box-shadow: 0 16px 32px rgba(202, 162, 79, 0.3);
}

body[data-page="king-battle"] .battle-actions .btn.primary:active {
  transform: translateY(1px);
}

body[data-page="king-battle"] .battle-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--kb-muted);
}

@media (max-width: 980px) {
  body[data-page="king-battle"] .battle-columns {
    grid-template-columns: 1fr;
  }
}

body[data-page="king-battle-result"] .battle-card {
  padding: 18px;
  border: 1px solid #2a3352;
  border-radius: 18px;
  background: radial-gradient(900px 320px at 20% -10%, rgba(255, 154, 84, 0.10), transparent 60%),
              radial-gradient(700px 320px at 90% 5%, rgba(80, 160, 255, 0.16), transparent 55%),
              linear-gradient(160deg, #0c1223 0%, #0a0f1d 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

body[data-page="king-battle-result"] .battle-arena {
  background: linear-gradient(120deg, #0f1a33, #0c1226);
  border: 1px solid #2c365b;
}

body[data-page="king-battle-result"] .arena-side {
  background: rgba(12, 16, 31, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px;
}

body[data-page="king-battle-result"] .battle-stage {
  height: 130px;
  background: radial-gradient(200px 120px at 20% 70%, rgba(255, 180, 84, 0.08), transparent 60%),
              radial-gradient(200px 120px at 80% 70%, rgba(80, 160, 255, 0.1), transparent 60%),
              linear-gradient(180deg, #121a30, #0a0f1d);
}

body[data-page="king-battle-result"] .fighter {
  font-size: 44px;
  animation: idleFloat 2.2s ease-in-out infinite;
  bottom: 8px;
}

body[data-page="king-battle-result"] .fighter.enemy {
  animation-delay: 0.4s;
}

@keyframes idleFloat {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

body[data-page="king-battle-result"] .battle-log {
  background: rgba(8, 12, 24, 0.6);
  border: 1px dashed #273153;
  border-radius: 12px;
  padding: 10px 12px;
}

body[data-page="king-battle-result"] .effect-toast {
  display: none !important;
}

.tile .title { font-weight: 600; }

.btn {
  background: linear-gradient(180deg, #1a2646, #121c34);
  border: 1px solid #2e3b63;
  color: #e6eeff;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn.primary {
  background: linear-gradient(140deg, #f6c24a, #ff9a47);
  border: none;
  color: #2b1b0f;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(246, 194, 74, 0.35);
}

.ico {
  width: 1.7em;
  height: 1.7em;
  vertical-align: -0.3em;
  margin: 0 0.15em;
  display: inline-block;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}

.ico-sm {
  width: 1.2em;
  height: 1.2em;
}

.ico-lg {
  width: 1.5em;
  height: 1.5em;
}

.ico-xl {
  width: 1.8em;
  height: 1.8em;
}

.ico-xxl {
  width: 3em;
  height: 3em;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #162039;
  border: 1px solid #233155;
  border-radius: 14px;
  padding: 10px 12px;
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: #263253;
  color: #cdd6e6;
  font-size: 11px;
}

.progress {
  width: 100%;
  height: 8px;
  background: #1c243f;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(120deg, #4dd4ff, #7b6cff);
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.section { display: none; }
.section.active { display: block; }

.bottom-nav {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  background: rgba(15, 22, 40, 0.85);
  border: 1px solid #273455;
  border-radius: 18px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
  box-shadow: 0 20px 40px var(--shadow);
  z-index: 10;
  backdrop-filter: blur(8px);
}

.bottom-btn {
  border: 1px solid #2a3a62;
  background: linear-gradient(160deg, #1a2442, #141c32);
  color: #e3ecff;
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 48px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.bottom-nav.icon-only .bottom-btn {
  padding: 8px 6px;
  min-height: 72px;
  height: auto;
}

.bottom-nav.icon-only .ico {
  margin: 0;
}

.bottom-label {
  font-size: 10px;
  color: #c2cfe6;
  line-height: 1;
}

.bottom-btn.active {
  background: linear-gradient(140deg, #f6c24a, #ff9a47);
  color: #2b1b0f;
  border: none;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(246, 194, 74, 0.35);
}

.bottom-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(246, 194, 74, 0.65);
}

.bottom-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1a2138;
  border: 1px solid #2a355a;
  color: #dbe3f5;
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 13px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .layout-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  header { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
}

@keyframes float-in {
  from { transform: translateY(8px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.home-wrap {
  padding-bottom: 130px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-left {
  display: flex;
  gap: 16px;
  align-items: center;
  background: linear-gradient(140deg, rgba(255, 199, 86, 0.15), rgba(59, 200, 255, 0.08));
  border: 1px solid rgba(246, 194, 74, 0.35);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 24px 40px var(--shadow);
}

.hero-right {
  display: flex;
}

.home-crest {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  background: linear-gradient(160deg, #f6c24a, #ff9a47);
  box-shadow: 0 16px 30px rgba(246, 194, 74, 0.4);
  position: relative;
}

.crest-gem {
  position: absolute;
  inset: 16px;
  border-radius: 14px;
  background: #121a2f;
  border: 2px solid rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.crest-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-kicker {
  font-size: 12px;
  letter-spacing: 2px;
  color: rgba(246, 194, 74, 0.9);
  text-transform: uppercase;
}

.home-hero h1 {
  font-family: "Lalezar", cursive;
  font-size: 30px;
  margin: 4px 0;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.hero-card {
  flex: 1;
  background: linear-gradient(180deg, #172545, #121a2f);
  border: 1px solid #2a375c;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 18px 36px var(--shadow);
  display: grid;
  gap: 10px;
  text-align: right;
}

html[dir="ltr"] .hero-card {
  text-align: left;
}

.hero-name {
  font-family: "Lalezar", cursive;
  font-size: 22px;
}

.hero-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.hero-res {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.res-chip {
  background: rgba(25, 34, 60, 0.85);
  border: 1px solid #2a3a62;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-start;
  text-align: left;
  direction: ltr;
}

.hero-sub {
  font-size: 12px;
  color: var(--muted);
}

.home-section {
  margin-top: 10px;
}

.section-head h2 {
  font-family: "Lalezar", cursive;
  margin: 0 0 4px;
}

.menu-grid--home {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.menu-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: linear-gradient(160deg, #192a4b, #151f37);
  border: 1px solid #2a3a62;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 12px 24px rgba(5, 8, 16, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.menu-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 28px rgba(5, 8, 16, 0.55);
}

.menu-ico {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(246, 194, 74, 0.14);
  border: 1px solid rgba(246, 194, 74, 0.35);
  font-size: 18px;
}

@media (max-width: 960px) {
  .home-hero {
    grid-template-columns: 1fr;
  }
  .hero-left {
    flex-direction: column;
    text-align: center;
  }
  .hero-actions {
    justify-content: center;
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.modal.show {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 20, 0.7);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(520px, 92vw);
  max-height: 78vh;
  overflow: auto;
  background: linear-gradient(180deg, #1b2542 0%, #121a2f 100%);
  border: 1px solid #2a375c;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.45);
  animation: float-in 0.25s ease-out;
}

.modal-card.modal-large {
  width: min(760px, 94vw);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-title {
  font-family: "Lalezar", cursive;
  font-size: 20px;
}

.modal-close {
  border: 1px solid #2a375c;
  background: #1a2138;
  color: #dfe7f6;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
}

.modal-body {
  display: grid;
  gap: 10px;
}

.modal-body .row {
  background: #141d35;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.train-hero {
  display: flex;
  justify-content: center;
  margin: 2px 0 6px;
}

.train-hero-icon {
  width: 104px;
  height: 104px;
  border-radius: 26px;
  background: radial-gradient(circle at top, rgba(246,194,74,0.35), transparent 60%), rgba(17,26,48,0.9);
  border: 1px solid rgba(246,194,74,0.45);
  display: grid;
  place-items: center;
  box-shadow: 0 14px 28px rgba(12,16,32,0.35);
}

.ico-hero {
  width: 4.6em;
  height: 4.6em;
}

.train-hero-icon img {
  width: 80%;
  height: 80%;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(15, 22, 40, 0.95);
  border: 1px solid #2a375c;
  color: #e7eefc;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
  box-shadow: 0 16px 30px rgba(0,0,0,0.35);
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-toast.success {
  border-color: rgba(78, 176, 116, 0.6);
  background: rgba(19, 34, 26, 0.95);
  color: #d7ffe3;
}

.app-toast.error {
  border-color: rgba(213, 99, 99, 0.6);
  background: rgba(40, 18, 18, 0.95);
  color: #ffd9d9;
}

.pass-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(64, 92, 145, 0.7);
  background:
    radial-gradient(120% 120% at 0% -20%, rgba(90, 140, 255, 0.18) 0%, rgba(10, 15, 31, 0) 55%),
    radial-gradient(80% 80% at 100% 0%, rgba(255, 206, 110, 0.18) 0%, rgba(10, 15, 31, 0) 60%),
    linear-gradient(180deg, rgba(17, 26, 49, 0.98) 0%, rgba(11, 18, 35, 0.98) 100%);
  box-shadow: 0 18px 40px rgba(2, 10, 24, 0.45);
}

.pass-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.pass-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pass-title .ico-xxl {
  width: 56px;
  height: 56px;
}

.pass-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 30, 55, 0.7);
  border: 1px solid rgba(58, 76, 118, 0.7);
  font-size: 12px;
  color: #d7e4ff;
}

.pass-points .row {
  background: rgba(15, 23, 43, 0.85);
  border: 1px solid rgba(42, 58, 92, 0.7);
}

.pass-points-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pass-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(20, 30, 55, 0.9);
  border: 1px solid rgba(48, 68, 110, 0.7);
  overflow: hidden;
  margin-top: 8px;
}

.pass-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #f6c24a, #ff9850);
  box-shadow: 0 0 14px rgba(246, 194, 74, 0.45);
}

.pass-earn-row .row-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pass-tier {
  display: grid;
  grid-template-columns: 54px 1fr auto auto;
  align-items: center;
  gap: 10px;
}

.pass-tier .tier-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #f6f7ff;
  background: #2a375c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.pass-tier.available .tier-badge {
  background: linear-gradient(160deg, #7a5c2a, #4b3a1c);
}

.pass-tier.claimed .tier-badge {
  background: linear-gradient(160deg, #2f6a46, #214a33);
}

.pass-tier.locked .tier-badge {
  opacity: 0.7;
}

.pass-tier .tier-info {
  display: grid;
  gap: 3px;
}

.pass-tier .tier-title {
  font-weight: 700;
}

.tier-reward {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(20, 30, 55, 0.8);
  border: 1px solid rgba(50, 70, 110, 0.7);
  font-size: 11px;
  color: #d7e2f7;
}

.pass-tier .btn {
  min-width: 90px;
}

@media (max-width: 720px) {
  .pass-tier {
    grid-template-columns: 44px 1fr;
  }
  .pass-tier .tier-reward,
  .pass-tier .tier-action {
    grid-column: 1 / -1;
  }
  .pass-tier .tier-action {
    display: flex;
    justify-content: flex-end;
  }
}

.season-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(64, 92, 145, 0.7);
  background:
    radial-gradient(120% 120% at 0% -20%, rgba(90, 140, 255, 0.2) 0%, rgba(10, 15, 31, 0) 55%),
    radial-gradient(90% 90% at 100% 0%, rgba(140, 255, 220, 0.18) 0%, rgba(10, 15, 31, 0) 60%),
    linear-gradient(180deg, rgba(16, 26, 48, 0.98) 0%, rgba(11, 18, 35, 0.98) 100%);
  box-shadow: 0 18px 40px rgba(2, 10, 24, 0.45);
}

.season-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.season-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.season-title .ico-xxl {
  width: 56px;
  height: 56px;
}

.season-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 30, 55, 0.7);
  border: 1px solid rgba(58, 76, 118, 0.7);
  font-size: 12px;
  color: #d7e4ff;
}

.season-stats {
  margin-top: 14px;
}

.season-stats .stat-tile {
  background: rgba(15, 23, 43, 0.85);
  border: 1px solid rgba(42, 58, 92, 0.7);
}

.season-reward .reward-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
}

.shop-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(64, 92, 145, 0.7);
  background:
    radial-gradient(120% 120% at 0% -20%, rgba(90, 140, 255, 0.2) 0%, rgba(10, 15, 31, 0) 55%),
    radial-gradient(90% 90% at 100% 0%, rgba(255, 206, 110, 0.18) 0%, rgba(10, 15, 31, 0) 60%),
    linear-gradient(180deg, rgba(16, 26, 48, 0.98) 0%, rgba(11, 18, 35, 0.98) 100%);
  box-shadow: 0 18px 40px rgba(2, 10, 24, 0.45);
}

.shop-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.shop-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shop-title .ico-xxl {
  width: 56px;
  height: 56px;
}

.shop-gem-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 30, 55, 0.7);
  border: 1px solid rgba(58, 76, 118, 0.7);
  font-size: 12px;
  color: #d7e4ff;
}

.shop-pack {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.shop-pack .pack-main {
  display: grid;
  gap: 4px;
}

.shop-pack .pack-title {
  font-weight: 700;
}

.shop-pack .pack-rewards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 720px) {
  .shop-pack {
    grid-template-columns: 1fr;
  }
  .shop-pack .btn {
    width: 100%;
  }
}

.friends-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(64, 92, 145, 0.7);
  background:
    radial-gradient(120% 120% at 0% -20%, rgba(90, 140, 255, 0.2) 0%, rgba(10, 15, 31, 0) 55%),
    radial-gradient(90% 90% at 100% 0%, rgba(110, 255, 200, 0.18) 0%, rgba(10, 15, 31, 0) 60%),
    linear-gradient(180deg, rgba(16, 26, 48, 0.98) 0%, rgba(11, 18, 35, 0.98) 100%);
  box-shadow: 0 18px 40px rgba(2, 10, 24, 0.45);
}

.friends-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.friends-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.friends-title .ico-xxl {
  width: 56px;
  height: 56px;
}

.friends-id {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 30, 55, 0.7);
  border: 1px solid rgba(58, 76, 118, 0.7);
  font-size: 12px;
  color: #d7e4ff;
}

.friends-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.friends-form .input {
  background: #0f1426;
  border: 1px solid #233155;
  border-radius: 12px;
  padding: 10px 12px;
  color: #e6efff;
  outline: none;
}

.friend-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.friend-row .friend-name {
  font-weight: 700;
}

.friend-actions {
  display: inline-flex;
  gap: 6px;
}

@media (max-width: 720px) {
  .friends-form {
    grid-template-columns: 1fr;
  }
  .friends-form .btn {
    width: 100%;
  }
  .friend-row {
    grid-template-columns: 1fr;
  }
  .friend-actions {
    justify-content: flex-end;
  }
}

.clan-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(64, 92, 145, 0.7);
  background:
    radial-gradient(120% 120% at 0% -20%, rgba(90, 140, 255, 0.2) 0%, rgba(10, 15, 31, 0) 55%),
    radial-gradient(90% 90% at 100% 0%, rgba(110, 200, 255, 0.18) 0%, rgba(10, 15, 31, 0) 60%),
    linear-gradient(180deg, rgba(16, 26, 48, 0.98) 0%, rgba(11, 18, 35, 0.98) 100%);
  box-shadow: 0 18px 40px rgba(2, 10, 24, 0.45);
}

.clan-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.clan-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.clan-title .ico-xxl {
  width: 56px;
  height: 56px;
}

.clan-card {
  display: grid;
  gap: 12px;
}

.clan-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.clan-card-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(20, 30, 55, 0.75);
  border: 1px solid rgba(58, 76, 118, 0.7);
}

.clan-card-level {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 30, 55, 0.7);
  border: 1px solid rgba(58, 76, 118, 0.7);
  font-size: 12px;
  color: #d7e4ff;
}

.clan-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.clan-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.clan-row .clan-name {
  font-weight: 700;
}

.clan-members .row-main .muted {
  margin-inline-start: 6px;
}

@media (max-width: 720px) {
  .clan-row {
    grid-template-columns: 1fr;
  }
}

.profile-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(64, 92, 145, 0.7);
  background:
    radial-gradient(120% 120% at 0% -20%, rgba(90, 140, 255, 0.2) 0%, rgba(10, 15, 31, 0) 55%),
    radial-gradient(90% 90% at 100% 0%, rgba(255, 210, 140, 0.18) 0%, rgba(10, 15, 31, 0) 60%),
    linear-gradient(180deg, rgba(16, 26, 48, 0.98) 0%, rgba(11, 18, 35, 0.98) 100%);
  box-shadow: 0 18px 40px rgba(2, 10, 24, 0.45);
}

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.profile-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-title .ico-xxl {
  width: 56px;
  height: 56px;
}

.profile-league {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 30, 55, 0.7);
  border: 1px solid rgba(58, 76, 118, 0.7);
  font-size: 12px;
  color: #d7e4ff;
}

.profile-stats {
  margin-top: 14px;
}

.profile-bars {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #cbd6ee;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.resource-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #162039;
  border: 1px solid #233155;
  border-radius: 14px;
  padding: 10px 12px;
}

.resource-chip .resource-label {
  font-size: 12px;
  color: #cbd6ee;
}

.resource-chip .resource-value {
  font-weight: 700;
}

.reports-hero,
.notifications-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(64, 92, 145, 0.7);
  background:
    radial-gradient(120% 120% at 0% -20%, rgba(90, 140, 255, 0.2) 0%, rgba(10, 15, 31, 0) 55%),
    radial-gradient(90% 90% at 100% 0%, rgba(255, 140, 190, 0.18) 0%, rgba(10, 15, 31, 0) 60%),
    linear-gradient(180deg, rgba(16, 26, 48, 0.98) 0%, rgba(11, 18, 35, 0.98) 100%);
  box-shadow: 0 18px 40px rgba(2, 10, 24, 0.45);
}

.reports-hero-head,
.notifications-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.reports-title,
.notifications-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reports-title .ico-xxl,
.notifications-title .ico-xxl {
  width: 56px;
  height: 56px;
}

.notification-row {
  align-items: flex-start;
}

.notification-row .row-main {
  display: grid;
  gap: 6px;
}

.notification-title {
  font-weight: 700;
  color: #f6f7ff;
}

.report-card {
  display: grid;
  gap: 10px;
}

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.report-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-result {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.report-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.report-loot {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge.pos {
  background: rgba(40, 90, 60, 0.9);
  border: 1px solid rgba(80, 170, 110, 0.6);
  color: #d5ffe6;
}

.badge.neg {
  background: rgba(90, 40, 40, 0.9);
  border: 1px solid rgba(180, 80, 80, 0.6);
  color: #ffd5d5;
}

.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #f6c24a;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes logo-spin {
  to { transform: rotate(360deg); }
}

body.no-scroll {
  overflow: hidden;
}

.battle-cinematic {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 20, 0.82);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.battle-cinematic.show {
  display: flex;
}

.battle-cine-card {
  width: min(760px, 92vw);
  max-height: 86vh;
  overflow: auto;
  background: linear-gradient(160deg, #141f37, #0e1528);
  border: 1px solid #2a375c;
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 10px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.45);
}

.battle-cine-head {
  display: grid;
  gap: 8px;
}

.battle-cine-title {
  font-weight: 700;
  font-size: 14px;
}

.battle-cine-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.battle-cine-bar {
  flex: 1;
  height: 8px;
  background: #1c243f;
  border-radius: 999px;
  overflow: hidden;
}

.battle-cine-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4bd87f, #f6c24a);
  transition: width 0.2s ease;
}

.battle-cine-percent {
  font-size: 12px;
  color: #c9d6f0;
  min-width: 44px;
  text-align: right;
}

.battle-cine-stars {
  display: flex;
  gap: 6px;
  font-size: 16px;
}

.cine-star {
  color: #3a4667;
  text-shadow: none;
}

.cine-star.active {
  color: #f6c24a;
  text-shadow: 0 0 10px rgba(246, 194, 74, 0.6);
}

.cine-star.pop {
  animation: battle-star-pop 0.4s ease-out;
}

.battle-cine-board {
  --layout-size: 6;
  display: grid;
  grid-template-columns: repeat(var(--layout-size), minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  border-radius: 14px;
  background: #0d1528;
  border: 1px solid #243153;
  position: relative;
  overflow: hidden;
}

.battle-cine-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #111a31;
  border: 1px solid #223152;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.battle-cine-cell.targeted::before {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 12px;
  border: 2px solid rgba(120, 180, 255, 0.6);
  box-shadow: 0 0 12px rgba(120, 180, 255, 0.35);
  animation: battle-target-pulse 0.7s ease-in-out infinite;
  pointer-events: none;
}

.battle-cine-cell.targeted::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: radial-gradient(circle, rgba(120, 180, 255, 0.15), transparent 60%);
  opacity: 0.8;
  pointer-events: none;
}

.battle-cine-cell.destroyed img {
  opacity: 0.25;
  filter: grayscale(1) blur(0.5px);
}

.battle-rubble {
  position: absolute;
  inset: 8%;
  border-radius: 10px;
  background: radial-gradient(circle, rgba(130, 150, 170, 0.45), rgba(40, 50, 70, 0.25), transparent 70%);
  box-shadow: inset 0 0 18px rgba(0,0,0,0.35);
  animation: battle-rubble 0.6s ease-out forwards;
  pointer-events: none;
}

.battle-explosion {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 200, 100, 0.95), rgba(255, 120, 60, 0.15), transparent 70%);
  animation: battle-boom 0.5s ease-out forwards;
  pointer-events: none;
}

.battle-smoke {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(120, 140, 160, 0.4), rgba(20, 30, 40, 0.1), transparent 70%);
  animation: battle-smoke 1.2s ease-out forwards;
  pointer-events: none;
}

.battle-cracks {
  position: absolute;
  inset: 10%;
  border-radius: 10px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.45) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 0 1px, transparent 1px 5px);
  opacity: 0.5;
  mix-blend-mode: screen;
  animation: battle-crack 0.35s ease-out forwards;
  pointer-events: none;
}

.battle-dust {
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 190, 160, 0.35), rgba(60, 60, 60, 0.05), transparent 70%);
  animation: battle-dust 0.8s ease-out forwards;
  pointer-events: none;
}

.battle-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(255, 190, 120, 0.15), transparent 70%);
  animation: battle-flash 0.45s ease-out forwards;
  pointer-events: none;
}

.battle-resource-burst {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  animation: battle-loot 0.9s ease-out forwards;
  pointer-events: none;
}

.battle-strike {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--len);
  height: 2px;
  transform-origin: 0 50%;
  transform: rotate(var(--angle));
  background: linear-gradient(90deg, rgba(120, 200, 255, 0.9), rgba(120, 200, 255, 0.15), transparent);
  box-shadow: 0 0 8px rgba(120, 200, 255, 0.45);
  animation: battle-strike 0.35s ease-out forwards;
  pointer-events: none;
}

.battle-cine-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.battle-cine-close {
  display: none;
}

.battle-cine-loot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.battle-cine-board .ico-lg {
  width: 78%;
  height: 78%;
}

.battle-cine-board.battle-shake {
  animation: battle-shake 0.25s ease-out;
}

.battle-cine-close.disabled {
  opacity: 0.6;
  pointer-events: none;
}

@keyframes battle-boom {
  from { transform: scale(0.4); opacity: 1; }
  to { transform: scale(1.6); opacity: 0; }
}

@keyframes battle-rubble {
  from { transform: scale(0.6); opacity: 0.2; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes battle-smoke {
  from { transform: scale(0.7); opacity: 0.8; }
  to { transform: scale(1.6); opacity: 0; }
}

@keyframes battle-flash {
  from { transform: scale(0.5); opacity: 0.9; }
  to { transform: scale(1.4); opacity: 0; }
}

@keyframes battle-crack {
  from { transform: scale(0.8); opacity: 0.1; }
  to { transform: scale(1); opacity: 0; }
}

@keyframes battle-dust {
  from { transform: scale(0.5); opacity: 0.8; }
  to { transform: scale(1.4); opacity: 0; }
}

@keyframes battle-strike {
  from { opacity: 0; transform: rotate(var(--angle)) scaleX(0.2); }
  to { opacity: 1; transform: rotate(var(--angle)) scaleX(1); }
}

@keyframes battle-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(2px, -2px); }
  50% { transform: translate(-2px, 2px); }
  75% { transform: translate(2px, 1px); }
  100% { transform: translate(0, 0); }
}

@keyframes battle-loot {
  from { transform: translate(0, 0) scale(1); opacity: 0.9; }
  to { transform: translate(var(--dx), var(--dy)) scale(0.6); opacity: 0; }
}

@keyframes battle-target-pulse {
  0% { transform: scale(0.98); opacity: 0.8; }
  70% { transform: scale(1.05); opacity: 0.3; }
  100% { transform: scale(1.08); opacity: 0; }
}

@keyframes battle-star-pop {
  0% { transform: scale(0.7); opacity: 0.6; }
  60% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.num {
  direction: ltr;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.barracks-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
  align-items: center;
}

.barracks-hero-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.barracks-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: radial-gradient(circle at top, rgba(246,194,74,0.25), transparent 60%), rgba(22,30,55,0.9);
  display: grid;
  place-items: center;
  border: 1px solid rgba(246,194,74,0.35);
}

.barracks-hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.mini-stat {
  background: #131c32;
  border: 1px solid #243256;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #b7c2d6;
}

.mini-stat strong {
  font-size: 16px;
  color: #f6f7ff;
}

.barracks-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 0;
  margin: 6px 0 10px;
}

.barracks-tabs .tab-btn {
  background: #141f37;
  color: #c9d6f0;
  border: 1px solid #233155;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.barracks-tabs .tab-btn.active {
  background: linear-gradient(140deg, rgba(246,194,74,0.95), rgba(255,154,71,0.92));
  color: #2b1b0f;
  border: none;
  box-shadow: 0 10px 20px rgba(246, 194, 74, 0.35);
}

.barracks-panel[hidden] {
  display: none;
}

.barracks-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.queue-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #141f37;
  border: 1px solid #233155;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
}

.barracks-status {
  font-size: 14px;
  font-weight: 600;
  margin-top: 6px;
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.unit-card {
  background: #111a30;
  border: 1px solid #233155;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.unit-card.locked {
  opacity: 0.7;
}

.unit-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unit-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(246, 194, 74, 0.12);
  display: grid;
  place-items: center;
  border: 1px solid rgba(246, 194, 74, 0.3);
}

.unit-title {
  font-weight: 700;
  font-size: 14px;
}

.unit-sub {
  font-size: 12px;
}

.unit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-chip {
  background: #16233f;
  border: 1px solid #233155;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.unit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  font-size: 12px;
}

.unit-lock {
  position: absolute;
  inset: auto 10px 10px 10px;
  background: rgba(10, 14, 30, 0.9);
  border: 1px solid rgba(255, 140, 120, 0.4);
  color: #f6c2c2;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.camp-panel {
  display: grid;
  gap: 10px;
}

.camp-actions {
  margin-top: 10px;
}

.role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.role-chip {
  background: #16233f;
  border: 1px solid #233155;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.barracks-warning,
.barracks-ok {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.barracks-warning {
  background: rgba(255, 115, 115, 0.12);
  border: 1px solid rgba(255, 115, 115, 0.35);
  color: #ffd0d0;
}

.barracks-ok {
  background: rgba(80, 210, 140, 0.12);
  border: 1px solid rgba(80, 210, 140, 0.35);
  color: #cbf7df;
}

.medal-card {
  background: linear-gradient(150deg, #1b2a4a, #10192d);
  border: 1px solid #27365a;
  border-radius: 16px;
  padding: 14px;
}

.medal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.medal-title {
  font-weight: 700;
  font-size: 14px;
}

.medal-score {
  font-size: 20px;
  font-weight: 700;
  color: #f6c24a;
}

.medal-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 8px;
  color: #b7c2d6;
}

.battle-prep {
  display: grid;
  gap: 12px;
}

.prep-group {
  display: grid;
  gap: 8px;
}

.prep-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.battle-army {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.battle-army-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.army-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  background: #121b31;
  border: 1px solid #233155;
}

.army-chip .ico-sm {
  width: 22px;
  height: 22px;
}

.army-count {
  background: #1b2a4a;
  border: 1px solid #2a3d68;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 12px;
}

.battle-actions {
  margin-top: 12px;
}

.battle-targets {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.battle-target-card {
  background: #111a30;
  border: 1px solid #233155;
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.battle-target-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.battle-target-name {
  font-weight: 700;
  font-size: 14px;
}

.battle-target-meta,
.battle-target-loot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.battle-target-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.battle-result {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.battle-result-card {
  background: linear-gradient(150deg, #1b2542, #121a2f);
  border: 1px solid #27365a;
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.battle-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.battle-result-title {
  font-weight: 700;
  font-size: 14px;
}

.battle-result-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.battle-result-warning {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 190, 90, 0.12);
  border: 1px solid rgba(255, 190, 90, 0.35);
  color: #ffe1ad;
  font-size: 12px;
}

.raid-preview {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 12px;
}

.raid-layout {
  margin-top: 8px;
  max-height: 320px;
}

.raid-layout .layout-cell {
  cursor: default;
}

.raid-layout .layout-cell:hover {
  transform: none;
  box-shadow: none;
}

.raid-order-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  max-height: 320px;
  overflow: auto;
}

.raid-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #141f37;
  border: 1px solid #233155;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
}

.raid-order-controls {
  display: flex;
  gap: 6px;
}

.btn.tiny {
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 8px;
}

.train-input {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.train-input input {
  background: #111a30;
  border: 1px solid #233155;
  border-radius: 10px;
  padding: 8px 10px;
  color: #f6f7ff;
}

.train-summary .row {
  margin-top: 8px;
}

@media (max-width: 720px) {
  .barracks-hero {
    grid-template-columns: 1fr;
  }

  .raid-preview {
    grid-template-columns: 1fr;
  }
}

/* King Management */
body[data-page="king"] {
  --king-ico-hero: clamp(22px, 5.2vw, 34px);
  --king-ico-tab: clamp(18px, 4.4vw, 28px);
  --king-ico-card: clamp(16px, 3.6vw, 24px);
  --king-ico-header: 1.7em;
}

body[data-page="king"] .king-header .king-logo {
  background-image: url("/static/assets/icons/logo_king.png");
  background-size: cover;
  background-position: center;
  border-radius: 16px;
  width: 44px;
  height: 44px;
  box-shadow: 0 10px 24px rgba(246, 194, 74, 0.25);
}

body[data-page="king"] .top-menu .ico,
body[data-page="king"] .page-head .ico {
  width: var(--king-ico-header);
  height: var(--king-ico-header);
}

body[data-page="king"] .king-hero-stats .ico,
body[data-page="king"] .king-hero-res .ico {
  width: var(--king-ico-hero);
  height: var(--king-ico-hero);
}

body[data-page="king"] .king-tabs .ico,
body[data-page="king"] .king-subtabs .ico,
body[data-page="king"] .section-head .ico {
  width: var(--king-ico-tab);
  height: var(--king-ico-tab);
}

body[data-page="king"] .king-grid .ico,
body[data-page="king"] .king-slot-summary .ico,
body[data-page="king"] .king-modal-stats .ico,
body[data-page="king"] .king-branch-meta .ico,
body[data-page="king"] .king-slot-meta .ico {
  width: var(--king-ico-card);
  height: var(--king-ico-card);
}

body[data-page="king"] .king-hero {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #2a375c;
  background: linear-gradient(160deg, rgba(25, 32, 55, 0.95) 0%, rgba(17, 23, 40, 0.95) 100%);
}

.king-hero-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.king-emblem {
  width: clamp(58px, 10vw, 74px);
  height: clamp(58px, 10vw, 74px);
  border-radius: 20px;
  background: radial-gradient(circle at 30% 30%, rgba(246, 194, 74, 0.45), rgba(52, 86, 199, 0.25));
  display: grid;
  place-items: center;
  border: 1px solid rgba(246, 194, 74, 0.35);
  box-shadow: 0 12px 26px rgba(0,0,0,0.35);
}

.king-emblem img {
  width: clamp(40px, 7vw, 54px);
  height: clamp(40px, 7vw, 54px);
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
}

.king-id .king-name {
  font-family: "Lalezar", cursive;
  font-size: 22px;
}

.king-id .king-branch {
  color: var(--muted);
  font-size: 13px;
}

.king-hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.king-stat {
  background: #16203a;
  border: 1px solid #28365b;
  border-radius: 12px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
  text-align: center;
}

.king-stat .stat-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.king-stat strong {
  font-size: 18px;
  font-weight: 700;
}

.king-hero-res {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.king-hero-res .res-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #141d35;
  border: 1px solid #28365b;
  font-size: 12px;
}

.king-hero-res .res-chip strong {
  font-size: 14px;
}

.king-boosts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.king-boosts .boost-chip {
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(59, 200, 255, 0.12);
  border: 1px solid rgba(59, 200, 255, 0.35);
  font-size: 12px;
  color: #cfefff;
}

.king-tabs,
.king-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 14px;
}

.king-tabs .seg-btn,
.king-subtabs .seg-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #141c33;
  border: 1px solid #2a375c;
  color: #d9e4ff;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

body[data-page="king"] .section-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.king-tabs .seg-btn.active,
.king-subtabs .seg-btn.active {
  background: linear-gradient(135deg, rgba(246,194,74,0.35), rgba(59,200,255,0.18));
  border-color: rgba(246, 194, 74, 0.6);
  color: #fff8d8;
  box-shadow: 0 10px 24px rgba(246, 194, 74, 0.12);
}

.king-panel {
  display: none;
}

.king-panel.active {
  display: block;
}

.king-overview-grid,
.king-upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.king-box {
  padding: 12px;
}

.king-box-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.king-box-body {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.king-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.king-slot-summary {
  background: #141d35;
  border: 1px solid #29375b;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 8px;
}

.king-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.king-card {
  background: #141d35;
  border: 1px solid #2a375c;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.king-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(0,0,0,0.25);
}

.king-card .title {
  font-weight: 600;
}

.king-card .meta {
  font-size: 12px;
  color: var(--muted);
}

.king-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.king-card .tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
}

.king-card .tag.active {
  border-color: rgba(53, 224, 137, 0.6);
  background: rgba(53, 224, 137, 0.16);
  color: #dfffee;
}

.king-card .tag.locked {
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.12);
  color: #ffdada;
}

.king-branch-meta,
.king-slot-meta,
.king-guide {
  background: #141d35;
  border: 1px solid #2a375c;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.king-branch-meta strong,
.king-slot-meta strong {
  color: #fff;
}

.king-guide {
  color: #dfe7f6;
}

.king-modal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.king-modal-stats .tile {
  padding: 8px 10px;
  border-radius: 12px;
  background: #161f37;
  border: 1px solid #28365b;
  font-size: 12px;
}

.king-modal-stats .tile strong {
  display: block;
  font-size: 14px;
}

@media (min-width: 900px) {
  body[data-page="king"] .king-hero {
    grid-template-columns: minmax(280px, 1.2fr) 1fr;
    grid-template-areas:
      "main res"
      "stats stats"
      "boosts boosts";
    align-items: center;
  }

  .king-hero-main { grid-area: main; }
  .king-hero-res { grid-area: res; justify-content: flex-end; }
  .king-hero-stats { grid-area: stats; }
  .king-boosts { grid-area: boosts; }
}

@media (max-width: 840px) {
  body[data-page="king"] .king-hero {
    padding: 14px;
  }

  .king-id .king-name { font-size: 20px; }
  .king-id .king-branch { font-size: 12px; }

  .king-hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .king-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

@media (max-width: 640px) {
  body[data-page="king"] .king-hero {
    gap: 10px;
  }

  .king-hero-main {
    gap: 10px;
  }

  .king-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .king-tabs,
  .king-subtabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .king-tabs::-webkit-scrollbar,
  .king-subtabs::-webkit-scrollbar {
    display: none;
  }

  .king-tabs .seg-btn,
  .king-subtabs .seg-btn {
    padding: 6px 10px;
  }

  .king-grid,
  .king-overview-grid,
  .king-upgrade-grid {
    grid-template-columns: 1fr;
  }
}

.num {
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: left;
}

@media (max-width: 720px) {
  .king-hero {
    padding: 14px;
  }
  .king-hero-stats {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  }
  .king-grid {
    grid-template-columns: 1fr;
  }
}
