: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: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  margin-bottom: 16px;
}

.brand-mark {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.brand-status {
  margin-left: 8px;
}

.brand-logo-button {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 0;
}

.brand-logo-image {
  display: block;
  width: clamp(104px, 12vw, 156px);
  height: auto;
  image-rendering: pixelated;
  transition: transform 120ms ease, filter 120ms ease;
}

.brand-logo-button:hover .brand-logo-image,
.brand-logo-button:focus-visible .brand-logo-image {
  transform: translateY(-2px);
  filter: drop-shadow(4px 4px 0 rgba(125, 91, 166, 0.2));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.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);
  grid-template-areas:
    "beta beta beta"
    "lab arena sheet"
    ". about sheet";
  gap: 16px;
  align-items: start;
}

.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: 0;
  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: 380px;
  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-panel {
  grid-area: lab;
}

.arena-launch {
  grid-area: arena;
}

.sheet-panel {
  grid-area: sheet;
}

.about-panel {
  grid-area: about;
  display: grid;
  gap: 14px;
  min-height: auto;
}

.beta-warning-panel {
  grid-area: beta;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 0;
  padding: 12px 16px;
  border-color: var(--gold);
  background:
    repeating-linear-gradient(90deg, rgba(245, 200, 92, 0.18) 0 12px, transparent 12px 24px),
    #fff8df;
}

.beta-warning-panel h2,
.beta-warning-panel p {
  margin: 0;
}

.beta-warning-panel p:not(.eyebrow) {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.4;
}

.about-copy {
  display: grid;
  gap: 12px;
}

.about-copy p {
  margin: 0;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
  line-height: 1.55;
  text-transform: none;
}

.about-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.about-steps span {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px;
  border: 2px solid var(--ink);
  background: #fff8df;
  font-size: 0.74rem;
  font-weight: 950;
  text-align: center;
}

.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,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.drop-zone:hover,
.drop-zone:focus-within,
.drop-zone.is-dragging {
  border-color: #4fae74;
  background:
    linear-gradient(135deg, rgba(188, 235, 217, 0.82), rgba(255, 248, 223, 0.72)),
    #eefaf4;
  box-shadow:
    inset 0 0 0 4px rgba(79, 174, 116, 0.16),
    0 0 0 3px rgba(79, 174, 116, 0.18);
  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;
}

.paste-hint {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.paste-hover-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  padding: 6px 8px;
  border: 2px solid var(--ink);
  background: #c9f3dd;
  box-shadow: 3px 3px 0 rgba(38, 50, 56, 0.2);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1.15;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.drop-zone:hover .paste-hover-hint,
.drop-zone:focus-within .paste-hover-hint,
.drop-zone.is-dragging .paste-hover-hint {
  opacity: 1;
  transform: translateY(0);
}

.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;
}

.stat-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  outline-offset: 3px;
}

.stat-tip::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 35;
  width: max-content;
  max-width: min(260px, 76vw);
  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;
  text-transform: none;
  transform: translate(-50%, 2px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

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

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

.stat-value {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
}

.stat-value.has-bonus .stat-total {
  color: #1f7a4d;
}

.stat-bonus-note,
.stat-bonus-pill {
  border: 1px solid rgba(35, 128, 76, 0.28);
  background: #e4ffe8;
  color: #1f7a4d;
  font-weight: 950;
}

.stat-bonus-note {
  padding: 2px 5px;
  font-size: 0.64rem;
  line-height: 1.15;
}

.stat-bonus-pill {
  display: block;
  width: 100%;
  padding: 1px 2px;
  font-size: 0.5rem;
  line-height: 1.05;
  text-align: center;
}

.fed-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  margin-left: 4px;
  padding: 1px 5px;
  border: 2px solid #263238;
  background: #72df8b;
  box-shadow: inset -2px -2px 0 rgba(35, 128, 76, 0.35);
  color: #173824;
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
  vertical-align: middle;
}

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

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

