:root {
  color-scheme: light;
  --ink: #263238;
  --muted: #64706c;
  --panel: #ffffff;
  --line: #d8e1df;
  --page: #f3f8f7;
  --sky: #cfeeff;
  --mint: #bcebd9;
  --coral: #ff8f74;
  --gold: #f5c85c;
  --plum: #7d5ba6;
  --danger: #d94f60;
  --shadow: 0 18px 42px rgba(38, 50, 56, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(207, 238, 255, 0.7), rgba(243, 248, 247, 0.95) 44%),
    repeating-linear-gradient(90deg, rgba(188, 235, 217, 0.18) 0 2px, transparent 2px 92px),
    var(--page);
}

body.battle-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  margin-bottom: 16px;
}

.topbar h1,
.section-heading h2,
.arena-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(2.1rem, 5vw, 4.5rem);
  line-height: 0.94;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(38, 50, 56, 0.18);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.tier-muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.82fr) minmax(460px, 1.7fr) minmax(270px, 0.92fr);
  gap: 16px;
  align-items: stretch;
}

.panel,
.arena,
.arena-launch {
  align-self: start;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  min-height: 720px;
  padding: 18px;
}

.arena {
  display: grid;
  grid-template-rows: auto auto minmax(330px, 1fr) auto;
  min-height: 720px;
  overflow: hidden;
}

.arena-launch {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 720px;
  overflow: hidden;
}

.section-heading,
.arena-head,
.roster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2,
.arena-head h2 {
  font-size: 1.18rem;
}

.lab-panel,
.sheet-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lab-tabs {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  background: rgba(238, 248, 244, 0.7);
}

.lab-tab {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.lab-tab.is-active {
  border-color: rgba(38, 50, 56, 0.12);
  background: #fff;
  color: var(--ink);
}

.lab-tab-panel {
  display: grid;
  gap: 16px;
}

.lab-tab-panel[hidden] {
  display: none;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 204px;
  padding: 18px;
  border: 2px dashed #9bcfc1;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(188, 235, 217, 0.42), rgba(255, 255, 255, 0.85)),
    #fff;
  text-align: center;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--coral);
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  background: #fff8df;
  box-shadow: inset 0 -8px 0 rgba(245, 200, 92, 0.3);
}

.drop-icon svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.mystery-body,
.mystery-ear {
  fill: #263238;
  stroke: #263238;
}

.mystery-mark {
  fill: none;
  stroke: #fff;
  stroke-width: 5;
}

.drop-title {
  margin-top: 10px;
  font-weight: 900;
}

.drop-file {
  display: block;
  width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-strip {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.image-preview {
  width: 82px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(125, 91, 166, 0.14) 25%, transparent 25% 75%, rgba(125, 91, 166, 0.14) 75%),
    linear-gradient(45deg, rgba(125, 91, 166, 0.14) 25%, transparent 25% 75%, rgba(125, 91, 166, 0.14) 75%),
    #fff;
  background-position:
    0 0,
    10px 10px;
  background-size: 20px 20px;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-monster-preview {
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 248, 223, 0.72), rgba(255, 255, 255, 0.88)),
    #fff;
}

.mini-monster-preview .monster-svg {
  width: 88%;
  height: 88%;
}

.generate-button {
  min-height: 52px;
  border: 1px solid rgba(90, 163, 125, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(188, 235, 217, 0.84), rgba(255, 248, 223, 0.9)),
    #fff;
  color: var(--ink);
  font-weight: 950;
  box-shadow: inset 0 -6px 0 rgba(90, 163, 125, 0.1);
}

.generate-button:hover {
  border-color: var(--coral);
  transform: translateY(-1px);
}

.generate-button:disabled {
  cursor: default;
  filter: grayscale(0.35);
  opacity: 0.62;
  transform: none;
}

.start-battle-button:disabled {
  cursor: default;
  filter: grayscale(0.45);
  opacity: 0.58;
  transform: none;
}

.preview-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hash-text {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.45;
}

.metadata-grid,
.stat-list {
  display: grid;
  grid-template-columns: minmax(88px, 0.85fr) minmax(0, 1.15fr);
  gap: 9px 12px;
  margin: 0;
}

.metadata-grid dt,
.stat-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metadata-grid dd,
.stat-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.criteria-block {
  display: grid;
  gap: 8px;
}

