* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-1: #0f172a;
  --bg-2: #111827;
  --panel: rgba(15, 23, 42, 0.88);
  --panel-soft: rgba(30, 41, 59, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

html,
body {
  min-height: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(129, 140, 248, 0.16), transparent 25%),
    linear-gradient(160deg, #020617 0%, #0f172a 45%, #111827 100%);
  padding: 20px;
}

button,
input {
  font: inherit;
}

.game-shell {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.brand-block h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
  margin-bottom: 8px;
}

.eyebrow {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 8px;
}

.subtitle {
  color: var(--muted);
  font-size: 1rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.turn-pill,
.reset-btn,
.info-badge {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
}

.turn-pill {
  font-weight: 700;
}

.reset-btn,
.info-badge {
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.reset-btn:hover,
.info-badge:hover {
  transform: translateY(-2px);
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(255, 255, 255, 0.22);
}

.disclaimer-wrap {
  position: relative;
}

.disclaimer-popup {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, 75vw);
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all 0.2s ease;
  z-index: 20;
}

.disclaimer-wrap:hover .disclaimer-popup,
.disclaimer-wrap:focus-within .disclaimer-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.battle-stage {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(to bottom, rgba(14, 165, 233, 0.18), rgba(15, 23, 42, 0.92)),
    linear-gradient(180deg, #0f172a 0%, #111827 100%);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 24px;
}

.stage-sky,
.stage-grid,
.stage-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stage-sky {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), transparent 18%),
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.06), transparent 15%);
}

.stage-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.8) 20%, rgba(0, 0, 0, 1));
}

.stage-glow.glow-1 {
  background: radial-gradient(circle at 25% 70%, rgba(56, 189, 248, 0.14), transparent 20%);
}

.stage-glow.glow-2 {
  background: radial-gradient(circle at 75% 35%, rgba(129, 140, 248, 0.16), transparent 22%);
}

.unit-panel {
  position: relative;
  z-index: 2;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  backdrop-filter: blur(8px);
}

.enemy-panel {
  grid-column: 1 / 2;
  align-self: start;
  max-width: 430px;
}

.player-panel {
  grid-column: 2 / 3;
  align-self: end;
  justify-self: end;
  max-width: 430px;
  width: 100%;
}

.unit-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.unit-tag {
  color: var(--accent);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}

.unit-header h2 {
  font-size: 1.5rem;
  margin-bottom: 2px;
}

.unit-level {
  color: var(--muted);
  font-size: 0.95rem;
}

.status-badge {
  align-self: flex-start;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-size: 0.85rem;
  font-weight: 700;
}

.hidden {
  display: none;
}

.resource-row {
  margin-bottom: 14px;
}

.resource-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 8px;
  gap: 12px;
}

.bar {
  width: 100%;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 0.35s ease;
  background: linear-gradient(90deg, #22c55e, #84cc16);
}

.energy-fill {
  background: linear-gradient(90deg, #38bdf8, #818cf8) !important;
}

.fighter {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
}

.enemy-fighter {
  top: 130px;
  right: 180px;
}

.player-fighter {
  bottom: 90px;
  left: 180px;
}

.fighter-ring {
  position: absolute;
  width: 150px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.35), rgba(56, 189, 248, 0.02) 72%);
  filter: blur(2px);
}

.fighter-core {
  position: relative;
  z-index: 2;
  width: 108px;
  height: 108px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  font-size: 3.2rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: floaty 2.8s ease-in-out infinite;
}

.enemy-core {
  background: linear-gradient(145deg, rgba(251, 146, 60, 0.9), rgba(239, 68, 68, 0.88));
}

.player-core {
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.92), rgba(99, 102, 241, 0.9));
}

@keyframes floaty {
  0%, 100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-10px);
  }
}

.bottom-ui {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.dialogue-panel,
.moves-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.panel-kicker {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  margin-bottom: 5px;
}

.panel-head h3 {
  font-size: 1.3rem;
}

.panel-note {
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 280px;
  text-align: right;
}

.log-scroll {
  height: 300px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  padding-right: 6px;
}

.log-entry {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  line-height: 1.45;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin-bottom: 16px;
  cursor: pointer;
}

.toggle-row input {
  transform: scale(1.1);
}

.move-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.move-btn {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  min-height: 104px;
}

.move-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.move-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.move-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.move-type {
  display: inline-block;
  font-size: 0.82rem;
  padding: 4px 9px;
  border-radius: 999px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.move-desc {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.4;
}

.move-attack { background: rgba(34, 197, 94, 0.08); }
.move-burst { background: rgba(249, 115, 22, 0.08); }
.move-guard { background: rgba(59, 130, 246, 0.08); }
.move-heal { background: rgba(168, 85, 247, 0.08); }
.move-ultimate { background: rgba(239, 68, 68, 0.1); }
.move-recharge { background: rgba(14, 165, 233, 0.08); }

.secondary-moves {
  margin-top: 14px;
}

.hidden-moves {
  display: none;
}

.team-preview {
  margin-top: 16px;
}

.team-preview h4 {
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: var(--muted);
}

.team-slots {
  display: grid;
  gap: 10px;
}

.team-slot {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
}

.team-slot-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.active-slot {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.fainted-slot {
  opacity: 0.45;
}

.mini-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.mini-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #84cc16);
}

.switch-panel {
  margin-top: 18px;
}

.switch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (max-width: 1100px) {
  .bottom-ui {
    grid-template-columns: 1fr;
  }

  .battle-stage {
    min-height: 620px;
  }

  .enemy-fighter {
    top: 170px;
    right: 100px;
  }

  .player-fighter {
    bottom: 110px;
    left: 100px;
  }
}

@media (max-width: 780px) {
  body {
    padding: 14px;
  }

  .battle-stage {
    grid-template-columns: 1fr;
    padding: 18px;
    min-height: 760px;
  }

  .enemy-panel,
  .player-panel {
    max-width: 100%;
    width: 100%;
    justify-self: stretch;
  }

  .player-panel,
  .enemy-panel {
    grid-column: 1 / -1;
  }

  .enemy-fighter {
    top: 270px;
    right: 50%;
    transform: translateX(110px);
  }

  .player-fighter {
    bottom: 180px;
    left: 50%;
    transform: translateX(-170px);
  }

  .move-grid {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
  }

  .panel-note {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 540px) {
  .fighter-core {
    width: 86px;
    height: 86px;
    font-size: 2.5rem;
  }

  .fighter-ring {
    width: 118px;
  }

  .enemy-fighter {
    transform: translateX(80px);
  }

  .player-fighter {
    transform: translateX(-130px);
  }

  .turn-pill,
  .reset-btn,
  .info-badge {
    width: 100%;
    text-align: center;
  }

  .top-actions {
    width: 100%;
  }
}