.criteria-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: start;
  min-height: 0;
  padding: 10px 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;
}

.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],
.creation-window[hidden] {
  display: none;
}

.battle-window,
.creation-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,
.creation-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);
}

.creation-window-inner {
  grid-template-rows: auto minmax(420px, 1fr);
  width: min(860px, 100%);
}

.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);
}

.creation-stage {
  position: relative;
  min-height: min(70vh, 620px);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(207, 238, 255, 0.68), rgba(188, 235, 217, 0.9)),
    #eaf8f5;
}

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

.creation-result {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(240px, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 100%;
  padding: 28px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.creation-result.is-ready {
  opacity: 1;
  transform: translateY(0);
}

.creation-monster {
  display: grid;
  place-items: center;
  min-height: 260px;
}

.creation-monster .monster-svg {
  width: min(96%, 280px);
}

.creation-copy {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 2px solid var(--ink);
  background: rgba(255, 255, 255, 0.86);
}

.creation-copy h3 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 0.95;
}

.creation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.creation-actions .text-button {
  flex: 1 1 auto;
}

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

.battle-window.has-analysis-report .battle-window-inner {
  grid-template-rows: auto auto minmax(150px, 0.58fr) auto minmax(0, 1fr);
}

.battle-window.has-analysis-report .stage {
  min-height: min(28vh, 230px);
}

.battle-window.has-analysis-report .battle-log {
  height: 132px;
}

.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: grid;
  align-content: start;
  gap: 8px;
  height: 188px;
  margin: 0;
  padding: 8px;
  overflow: auto;
  border: 2px solid var(--ink);
  background: #fff8df;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.35;
  list-style: none;
}

.battle-log-entry {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(38, 50, 56, 0.14);
  border-left: 6px solid var(--gold);
  background: #fff;
  box-shadow: 3px 3px 0 rgba(38, 50, 56, 0.08);
}

.battle-log-entry strong,
.battle-log-entry span,
.battle-log-entry small {
  display: block;
}

.battle-log-entry strong {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 950;
}

.battle-log-entry span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 950;
}

.battle-log-entry small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: none;
}

.battle-log-entry.is-hit {
  border-left-color: var(--danger);
  background: #fff0e8;
}

.battle-log-entry.is-miss {
  border-left-color: #5aa37d;
  background: #eef8f4;
}

.battle-log-entry.is-guard {
  border-left-color: var(--plum);
  background: #fbf7ff;
}

.battle-log-entry.is-initiative,
.battle-log-entry.is-finish,
.battle-log-entry.is-note {
  background: #fff;
}

.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);
}

.sheet-portrait {
  max-width: 230px;
}

.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;
}

.monster-call-button {
  width: 100%;
  min-height: 36px;
  margin-top: -4px;
}

.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: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.danger-button {
  background: #fff0eb;
}

.danger-button:hover {
  background: #ffd9cc;
}

.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;
}

.feed-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);
}

.feed-favorite-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--food-color, #ff6f91) 22%, #fff) 0, rgba(255, 255, 255, 0.92) 62%),
    #fff;
}

.feed-favorite-card h3,
.food-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.05;
}

.feed-favorite-card p,
.food-flavor {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.35;
  text-transform: none;
}