.criteria-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.criteria-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  align-items: start;
  min-height: 0;
  padding: 11px 12px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.criteria-item span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.criteria-item strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.94rem;
  line-height: 1.2;
}

.criteria-item small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  text-transform: none;
}

.arena-head {
  padding: 18px 18px 8px;
}

.launch-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(220px, 1fr) minmax(120px, 0.8fr);
  gap: 18px;
  align-items: center;
  min-height: 610px;
  padding: 26px;
  background:
    linear-gradient(180deg, rgba(207, 238, 255, 0.68) 0 50%, rgba(188, 235, 217, 0.9) 50%),
    #eaf8f5;
}

.launch-stage::before {
  position: absolute;
  right: 8%;
  bottom: 29%;
  left: 8%;
  height: 56px;
  border-radius: 50%;
  background: rgba(38, 50, 56, 0.08);
  content: "";
}

.launch-monster {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 0;
  filter: drop-shadow(0 16px 12px rgba(38, 50, 56, 0.16));
}

.launch-monster .monster-svg {
  width: min(100%, 220px);
}

.rival-launch {
  transform: scale(0.9);
}

.launch-copy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.launch-copy h3 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  line-height: 1.02;
}

.launch-copy p:not(.eyebrow) {
  max-width: 32ch;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.start-battle-button {
  min-height: 54px;
  padding: 0 24px;
  border: 1px solid rgba(217, 79, 96, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 143, 116, 0.94), rgba(245, 200, 92, 0.86)),
    #fff;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
  box-shadow: inset 0 -7px 0 rgba(38, 50, 56, 0.08);
}

.start-battle-button:hover {
  transform: translateY(-1px);
}

.battle-window[hidden] {
  display: none;
}

.battle-window {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(38, 50, 56, 0.42);
  backdrop-filter: blur(7px);
}

.battle-window-inner {
  display: grid;
  grid-template-rows: auto auto minmax(320px, 1fr) auto;
  width: min(1120px, 100%);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(38, 50, 56, 0.28);
}

.battle-window-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 12px;
  background:
    linear-gradient(90deg, rgba(255, 248, 223, 0.9), rgba(207, 238, 255, 0.72)),
    #fff;
}

.battle-window-head h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.8vw, 2.4rem);
  line-height: 1.02;
}

.battle-window-actions {
  display: flex;
  gap: 8px;
}

.battle-start-button {
  min-width: 82px;
  min-height: 42px;
}

.turn-banner {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 8px 0 0;
  padding: 0 12px;
  border: 1px solid rgba(125, 91, 166, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--plum);
  font-size: 0.9rem;
  font-weight: 950;
}

.battle-window .battle-hud {
  padding: 12px 18px;
  background: #fff;
}

.battle-window .stage {
  min-height: min(48vh, 430px);
}

.battle-window .battle-console {
  grid-template-columns: minmax(360px, 1fr) minmax(270px, 0.75fr);
  border-top: 1px solid rgba(38, 50, 56, 0.1);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(38, 50, 56, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.battle-hud {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 10px 18px 0;
}

.combatant-card {
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.combatant-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.combatant-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combatant-row span,
.hp-text,
.charge-text {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.hp-track {
  height: 10px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edeb;
}

.hp-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--mint);
  transition: width 240ms ease;
}

.rival-card .hp-track span {
  background: var(--coral);
}

.charge-track {
  height: 8px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #ece7f4;
}

.charge-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--plum));
  transition: width 240ms ease;
}

.stage {
  position: relative;
  display: grid;
  min-height: 330px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(207, 238, 255, 0.65) 0 52%, rgba(188, 235, 217, 0.9) 52%),
    #eaf8f5;
}

.stage::before {
  position: absolute;
  right: 6%;
  bottom: 17%;
  left: 6%;
  height: 42px;
  border-radius: 50%;
  background: rgba(38, 50, 56, 0.08);
  content: "";
}

.stage-ring {
  position: absolute;
  right: 14%;
  bottom: 12%;
  left: 14%;
  height: 126px;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

.forge-animation {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  place-items: center;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 248, 223, 0.82), transparent 36%),
    rgba(207, 238, 255, 0.62);
  pointer-events: none;
}

.forge-animation.is-active {
  display: grid;
}

.forge-core {
  position: relative;
  display: grid;
  place-items: center;
  width: min(46%, 260px);
  aspect-ratio: 1;
}

