:root {
  color-scheme: dark;
  --bg: #1e1f26;
  --panel: #262832;
  --line: #3a3d49;
  --text: #f1f1f3;
  --muted: #9b9daa;
  --link: #8ab4f8;
  --green: #72d572;
  --yellow: #e6c75a;
  --red: #e47070;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main { width: min(920px, calc(100% - 36px)); margin: 0 auto; padding: 64px 0 40px; }

nav { display: flex; justify-content: space-between; margin-bottom: 72px; font-size: 14px; }
a { color: var(--link); text-underline-offset: 3px; }
nav a:first-child { color: var(--text); font-weight: 700; text-decoration: none; }

header { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
h1 { margin: 0; font-size: clamp(34px, 6vw, 58px); line-height: 1; letter-spacing: -.04em; }
.presence { display: flex; align-items: center; gap: 7px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.presence i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.presence i.live { background: var(--green); box-shadow: 0 0 10px rgba(114,213,114,.7); }
.presence i.stale { background: var(--red); }
.presence b { font-weight: 400; }

dl { display: flex; gap: clamp(22px, 5vw, 56px); margin: 0; }
dl div { min-width: 70px; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 2px 0 0; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }

.battle { overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.battle-topline { height: 48px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.battle-topline b { color: var(--text); font-weight: 600; }

.stage {
  height: 500px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 72% 28%, rgba(255,255,255,.08), transparent 28%),
    radial-gradient(ellipse at 28% 76%, rgba(255,255,255,.08), transparent 28%),
    linear-gradient(155deg, #343744 0 49.8%, #292b35 50.2%);
}
.stage::after { content: ""; position: absolute; left: 13%; right: 13%; top: 18%; bottom: 18%; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; transform: rotate(-12deg); }

.mon { position: absolute; z-index: 1; display: flex; align-items: end; gap: 22px; }
.mon.opponent { top: 38px; right: 8%; flex-direction: row-reverse; }
.mon.ours { bottom: 35px; left: 8%; }
.sprite { width: 190px; height: 190px; display: grid; place-items: center; position: relative; }
.sprite::after { content: ""; position: absolute; left: 16%; right: 16%; bottom: 13%; height: 20px; border-radius: 50%; background: rgba(0,0,0,.23); filter: blur(5px); }
.sprite span { position: absolute; color: rgba(255,255,255,.1); font-size: 80px; font-weight: 700; }
.sprite img { z-index: 1; max-width: 180px; max-height: 180px; image-rendering: pixelated; filter: drop-shadow(0 12px 7px rgba(0,0,0,.35)); }
.sprite img:not([src]) { display: none; }

.plate { width: 235px; margin-bottom: 15px; padding: 12px 14px; background: rgba(30,31,38,.86); border-radius: 3px; backdrop-filter: blur(5px); }
.plate strong { display: block; margin-bottom: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; text-transform: capitalize; }
.hp { height: 6px; overflow: hidden; border-radius: 4px; background: #494c58; }
.hp i { display: block; width: 0; height: 100%; background: var(--green); transition: width .35s; }
.hp i.medium { background: var(--yellow); }
.hp i.low { background: var(--red); }
.plate small { display: flex; justify-content: space-between; margin-top: 5px; color: var(--muted); font-size: 11px; }
.plate small b { color: var(--red); font-weight: 600; text-transform: uppercase; }

.battle-bottom { display: grid; grid-template-columns: 1fr 1fr; min-height: 90px; border-top: 1px solid var(--line); }
.teams { padding: 14px 18px; display: flex; flex-direction: column; justify-content: center; gap: 8px; border-right: 1px solid var(--line); }
.teams > span { min-height: 22px; display: flex; gap: 5px; }
.team-icon { width: 25px; height: 25px; object-fit: contain; image-rendering: pixelated; }
.team-icon.fainted { opacity: .25; filter: grayscale(1); }
ol { margin: 0; padding: 12px 18px; list-style: none; display: flex; flex-direction: column; justify-content: center; gap: 5px; color: var(--muted); font-size: 12px; }
ol li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol li.us { color: var(--text); }

.recent { min-height: 54px; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.recent > span { color: var(--text); }
.recent > div { display: flex; gap: 6px; }
.result { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.result.win { background: var(--green); }
.result.loss { background: var(--red); }
.recent small { margin-left: auto; color: var(--muted); }

@media (max-width: 700px) {
  main { width: min(100% - 24px, 500px); padding-top: 30px; }
  nav { margin-bottom: 48px; }
  header { align-items: start; flex-direction: column; }
  dl { width: 100%; justify-content: space-between; }
  .stage { height: 480px; }
  .mon.opponent { top: 28px; right: 12px; }
  .mon.ours { left: 12px; bottom: 25px; }
  .sprite { width: 125px; height: 155px; }
  .sprite img { max-width: 125px; max-height: 145px; }
  .plate { width: min(54vw, 220px); }
  .battle-bottom { grid-template-columns: 1fr; }
  .teams { border-right: 0; border-bottom: 1px solid var(--line); }
  .recent small { display: none; }
}
