:root {
  --bg: #f7f7f8;
  --panel: #ffffff;
  --ink: #17181c;
  --muted: #5c6370;
  --line: #e4e6eb;
  --accent: #2563eb;
  --header-h: 49px;
  --rarity-0: 176, 176, 176;
  --rarity-1: 76, 175, 80;
  --rarity-2: 66, 165, 245;
  --rarity-3: 171, 71, 188;
  --rarity-4: 255, 179, 0;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 40;
  background: var(--panel);
  padding: 8px 12px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  min-height: var(--header-h);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 650;
  font-size: 16px;
}

.play {
  margin-left: auto;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
}

.burger {
  display: none;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 6px 10px;
  font: inherit;
}

.wrap {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  max-width: 1080px;
  margin: 0 auto;
}

.side {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  overflow: auto;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
}

.side a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 13.5px;
}

.side a:hover,
.side a.is-on {
  background: #eef3ff;
  color: var(--accent);
}

.side .sub {
  padding-left: 16px;
  color: var(--muted);
  font-size: 13px;
}

.tag {
  font-size: 10px;
  font-weight: 650;
  color: var(--muted);
  background: #eef0f4;
  border-radius: 999px;
  padding: 1px 6px;
  flex: 0 0 auto;
}

main {
  padding: 28px 32px 80px;
  background: var(--panel);
  min-height: calc(100vh - var(--header-h));
}

h1 {
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.lede {
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 62ch;
}

h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 36px 0 10px;
  font-size: 22px;
  letter-spacing: -0.02em;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

h3 {
  margin: 18px 0 6px;
  font-size: 16px;
}

p {
  margin: 0 0 10px;
  max-width: 68ch;
}

ul {
  margin: 0 0 12px;
  padding-left: 20px;
  max-width: 68ch;
}

.log {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.log strong {
  font-variant-numeric: tabular-nums;
}

.log ul {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 16px;
}

th,
td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

caption {
  text-align: left;
  padding: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

main img,
main video {
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
  margin: 12px 0 28px;
}

.stage-card {
  margin: 0;
}

.stage-card h4 {
  margin: 8px 0 4px;
  font-size: 15px;
}

.stage-card .meta,
.stage-card .mobs {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stage-shot img {
  width: 100%;
  max-width: 200px;
}

.rarity-0 { color: rgb(var(--rarity-0)); }
.rarity-1 { color: rgb(var(--rarity-1)); }
.rarity-2 { color: rgb(var(--rarity-2)); }
.rarity-3 { color: rgb(var(--rarity-3)); }
.rarity-4 { color: rgb(var(--rarity-4)); }

.rarity-0,
.rarity-1,
.rarity-2,
.rarity-3,
.rarity-4 {
  font-weight: 650;
}

.portrait {
  margin: 0;
}

.portrait img,
.portrait video {
  display: block;
  width: 88px;
  height: auto;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.portrait img.clip {
  display: none;
}

.portrait:has(video) img.still {
  display: none;
}

.portrait.has-clip video {
  display: none;
}

.portrait.has-clip img.still {
  display: block;
}

.portrait.has-clip.is-on img.still {
  display: none;
}

.portrait.has-clip.is-on img.clip {
  display: block;
}

.portrait.rarity-0 img,
.portrait.rarity-0 video {
  background: rgb(var(--rarity-0) / 0.28);
  border-color: rgb(var(--rarity-0) / 0.55);
}

.portrait.rarity-1 img,
.portrait.rarity-1 video {
  background: rgb(var(--rarity-1) / 0.28);
  border-color: rgb(var(--rarity-1) / 0.55);
}

.portrait.rarity-2 img,
.portrait.rarity-2 video {
  background: rgb(var(--rarity-2) / 0.28);
  border-color: rgb(var(--rarity-2) / 0.55);
}

.portrait.rarity-3 img,
.portrait.rarity-3 video {
  background: rgb(var(--rarity-3) / 0.28);
  border-color: rgb(var(--rarity-3) / 0.55);
}

.portrait.rarity-4 img,
.portrait.rarity-4 video {
  background: rgb(var(--rarity-4) / 0.28);
  border-color: rgb(var(--rarity-4) / 0.55);
}

.portrait figcaption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.overlay {
  display: none;
}

@media (max-width: 720px) {
  .burger {
    display: inline-block;
  }

  .wrap {
    grid-template-columns: 1fr;
  }

  .side {
    position: fixed;
    inset: var(--header-h) auto 0 0;
    width: min(84vw, 300px);
    background: var(--panel);
    transform: translateX(-105%);
    transition: transform 0.2s;
    z-index: 30;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.08);
  }

  .side.is-open {
    transform: none;
  }

  .overlay.is-on {
    display: block;
    position: fixed;
    inset: var(--header-h) 0 0;
    background: rgba(23, 24, 28, 0.28);
    z-index: 25;
  }

  main {
    padding: 18px 16px 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .portrait video,
  .portrait img.clip {
    display: none;
  }

  .portrait img.still {
    display: block;
  }
}