.feed-favorite-card .feed-image-hint {
  padding: 7px 8px;
  border: 2px solid var(--ink);
  background: color-mix(in srgb, var(--food-color, #ff6f91) 18%, #fff8df);
  box-shadow: inset -4px -4px 0 rgba(255, 211, 97, 0.34);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 950;
}

.feed-accepts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.feed-accepts span,
.food-bonus-line {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  background: rgba(188, 235, 217, 0.48);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 950;
}

.feed-accepts span.is-favorite,
.feed-food-row.is-favorite {
  background: color-mix(in srgb, var(--food-accent, #ffe08a) 72%, #fff);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--food-color, #ff6f91) 32%, var(--ink));
}

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

.feed-food-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  background: #fff;
}

.feed-food-row.is-liked {
  background: linear-gradient(90deg, rgba(188, 235, 217, 0.5), #fff);
}

.food-dot {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  box-shadow: inset -3px -3px 0 rgba(38, 50, 56, 0.14);
}

.feed-food-row strong,
.feed-food-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-food-row small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.sheet-panel.is-fed .sheet-monster {
  animation: feed-bounce 760ms steps(4, end);
}

.sheet-panel.is-food-rejected .sheet-monster {
  animation: feed-refuse 520ms steps(3, end);
}

.sheet-panel.is-food-neutral .sheet-monster {
  animation: feed-neutral 560ms ease;
}

.fridge-forge {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(220px, 0.75fr) auto;
  gap: 14px;
  align-items: stretch;
}

.food-drop-zone {
  min-height: 180px;
}

.food-drop-icon {
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 950;
}

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

.food-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-left: 6px solid var(--food-color, var(--mint));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), color-mix(in srgb, var(--food-accent, #fff0a8) 28%, #fff)),
    #fff;
}

.food-thumb {
  display: grid;
  gap: 6px;
  place-items: center;
  width: 100%;
  margin: 0;
  padding: 8px;
  border: 2px solid var(--ink);
  background:
    repeating-linear-gradient(45deg, rgba(125, 91, 166, 0.08) 0 7px, transparent 7px 14px),
    #fff8df;
}

.food-sprite {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
}

.food-svg {
  width: 92%;
  max-height: 100%;
}

.food-source-mini {
  display: grid;
  gap: 2px;
  width: 100%;
  min-width: 0;
}

.food-source-mini img {
  width: 100%;
  aspect-ratio: 1.45;
  border: 1px solid var(--ink);
  object-fit: cover;
}

.food-source-mini span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.food-thumb > span {
  font-size: 1.7rem;
  font-weight: 950;
}

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

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

.food-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.food-actions .text-button {
  flex: 1 1 120px;
}

@keyframes feed-bounce {
  0% { transform: translateY(0) scale(1); filter: none; }
  30% { transform: translateY(-8px) scale(1.05); filter: drop-shadow(0 0 10px rgba(119, 217, 144, 0.45)); }
  60% { transform: translateY(2px) scale(0.98); }
  100% { transform: translateY(0) scale(1); filter: none; }
}

@keyframes feed-refuse {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@keyframes feed-neutral {
  0% { filter: none; }
  50% { filter: drop-shadow(0 0 8px rgba(245, 200, 92, 0.45)); }
  100% { filter: none; }
}

.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;
}

.stego-portrait {
  position: relative;
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 220px;
  margin: 0;
}

.stego-portrait-sprite {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
}

.stego-portrait-sprite .monster-svg {
  width: 94%;
  max-height: 100%;
}

.stego-info-button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  vertical-align: 0.08em;
  border: 2px solid var(--ink);
  background: #fff8df;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 950;
  line-height: 1;
}

.stego-info-button:hover,
.stego-info-button:focus-visible {
  background: var(--mint);
}

.stego-source-frame {
  position: relative;
  display: grid;
  gap: 2px;
  width: 100%;
  margin: 0;
  min-width: 0;
}

.stego-source-frame img,
.source-show-button {
  width: 100%;
  aspect-ratio: 1.65;
  border: 2px solid var(--ink);
  background: #fff;
}

.stego-source-frame img {
  display: block;
  object-fit: cover;
}

.source-show-button {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 950;
}

.source-private-label {
  display: block;
  padding: 3px 5px;
  border: 1px solid rgba(38, 50, 56, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 950;
  text-align: center;
}

.source-show-button {
  min-height: 0;
  padding: 0 4px;
  background:
    repeating-linear-gradient(45deg, rgba(125, 91, 166, 0.08) 0 7px, transparent 7px 14px),
    #fff8df;
  color: var(--ink);
  font-size: 0.68rem;
}

.source-hide-button {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 20px;
  padding: 0 5px;
  border: 2px solid var(--ink);
  background: #fff8df;
  color: var(--ink);
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
}

.stego-source-name {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-portrait {
  width: 56px;
  gap: 2px;
}

.collection-portrait .stego-source-frame img,
.collection-portrait .source-show-button {
  border-width: 1px;
}

.collection-portrait .source-hide-button,
.collection-portrait .source-private-label,
.collection-portrait .stego-source-name {
  display: none;
}

.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 {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.28;
}

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

.roster-copy small {
  overflow-wrap: anywhere;
  white-space: normal;
}

.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;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 18px 0 4px;
  font-size: 0.78rem;
  font-weight: 900;
}

.site-footer a {
  color: var(--ink);
}

.policy-copy {
  display: grid;
  gap: 12px;
  max-width: 860px;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.55;
  text-transform: none;
}

.policy-copy p {
  margin: 0;
}

.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,
.public-gallery-panel,
.fridge-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 .account-consent {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  color: var(--ink);
  line-height: 1.35;
  text-transform: none;
}

.account-form .account-consent input {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  accent-color: var(--plum);
}

.account-consent a {
  color: var(--ink);
  text-decoration-thickness: 2px;
}

.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(360px, 1fr));
  gap: 12px;
}

.gallery-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.gallery-panel.is-gallery-collapsed .gallery-grid {
  align-items: start;
}

.gallery-panel > .collection-status {
  margin: -4px 0 12px;
}

.public-gallery-note,
.screen-note {
  padding: 12px;
  border: 2px solid var(--ink);
  background: #fff8df;
}

.public-gallery-note p,
.screen-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.45;
  text-transform: none;
}

.public-source-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.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(180px, 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;
  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-stack {
  align-content: start;
  gap: 8px;
  min-height: 236px;
  padding: 8px;
}

.gallery-sprite-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
}

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

.gallery-portrait {
  max-width: 118px;
}

.gallery-reference {
  display: grid;
  gap: 4px;
  width: 100%;
  margin: 0;
}

.gallery-reference img,
.gallery-reference span {
  width: 100%;
  aspect-ratio: 1.45;
  border: 2px solid var(--ink);
  background: #fff;
  object-fit: cover;
}

.gallery-reference span {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 950;
}

.gallery-reference figcaption {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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;
}

.level-tier {
  border-color: rgba(38, 50, 56, 0.24);
}

.level-tier-common {
  background: #eef8f4;
}

.level-tier-sturdy {
  background: #fff8df;
}

.level-tier-notable {
  background: #dff3ff;
}

.level-tier-champion {
  background: #ffe3ed;
}

.level-tier-legendary {
  background: #f2e7ff;
}

.level-tier-mythic {
  background: linear-gradient(90deg, #fff8df, #dff3ff, #ffe3ed);
}

.gallery-title-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 5px;
}

.gallery-title-badges .fed-badge {
  margin-left: 0;
}

.gallery-card.is-fed,
.home-slot.is-fed,
.home-candidate-card.is-fed,
.hill-card.is-fed {
  box-shadow: inset 4px 0 0 #72df8b;
}

.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: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.gallery-actions .text-button {
  flex: 1 1 84px;
  min-height: 36px;
  min-width: 78px;
  padding-inline: 8px;
  white-space: normal;
}

.gallery-share-toggle {
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border: 2px solid var(--ink);
  background: #fff8df;
  box-shadow: inset -4px -4px 0 rgba(255, 211, 97, 0.55);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1.15;
}

.gallery-share-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  flex: 0 0 auto;
}