.forge-source,
.forge-monster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.forge-source {
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 18px 32px rgba(38, 50, 56, 0.18);
  animation: sourceDissolve 2.1s ease forwards;
}

.forge-monster {
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.74);
  filter: drop-shadow(0 18px 14px rgba(38, 50, 56, 0.18));
  animation: monsterReveal 2.1s ease forwards;
}

.forge-pixels {
  position: absolute;
  inset: -8%;
  animation: pixelFade 2.1s ease forwards;
}

.forge-pixels span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--gold);
  opacity: 0;
  animation: pixelBurst 1.5s ease forwards;
}

.forge-pixels span:nth-child(3n) {
  background: var(--coral);
}

.forge-pixels span:nth-child(4n) {
  background: var(--mint);
}

.forge-pixels span:nth-child(1) { left: 14%; top: 18%; --x: -52px; --y: -36px; animation-delay: 180ms; }
.forge-pixels span:nth-child(2) { left: 32%; top: 12%; --x: -18px; --y: -54px; animation-delay: 250ms; }
.forge-pixels span:nth-child(3) { left: 58%; top: 14%; --x: 25px; --y: -56px; animation-delay: 210ms; }
.forge-pixels span:nth-child(4) { left: 78%; top: 24%; --x: 58px; --y: -28px; animation-delay: 310ms; }
.forge-pixels span:nth-child(5) { left: 12%; top: 44%; --x: -64px; --y: -2px; animation-delay: 330ms; }
.forge-pixels span:nth-child(6) { left: 86%; top: 45%; --x: 67px; --y: 2px; animation-delay: 280ms; }
.forge-pixels span:nth-child(7) { left: 23%; top: 74%; --x: -42px; --y: 48px; animation-delay: 390ms; }
.forge-pixels span:nth-child(8) { left: 48%; top: 84%; --x: -2px; --y: 64px; animation-delay: 420ms; }
.forge-pixels span:nth-child(9) { left: 71%; top: 78%; --x: 47px; --y: 52px; animation-delay: 370ms; }
.forge-pixels span:nth-child(10) { left: 42%; top: 34%; --x: -8px; --y: -20px; animation-delay: 520ms; }
.forge-pixels span:nth-child(11) { left: 55%; top: 48%; --x: 18px; --y: 8px; animation-delay: 590ms; }
.forge-pixels span:nth-child(12) { left: 35%; top: 58%; --x: -24px; --y: 22px; animation-delay: 560ms; }
.forge-pixels span:nth-child(13) { left: 19%; top: 31%; --x: -48px; --y: -18px; animation-delay: 450ms; }
.forge-pixels span:nth-child(14) { left: 70%; top: 36%; --x: 46px; --y: -17px; animation-delay: 470ms; }
.forge-pixels span:nth-child(15) { left: 28%; top: 48%; --x: -32px; --y: 0; animation-delay: 650ms; }
.forge-pixels span:nth-child(16) { left: 63%; top: 62%; --x: 36px; --y: 28px; animation-delay: 620ms; }
.forge-pixels span:nth-child(17) { left: 46%; top: 20%; --x: -4px; --y: -42px; animation-delay: 700ms; }
.forge-pixels span:nth-child(18) { left: 49%; top: 67%; --x: 4px; --y: 42px; animation-delay: 740ms; }
.forge-pixels span:nth-child(19) { left: 8%; top: 61%; --x: -70px; --y: 28px; animation-delay: 690ms; }
.forge-pixels span:nth-child(20) { left: 88%; top: 63%; --x: 72px; --y: 31px; animation-delay: 720ms; }

.forge-animation p {
  align-self: end;
  margin: 0 0 22px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
}

@keyframes sourceDissolve {
  0% {
    opacity: 1;
    filter: saturate(1) blur(0);
    transform: scale(1);
    clip-path: inset(0 0 0 0);
  }

  50% {
    opacity: 0.92;
    filter: saturate(1.8) blur(1px);
    transform: scale(0.96) rotate(-2deg);
    clip-path: inset(9% 12% 12% 8%);
  }

  100% {
    opacity: 0;
    filter: saturate(2.5) blur(8px);
    transform: scale(0.68) rotate(6deg);
    clip-path: inset(48% 48% 48% 48%);
  }
}

