:root {
  color: #f6efe2;
  font-family: "Leelawadee UI", "Segoe UI", sans-serif;
  background: #140e22;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #140e22 center / cover no-repeat fixed;
}

body[data-scene="register"] { background-image: url("/art/bg/register.png"); }
body[data-scene="create"] { background-image: url("/art/bg/create.png"); }
body[data-scene="menu"],
body[data-scene="hero"] { background-image: url("/art/bg/menu.png"); }
body[data-scene="stage"] { background-image: url("/art/bg/stage.png"); }
body[data-scene="battle"] { background-image: url("/art/bg/battle.png"); }

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

#app {
  min-height: 100vh;
  padding: 24px 16px 40px;
}

.wrap {
  width: min(1080px, 100%);
  margin: 0 auto;
}

.panel {
  background: rgba(18, 12, 32, 0.9);
  border: 4px solid #1a1028;
  box-shadow: 0 0 0 4px #f0c36a;
  padding: 18px;
}

h1, h2, p { margin: 0 0 12px; }

h1 {
  font-size: 40px;
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 #1a1028;
}

.sub { color: #f0c36a; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

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

label { display: block; margin: 10px 0; }
label span { display: block; margin-bottom: 4px; }

input {
  width: 100%;
  padding: 10px 12px;
  background: #241833;
  border: 3px solid #3a2a55;
  outline: none;
}

.btn {
  background: #f0c36a;
  color: #24160c;
  border: 3px solid #1a1028;
  padding: 10px 16px;
  font-weight: 700;
}

.btn.alt { background: #d7d2ea; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.big { font-size: 22px; min-width: 180px; padding: 16px 20px; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button { background: transparent; border: 3px solid #f0c36a; padding: 8px 12px; }
.tabs button.on { background: #f0c36a; color: #24160c; }

.err { color: #ffb4be; min-height: 1.2em; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.card, .floor {
  background: #241833;
  border: 3px solid #3a2a55;
  padding: 8px;
  text-align: center;
}

.card.on, .floor.on { border-color: #f0c36a; }
.floor:disabled { opacity: 0.4; }
.floor.boss { box-shadow: inset 0 0 0 2px #f0c36a; }

.sprite, .mob, .back {
  width: 100%;
  image-rendering: pixelated;
  object-fit: contain;
}

.sprite { height: 92px; background: transparent; }
.portrait { width: min(280px, 100%); image-rendering: pixelated; }

.stat, .sub {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(246, 239, 226, 0.15);
}

.subs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.plus { min-width: 36px; }

.feed { margin-top: 16px; }
.feed li { margin: 4px 0; }

.domain { margin-top: 14px; color: #c8bdd8; font-size: 14px; }

.battle-screen { width: min(980px, 100%); margin: 0 auto; }

.bezel {
  background: rgba(10, 8, 18, 0.55);
  border: 8px solid #2a241c;
  box-shadow: 0 0 0 4px #c8b48a;
  min-height: 72vh;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto auto;
  gap: 8px;
}

.side { position: relative; min-height: 220px; }
.enemy-side { justify-self: end; text-align: right; }
.player-side { align-self: end; }

.platform {
  width: 220px;
  height: 36px;
  margin: 0 auto;
  background: rgba(28, 80, 40, 0.55);
  border-radius: 50%;
}

.fighter {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
}

.fighter img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.enemy-side .fighter img { animation: walk 0.55s steps(2, end) infinite; }
.player-side .fighter img { animation: idle 1.1s steps(2, end) infinite; }
.fighter.shake img { animation: shake 0.28s linear; }

.fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: pop 0.48s linear forwards;
}

.float {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  font-weight: 800;
  text-shadow: 2px 2px 0 #000;
  animation: rise 0.7s ease-out forwards;
  pointer-events: none;
}
.float.crit { color: #ffd76a; }
.float.heal { color: #9dffb0; }
.float.miss { color: #ddd; }

.hud { width: min(280px, 100%); background: rgba(12, 10, 20, 0.82); border: 3px solid #f0c36a; padding: 8px; }
.enemy-side .hud { margin-left: auto; }

.bar { height: 12px; background: #2a2433; border: 2px solid #111; margin-top: 4px; }
.bar > i { display: block; height: 100%; width: 0; }
.hp > i { background: #ef5d6a; }
.atb > i { background: #67d2ff; }
.bar.full > i { background: #fff1a8; }

.log {
  grid-column: 1 / -1;
  min-height: 92px;
  background: rgba(8, 6, 14, 0.82);
  border: 3px solid #3a2a55;
  padding: 8px 12px;
}
.log div { margin: 2px 0; }

.end {
  grid-column: 1 / -1;
  text-align: center;
  background: rgba(12, 8, 20, 0.92);
  border: 4px solid #f0c36a;
  padding: 16px;
}

.auto-tag { color: #9ad7ff; }

@keyframes walk {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes shake {
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
@keyframes pop {
  0% { opacity: 0; transform: scale(0.7); }
  20% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); }
}
@keyframes rise {
  to { transform: translate(-50%, -36px); opacity: 0; }
}

@media (max-width: 800px) {
  h1 { font-size: 32px; }
  .grid, .cards, .subs, .bezel { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .enemy-side { text-align: left; }
  .enemy-side .hud { margin-left: 0; }
}