.gallery-share-toggle span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.gallery-share-toggle.is-disabled {
  opacity: 0.58;
}

.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.is-yours {
  border-color: rgba(125, 91, 166, 0.55);
  background:
    linear-gradient(180deg, rgba(217, 196, 255, 0.45), rgba(255, 255, 255, 0.95)),
    #fff;
}

.hill-owner-line {
  margin: 2px 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(38, 50, 56, 0.78);
}

.hill-card.is-yours .hill-owner-line {
  color: #4a2f78;
}

.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-portrait {
  max-width: 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: 1fr;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-left: 6px solid var(--gold);
  border-radius: 8px;
  background: #fff;
}

.history-owner {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(38, 50, 56, 0.72);
  text-transform: none;
  letter-spacing: 0;
}

.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 .stat-tip::after {
  max-width: min(220px, 72vw);
  font-size: 0.66rem;
}

.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;
}

.mini-stat-grid dd.has-bonus {
  border-color: rgba(35, 128, 76, 0.42);
  background: #e4ffe8;
}

.mini-stat-grid dd.has-bonus .stat-value {
  display: grid;
  gap: 1px;
  justify-items: center;
}

.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-portrait {
  max-width: 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: 58px minmax(0, 1fr) minmax(76px, auto);
  gap: 10px;
  align-items: start;
  min-height: 88px;
  padding: 8px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: #fff;
}