@keyframes monsterReveal {
  0%,
  46% {
    opacity: 0;
    transform: scale(0.66) rotate(4deg);
  }

  72% {
    opacity: 1;
    transform: scale(1.08) rotate(-2deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes pixelBurst {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.4);
  }

  22% {
    opacity: 0.95;
  }

  100% {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(1.3) rotate(60deg);
  }
}

@keyframes pixelFade {
  0%,
  82% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.battle-fx {
  position: absolute;
  top: 38%;
  z-index: 7;
  display: grid;
  place-items: center;
  min-width: 92px;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 1000;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  box-shadow: 0 13px 24px rgba(38, 50, 56, 0.18);
}

.player-fx {
  left: 20%;
}

.rival-fx {
  right: 20%;
}

.battle-fx.is-active {
  animation: battlePop 900ms ease forwards;
}

.battle-fx[data-result="hit"] {
  background: #fff0e8;
  color: var(--danger);
}

.battle-fx[data-result="miss"] {
  background: #eef8f4;
  color: #3f8d71;
}

.battle-fx[data-result="guard"] {
  background: #fbf7ff;
  color: var(--plum);
}

@keyframes battlePop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.72) rotate(-3deg);
  }

  18% {
    opacity: 1;
    transform: translateY(-4px) scale(1.08) rotate(2deg);
  }

  58% {
    opacity: 1;
    transform: translateY(-12px) scale(1) rotate(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-34px) scale(1.12) rotate(2deg);
  }
}

.monster-slot {
  position: absolute;
  display: grid;
  place-items: center;
  width: min(42%, 280px);
  aspect-ratio: 1;
  filter: drop-shadow(0 16px 12px rgba(38, 50, 56, 0.18));
}

.player-slot {
  left: 9%;
  bottom: 7%;
}

.rival-slot {
  right: 9%;
  top: 8%;
  transform: scale(0.88);
}

.monster-svg {
  width: 100%;
  height: 100%;
  animation: bob 2.8s ease-in-out infinite;
}

.rival-slot .monster-svg {
  animation-delay: -1s;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-7px);
  }
}

.battle-console {
  display: grid;
  grid-template-columns: minmax(230px, 0.95fr) minmax(0, 1.05fr);
  gap: 12px;
  padding: 14px 18px 18px;
  background: #fff;
}

.move-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.move-button,
.text-button {
  min-height: 46px;
  border: 1px solid rgba(38, 50, 56, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.move-button {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 2px;
  padding: 8px 10px;
  text-align: left;
}

.move-button span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.move-button strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: 0.98rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-button small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.24;
}

.move-button:hover,
.text-button:hover,
.icon-button:hover {
  border-color: var(--coral);
}

.move-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.auto-move-card {
  min-height: 76px;
  cursor: default;
}

.auto-move-card:first-child {
  grid-column: 1 / -1;
}

.super-button {
  border-color: rgba(125, 91, 166, 0.32);
  background: #fbf7ff;
}

.text-button:disabled {
  cursor: default;
  opacity: 0.72;
}

.battle-log {
  display: flex;
  flex-direction: column-reverse;
  gap: 7px;
  height: 116px;
  margin: 0;
  padding: 0 4px 0 22px;
  overflow: auto;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.battle-log li::marker {
  color: var(--gold);
  font-weight: 900;
}

.sheet-monster {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 248, 223, 0.78), rgba(255, 255, 255, 0.9)),
    #fff;
}

.sheet-monster .monster-svg {
  width: min(92%, 220px);
}

.nameplate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nameplate h3 {
  margin: 0;
  overflow: hidden;
  font-size: 1.5rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nameplate span,
.trait-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef8f4;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.trait-chip {
  position: relative;
  cursor: help;
  outline-offset: 3px;
}

.trait-chip::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 30;
  width: max-content;
  max-width: min(260px, 78vw);
  padding: 8px 10px;
  border: 2px solid var(--ink);
  background: #263238;
  color: #fff8df;
  box-shadow: 4px 4px 0 rgba(38, 50, 56, 0.18);
  content: attr(data-tooltip);
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, 2px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.trait-chip:hover::after,
.trait-chip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, -2px);
}

.traits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trade-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.source-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.source-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--plum);
}

.trade-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.trade-code {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid rgba(38, 50, 56, 0.14);
  border-radius: 8px;
  padding: 9px;
  color: var(--ink);
  background: #fff;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.35;
}

