* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: #0b0f0b;
  color: #f2fbf2;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 64px;
}
a { color: #f5cb42; }

header {
  text-align: center;
  margin-bottom: 8px;
}
header h1 {
  font-size: 2rem;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}
header h1 .vs { color: #e0454f; }
header p {
  color: #9fb8a0;
  margin: 0;
  font-size: 0.85rem;
  max-width: 520px;
}
header p a { color: #9fb8a0; text-decoration: underline; }

main {
  width: 100%;
  max-width: 640px;
  margin-top: 20px;
}

.panel {
  background: #10190f;
  border: 1px solid #28402a;
  border-radius: 14px;
  padding: 20px;
}

/* --- intro / team select --- */
#intro { text-align: center; }
#intro button, .primary-btn {
  background: #f5cb42;
  color: #0b0f0b;
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
#intro button:hover, .primary-btn:hover { background: #ffd75c; }
#intro button:disabled { opacity: 0.5; cursor: default; }

.format-note {
  margin-top: 10px;
  color: #6c8a6e;
  font-size: 0.75rem;
}

/* --- battle arena --- */
#arena { display: none; }
.field {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 10px 6px 24px;
}
.combatant {
  flex: 1;
  min-width: 0;
}
.combatant.p2 { text-align: right; }
.combatant .sprite-wrap {
  height: 96px;
  display: flex;
  align-items: flex-end;
}
.combatant.p1 .sprite-wrap { justify-content: flex-start; }
.combatant.p2 .sprite-wrap { justify-content: flex-end; }
.combatant img.sprite {
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 6px rgba(0,0,0,0.5));
}
.combatant.p2 img.sprite { transform: scaleX(-1); }
.combatant.fainted img.sprite { opacity: 0.25; filter: grayscale(1); }

.namebar {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-top: 6px;
}
.combatant.p2 .namebar { flex-direction: row-reverse; }
.namebar .lvl { color: #6c8a6e; }

.hpbar-track {
  height: 8px;
  border-radius: 4px;
  background: #1e2e1f;
  overflow: hidden;
  margin-top: 4px;
  border: 1px solid #28402a;
}
.hpbar-fill {
  height: 100%;
  background: #4caf50;
  transition: width 0.4s ease;
}
.hpbar-fill.mid { background: #f5cb42; }
.hpbar-fill.low { background: #e0454f; }
.hptext { font-size: 0.7rem; color: #9fb8a0; margin-top: 2px; }
.status-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: #4a3a1a;
  color: #f5cb42;
  margin-left: 6px;
}

.vs-mid {
  text-align: center;
  color: #e0454f;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0 4px;
}

#turn-badge {
  text-align: center;
  color: #6c8a6e;
  font-size: 0.75rem;
  margin-bottom: 4px;
}

/* --- log --- */
#log {
  background: #0b120a;
  border: 1px solid #28402a;
  border-radius: 10px;
  padding: 10px 12px;
  height: 140px;
  overflow-y: auto;
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 12px 0;
}
#log .row { opacity: 0; animation: fadein 0.25s forwards; }
@keyframes fadein { to { opacity: 1; } }
#log .row.dmg { color: #ff8a80; }
#log .row.heal { color: #8affa0; }
#log .row.faint { color: #e0454f; font-weight: 700; }
#log .row.win { color: #f5cb42; font-weight: 700; }
#log .row.move { color: #d7e9d8; }

/* --- controls --- */
#controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#controls button {
  background: #16221a;
  border: 1px solid #33513a;
  color: #f2fbf2;
  border-radius: 8px;
  padding: 10px 8px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
}
#controls button:hover:not(:disabled) { background: #1f3324; border-color: #4caf50; }
#controls button:disabled { opacity: 0.35; cursor: default; }
#controls button .mv-type {
  display: block;
  font-size: 0.65rem;
  color: #9fb8a0;
  margin-top: 2px;
}
#controls.switch-mode button { grid-template-columns: 1fr; }

#waiting {
  text-align: center;
  color: #6c8a6e;
  font-size: 0.8rem;
  padding: 12px 0;
  display: none;
}

/* --- team preview --- */
.team-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.team-row .icon {
  border-radius: 6px;
  background: #0b120a;
  border: 1px solid #28402a;
}

/* --- result --- */
#result { display: none; text-align: center; }
#result h2 { margin-top: 0; }
#result h2.win { color: #4caf50; }
#result h2.lose { color: #e0454f; }
#share-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
#share-row a, #share-row button {
  display: inline-block;
  background: #1d94e0;
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  font-weight: 700;
}
#share-row .again { background: #16221a; border: 1px solid #33513a; color: #f2fbf2; }

footer {
  margin-top: 32px;
  color: #4a664c;
  font-size: 0.72rem;
  text-align: center;
}
footer a { color: #6c8a6e; }