.other-trainers {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(38, 50, 56, 0.12);
}

.other-trainers-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.other-trainer-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid rgba(38, 50, 56, 0.16);
  border-radius: 8px;
  background: #fff;
}

.other-trainer-card.is-active {
  border-color: var(--accent, #7d5ba6);
  background: rgba(125, 91, 166, 0.08);
}

.other-trainer-card small {
  color: rgba(38, 50, 56, 0.7);
  font-size: 0.72rem;
}

.other-trainer-defenders {
  display: grid;
  gap: 10px;
}

.other-trainer-defender-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 760px) {
  .other-trainer-defender-list {
    grid-template-columns: 1fr;
  }

  .fridge-forge {
    grid-template-columns: 1fr;
  }

  .food-card,
  .feed-food-row {
    grid-template-columns: 1fr;
  }

  .food-thumb {
    max-width: 150px;
  }
}

.home-place-actions {
  display: flex;
  align-self: center;
  justify-content: flex-end;
  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;
}

.notice-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);
}

.notice-modal {
  position: fixed;
  inset: 0;
  z-index: 58;
  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);
}

.notice-modal-inner {
  width: min(460px, 100%);
  border: 2px solid var(--ink);
  background: #fff;
  box-shadow: 8px 8px 0 rgba(38, 50, 56, 0.26);
}

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

.notice-modal-head {
  border-bottom: 2px solid var(--ink);
  background: linear-gradient(90deg, rgba(255, 240, 168, 0.86), rgba(255, 255, 255, 0.94));
}

.notice-modal-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.notice-modal-body p {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 900;
  line-height: 1.45;
  text-transform: none;
}

.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-portrait {
  max-width: 220px;
}

.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,
.creation-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,
.creation-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,
.creation-copy,
.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,
.about-panel,
.about-steps span,
.sheet-monster,
.nameplate span,
.trait-pill,
.monster-call-button,
.trade-panel,
.trade-code,
.roster-card,
.collection-thumb,
.stego-source-frame img,
.source-show-button,
.source-hide-button,
.remove-button,
.history-panel,
.feed-panel,
.feed-favorite-card,
.feed-food-row,
.food-card,
.food-thumb,
.history-row,
.mini-stat-grid dd,
.public-gallery-panel,
.fridge-panel,
.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,
.about-panel,
.about-steps span,
.sheet-monster,
.monster-call-button,
.trade-panel,
.roster-card,
.trade-code,
.stego-source-frame img,
.source-show-button,
.source-hide-button,
.history-panel,
.feed-panel,
.feed-favorite-card,
.feed-food-row,
.food-card,
.food-thumb,
.history-row,
.mini-stat-grid dd,
.gallery-panel,
.public-gallery-panel,
.fridge-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,
.food-card:hover,
.food-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;
    grid-template-areas: none;
  }

  .lab-panel,
  .arena-launch,
  .sheet-panel,
  .beta-warning-panel,
  .about-panel {
    grid-area: auto;
  }

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

  .panel {
    min-height: 540px;
  }

  .home-layout,
  .home-slots,
  .account-layout,
  .hill-layout,
  .hill-card,
  .about-steps {
    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,
  .creation-window {
    align-items: start;
    padding: 8px;
    overflow: hidden;
  }

  .battle-window-inner,
  .creation-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;
  }

  .creation-window-inner {
    grid-template-rows: auto minmax(520px, auto);
  }

  .creation-result {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .creation-stage {
    min-height: 620px;
  }

  .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: 58px minmax(0, 1fr);
  }

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

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

  .gallery-meta {
    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));
}