.roster {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.collection-count,
.collection-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.collection-actions {
  display: flex;
  gap: 6px;
}

.text-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.save-button {
  border-color: rgba(90, 163, 125, 0.4);
  background: #eef8f4;
}

.roster-list {
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
}

.roster-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  text-align: left;
  cursor: pointer;
}

.roster-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.roster-duel-button {
  min-height: 32px;
  padding: 0 8px;
  font-size: 0.72rem;
}

.roster-card:hover,
.roster-card:focus {
  border-color: var(--coral);
  outline: none;
}

.collection-thumb {
  display: block;
  width: 46px;
  aspect-ratio: 1;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  object-fit: cover;
}

.generated-thumb {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--thumb-a), var(--thumb-b));
  color: var(--ink);
  font-weight: 900;
}

.roster-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.roster-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-copy span,
.roster-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.remove-button:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.remove-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.4;
}

.roster-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.top-nav-button {
  max-width: 190px;
  min-height: 32px;
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.codex-toggle-button {
  min-height: 32px;
  padding: 0 12px;
}

.account-panel,
.gallery-panel,
.trait-codex-panel,
.hill-panel,
.leaderboard-panel {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  min-height: auto;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 0.75fr) minmax(240px, 0.75fr);
  gap: 12px;
}

.account-card,
.account-form {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 220px;
  padding: 14px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: #fff;
}

.account-feedback {
  min-height: 44px;
  margin: 0;
  padding: 10px;
  border: 2px solid rgba(38, 50, 56, 0.18);
  background: #fff8df;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.35;
  text-transform: none;
}

.account-feedback[data-mode="success"] {
  border-color: var(--mint);
  background: #e9fff6;
}

.account-feedback[data-mode="error"] {
  border-color: var(--coral);
  background: #fff0eb;
}

.account-feedback[data-mode="working"] {
  border-color: var(--gold);
  background: #fff7d6;
}

.account-card h3,
.account-form h3 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  line-height: 1;
}

.account-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.account-form input {
  min-width: 0;
  height: 40px;
  border: 1px solid rgba(38, 50, 56, 0.14);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 850;
  text-transform: none;
}

.account-form[hidden] {
  display: none;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.trait-codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.trait-codex-grid[hidden] {
  display: none;
}

.trait-codex-panel.is-collapsed {
  gap: 0;
}

.trait-codex-group {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 220px;
  padding: 14px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-left: 6px solid var(--coral);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(207, 238, 255, 0.42)),
    #fff;
}

.trait-codex-group:nth-child(2n) {
  border-left-color: var(--mint);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 240, 168, 0.42)),
    #fff;
}

.trait-codex-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.trait-codex-head h3 {
  margin: 0;
  font-size: clamp(1.15rem, 2.6vw, 1.8rem);
  line-height: 1;
}

.trait-term-list {
  display: grid;
  gap: 8px;
}

.trait-term {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.trait-term strong {
  font-size: 0.86rem;
  line-height: 1.15;
}

.trait-term p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1.45;
  text-transform: none;
}

.gallery-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 310px;
  padding: 12px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-left: 6px solid var(--mint);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 248, 223, 0.42)),
    #fff;
}

.gallery-card.is-current {
  border-left-color: var(--coral);
}

.gallery-visual {
  display: grid;
  place-items: center;
  min-height: 132px;
  aspect-ratio: 1;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, rgba(125, 91, 166, 0.08) 0 8px, transparent 8px 16px),
    #fff8df;
}

.gallery-visual .monster-svg {
  width: 92%;
}

.gallery-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.gallery-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.gallery-title-row h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.2rem;
  line-height: 1.05;
}

.gallery-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(38, 50, 56, 0.14);
  background: #eef8f4;
  font-size: 0.72rem;
  font-weight: 950;
  white-space: nowrap;
}

.gallery-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.gallery-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.gallery-meta span {
  min-width: 0;
  padding: 4px 5px;
  overflow: hidden;
  border: 1px solid rgba(38, 50, 56, 0.1);
  background: #fff;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-traits {
  gap: 5px;
}

.gallery-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
}

.gallery-actions .text-button {
  min-height: 36px;
}

.gallery-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 160px;
  padding: 16px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: #fff;
}

.gallery-empty h3 {
  margin: 0 0 6px;
  font-size: clamp(1.2rem, 3vw, 2rem);
}

.hill-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 16px;
}

.hill-card {
  display: grid;
  grid-template-columns: minmax(190px, 0.72fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 250px;
  padding: 14px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 248, 223, 0.72), rgba(255, 255, 255, 0.92)),
    #fff;
}

.hill-card.is-empty {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.hill-card h3 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.8rem);
  line-height: 0.96;
}

.hill-king-stage {
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, rgba(245, 200, 92, 0.16) 0 8px, transparent 8px 16px),
    #fff8df;
}

.hill-king-stage .monster-svg {
  width: min(92%, 210px);
}

.hill-copy,
.hill-candidates {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.hill-actions {
  display: grid;
  gap: 8px;
  min-width: 150px;
}

.hill-actions .text-button,
.hill-place-button {
  min-height: 36px;
}

.hill-candidate-list {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow: auto;
}

.hill-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.leaderboard-list {
  display: grid;
  gap: 8px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(90px, auto);
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-left: 6px solid var(--gold);
  border-radius: 8px;
  background: #fff;
}

.leaderboard-row.is-current {
  border-left-color: var(--plum);
  background: linear-gradient(90deg, rgba(188, 235, 217, 0.52), #fff);
}

.leaderboard-rank,
.leaderboard-kudos {
  font-weight: 950;
}

.leaderboard-rank {
  color: var(--muted);
}

.leaderboard-player {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.leaderboard-player strong,
.leaderboard-player small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-player small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.history-panel {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.92fr);
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 8px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-left: 6px solid var(--gold);
  border-radius: 8px;
  background: #fff;
}

.history-row.is-win {
  border-left-color: var(--mint);
}

.history-row.is-loss {
  border-left-color: var(--danger);
}

.history-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.history-result {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
}

.history-opponent {
  width: fit-content;
  max-width: 100%;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  color: var(--ink);
  font-weight: 950;
  text-align: left;
  text-decoration: underline;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-main small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
}

.mini-stat-grid dt,
.mini-stat-grid dd {
  min-width: 0;
  margin: 0;
  text-align: center;
}

.mini-stat-grid dt {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 950;
}

.mini-stat-grid dd {
  padding: 2px 0;
  border: 1px solid rgba(38, 50, 56, 0.08);
  background: #eef8f4;
  font-size: 0.76rem;
  font-weight: 950;
}

.home-panel {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  min-height: auto;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
}

.home-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-slot {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 430px;
  padding: 12px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 248, 223, 0.58), rgba(255, 255, 255, 0.92)),
    #fff;
}

.home-slot.is-empty {
  align-content: center;
  justify-items: center;
  text-align: center;
}

.home-slot-head {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.home-slot-head span,
.home-type {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.home-slot-head strong,
.home-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-sprite {
  display: grid;
  place-items: center;
  min-height: 170px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, rgba(125, 91, 166, 0.08) 0 8px, transparent 8px 16px),
    #fff8df;
}

.home-sprite .monster-svg {
  width: min(92%, 180px);
}

.home-empty-mark {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border: 3px dashed rgba(38, 50, 56, 0.28);
  color: var(--muted);
  font-size: 2.2rem;
  font-weight: 950;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.home-actions .text-button {
  min-height: 36px;
  padding: 0 6px;
  font-size: 0.72rem;
}

.home-candidates {
  display: grid;
  align-content: start;
  gap: 10px;
}

.home-candidate-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
}

.home-candidate-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  padding: 8px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: #fff;
}

.home-place-actions {
  display: flex;
  gap: 5px;
}

.slot-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(38, 50, 56, 0.16);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 950;
}

.slot-button.is-active {
  background: var(--mint);
}

.slot-button:disabled {
  cursor: default;
  filter: grayscale(0.4);
  opacity: 0.52;
}

.opponent-modal[hidden] {
  display: none;
}

.opponent-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(38, 50, 56, 0.56);
}

.opponent-modal-inner {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(38, 50, 56, 0.28);
}

.opponent-modal-head {
  border-bottom: 1px solid rgba(38, 50, 56, 0.1);
}