.stego-info-copy {
  gap: 14px;
}

.stego-info-special {
  margin: 0;
}

.stego-info-stats {
  gap: 8px;
}

.stego-info-meta {
  margin: 0;
}

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

.current-pin {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: rgba(255, 248, 223, 0.96);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  text-align: left;
  font: inherit;
  max-width: 260px;
  transition: transform 0.18s ease;
}

.current-pin:hover,
.current-pin:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.current-pin-sprite {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid rgba(38, 50, 56, 0.18);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.current-pin-sprite svg {
  width: 100%;
  height: 100%;
}

.current-pin-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.current-pin-eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(38, 50, 56, 0.7);
}

.current-pin-info strong {
  font-size: 0.96rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-pin-info small {
  font-size: 0.72rem;
  color: rgba(38, 50, 56, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.modal-open .current-pin,
body.battle-open .current-pin {
  display: none;
}

@media (max-width: 540px) {
  .current-pin {
    bottom: 10px;
    right: 10px;
    padding: 6px 10px;
    max-width: 200px;
  }
  .current-pin-sprite {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
}

.sheet-expand-button {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: rgba(255, 248, 223, 0.86);
}

.sheet-expandable {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.sheet-expandable[hidden] {
  display: none;
}

.forge-paste-hint {
  margin: 6px 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(38, 50, 56, 0.7);
  line-height: 1.45;
}

.defender-record {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(125, 91, 166, 0.18);
  font-size: 0.7rem;
  font-weight: 800;
  color: rgba(38, 50, 56, 0.82);
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.analysis-report {
  position: relative;
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  min-height: 0;
  max-height: min(64vh, 660px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 248, 223, 0.92), rgba(255, 255, 255, 0.95));
  box-shadow: var(--shadow);
}

.analysis-report-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  z-index: 1;
}

.analysis-report-close svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
}

.analysis-report[hidden] {
  display: none;
}

.analysis-report-head h3 {
  margin: 0 0 4px;
  padding-right: 48px;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
}

.analysis-report-head > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.analysis-report-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.analysis-report-rematch {
  background: var(--gold, #f5c85c);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.analysis-report-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.6fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.analysis-report-portrait {
  display: grid;
  gap: 10px;
}

.analysis-report-sprite {
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: #fff;
  min-height: 140px;
}

.analysis-report-sprite svg {
  width: 100%;
  height: auto;
}

.analysis-report-source-frame {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  background: #fff;
}

.analysis-report-source-frame img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

.analysis-report-source-frame figcaption {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  word-break: break-all;
}

.analysis-report-meta {
  display: grid;
  gap: 6px;
  align-content: start;
}

.analysis-report-meta h4 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1;
}

.analysis-report-type {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 800;
  color: rgba(38, 50, 56, 0.78);
}

.analysis-report-level {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.analysis-report-summary {
  margin: 6px 0 0;
  font-size: 0.86rem;
  line-height: 1.5;
}

.analysis-report-special {
  position: relative;
  margin-top: 8px;
  padding: 12px;
  border: 2px solid var(--accent, #7d5ba6);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(247, 200, 92, 0.34), rgba(125, 91, 166, 0.18));
  overflow: hidden;
}

.analysis-report-special strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.analysis-report-special p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: rgba(38, 50, 56, 0.86);
}

.analysis-report-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.analysis-report-sparkles span {
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, #fff8df 0%, #f9f871 60%, transparent 75%);
  border-radius: 50%;
  opacity: 0;
  animation: sparkleDrift 2.2s ease-in-out infinite;
}

.analysis-report-sparkles span:nth-child(1) { top: 12%; left: 6%; animation-delay: 0s; }
.analysis-report-sparkles span:nth-child(2) { top: 64%; left: 14%; animation-delay: 0.32s; }
.analysis-report-sparkles span:nth-child(3) { top: 26%; left: 78%; animation-delay: 0.6s; }
.analysis-report-sparkles span:nth-child(4) { top: 72%; left: 82%; animation-delay: 0.9s; }
.analysis-report-sparkles span:nth-child(5) { top: 42%; left: 48%; animation-delay: 1.3s; }
.analysis-report-sparkles span:nth-child(6) { top: 18%; left: 36%; animation-delay: 1.6s; }

@keyframes sparkleDrift {
  0%   { opacity: 0; transform: translateY(0) scale(0.6); }
  40%  { opacity: 1; transform: translateY(-6px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-14px) scale(0.4); }
}

.analysis-report-section h5 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(38, 50, 56, 0.72);
}

.analysis-stat-list,
.analysis-trait-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.analysis-stat-row,
.analysis-trait-row {
  padding: 10px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-left: 6px solid rgba(38, 50, 56, 0.2);
  border-radius: 8px;
  background: #fff;
}

.analysis-stat-row.is-tier-0 { border-left-color: #d94f60; }
.analysis-stat-row.is-tier-1 { border-left-color: #f5c85c; }
.analysis-stat-row.is-tier-2 { border-left-color: #5aa37d; }
.analysis-stat-row.is-tier-3 { border-left-color: #7d5ba6; background: linear-gradient(135deg, #fff 0%, rgba(217, 196, 255, 0.4) 100%); }

.analysis-stat-row header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.analysis-stat-row header strong {
  font-size: 0.86rem;
}

.analysis-stat-value {
  font-size: 1.1rem;
  font-weight: 900;
}

.analysis-stat-rating {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(38, 50, 56, 0.78);
}

.analysis-stat-row p,
.analysis-trait-row p {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: rgba(38, 50, 56, 0.78);
}

.analysis-trait-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.86rem;
}

.analysis-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 12px;
  margin: 0;
}

.analysis-meta-grid dt {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.analysis-meta-grid dd {
  margin: 0 0 4px;
  font-size: 0.82rem;
  font-weight: 700;
  word-break: break-word;
}

@media (max-width: 640px) {
  .battle-window.has-analysis-report .battle-window-inner {
    grid-template-rows: auto auto minmax(160px, auto) auto minmax(0, 1fr);
  }

  .battle-window.has-analysis-report .stage {
    min-height: 170px;
  }

  .analysis-report-grid {
    grid-template-columns: 1fr;
  }

  .analysis-report {
    max-height: calc(100vh - 112px);
  }
}

@media (max-width: 760px) {
  .battle-window.has-analysis-report .battle-window-inner {
    grid-template-rows: auto auto minmax(160px, auto) auto minmax(0, 1fr);
  }

  .battle-window.has-analysis-report .stage {
    min-height: 170px;
  }
}

[data-screen-section] {
  display: none;
}
.app-shell[data-active-screen="home"] [data-screen-section="home"],
.app-shell[data-active-screen="public-gallery"] [data-screen-section="public-gallery"],
.app-shell[data-active-screen="stego-fridge"] [data-screen-section="stego-fridge"],
.app-shell[data-active-screen="trait-codex"] [data-screen-section="trait-codex"],
.app-shell[data-active-screen="kudos-leaderboard"] [data-screen-section="kudos-leaderboard"] {
  display: block;
}
.app-shell[data-active-screen="home"] main.game-grid[data-screen-section="home"] {
  display: grid;
}