.opponent-detail {
  display: grid;
  grid-template-columns: minmax(180px, 0.74fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.opponent-visual,
.opponent-copy {
  display: grid;
  gap: 12px;
  align-content: start;
}

.opponent-source-image,
.opponent-sprite {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, rgba(125, 91, 166, 0.08) 0 8px, transparent 8px 16px),
    #fff8df;
}

.opponent-source-image {
  object-fit: cover;
}

.opponent-sprite {
  display: grid;
  place-items: center;
}

.opponent-sprite .monster-svg {
  width: 88%;
}

.opponent-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* Pixel anime skin */
body {
  font-family:
    "Cascadia Mono", "Consolas", "SFMono-Regular", "Courier New", ui-monospace,
    monospace;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.22) 0 2px, transparent 2px 24px),
    repeating-linear-gradient(90deg, rgba(125, 91, 166, 0.09) 0 2px, transparent 2px 24px),
    linear-gradient(180deg, #cfeeff 0 38%, #fff8df 38% 39%, #bcebd9 39% 100%);
  image-rendering: pixelated;
}

button,
input,
textarea {
  font-family: inherit;
}

.topbar h1 {
  color: #202a2f;
  text-shadow:
    4px 4px 0 #ffffff,
    7px 7px 0 rgba(125, 91, 166, 0.22);
}

.eyebrow {
  letter-spacing: 0;
}

.panel,
.arena,
.arena-launch,
.battle-window-inner {
  border: 3px solid var(--ink);
  border-radius: 0;
  background: #fffdf7;
  box-shadow: 8px 8px 0 rgba(38, 50, 56, 0.22);
}

.battle-window,
.opponent-modal {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.12) 0 4px, transparent 4px 16px),
    rgba(38, 50, 56, 0.56);
  backdrop-filter: none;
}

.battle-window-head,
.arena-head,
.opponent-modal-head {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.48) 0 12px, transparent 12px 24px),
    linear-gradient(90deg, #fff8df, #cfeeff);
}

.tier-badge,
.lab-tabs,
.lab-tab,
.drop-zone,
.drop-icon,
.image-preview,
.generate-button,
.criteria-item,
.start-battle-button,
.turn-banner,
.icon-button,
.combatant-card,
.hp-track,
.charge-track,
.stage-ring,
.forge-source,
.forge-pixels span,
.forge-animation p,
.battle-fx,
.move-button,
.text-button,
.codex-toggle-button,
.account-card,
.account-feedback,
.account-form,
.account-form input,
.sheet-monster,
.nameplate span,
.trait-pill,
.trade-panel,
.trade-code,
.roster-card,
.collection-thumb,
.remove-button,
.history-panel,
.history-row,
.mini-stat-grid dd,
.gallery-card,
.gallery-visual,
.gallery-level,
.gallery-meta span,
.gallery-empty,
.trait-codex-panel,
.trait-codex-group,
.trait-term,
.home-slot,
.home-sprite,
.home-empty-mark,
.home-candidate-card,
.hill-card,
.hill-king-stage,
.leaderboard-row,
.slot-button,
.opponent-modal-inner,
.opponent-source-image,
.opponent-sprite {
  border-radius: 0;
}

.lab-tabs,
.drop-zone,
.criteria-item,
.combatant-card,
.move-button,
.text-button,
.codex-toggle-button,
.account-panel,
.account-card,
.account-feedback,
.account-form,
.account-form input,
.sheet-monster,
.trade-panel,
.roster-card,
.trade-code,
.history-panel,
.history-row,
.mini-stat-grid dd,
.gallery-panel,
.gallery-card,
.gallery-visual,
.gallery-level,
.gallery-meta span,
.gallery-empty,
.trait-codex-panel,
.trait-codex-group,
.trait-term,
.home-panel,
.home-slot,
.home-sprite,
.home-empty-mark,
.home-candidate-card,
.hill-panel,
.leaderboard-panel,
.hill-card,
.hill-king-stage,
.leaderboard-row,
.slot-button,
.opponent-modal-inner,
.opponent-source-image,
.opponent-sprite {
  border-color: var(--ink);
}

.lab-tab.is-active,
.move-button:focus,
.move-button:hover,
.text-button:hover,
.icon-button:hover,
.roster-card:hover,
.roster-card:focus,
.gallery-card:hover,
.gallery-card:focus-within,
.history-opponent:focus,
.hill-place-button:hover,
.hill-place-button:focus,
.slot-button:hover,
.slot-button:focus {
  outline: none;
  box-shadow: 4px 4px 0 rgba(255, 143, 116, 0.42);
}

.generate-button,
.start-battle-button,
.text-button,
.icon-button {
  border: 3px solid var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0 50%, rgba(245, 200, 92, 0.38) 50%),
    var(--gold);
  box-shadow: inset -4px -4px 0 rgba(38, 50, 56, 0.16);
}

.generate-button:disabled,
.start-battle-button:disabled,
.move-button:disabled {
  filter: grayscale(0.6);
}

.hash-text,
.trade-code {
  font-family: inherit;
}

.launch-stage,
.stage {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.24) 0 12px, transparent 12px 24px),
    linear-gradient(180deg, #cfeeff 0 52%, #bcebd9 52% 100%);
}

.launch-stage::before,
.stage::before {
  right: 9%;
  bottom: 16%;
  left: 9%;
  height: 22px;
  border-radius: 0;
  background:
    repeating-linear-gradient(90deg, rgba(38, 50, 56, 0.1) 0 18px, rgba(38, 50, 56, 0.16) 18px 36px);
}

.stage-ring {
  right: 18%;
  bottom: 12%;
  left: 18%;
  height: 92px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.12);
  transform: skewX(-10deg);
}

.monster-svg.pixel-monster {
  overflow: visible;
  animation: pixelBob 950ms steps(2, end) infinite;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.monster-svg.pixel-monster rect {
  shape-rendering: crispEdges;
}

.rival-slot .monster-svg.pixel-monster {
  animation-delay: -475ms;
}

.sheet-monster,
.mini-monster-preview {
  background:
    repeating-linear-gradient(45deg, rgba(125, 91, 166, 0.08) 0 8px, transparent 8px 16px),
    #fff8df;
}

.battle-fx {
  border: 3px solid var(--ink);
  text-shadow: 2px 2px 0 #ffffff;
  box-shadow: 4px 4px 0 rgba(38, 50, 56, 0.22);
}

@keyframes pixelBob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@media (max-width: 1120px) {
  .game-grid {
    grid-template-columns: 1fr 1fr;
  }

  .arena,
  .arena-launch {
    grid-column: 1 / -1;
    order: -1;
  }

  .panel {
    min-height: 540px;
  }

  .home-layout,
  .home-slots,
  .account-layout,
  .hill-layout,
  .hill-card {
    grid-template-columns: 1fr;
  }

  .home-slot,
  .hill-card {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 12px;
  }

  .topbar,
  .section-heading,
  .arena-head {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .game-grid,
  .battle-console,
  .battle-hud,
  .history-row,
  .opponent-detail {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .arena,
  .arena-launch,
  .panel {
    min-height: auto;
  }

  .launch-stage {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: auto;
    padding: 18px;
  }

  .launch-stage::before {
    bottom: 18%;
  }

  .launch-monster .monster-svg {
    width: min(58%, 188px);
  }

  .rival-launch {
    transform: scale(0.82);
  }

  .battle-window {
    align-items: start;
    padding: 8px;
    overflow: hidden;
  }

  .battle-window-inner {
    grid-template-rows: auto auto minmax(300px, auto) auto;
    max-height: calc(100vh - 16px);
    min-height: auto;
    overflow: auto;
  }

  .battle-window-head {
    padding: 12px;
  }

  .turn-banner {
    font-size: 0.82rem;
  }

  .battle-window .battle-hud,
  .battle-window .battle-console {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .stage {
    min-height: 300px;
  }

  .battle-window .stage {
    min-height: 270px;
  }

  .battle-window .battle-log {
    height: 88px;
  }

  .monster-slot {
    width: min(49%, 210px);
  }

  .player-slot {
    left: 3%;
    bottom: 5%;
  }

  .rival-slot {
    right: 2%;
    top: 12%;
  }

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

  .home-candidate-card {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .gallery-grid,
  .gallery-card,
  .gallery-empty {
    grid-template-columns: 1fr;
  }

  .gallery-visual {
    width: min(100%, 260px);
    justify-self: center;
  }

  .gallery-meta,
  .gallery-actions {
    grid-template-columns: 1fr;
  }

  .gallery-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-place-actions {
    grid-column: 1 / -1;
  }

  .hill-card,
  .hill-card.is-empty,
  .leaderboard-row {
    grid-template-columns: 1fr;
  }

  .hill-actions {
    grid-template-columns: 1fr 1fr;
  }

  .opponent-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hill-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
