* {
  box-sizing: border-box;
}

:root {
  --bg: #0f1113;
  --surface: #1a1d21;
  --surface-strong: #0f1113;
  --surface-soft: #15181c;
  --text: #e6e9ed;
  --muted: #a0a7af;
  --line: #3a3f45;
  --line-strong: #3a3f45;
  --accent: #39ff14;
  --accent-dark: #1fa30b;
  --success: #39ff14;
  --accent-rgb: 57, 255, 20;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  --section-gap: 18px;
  --subsection-gap: 14px;
  --animal-card-ratio: 3 / 5;
  --animal-card-width: 100%;
  --animal-card-height: auto;
  --animal-card-zoom-width: 350px;
  --animal-card-zoom-height: 584px;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #17191c 0%, #101214 42%, #0f1113 100%);
  color: var(--text);
}

h1,
h2,
h3 {
  line-height: 1.08;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.hidden {
  display: none !important;
}

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

.app {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: var(--section-gap);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: clamp(2.25rem, 4vw, 3.5rem);
}

.page-header p {
  margin: 0;
  max-width: 48ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ruby-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  transform: rotate(45deg);
  border: 1px solid rgba(255, 188, 194, 0.8);
  background: linear-gradient(135deg, #ff8a94 0%, #ff3040 45%, #8f0f1d 100%);
  box-shadow: 0 0 12px rgba(255, 48, 64, 0.7);
}

.highlight-color-picker {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.color-swatch {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border: 2px solid rgba(230, 233, 237, 0.2);
  border-radius: 8px;
  background: var(--swatch-color);
  box-shadow: 0 0 16px rgba(var(--swatch-rgb), 0.3);
}

.color-swatch:hover,
.color-swatch.is-active {
  border-color: var(--text);
  background: var(--swatch-color);
  box-shadow: 0 0 22px rgba(var(--swatch-rgb), 0.52);
}

.color-swatch--pink {
  --swatch-color: #ff4fd8;
  --swatch-rgb: 255, 79, 216;
}

.color-swatch--yellow {
  --swatch-color: #f5ff00;
  --swatch-rgb: 245, 255, 0;
}

.color-swatch--red {
  --swatch-color: #ff3040;
  --swatch-rgb: 255, 48, 64;
}

.color-swatch--green {
  --swatch-color: #39ff14;
  --swatch-rgb: 57, 255, 20;
}

.color-swatch--blue {
  --swatch-color: #2af5ff;
  --swatch-rgb: 42, 245, 255;
}

.dashboard {
  display: grid;
  gap: var(--section-gap);
}

.dashboard-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--section-gap);
  align-items: start;
}

.panel,
.profile-hero {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.profile-hero {
  padding: 24px;
  background: linear-gradient(135deg, #1c1f23, #111315);
  color: var(--text);
}

.profile-shell {
  display: grid;
  gap: var(--subsection-gap);
}

.auth-shell {
  display: grid;
  gap: 14px;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.auth-panel {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.auth-panel-start {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17, 20, 23, 0.78);
}

.auth-copy,
.auth-form-copy {
  display: grid;
  gap: 8px;
}

.auth-lead,
.auth-form-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-actions {
  align-items: stretch;
}

.auth-restore-row {
  display: flex;
  justify-content: flex-end;
}

.auth-shell.is-authenticated .auth-grid,
.auth-shell.is-authenticated .auth-restore-row {
  display: none;
}

.login-form {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17, 20, 23, 0.78);
}

.profile-hero .panel-head {
  align-items: start;
}

.profile-hero .panel-head > div {
  min-width: 0;
}

.profile-hero #logout-button {
  justify-self: end;
  align-self: start;
}

.profile-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 6px;
}

.profile-top h2 {
  margin: 4px 0 6px;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.profile-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.profile-identity {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.profile-subline {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 100%;
}

.profile-subline span {
  position: static;
}

.secret-code-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.secret-code-button {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.secret-code-button:hover {
  background: transparent;
  color: var(--text);
}

.secret-code-value.is-blurred {
  filter: blur(5px);
  user-select: none;
}

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

.profile-groups {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.profile-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-group-collapsible {
  margin: 0;
}

.profile-group-summary {
  display: none;
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0;
  border: 0;
  background: transparent;
}

.profile-group-title {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.profile-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  font-size: 0.86rem;
  flex: 0 0 auto;
  white-space: nowrap;
}

.profile-chip-action {
  cursor: pointer;
}

.profile-chip-action:hover {
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--text);
}

.profile-chip.is-positive {
  background: rgba(var(--accent-rgb), 0.16);
}

.profile-chip.is-warning {
  background: rgba(31, 163, 11, 0.2);
}

.profile-chip.is-danger {
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(248, 113, 113, 0.28);
  color: #fecaca;
}

.profile-warning {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.24);
  color: #fecaca;
  font-size: 0.9rem;
}

.hero-note {
  color: var(--muted);
}

#account-box {
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: var(--subsection-gap);
}

.panel-head.compact {
  margin-bottom: var(--subsection-gap);
}

.panel-head h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
}

.panel-heading-button {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-transform: none;
  text-align: left;
}

.profile-hero input,
.profile-hero select {
  background: #111417;
  color: var(--text);
}

.profile-hero .ghost-button {
  color: var(--text);
  border-color: var(--line);
}

.profile-hero .ghost-button:hover {
  background: rgba(var(--accent-rgb), 0.08);
}

.actions,
.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.login-form,
.search-form,
label {
  display: grid;
  gap: 8px;
}

.login-form,
.search-form {
  margin-bottom: 14px;
}

.search-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.search-inline-field {
  min-width: 0;
}

input,
select,
button {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
}

button {
  border-color: transparent;
  background: var(--accent);
  color: #0f1113;
  font-weight: 700;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary-button {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
}

button.secondary-button:hover {
  background: #20242a;
}

button.ghost-button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button.success-button {
  background: var(--success);
  color: #0f1113;
}

button.is-active-toggle {
  cursor: default;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.info-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 14px;
  white-space: pre-wrap;
}

.section-copy {
  color: var(--muted);
  margin-bottom: var(--subsection-gap);
}

.stacked-sections {
  display: grid;
  gap: var(--subsection-gap);
}

.subsection {
  display: grid;
  gap: 10px;
}

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

.subsection + .subsection {
  padding-top: var(--subsection-gap);
  border-top: 1px solid var(--line);
}

.collection-section {
  padding-top: 0;
  border-top-color: transparent;
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-10px);
  transition:
    grid-template-rows 320ms ease,
    opacity 220ms ease,
    transform 320ms ease,
    padding-top 320ms ease,
    border-top-color 320ms ease;
}

.collection-section.is-open {
  padding-top: var(--subsection-gap);
  border-top-color: var(--line);
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
}

.collection-section-inner {
  min-height: 0;
  overflow: hidden;
  display: grid;
  gap: 10px;
}

.collection-toggle-row {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.shop-box {
  display: grid;
  gap: 14px;
}

.shop-page {
  display: grid;
  gap: 14px;
}

.shop-feature {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(255, 48, 64, 0.28);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 48, 64, 0.14), rgba(17, 20, 23, 0.8)),
    #15181c;
}

.shop-feature h3 {
  margin: 0;
  font-size: 1rem;
}

.shop-feature p {
  margin: 6px 0 0;
  max-width: 62ch;
}

.shop-kicker {
  margin-bottom: 6px;
  color: #ff9aa3;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-buy {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.shop-price {
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  justify-content: stretch;
  gap: 18px 14px;
}

.shop-item {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.shop-card-wrap {
  position: relative;
  min-width: 0;
}

.team-pagination {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 10px;
}

.team-pagination-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(230, 233, 237, 0.24);
  transition: transform 180ms ease, background-color 180ms ease, opacity 180ms ease;
}

.team-pagination-dot.is-active {
  background: rgba(230, 233, 237, 0.96);
  transform: scale(1.15);
}

.subsection-title {
  margin: 0;
  font-size: 0.95rem;
  white-space: nowrap;
}

.team-grid,
.collection-grid {
  display: grid;
  gap: 14px;
}

.team-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-columns: auto;
  justify-content: stretch;
  overflow: visible;
  scroll-snap-type: none;
  padding-bottom: 6px;
}

.collection-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  justify-content: stretch;
}

.team-grid > .card,
.collection-grid > .card,
.card-shell > .card,
.shop-card-wrap > .card {
  width: 100%;
  height: auto;
  aspect-ratio: var(--animal-card-ratio);
}

.card-shell {
  display: grid;
  gap: 8px;
  align-content: start;
  width: 100%;
  min-width: 0;
}

.card-context-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 44px;
}

.card-context-bar button {
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.76rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-context-bar--shop {
  grid-template-columns: 1fr;
}

.card-context-status {
  min-height: 18px;
  text-align: center;
}

.team-grid > .card,
.team-grid > .card-shell {
  scroll-snap-align: start;
}

.card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #1d2025, #171a1e);
  height: 100%;
  container-type: inline-size;
}

.card.is-flippable {
  padding: 0;
  border: 0;
  background: transparent;
  perspective: 1200px;
  cursor: pointer;
}

.card-inner {
  display: grid;
  min-height: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 420ms ease;
}

.card.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  grid-area: 1 / 1;
  position: relative;
  display: grid;
  gap: 10px;
  grid-template-rows: auto auto auto auto 1fr auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #1d2025, #171a1e);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  height: 100%;
  isolation: isolate;
}

.card-front {
  transform: rotateY(0deg);
  -webkit-transform: rotateY(0deg);
}

.card-back {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  grid-template-rows: 1fr;
  align-content: stretch;
}

.card-back-copy {
  display: grid;
  gap: 10px;
  height: 100%;
  align-content: start;
}

.card-back-head {
  display: grid;
  gap: 3px;
}

.card-back-id {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.card-back-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.beast-card .card-back-copy {
  grid-template-rows: minmax(0, var(--card-head-size)) minmax(0, 1fr) auto;
  overflow: hidden;
}

.beast-card .card-back-copy p {
  overflow: hidden;
}

.card-back-meta {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(58, 63, 69, 0.78);
}

.card-back-meta span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-back-meta strong {
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.3;
}

.card.is-attacker .card-face {
  border-color: rgba(var(--accent-rgb), 0.7);
  box-shadow: 0 14px 30px rgba(var(--accent-rgb), 0.14);
  animation: attacker-pulse 3.6s ease-in-out infinite;
}

@keyframes attacker-pulse {
  0%,
  100% {
    border-color: rgba(var(--accent-rgb), 0.58);
    box-shadow: 0 14px 28px rgba(var(--accent-rgb), 0.1);
  }

  50% {
    border-color: rgba(var(--accent-rgb), 0.82);
    box-shadow: 0 14px 34px rgba(var(--accent-rgb), 0.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card.is-attacker .card-face {
    animation: none;
  }

  .card-inner {
    transition: none;
  }
}

.card.is-empty {
  justify-items: start;
  align-content: start;
  min-height: 180px;
  background: repeating-linear-gradient(
    135deg,
    rgba(58, 63, 69, 0.45),
    rgba(58, 63, 69, 0.45) 16px,
    rgba(21, 24, 28, 0.95) 16px,
    rgba(21, 24, 28, 0.95) 32px
  );
}

.team-grid > .card.is-empty,
.collection-grid > .card.is-empty {
  min-height: 0;
}

.card h3 {
  margin: 0;
  font-size: 1rem;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.beast-card {
  --card-pad: 10px;
  --card-gap: 8px;
  --card-head-size: 0.14fr;
  --card-art-size: 0.56fr;
  --card-stats-size: 0.16fr;
  --card-copy-size: 0.2fr;
  --rarity-rgb: 160, 167, 175;
  --rarity-soft: rgba(var(--rarity-rgb), 0.13);
  --rarity-line: rgba(var(--rarity-rgb), 0.5);
}

.beast-card .card-face {
  padding: var(--card-pad);
  gap: var(--card-gap);
  border-color: var(--rarity-line);
  background:
    linear-gradient(180deg, rgba(var(--rarity-rgb), 0.13), transparent 34%),
    linear-gradient(180deg, #20242a, #101316);
  box-shadow: inset 0 0 24px rgba(var(--rarity-rgb), 0.08);
}

.beast-card .card-face::before,
.beast-card .card-face::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.beast-card .card-face::before {
  top: 7px;
  right: 7px;
  bottom: 7px;
  left: 7px;
  inset: 7px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(var(--rarity-rgb), 0.42), rgba(var(--rarity-rgb), 0.42)) top left / 28px 1px no-repeat,
    linear-gradient(180deg, rgba(var(--rarity-rgb), 0.42), rgba(var(--rarity-rgb), 0.42)) top left / 1px 28px no-repeat,
    linear-gradient(90deg, rgba(var(--rarity-rgb), 0.42), rgba(var(--rarity-rgb), 0.42)) top right / 28px 1px no-repeat,
    linear-gradient(180deg, rgba(var(--rarity-rgb), 0.42), rgba(var(--rarity-rgb), 0.42)) top right / 1px 28px no-repeat,
    linear-gradient(90deg, rgba(var(--rarity-rgb), 0.42), rgba(var(--rarity-rgb), 0.42)) bottom left / 28px 1px no-repeat,
    linear-gradient(180deg, rgba(var(--rarity-rgb), 0.42), rgba(var(--rarity-rgb), 0.42)) bottom left / 1px 28px no-repeat,
    linear-gradient(90deg, rgba(var(--rarity-rgb), 0.42), rgba(var(--rarity-rgb), 0.42)) bottom right / 28px 1px no-repeat,
    linear-gradient(180deg, rgba(var(--rarity-rgb), 0.42), rgba(var(--rarity-rgb), 0.42)) bottom right / 1px 28px no-repeat;
  opacity: 0.74;
}

.beast-card .card-face::after {
  top: 9px;
  right: 9px;
  bottom: 9px;
  left: 9px;
  inset: 9px;
  border-radius: 4px;
  opacity: 0.72;
}

.beast-card .card-face > * {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.beast-card .card-front {
  align-content: start;
  grid-template-rows:
    auto
    auto
    auto
    minmax(0, 1fr);
}

.beast-card .card-front::after {
  background:
    repeating-linear-gradient(135deg, rgba(var(--rarity-rgb), 0.08) 0, rgba(var(--rarity-rgb), 0.08) 1px, transparent 1px, transparent 13px),
    repeating-linear-gradient(90deg, transparent 0, transparent 28px, rgba(255, 255, 255, 0.03) 28px, rgba(255, 255, 255, 0.03) 29px),
    radial-gradient(circle at 18% 14%, rgba(var(--rarity-rgb), 0.18), transparent 18%),
    radial-gradient(circle at 86% 82%, rgba(var(--rarity-rgb), 0.12), transparent 20%);
}

.beast-card .card-back {
  grid-template-rows: 1fr;
  background:
    radial-gradient(circle at 50% 42%, rgba(var(--rarity-rgb), 0.22), transparent 28%),
    linear-gradient(180deg, #20242a, #0f1215);
}

.beast-card .card-back::after {
  opacity: 0.88;
  background:
    radial-gradient(circle at 50% 50%, transparent 0, transparent 24%, rgba(var(--rarity-rgb), 0.16) 25%, transparent 27%, transparent 100%),
    repeating-linear-gradient(45deg, rgba(var(--rarity-rgb), 0.08) 0, rgba(var(--rarity-rgb), 0.08) 2px, transparent 2px, transparent 15px),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 12px);
}

.beast-card .card-top {
  align-items: center;
  gap: 8px;
  min-height: 0;
  min-width: 0;
}

.beast-card .card-top h3 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rarity-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  min-width: 0;
}

.rarity-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  background: #252930;
  color: #d8dde5;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
}

.rarity-text {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.rarity-rare .rarity-icon {
  background: linear-gradient(180deg, #1d4f7a, #182f4c);
  color: #70d7ff;
}

.rarity-epic .rarity-icon {
  background: linear-gradient(180deg, #6736a2, #37205c);
  color: #e7bdff;
}

.rarity-legendary .rarity-icon {
  background: linear-gradient(180deg, #b86a18, #523114);
  color: #ffe08a;
}

.rarity-mythic .rarity-icon {
  background: linear-gradient(180deg, #8b1e2d, #34101a);
  color: #ffd6dc;
}

.rarity-divine .rarity-icon {
  background: linear-gradient(180deg, #f5f0c8, #9a7426);
  color: #fffdf0;
}

.rarity-common {
  --rarity-rgb: 160, 167, 175;
}

.rarity-rare {
  --rarity-rgb: 83, 194, 255;
}

.rarity-epic {
  --rarity-rgb: 197, 118, 255;
}

.rarity-legendary {
  --rarity-rgb: 255, 198, 83;
}

.rarity-mythic {
  --rarity-rgb: 255, 78, 102;
}

.rarity-divine {
  --rarity-rgb: 255, 244, 173;
}

.beast-card.rarity-rare .card-face {
  border-color: rgba(83, 194, 255, 0.56);
}

.beast-card.rarity-epic .card-face {
  border-color: rgba(197, 118, 255, 0.58);
}

.beast-card.rarity-legendary .card-face {
  border-color: rgba(255, 198, 83, 0.68);
}

.beast-card.rarity-mythic .card-face {
  border-color: rgba(255, 78, 102, 0.72);
}

.beast-card.rarity-divine .card-face {
  border-color: rgba(255, 244, 173, 0.82);
}

.badge {
  padding: 3px 6px;
  border-radius: 999px;
  background: #20242a;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.1;
  white-space: nowrap;
}

.badge.accent {
  background: #20242a;
  color: var(--text);
}

.badge.success {
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--success);
}

.card-art-placeholder {
  aspect-ratio: 4 / 3;
  width: 100%;
  border: 1px solid rgba(58, 63, 69, 0.9);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(34, 38, 43, 0.9), rgba(24, 27, 31, 0.98));
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-art {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  max-height: 42cqw;
  border: 1px solid rgba(58, 63, 69, 0.9);
  border-radius: 14px;
  overflow: hidden;
  background: #111417;
}

.beast-card .card-art,
.beast-card .card-art-placeholder {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  min-height: 0;
  align-self: start;
  max-height: none;
  border-color: rgba(var(--rarity-rgb), 0.38);
  background:
    linear-gradient(180deg, rgba(var(--rarity-rgb), 0.14), rgba(17, 20, 23, 0.98)),
    #111417;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 14px rgba(var(--rarity-rgb), 0.08);
}

.card-art-media {
  position: relative;
}

.card-art-image,
.card-art-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.card-art-video {
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.card-art-media.is-playing .card-art-video {
  opacity: 1;
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.beast-card .card-stats {
  width: 100%;
  height: 100%;
}

.card-stats div {
  padding: 7px 9px;
  border-radius: 12px;
  background: var(--surface-soft);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.card-stat {
  align-items: center;
  min-width: 0;
}

.card-stats strong {
  font-size: 0.92rem;
  line-height: 1;
}

.card-stats-primary div {
  min-height: 0;
  min-width: 0;
  height: 100%;
  padding: 8px 9px;
  align-items: center;
  border: 1px solid rgba(var(--rarity-rgb), 0.2);
  background:
    linear-gradient(180deg, rgba(var(--rarity-rgb), 0.1), transparent),
    var(--surface-soft);
  overflow: hidden;
}

.card-stats-primary strong {
  font-size: 0.92rem;
}

.stat-symbol {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 1px solid rgba(var(--rarity-rgb), 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(var(--rarity-rgb), 0.14), rgba(255, 255, 255, 0.025)),
    rgba(8, 10, 12, 0.52);
  box-shadow: inset 0 0 8px rgba(var(--rarity-rgb), 0.08);
}

.stat-symbol svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.stat-symbol-attack {
  color: #ff727d;
}

.stat-symbol-health {
  color: #61f58c;
  border-radius: 999px;
}

.small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.card-blurb {
  display: -webkit-box;
  min-height: 0;
  max-height: 100%;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.card-actions {
  gap: 6px;
}

.card-actions button {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.76rem;
  line-height: 1.2;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-preview-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 20px;
  overflow: auto;
}

.card-preview-modal.is-active {
  display: grid;
}

body.is-card-preview-open {
  overflow: hidden;
}

.card-preview-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  background: rgba(2, 4, 6, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.card-preview-window {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: end;
  gap: 10px;
  width: var(--animal-card-zoom-width);
  perspective: 1100px;
  animation: card-preview-pop 180ms ease-out;
}

.card-preview-close {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(17, 20, 23, 0.94);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
}

.card-preview-card {
  --preview-tilt-x: 0deg;
  --preview-tilt-y: 0deg;
  --preview-glow-x: 50%;
  --preview-glow-y: 42%;
  position: relative;
  width: var(--animal-card-zoom-width);
  isolation: isolate;
  transform: rotateX(var(--preview-tilt-x)) rotateY(var(--preview-tilt-y)) translate3d(0, 0, 0);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 150ms ease, filter 150ms ease;
  will-change: transform;
  filter:
    drop-shadow(0 18px 34px rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 18px rgba(var(--rarity-rgb), 0.18));
}

.card-preview-card::before,
.card-preview-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.card-preview-card::before {
  top: -18px;
  right: -18px;
  bottom: -18px;
  left: -18px;
  inset: -18px;
  z-index: -1;
  border-radius: 24px;
  background: radial-gradient(circle at var(--preview-glow-x) var(--preview-glow-y), rgba(var(--rarity-rgb), 0.32), transparent 48%);
  opacity: 0.7;
}

.card-preview-card::after {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 2;
  border-radius: 10px;
  background:
    radial-gradient(circle at var(--preview-glow-x) var(--preview-glow-y), rgba(255, 255, 255, 0.18), transparent 25%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 32%, rgba(var(--rarity-rgb), 0.1) 78%, transparent);
  opacity: 0.24;
}

.card-preview-card > .card {
  position: relative;
  z-index: 1;
  width: 100%;
  height: var(--animal-card-zoom-height);
  aspect-ratio: auto;
}

.card-preview-card .beast-card {
  --card-pad: 16px;
  --card-gap: 10px;
  --card-head-size: 48px;
  --card-art-size: 268px;
  --card-stats-size: 58px;
  --card-copy-size: 146px;
}

.card-preview-card .beast-card .card-face {
  box-shadow:
    inset 0 0 24px rgba(var(--rarity-rgb), 0.1),
    0 0 22px rgba(var(--rarity-rgb), 0.14);
}

.card-preview-card .card h3 {
  font-size: 1.24rem;
}

.card-preview-card .rarity-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 1.08rem;
}

.card-preview-card .rarity-text {
  font-size: 0.68rem;
}

.card-preview-card .card-stats-primary strong {
  font-size: 1.34rem;
}

.card-preview-card .stat-symbol {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.card-preview-card .stat-symbol svg {
  width: 22px;
  height: 22px;
}

.card-preview-card .card-blurb {
  font-size: 1rem;
  line-height: 1.42;
  -webkit-line-clamp: 4;
}

.card-preview-card .card-back-copy p {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

@keyframes card-preview-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.list-item .inline-actions button {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.76rem;
  line-height: 1.2;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.incoming-battle-card {
  animation: incoming-battle-pulse 3.8s ease-in-out infinite;
}

@keyframes incoming-battle-pulse {
  0%,
  100% {
    border-color: rgba(var(--accent-rgb), 0.22);
    background: rgba(var(--accent-rgb), 0.04);
    box-shadow: 0 0 0 rgba(var(--accent-rgb), 0);
  }

  50% {
    border-color: rgba(var(--accent-rgb), 0.5);
    background: rgba(var(--accent-rgb), 0.1);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.12), 0 10px 24px rgba(var(--accent-rgb), 0.08);
  }
}

.opponent-card-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.opponent-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item h3 {
  margin: 0;
  font-size: 1rem;
}

.opponent-actions {
  align-items: center;
}

.opponent-actions button:first-child:not(:only-child) {
  margin-right: auto;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.event-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.event-overlay.is-active {
  pointer-events: auto;
}

body.is-overlay-active {
  overflow: hidden;
}

.event-overlay-shell {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.event-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 11, 0.64);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.event-panel {
  position: relative;
  width: min(100%, 620px);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(22, 25, 29, 0.96), rgba(13, 15, 18, 0.98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.event-kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro-panel {
  align-self: start;
  margin-top: min(10vh, 88px);
  width: min(100%, 560px);
  padding: 20px;
  display: grid;
  gap: 12px;
}

.intro-panel h2,
.reward-panel h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.intro-panel p,
.reward-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.starter-reveal-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
  padding: 20px 10px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(var(--accent-rgb), 0.14), transparent 55%),
    linear-gradient(180deg, rgba(24, 28, 32, 0.96), rgba(14, 16, 19, 0.98));
}

.starter-reveal-stage::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.18), transparent 45%);
  opacity: 0.9;
}

.starter-reveal-stage.is-revealing::after {
  content: "";
  position: absolute;
  inset: -20% 0;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transform: translateY(-120%);
  animation: reward-scan 1.2s ease 1;
}

.starter-reveal-stack {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: end;
  padding: 0 8px;
}

.starter-reveal-card {
  width: clamp(112px, 16vw, 148px);
  aspect-ratio: var(--animal-card-ratio);
  margin-inline: -16px;
  transform: translateX(var(--starter-shift)) rotate(var(--starter-angle));
  transform-origin: center bottom;
  z-index: 1;
}

.starter-reveal-card:nth-child(3) {
  z-index: 3;
}

.starter-reveal-card:nth-child(2),
.starter-reveal-card:nth-child(4) {
  z-index: 2;
}

.starter-reveal-card .card-inner {
  transition: transform 760ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.starter-reveal-card.is-revealing .card-inner {
  animation: starter-reveal-flip 760ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--starter-delay, 0ms);
}

@keyframes starter-reveal-flip {
  0% {
    transform: rotateY(180deg);
  }

  100% {
    transform: rotateY(0deg);
  }
}

.starter-reveal-card.is-starter-lead .card-face {
  border-color: rgba(var(--accent-rgb), 0.72);
  box-shadow: 0 16px 38px rgba(var(--accent-rgb), 0.18);
  animation: attacker-pulse 2.4s ease-in-out infinite;
}

.intro-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
  font-size: 0.84rem;
}

.intro-status.is-ready {
  background: rgba(var(--accent-rgb), 0.14);
}

.reward-panel {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.reward-panel--common {
  border-color: rgba(var(--accent-rgb), 0.18);
}

.reward-panel--rare {
  border-color: rgba(68, 211, 255, 0.28);
}

.reward-panel--epic {
  border-color: rgba(255, 176, 92, 0.32);
}

.reward-panel--legendary {
  border-color: rgba(255, 225, 107, 0.4);
}

.reward-panel--mythic {
  border-color: rgba(255, 78, 102, 0.46);
}

.reward-panel--divine {
  border-color: rgba(255, 244, 173, 0.54);
}

.reward-copy {
  display: grid;
  gap: 10px;
}

.reward-reveal-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 18px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(var(--accent-rgb), 0.14), transparent 55%),
    linear-gradient(180deg, rgba(24, 28, 32, 0.96), rgba(14, 16, 19, 0.98));
}

.reward-reveal-stage::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.18), transparent 45%);
  opacity: 0.9;
}

.rarity-rare .reward-reveal-stage::before {
  background: radial-gradient(circle, rgba(68, 211, 255, 0.22), transparent 45%);
}

.rarity-epic .reward-reveal-stage::before {
  background: radial-gradient(circle, rgba(255, 176, 92, 0.24), transparent 45%);
}

.rarity-legendary .reward-reveal-stage::before {
  background: radial-gradient(circle, rgba(255, 225, 107, 0.32), transparent 42%);
}

.rarity-mythic .reward-reveal-stage::before {
  background: radial-gradient(circle, rgba(255, 78, 102, 0.36), transparent 42%);
}

.rarity-divine .reward-reveal-stage::before {
  background: radial-gradient(circle, rgba(255, 244, 173, 0.42), transparent 42%);
}

.reward-reveal-stage::after {
  content: "";
  position: absolute;
  inset: -20% 0;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transform: translateY(-120%);
  animation: reward-scan 1.2s ease 1;
}

@keyframes reward-scan {
  0% {
    transform: translateY(-120%);
    opacity: 0;
  }

  30% {
    opacity: 1;
  }

  100% {
    transform: translateY(120%);
    opacity: 0;
  }
}

.reward-reveal-card {
  position: relative;
  width: min(100%, var(--animal-card-zoom-width));
  aspect-ratio: var(--animal-card-ratio);
  z-index: 1;
}

.reward-reveal-card .card-inner {
  transition: transform 760ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reward-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.reward-actions button {
  flex: 1 1 0;
}

.team-replacement-panel {
  width: min(100%, 620px);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.team-replacement-panel h2,
.team-replacement-panel p {
  margin: 0;
}

.team-replacement-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.team-replacement-panel p strong {
  color: var(--text);
}

.team-replacement-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.team-replacement-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
}

.team-replacement-option:hover,
.team-replacement-option:focus-visible {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
}

.team-replacement-option img {
  width: 56px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #0c1116;
  object-fit: contain;
}

.team-replacement-option span,
.team-replacement-option small {
  display: grid;
  min-width: 0;
}

.team-replacement-option strong,
.team-replacement-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-replacement-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.toast-viewport {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(58, 63, 69, 0.9);
  border-radius: 18px;
  background: rgba(17, 20, 23, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
  pointer-events: auto;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.toast--success {
  border-color: rgba(var(--accent-rgb), 0.28);
}

.toast--error {
  border-color: rgba(248, 113, 113, 0.34);
}

.toast--info {
  border-color: rgba(68, 211, 255, 0.2);
}

.toast-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.toast-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toast-message {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.toast-close {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  line-height: 1;
}

.toast-close:hover {
  background: transparent;
  color: var(--text);
}

.toast-progress {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.toast-progress span {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  animation: toast-progress var(--toast-duration, 4200ms) linear forwards;
}

.toast--success .toast-progress span {
  background: rgba(var(--accent-rgb), 0.72);
}

.toast--error .toast-progress span {
  background: rgba(248, 113, 113, 0.78);
}

.toast--info .toast-progress span {
  background: rgba(68, 211, 255, 0.72);
}

@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

@media (max-width: 760px) {
  :root {
    --section-gap: 14px;
    --subsection-gap: 12px;
  }

  h1,
  h2,
  h3,
  .subsection-title,
  .panel-heading-button,
  button,
  .profile-chip,
  .badge,
  .opponent-meta {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  body {
    font-size: 15px;
  }

  .app {
    padding: 12px;
  }

  .page-header {
    align-items: start;
    flex-direction: column;
    gap: 10px;
  }

  .page-header h1 {
    margin-bottom: 0;
    font-size: clamp(1.9rem, 10vw, 2.6rem);
  }

  .page-header p {
    max-width: none;
    font-size: 0.95rem;
  }

  .highlight-color-picker {
    justify-content: flex-start;
  }

  .shop-feature {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .shop-feature {
    display: grid;
  }

  .shop-buy {
    justify-items: stretch;
  }

  .panel,
  .profile-hero {
    border-radius: 18px;
  }

  .panel {
    padding: 14px;
  }

  .profile-hero {
    padding: 16px;
  }

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

  .dashboard-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mobile-panel[data-panel="battles"] {
    order: 1;
  }

  .mobile-panel[data-panel="opponents"] {
    order: 2;
  }

  .mobile-panel[data-panel="history"] {
    order: 3;
  }

  .panel-head,
  .profile-top {
    grid-template-columns: 1fr;
    display: grid;
    gap: 10px;
  }

  .profile-hero .panel-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .profile-inline {
    display: grid;
    gap: 12px;
  }

  .profile-top h2,
  .panel-head h2,
  .panel-heading-button {
    font-size: 1.15rem;
  }

  .profile-groups,
  .profile-group {
    justify-items: start;
  }

  .profile-group {
    display: grid;
    gap: 6px;
    justify-items: start;
  }

  .profile-group-collapsible .profile-group-title,
  .profile-group-collapsible .profile-meta {
    display: none;
  }

  .profile-group-collapsible.is-open .profile-group-title,
  .profile-group-collapsible.is-open .profile-meta {
    display: flex;
  }

  .profile-group-collapsible.is-open .profile-group-title {
    display: block;
  }

  .profile-group-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .profile-group-summary::after {
    content: "+";
    color: var(--text);
  }

  .profile-group-collapsible.is-open .profile-group-summary::after {
    content: "−";
  }

  .profile-subline,
  .profile-meta.single-row {
    overflow: visible;
    white-space: normal;
  }

  .profile-subline span:not(:last-child)::after {
    content: "";
    margin: 0;
  }

  .profile-chip,
  .badge {
    line-height: 1.3;
  }

  .panel-head.compact {
    margin-bottom: 0;
  }

  .mobile-panel .mobile-panel-body,
  .mobile-panel.is-open .mobile-panel-body {
    display: grid;
    padding-top: 12px;
  }

  .mobile-panel {
    background: linear-gradient(180deg, #1a1d21, #14181b);
  }

  .actions,
  .inline-actions {
    flex-direction: column;
  }

  .toast-viewport {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

  .toast {
    border-radius: 16px;
  }

  .event-overlay-shell {
    padding: 14px;
  }

  .event-overlay--fullscreen .event-overlay-shell {
    place-items: stretch;
    padding: 0;
    overflow-y: auto;
  }

  .event-overlay--fullscreen .event-overlay-backdrop {
    background: rgba(8, 10, 11, 0.88);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .event-overlay--fullscreen .event-panel {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .event-overlay--fullscreen .intro-panel,
  .event-overlay--fullscreen .reward-panel {
    align-self: stretch;
    margin-top: 0;
    padding: 18px 16px 24px;
  }

  .event-overlay--fullscreen .reward-panel {
    grid-template-rows: auto 1fr auto;
  }

  .event-overlay--fullscreen .starter-reveal-stage,
  .event-overlay--fullscreen .reward-reveal-stage {
    min-height: 320px;
    min-height: min(54dvh, 440px);
  }

  .event-overlay--fullscreen .starter-reveal-stage {
    padding-inline: 0;
  }

  .event-overlay--fullscreen .starter-reveal-card {
    width: clamp(96px, 22vw, 128px);
  }

  .event-overlay--fullscreen .reward-actions,
  .event-overlay--fullscreen .intro-panel .inline-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    margin-top: auto;
  }

  .event-overlay--fullscreen .reward-actions button,
  .event-overlay--fullscreen .intro-panel .inline-actions button {
    width: auto;
    min-width: 0;
  }

  .event-overlay--fullscreen .reward-actions button:first-child,
  .event-overlay--fullscreen .intro-panel .inline-actions button:first-child {
    flex: 1.25 1 0;
  }

  .event-overlay--fullscreen .reward-actions button:last-child,
  .event-overlay--fullscreen .intro-panel .inline-actions button:last-child {
    flex: 0.85 1 0;
  }

  .intro-panel {
    margin-top: 18px;
  }

  .reward-panel,
  .intro-panel {
    border-radius: 18px;
  }

  .starter-reveal-stage {
    min-height: 248px;
    padding: 14px 0;
  }

  .starter-reveal-card {
    width: clamp(84px, 18vw, 112px);
    margin-inline: -12px;
  }

  .reward-panel {
    padding: 16px;
  }

  .reward-reveal-stage {
    padding: 12px;
  }

  .auth-shell {
    gap: 12px;
  }

  .auth-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .auth-panel-start {
    padding: 14px;
    border-radius: 16px;
  }

  .auth-restore-row {
    justify-content: stretch;
  }

  .auth-restore-row button {
    width: 100%;
  }

  .login-form {
    padding: 14px;
    border-radius: 16px;
  }

  .actions button,
  .inline-actions button,
  .search-inline button,
  .collection-toggle-row button,
  .subsection-head .ghost-button,
  .reward-actions button {
    width: 100%;
  }

  .event-overlay--fullscreen .reward-actions button,
  .event-overlay--fullscreen .intro-panel .inline-actions button {
    width: auto;
  }

  .subsection-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search-inline {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  input,
  select,
  button {
    min-height: 48px;
  }

  .team-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 12px;
    overflow: visible;
    scroll-snap-type: none;
    padding-right: 0;
    padding-bottom: 6px;
  }

  .collection-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow: visible;
  }

  .team-pagination {
    display: flex;
    margin-top: 4px;
  }

  .team-grid > .card,
  .team-grid > .card-shell {
    width: 100%;
    scroll-snap-align: none;
  }

  .collection-grid > .card,
  .collection-grid > .card-shell {
    width: 100%;
  }

  .card,
  .card-face {
    gap: 12px;
  }

  .card-actions {
    flex-direction: column;
  }

  .card-actions button,
  .card-context-bar button,
  .list-item .inline-actions button {
    width: 100%;
  }

  .card-stats {
    grid-template-columns: 1fr;
  }

  .list-item {
    gap: 10px;
  }

  .opponent-actions {
    align-items: stretch;
  }

  .opponent-actions button:first-child:not(:only-child) {
    margin-right: 0;
  }
}

/* Combined brand and profile game bar. */
.page-header {
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(18px, 2.4vw, 30px);
}

.page-header > .brand-lockup {
  align-self: center;
  justify-self: start;
  width: auto;
}

.page-header > .brand-lockup .brand-logo {
  width: clamp(48px, 5vw, 56px);
  height: clamp(48px, 5vw, 56px);
}

.page-header > .brand-lockup .brand-wordmark {
  width: clamp(170px, 18vw, 220px);
  max-height: 44px;
}

.page-header > .profile-hero {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.page-header > .profile-hero.is-authenticated .profile-shell {
  display: grid;
  grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.page-header > .profile-hero.is-authenticated .panel-head {
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
}

.page-header > .profile-hero.is-authenticated .profile-title-row {
  justify-content: flex-end;
}

.page-header > .profile-hero.is-authenticated .profile-title-row h2 {
  overflow: hidden;
  color: var(--text);
  font-size: clamp(1rem, 1.7vw, 1.35rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-header > .profile-hero.is-authenticated .auth-shell,
.page-header > .profile-hero.is-authenticated #account-box,
.page-header > .profile-hero.is-authenticated .profile-identity {
  min-width: 0;
}

.page-header > .profile-hero.is-authenticated .profile-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  padding: 0;
}

.page-header > .profile-hero.is-authenticated .profile-detail-strip {
  display: grid;
  grid-template-columns: minmax(138px, 1fr) 52px minmax(164px, 1.08fr);
  gap: 8px;
  width: 100%;
}

.page-header > .profile-hero.is-authenticated .profile-detail-item {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}

.page-header > .profile-hero.is-authenticated .profile-stat-toggle {
  padding-inline: 0;
}

.page-header > .profile-hero.is-authenticated .profile-meta-compact {
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 6px;
}

.page-header > .profile-hero.is-authenticated .profile-chip {
  min-height: 42px;
  padding: 6px 8px;
}

.page-header > .profile-hero:not(.is-authenticated) {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line-strong);
}

.page-header > .profile-hero:not(.is-authenticated) .panel-head {
  padding-inline: 0;
  background: transparent;
}

@media (max-width: 1040px) and (min-width: 761px) {
  .page-header > .profile-hero.is-authenticated .profile-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .page-header > .profile-hero.is-authenticated .profile-title-row {
    justify-content: flex-end;
  }
}

@media (max-width: 760px) {
  .page-header {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px 12px;
  }

  .page-header > .brand-lockup {
    grid-column: 1;
    grid-row: 1;
  }

  .page-header > .brand-lockup .brand-logo {
    width: 48px;
    height: 48px;
  }

  .page-header > .brand-lockup .brand-wordmark {
    display: none;
  }

  .page-header > .profile-hero.is-authenticated,
  .page-header > .profile-hero.is-authenticated .profile-shell {
    display: contents;
  }

  .page-header > .profile-hero.is-authenticated .panel-head {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    padding: 0;
  }

  .page-header > .profile-hero.is-authenticated .profile-title-row {
    justify-content: flex-end;
  }

  .page-header > .profile-hero.is-authenticated .profile-title-row h2 {
    font-size: clamp(0.96rem, 5vw, 1.2rem);
  }

  .page-header > .profile-hero.is-authenticated .auth-shell {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .page-header > .profile-hero.is-authenticated .profile-detail-strip {
    grid-template-columns: minmax(0, 1.1fr) minmax(52px, 0.68fr) minmax(0, 1.32fr);
  }

  .page-header > .profile-hero.is-authenticated .profile-code-label {
    display: none;
  }

  .page-header > .profile-hero.is-authenticated .secret-code-row,
  .page-header > .profile-hero.is-authenticated .shop-ruby-button {
    padding-inline: 8px;
  }

  .page-header > .profile-hero.is-authenticated .profile-meta-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }
}

@media (min-width: 761px) {
  .profile-group-collapsible {
    display: flex;
  }

  .mobile-panel .mobile-panel-body {
    display: grid;
  }

  .profile-group-summary {
    display: none;
  }

  .profile-group-collapsible .profile-group-title,
  .profile-group-collapsible .profile-meta {
    display: flex;
  }

  .profile-group-collapsible .profile-group-title {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .starter-reveal-card.is-revealing .card-inner,
  .reward-reveal-card .card-inner,
  .event-overlay-backdrop,
  .reward-reveal-stage::after,
  .starter-reveal-stage.is-revealing::after,
  .card-preview-card,
  .starter-reveal-card.is-starter-lead .card-face {
    transition: none;
    animation: none;
  }

  .card-preview-card {
    transform: none;
  }
}

/* Simplified game-first interface */
:root {
  --bg: #0b0d0f;
  --surface: #15181b;
  --surface-strong: #0d1012;
  --surface-soft: #101316;
  --text: #f1f4f6;
  --muted: #9ca6ae;
  --line: rgba(241, 244, 246, 0.12);
  --line-strong: rgba(241, 244, 246, 0.2);
  --shadow: none;
  --section-gap: 12px;
  --subsection-gap: 12px;
  --animal-card-width: 100%;
  --animal-card-height: auto;
  --animal-card-zoom-width: 350px;
  --animal-card-zoom-height: 584px;
  --view-panel-padding: 14px;
  --view-panel-padding: clamp(12px, 1.8vw, 16px);
  --view-head-height: 44px;
  --header-control-height: 44px;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -8%, rgba(var(--accent-rgb), 0.14), transparent 34rem),
    linear-gradient(180deg, #111417 0%, var(--bg) 48%, #08090a 100%);
}

.app {
  max-width: 1180px;
  padding: 18px;
  padding: clamp(14px, 2.2vw, 24px);
  gap: 12px;
  align-content: start;
  grid-auto-rows: max-content;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 54px;
  height: auto;
  overflow: visible;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(1.65rem, 2.8vw, 2.35rem);
  letter-spacing: 0;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: clamp(44px, 7vw, 64px);
  height: clamp(44px, 7vw, 64px);
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(var(--accent-rgb), 0.32));
}

.brand-wordmark {
  width: clamp(170px, 28vw, 280px);
  height: auto;
  max-height: 52px;
  flex: 0 1 auto;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(var(--accent-rgb), 0.18));
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: visible;
}

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

.color-swatch,
input,
select,
button,
.profile-chip,
.badge {
  border-radius: 8px;
}

.highlight-color-picker {
  min-height: 44px;
  gap: 0;
  flex-wrap: nowrap;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 10, 12, 0.5);
}

.color-swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.color-swatch::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: var(--swatch-color);
  box-shadow: 0 0 10px rgba(var(--swatch-rgb), 0.22);
}

.color-swatch:hover,
.color-swatch.is-active {
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
}

.color-swatch.is-active::before {
  width: 16px;
  height: 16px;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.16),
    0 0 14px rgba(var(--swatch-rgb), 0.36);
}

.panel,
.profile-hero {
  border-radius: 10px;
  background: rgba(21, 24, 27, 0.86);
  box-shadow: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.profile-hero {
  padding: 0;
  overflow: hidden;
  background: rgba(13, 16, 18, 0.82);
}

.profile-shell,
.auth-shell,
.stacked-sections {
  gap: 10px;
}

.profile-hero .panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 64px;
  margin-bottom: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.profile-hero .panel-head h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  letter-spacing: 0;
}

.profile-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.profile-title-row h2 {
  min-width: 0;
}

.profile-field-edit-button,
.profile-edit-cancel-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
}

.profile-field-edit-button:hover,
.profile-edit-cancel-button:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
}

.profile-field-edit-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.profile-edit-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.profile-title-row .profile-edit-control {
  width: min(430px, 100%);
}

.profile-edit-control input {
  min-width: 0;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
}

.profile-edit-save-button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
}

.profile-hero #logout-button {
  height: var(--header-control-height);
  min-height: var(--header-control-height);
  padding: 0 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
}

.auth-shell.is-authenticated {
  padding: 0;
}

.profile-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 66px;
  padding: 12px 16px;
}

.profile-detail-strip,
.profile-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
}

.profile-detail-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
}

.profile-detail-item.is-editing {
  grid-column: 1 / -1;
}

.profile-detail-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.secret-code-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
}

.profile-groups {
  gap: 8px;
  justify-items: end;
}

.profile-group {
  justify-content: flex-end;
  gap: 8px;
}

.profile-group-title {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.profile-meta {
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.profile-chip {
  display: grid;
  align-content: center;
  gap: 1px;
  min-width: 66px;
  min-height: 38px;
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  font-size: 0.72rem;
  line-height: 1.15;
}

.profile-chip span {
  color: var(--muted);
  font-weight: 700;
}

.profile-chip strong {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1;
}

.dashboard {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.dashboard-tabs {
  position: static;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  height: 56px;
  min-height: 56px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 10, 12, 0.86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.dashboard-tab {
  position: relative;
  display: flex;
  height: 44px;
  min-height: 44px;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-tab:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.dashboard-tab.is-active {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.09);
  color: var(--text);
}

.dashboard-tab-badge {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 48, 64, 0.92);
  color: white;
  font-size: 0.68rem;
  line-height: 1;
}

.dashboard-view[hidden] {
  display: none !important;
}

.dashboard-view {
  min-width: 0;
}

.dashboard-view.is-active {
  display: grid;
}

.dashboard-stack.dashboard-view.is-active {
  display: grid;
}

.dashboard-view > .panel,
.today-panel {
  min-width: 0;
}

.today-panel {
  padding: var(--view-panel-padding);
  border-color: rgba(var(--accent-rgb), 0.2);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.13), rgba(21, 24, 27, 0.92) 42%),
    rgba(13, 16, 18, 0.9);
}

.today-head,
.collection-panel .panel-head,
.sidebar-panel .panel-head {
  display: flex;
  align-items: center;
  min-height: var(--view-head-height);
  margin-bottom: 10px;
}

.today-head h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
  letter-spacing: 0;
}

.today-context {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(230px, 0.75fr);
  gap: 8px;
}

.today-quick-row {
  display: grid;
  gap: 8px;
}

.today-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 92px;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 38%),
    rgba(8, 10, 12, 0.64);
  color: var(--text);
  text-align: left;
  overflow: hidden;
  isolation: isolate;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.today-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.38;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.22), transparent 38%) top left / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), transparent 45%) top left / 1px 100% no-repeat;
}

button.today-card {
  font: inherit;
}

.today-card.is-action:hover {
  border-color: rgba(var(--accent-rgb), 0.42);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.14), transparent 46%),
    rgba(8, 10, 12, 0.68);
  transform: translateY(-1px);
}

.today-card-primary {
  min-height: 132px;
  border-color: rgba(var(--accent-rgb), 0.34);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.24), transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
    rgba(8, 10, 12, 0.68);
}

.today-card-compact {
  min-height: 62px;
  padding: 11px;
  gap: 10px;
}

.today-card.is-urgent {
  border-color: rgba(255, 48, 64, 0.48);
  background:
    linear-gradient(135deg, rgba(255, 48, 64, 0.2), transparent 48%),
    rgba(8, 10, 12, 0.68);
}

.today-card-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  white-space: normal;
}

.today-card-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), rgba(255, 255, 255, 0.025)),
    rgba(15, 17, 19, 0.72);
  color: var(--accent);
  box-shadow: inset 0 0 14px rgba(var(--accent-rgb), 0.08);
}

.today-card-primary .today-card-icon {
  width: 54px;
  height: 54px;
}

.today-card.is-urgent .today-card-icon {
  border-color: rgba(255, 48, 64, 0.42);
  color: #ff8a94;
  background:
    linear-gradient(180deg, rgba(255, 48, 64, 0.18), rgba(255, 255, 255, 0.025)),
    rgba(15, 17, 19, 0.72);
}

.today-card-icon svg {
  width: 27px;
  height: 27px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.today-card-primary .today-card-icon svg {
  width: 33px;
  height: 33px;
}

.today-card-cue {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(230, 233, 237, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.today-card-cue::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 8px 0 0 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.today-card-kicker,
.today-card-note {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: normal;
}

.today-card-kicker {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.today-card-value {
  font-size: clamp(1.05rem, 1.8vw, 1.32rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  white-space: normal;
}

.today-card-compact .today-card-value {
  font-size: 0.98rem;
}

.collection-panel {
  padding: var(--view-panel-padding);
  border-color: rgba(var(--accent-rgb), 0.16);
  background:
    linear-gradient(180deg, rgba(24, 28, 32, 0.94), rgba(13, 16, 18, 0.92));
}

.panel-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: 0;
}

.section-copy {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.subsection-title {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-columns: auto;
  justify-content: stretch;
  gap: 10px;
  overflow: visible;
  scroll-snap-type: none;
  padding-bottom: 2px;
}

.collection-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  justify-content: stretch;
  gap: 10px;
}

.shop-grid {
  gap: 10px;
}

.team-grid > .card,
.collection-grid > .card,
.team-grid > .card-shell,
.collection-grid > .card-shell {
  width: 100%;
  scroll-snap-align: none;
}

.card-face,
.card {
  border-radius: 10px;
  border-color: var(--line);
  background: linear-gradient(180deg, #1b1f23, #111417);
}

.team-grid .card.is-attacker .card-face {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.16);
}

.card-face {
  padding: 10px;
  gap: 8px;
}

.card h3,
.list-item h3 {
  letter-spacing: 0;
}

.card-art,
.card-art-placeholder {
  border-radius: 8px;
  border-color: var(--line);
}

.card-stats {
  gap: 6px;
}

.card-stats div {
  padding: 7px 8px;
  border-radius: 8px;
}

.card-actions button,
.card-context-bar button,
.list-item .inline-actions button {
  border-radius: 8px;
}

.collection-toggle-row {
  justify-content: center;
}

.collection-toggle-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 210px;
}

.collection-toggle-row button::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.collection-toggle-row button.is-open::after {
  transform: translateY(2px) rotate(225deg);
}

.dashboard-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.58fr);
  grid-template-areas:
    "battles history";
  gap: 12px;
}

.sidebar-panel {
  padding: var(--view-panel-padding);
  overflow: hidden;
  background: rgba(15, 18, 20, 0.82);
}

.sidebar-panel[data-panel="battles"] {
  grid-area: battles;
}

.sidebar-panel[data-panel="opponents"] {
  grid-area: opponents;
  border-color: rgba(var(--accent-rgb), 0.18);
  background: rgba(18, 21, 24, 0.9);
}

.sidebar-panel[data-panel="history"] {
  grid-area: history;
  opacity: 0.84;
}

.panel-heading-button {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.mobile-panel .mobile-panel-body,
.mobile-panel.is-open .mobile-panel-body {
  display: grid;
  padding: 0;
}

.list {
  gap: 8px;
}

.list-item {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.subsection + .subsection {
  padding-top: 10px;
}

input,
select,
button {
  padding: 10px 12px;
}

button {
  min-height: 44px;
}

.search-inline {
  grid-template-columns: minmax(0, 1fr);
}

.auth-grid {
  gap: 10px;
}

.auth-panel-start,
.login-form {
  border-radius: 10px;
}

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

  .today-card-primary {
    grid-column: auto;
    min-height: 112px;
  }

  .today-quick-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-stack {
    grid-template-columns: 1fr;
    grid-template-areas:
      "battles"
      "history";
  }

  .profile-inline,
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .profile-inline {
    align-items: stretch;
  }

  .profile-groups {
    justify-items: start;
  }

  .profile-meta,
  .profile-group {
    justify-content: flex-start;
  }

  .profile-meta {
    flex-wrap: wrap;
  }

  .team-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow: visible;
    scroll-snap-type: none;
    padding-right: 0;
  }

  .team-grid > .card,
  .team-grid > .card-shell {
    width: 100%;
    scroll-snap-align: none;
  }

  .team-pagination {
    display: flex;
    margin-top: 4px;
  }

  .collection-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app {
    padding: 10px;
  }

  .dashboard {
    padding-bottom: 0;
  }

  .dashboard-tabs {
    position: static;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: 56px;
    min-height: 56px;
    box-shadow: none;
  }

  .dashboard-tab {
    height: 44px;
    min-height: 44px;
    padding: 8px 4px;
    font-size: 0.76rem;
  }

  .dashboard-tab-badge {
    position: absolute;
    top: 4px;
    right: 8px;
  }

  .page-header {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    gap: 10px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    overflow: visible;
  }

  .highlight-color-picker {
    flex: 1 1 auto;
    justify-content: flex-start;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .highlight-color-picker::-webkit-scrollbar {
    display: none;
  }

  .today-head {
    align-items: flex-start;
  }

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

  .today-quick-row {
    grid-template-columns: 1fr;
  }

  .today-card-primary {
    grid-column: auto;
  }

  .today-card {
    min-height: 82px;
  }

  .profile-inline,
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .profile-hero .panel-head {
    grid-template-columns: 1fr;
    min-height: 58px;
    padding: 12px;
    gap: 10px;
  }

  .profile-head-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .profile-inline {
    min-height: 0;
    padding: 12px;
  }

  .profile-detail-item {
    flex: 1 1 138px;
  }

  .profile-meta,
  .profile-group {
    justify-content: flex-start;
  }

  .team-grid {
    grid-auto-columns: auto;
    padding-right: 36px;
  }

  .team-grid > .card,
  .team-grid > .card-shell {
    width: 100%;
  }

  .collection-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .actions,
  .inline-actions {
    flex-direction: column;
  }

  .actions button,
  .inline-actions button,
  .search-inline button,
  .collection-toggle-row button,
  .subsection-head .ghost-button,
  .reward-actions button {
    width: 100%;
  }

  .event-overlay--fullscreen .reward-actions,
  .event-overlay--fullscreen .intro-panel .inline-actions {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .event-overlay--fullscreen .reward-actions button,
  .event-overlay--fullscreen .intro-panel .inline-actions button {
    width: auto;
    min-width: 0;
  }
}

@supports not (aspect-ratio: 1 / 1) {
  .card-art,
  .card-art-placeholder {
    height: 140px;
  }

  .starter-reveal-card,
  .reward-reveal-card,
  .shop-card {
    min-height: 340px;
  }

  .card-shell > .card,
  .shop-card-wrap > .card {
    position: relative;
    min-height: 0;
    height: 0;
    padding-top: 166.6667%;
  }

  .card-shell > .card > .card-inner,
  .shop-card-wrap > .card > .card-inner {
    position: absolute;
    inset: 0;
  }

  .card-preview-card > .card {
    min-height: 0;
    height: var(--animal-card-zoom-height);
    padding-top: 0;
  }

  .team-grid > .card,
  .collection-grid > .card,
  .team-grid > .card-shell > .card,
  .collection-grid > .card-shell > .card {
    min-height: 0;
  }
}

/* Mobile clarity pass */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

button,
input,
select {
  min-height: 44px;
}

button {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 120ms ease;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.78);
  outline-offset: 2px;
}

.team-grid,
.collection-grid,
.shop-grid {
  grid-template-columns: repeat(auto-fit, minmax(154px, 1fr));
}

.card-context-bar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-context-bar--shop {
  grid-template-columns: 1fr;
}

#view-opponents.dashboard-view.is-active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

#view-opponents > .sidebar-panel[data-panel="opponents"] {
  grid-area: auto;
  width: 100%;
}

.page-header {
  grid-template-columns: minmax(0, 1fr);
}

.profile-head-actions .highlight-color-picker {
  flex: 0 0 auto;
  width: auto;
  max-width: 178px;
  height: var(--header-control-height);
  min-height: var(--header-control-height);
  padding: 4px 6px;
}

.profile-head-actions .color-swatch {
  width: 30px;
  min-width: 30px;
  height: 32px;
}

.profile-summary {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  padding-block: 10px 12px;
}

.profile-summary .profile-identity {
  min-width: 0;
}

.profile-summary .profile-detail-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.profile-summary .profile-detail-item {
  min-height: 44px;
}

.profile-stat-toggle {
  cursor: pointer;
  text-align: left;
}

.profile-stat-toggle:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.08);
}

.profile-meta-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  width: 100%;
  justify-content: stretch;
}

.profile-meta-compact.is-collapsed {
  display: none;
}

.profile-meta-compact .profile-chip {
  min-width: 0;
  min-height: 44px;
}

.beast-card .card-top h3 {
  font-size: clamp(0.82rem, 9cqw, 1rem);
  line-height: 1.05;
}

.beast-card .rarity-text {
  font-size: clamp(0.5rem, 4.6cqw, 0.58rem);
}

@container (max-width: 190px) {
  .beast-card .rarity-text {
    display: none;
  }

  .beast-card .rarity-icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    font-size: 0.78rem;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 8px;
    gap: 10px;
  }

  .panel,
  .profile-hero,
  .dashboard-tabs {
    border-radius: 12px;
  }

  .profile-hero .panel-head {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .profile-head-actions {
    display: grid;
    grid-template-columns: minmax(86px, auto) minmax(86px, 1fr) minmax(112px, 1.2fr);
    gap: 8px;
  }

  .profile-head-actions > * {
    width: 100%;
  }

  .profile-head-actions .highlight-color-picker {
    grid-column: 1 / -1;
    justify-self: start;
    width: auto;
    max-width: none;
  }

  .profile-inline {
    gap: 12px;
  }

  .profile-summary {
    gap: 8px;
    padding: 10px 12px 12px;
  }

  .profile-detail-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .profile-summary .profile-detail-strip {
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  }

  .profile-detail-item {
    min-height: 48px;
  }

  .profile-groups {
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .profile-group-summary {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    letter-spacing: 0.06em;
  }

  .profile-group-collapsible.is-open {
    gap: 10px;
  }

  .profile-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .profile-meta-compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .profile-chip {
    min-width: 0;
  }

  .dashboard-tabs {
    position: sticky;
    top: 8px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: auto;
    min-height: 58px;
    padding: 6px;
  }

  .dashboard-tab {
    height: 44px;
    min-height: 44px;
    padding: 6px 4px;
    font-size: clamp(0.72rem, 3.2vw, 0.82rem);
  }

  .dashboard-tab-badge {
    top: 3px;
    right: 4px;
  }

  .today-panel,
  .collection-panel,
  .sidebar-panel {
    padding: 14px;
  }

  .team-grid,
  .collection-grid,
  .shop-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(168px, 74vw);
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-padding-left: 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 2px 20px 12px 0;
    scrollbar-width: none;
  }

  .shop-card-wrap {
    display: grid;
    gap: 8px;
  }

  .team-grid::-webkit-scrollbar,
  .collection-grid::-webkit-scrollbar,
  .shop-grid::-webkit-scrollbar {
    display: none;
  }

  .team-grid > .card-shell,
  .collection-grid > .card-shell,
  .shop-grid > .shop-item,
  .team-grid > .card.is-empty,
  .collection-grid > .card.is-empty {
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .team-grid > .card,
  .team-grid > .card-shell,
  .collection-grid > .card,
  .collection-grid > .card-shell,
  .shop-grid > .shop-item {
    width: 100%;
  }

  .card-context-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .card-context-bar button {
    min-height: 48px;
    padding: 8px 10px;
    font-size: 0.86rem;
  }

  .card-face {
    padding: 10px;
  }

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

  .card-preview-modal {
    padding: 12px;
  }

  .card-preview-window,
  .card-preview-card {
    width: min(350px, calc(100vw - 24px));
  }

  .card-preview-card > .card {
    height: auto;
    aspect-ratio: var(--animal-card-ratio);
  }
}

@media (max-width: 420px) {
  .profile-head-actions {
    grid-template-columns: 1fr 1fr;
  }

  .profile-summary .profile-detail-strip,
  .profile-meta-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-head-actions .highlight-color-picker {
    grid-column: 1 / -1;
  }

  .team-grid,
  .collection-grid,
  .shop-grid {
    grid-auto-columns: minmax(162px, 78vw);
  }

  .panel-head h2 {
    font-size: clamp(1.35rem, 9vw, 1.8rem);
  }
}

/* Progression, diamonds and global cosmetics */
.diamond-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  overflow: visible;
  fill: none;
  stroke: #ff3040;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(255, 48, 64, 0.58));
}

.diamond-amount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.shop-ruby-value .diamond-icon {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
}

.battle-report-reward strong .diamond-icon {
  display: inline-block;
  vertical-align: -4px;
}

.card-top-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.card-level {
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: rgba(8, 10, 12, 0.72);
  color: var(--text);
  font-size: 0.56rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.beast-card.has-custom-frame .card-face {
  border-color: var(--animal-frame-color);
  box-shadow:
    inset 0 0 24px rgba(var(--animal-frame-rgb), 0.14),
    0 0 0 1px rgba(var(--animal-frame-rgb), 0.36),
    0 0 18px rgba(var(--animal-frame-rgb), 0.3);
}

.beast-card.has-custom-frame .card-face::before {
  filter: drop-shadow(0 0 5px var(--animal-frame-color));
}

.card-upgrade-row {
  display: grid;
  min-width: 0;
}

.card-upgrade-button {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px;
  border-color: rgba(255, 48, 64, 0.28);
  background: rgba(255, 48, 64, 0.08);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: left;
}

.card-upgrade-button:not(:disabled):hover {
  border-color: rgba(255, 48, 64, 0.64);
  background: rgba(255, 48, 64, 0.15);
}

.card-upgrade-button .diamond-icon {
  width: 15px;
  height: 15px;
  flex-basis: 15px;
}

.shop-cosmetics {
  display: grid;
  gap: 12px;
}

.cosmetic-shop-group {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 10, 12, 0.5);
}

.cosmetic-shop-head h3,
.cosmetic-shop-head p {
  margin: 0;
}

.cosmetic-shop-head p {
  margin-top: 4px;
}

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

.cosmetic-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.cosmetic-card.is-active {
  border-color: rgba(var(--accent-rgb), 0.58);
  background: rgba(var(--accent-rgb), 0.09);
}

.cosmetic-card > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cosmetic-card strong,
.cosmetic-card span {
  min-width: 0;
}

.cosmetic-card strong {
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cosmetic-card > div > span {
  color: var(--muted);
  font-size: 0.68rem;
}

.cosmetic-card button {
  width: auto;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 0.72rem;
}

.cosmetic-swatch {
  width: 30px;
  height: 30px;
  border: 2px solid var(--cosmetic-color);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: 0 0 12px color-mix(in srgb, var(--cosmetic-color) 45%, transparent);
}

.cosmetic-swatch--none {
  border-color: var(--line-strong);
  background: linear-gradient(135deg, transparent 45%, #ff3040 46%, #ff3040 54%, transparent 55%);
  box-shadow: none;
}

@media (max-width: 900px) {
  .cosmetic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .card-top-meta {
    gap: 3px;
  }

  .card-level {
    padding: 3px 4px;
    font-size: 0.5rem;
  }

  .rarity-text {
    display: none;
  }

  .card-upgrade-button {
    display: grid;
    justify-items: start;
  }

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

.profile-head-actions {
  display: flex;
  justify-content: flex-end;
}

.shop-ruby-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(255, 48, 64, 0.34);
  border-radius: 8px;
  background: rgba(255, 48, 64, 0.1);
  color: var(--text);
  font-weight: 800;
  box-shadow: none;
}

.shop-ruby-button:hover,
.shop-ruby-button:focus-visible {
  border-color: rgba(255, 188, 194, 0.62);
  background: rgba(255, 48, 64, 0.16);
}

.shop-ruby-label {
  color: var(--muted);
  font-weight: 700;
}

.shop-ruby-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.profile-summary .profile-detail-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.profile-summary .profile-detail-item {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.secret-code-row,
.profile-stat-toggle,
.shop-ruby-button {
  justify-content: space-between;
}

.profile-action-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  color: var(--muted);
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.profile-stat-toggle,
.profile-stat-toggle.is-open {
  justify-content: center;
}

.profile-stat-toggle.is-open .profile-action-icon,
.profile-stat-toggle:hover .profile-action-icon,
.secret-code-row:hover .profile-action-icon,
.shop-ruby-button:hover .profile-action-icon {
  color: var(--text);
}

.secret-code-button {
  min-width: 0;
  overflow: hidden;
}

.profile-code-editor {
  flex: 1 1 auto;
}

.profile-code-editor input {
  width: 100%;
}

.secret-code-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-context-bar--shop {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.shop-card-price {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.card-context-bar--shop .card-context-status {
  grid-column: 1 / -1;
}

.card-context-bar .card-icon-action,
.card-context-bar .card-action-status {
  display: inline-grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border-radius: 8px;
}

.card-context-bar .card-icon-action svg,
.card-context-bar .card-action-status svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.card-context-bar .card-action-status {
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.11);
  color: #fff;
}

button svg,
.profile-action-icon,
.today-card-icon,
.card-context-bar .card-icon-action,
.card-context-bar .card-action-status {
  color: #fff;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}

.app-footer .highlight-color-picker {
  justify-content: flex-start;
}

.app-footer #logout-button {
  flex: 0 0 auto;
  color: var(--muted);
}

@media (max-width: 900px) {
  .profile-head-actions {
    width: auto;
    display: flex;
    justify-content: flex-end;
  }

  .profile-head-actions > * {
    width: auto;
  }

  .app-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin-inline: -8px;
    padding: 10px 8px;
    background: rgba(15, 17, 19, 0.94);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  .app-footer .highlight-color-picker {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-footer .highlight-color-picker::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 420px) {
  .profile-head-actions {
    display: flex;
    grid-template-columns: none;
  }

  .profile-summary .profile-detail-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-summary .profile-detail-item {
    min-height: 54px;
    padding-inline: 10px;
  }

  .profile-action-icon {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  .app-footer {
    gap: 8px;
  }

  .app-footer .color-swatch {
    width: 44px;
    min-width: 44px;
  }

  .app-footer #logout-button {
    padding-inline: 10px;
  }
}

@media (max-width: 760px) {
  .team-grid,
  .collection-grid,
  .shop-grid {
    grid-auto-columns: minmax(168px, 74vw);
  }

  .card-context-bar .card-action-status {
    min-height: 48px;
  }

  .shop-card-wrap {
    display: block;
  }
}

@media (max-width: 420px) {
  .team-grid,
  .collection-grid,
  .shop-grid {
    grid-auto-columns: minmax(162px, 78vw);
  }
}

.team-grid,
.collection-grid,
.shop-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
}

.team-grid > .card,
.team-grid > .card-shell,
.collection-grid > .card,
.collection-grid > .card-shell,
.shop-grid > .shop-item {
  width: 100%;
}

.team-grid > .card-shell > .beast-card,
.collection-grid > .card-shell > .beast-card,
.shop-grid > .shop-item .shop-card-wrap > .beast-card {
  width: 100%;
  height: auto;
  aspect-ratio: var(--animal-card-ratio);
}

.starter-reveal-card {
  --card-pad: 7px;
  --card-gap: 5px;
  --card-head-size: 0.17fr;
  --card-art-size: 0.58fr;
  --card-stats-size: 0.18fr;
  --card-copy-size: 0fr;
  width: clamp(94px, 13vw, 126px);
  margin-inline: -12px;
}

.starter-reveal-card .card-face {
  padding: var(--card-pad);
  gap: var(--card-gap);
}

.starter-reveal-card .card-front {
  grid-template-rows:
    minmax(20px, var(--card-head-size))
    minmax(0, var(--card-art-size))
    minmax(26px, var(--card-stats-size))
    0;
}

.starter-reveal-card .card-blurb,
.starter-reveal-card .rarity-text {
  display: none;
}

.starter-reveal-card .rarity-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: 0.74rem;
}

.starter-reveal-card .card-stats {
  gap: 4px;
}

.starter-reveal-card .card-stats-primary div {
  padding: 4px 5px;
}

.starter-reveal-card .card-stats-primary strong {
  font-size: 0.82rem;
}

.starter-reveal-card .stat-symbol {
  width: 20px;
  height: 20px;
  flex-basis: 20px;
}

.starter-reveal-card .stat-symbol svg {
  width: 15px;
  height: 15px;
}

.starter-reveal-card .card-back-copy {
  grid-template-rows: 1fr;
  place-items: center;
  text-align: center;
}

.starter-reveal-card .card-back-copy p,
.starter-reveal-card .card-back-meta {
  display: none;
}

.starter-reveal-card .card-back-head {
  display: grid;
  gap: 6px;
  justify-items: center;
}

@media (max-width: 760px) {
  .team-grid,
  .collection-grid,
  .shop-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(168px, 74vw);
  }

  .starter-reveal-stage {
    min-height: 248px;
  }

  .starter-reveal-card {
    width: clamp(82px, 18vw, 108px);
    margin-inline: -10px;
  }
}

@media (max-width: 420px) {
  .team-grid,
  .collection-grid,
  .shop-grid {
    grid-auto-columns: minmax(162px, 78vw);
  }
}

/* Final narrow-layout split: team/shop carousel, collection compact grid. */
@media (max-width: 1200px) {
  .team-grid,
  .shop-grid {
    display: flex;
    grid-template-columns: none;
    grid-auto-flow: initial;
    grid-auto-columns: initial;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
  }

  .team-grid > .card,
  .team-grid > .card-shell,
  .team-grid > .card.is-empty,
  .shop-grid > .shop-item {
    flex: 0 0 max(220px, calc((100% - 24px) / 2.28));
    width: auto;
  }

  .collection-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 10px;
    overflow: visible;
    scroll-snap-type: none;
    padding: 2px 0 12px;
  }

  .collection-grid > .card-shell {
    width: 100%;
    scroll-snap-align: none;
  }

  .collection-grid .card-shell {
    gap: 6px;
  }

  .collection-grid .beast-card {
    --card-pad: 6px;
    --card-gap: 5px;
    --card-head-size: 0.18fr;
    --card-art-size: 0.6fr;
    --card-stats-size: 0.18fr;
    --card-copy-size: 0fr;
  }

  .collection-grid .beast-card .card-front {
    grid-template-rows:
      minmax(20px, var(--card-head-size))
      minmax(0, var(--card-art-size))
      minmax(26px, var(--card-stats-size))
      0;
  }

  .collection-grid .card-blurb,
  .collection-grid .rarity-text {
    display: none;
  }

  .collection-grid .card-top {
    gap: 5px;
  }

  .collection-grid .card-top h3 {
    font-size: clamp(0.72rem, 4vw, 0.9rem);
  }

  .collection-grid .rarity-icon {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    font-size: 0.74rem;
  }

  .collection-grid .card-stats {
    gap: 4px;
  }

  .collection-grid .card-stats-primary div {
    padding: 4px 5px;
  }

  .collection-grid .card-stats-primary strong {
    font-size: 0.82rem;
  }

  .collection-grid .stat-symbol {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }

  .collection-grid .stat-symbol svg {
    width: 15px;
    height: 15px;
  }

  .collection-grid .card-context-bar {
    gap: 6px;
    min-height: 44px;
  }

  .collection-grid .card-context-bar .card-icon-action,
  .collection-grid .card-context-bar .card-action-status {
    min-height: 44px;
  }
}

@media (min-width: 761px) and (max-width: 1200px) {
  .team-grid > .card,
  .team-grid > .card-shell,
  .team-grid > .card.is-empty,
  .shop-grid > .shop-item {
    flex-basis: max(180px, calc((100% - 36px) / 3.2));
  }
}

@media (max-width: 420px) {
  .team-grid,
  .shop-grid {
    grid-auto-columns: initial;
  }

  .team-grid > .card,
  .team-grid > .card-shell,
  .team-grid > .card.is-empty,
  .shop-grid > .shop-item {
    flex-basis: max(162px, calc((100% - 18px) / 2.2));
  }

  .collection-grid {
    gap: 8px;
  }
}

@media (min-width: 761px) {
  #view-opponents .list-item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  #view-opponents .opponent-actions {
    justify-self: end;
  }

  #view-opponents .opponent-actions button {
    min-width: 132px;
  }
}

@media (max-width: 760px) {
  body.is-overlay-active .toast-viewport {
    z-index: 30;
  }

  .event-overlay--fullscreen .starter-reveal-stack {
    padding-inline: 4px;
    overflow: hidden;
  }

  .event-overlay--fullscreen .starter-reveal-card {
    width: clamp(66px, 16vw, 96px);
    margin-inline: 0;
    transform: translateX(calc(var(--starter-shift) * 0.2)) rotate(var(--starter-angle));
  }
}

@media (max-width: 340px) {
  .event-overlay--fullscreen .reward-actions,
  .event-overlay--fullscreen .intro-panel .inline-actions {
    flex-direction: column;
  }

  .event-overlay--fullscreen .reward-actions button,
  .event-overlay--fullscreen .intro-panel .inline-actions button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .event-overlay--fullscreen .team-replacement-panel {
    align-self: stretch;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 18px 16px 24px;
    border: 0;
    border-radius: 0;
  }

  .team-replacement-options {
    grid-template-columns: 1fr;
  }
}

.app-footer {
  align-items: stretch;
}

.app-footer .highlight-color-picker,
.app-footer #logout-button {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.app-footer .highlight-color-picker {
  display: flex;
  align-items: center;
  padding: 10px 14px;
}

.app-footer #logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
}

.app-footer #logout-button:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.08);
}

@media (max-width: 420px) {
  .app-footer .highlight-color-picker,
  .app-footer #logout-button {
    min-height: 52px;
  }

  .app-footer .highlight-color-picker {
    padding-inline: 10px;
  }
}

/* UI clarity pass: stronger zones, calmer game actions. */
:root {
  --bg: #0d141b;
  --surface: #17212a;
  --surface-strong: #0f171f;
  --surface-soft: #202b36;
  --surface-tint: #13251d;
  --text: #f2f7f4;
  --muted: #a7b8bd;
  --line: rgba(143, 171, 179, 0.26);
  --line-strong: rgba(174, 205, 213, 0.42);
  --accent: #36d77b;
  --accent-dark: #25b766;
  --success: #36d77b;
  --accent-rgb: 54, 215, 123;
  --warm: #ffd166;
  --danger: #ff5c7a;
  --shadow: 0 18px 42px rgba(4, 8, 12, 0.32);
}

body {
  background:
    linear-gradient(180deg, #12202a 0%, #0d141b 34%, #091016 100%);
}

.app {
  gap: 14px;
}

.page-header {
  padding: 14px 16px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(255, 209, 102, 0.13), transparent 42%),
    linear-gradient(180deg, rgba(27, 38, 49, 0.94), rgba(12, 18, 25, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.page-header h1 {
  color: #fff5cf;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.profile-hero,
.panel {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(31, 43, 54, 0.96), rgba(15, 23, 31, 0.96));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.profile-hero .panel-head {
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.11), transparent 48%),
    rgba(10, 16, 22, 0.42);
  border-bottom-color: var(--line-strong);
}

.profile-detail-item,
.profile-chip,
.app-footer .highlight-color-picker,
.app-footer #logout-button {
  border-color: var(--line);
  background: rgba(8, 14, 20, 0.5);
}

.dashboard-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.dashboard-tab {
  border-color: rgba(143, 171, 179, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: #c3d1d5;
}

.dashboard-tab:hover {
  border-color: rgba(var(--accent-rgb), 0.38);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
}

.dashboard-tab.is-active {
  border-color: rgba(var(--accent-rgb), 0.72);
  background: var(--accent);
  color: #06150d;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 8px 18px rgba(var(--accent-rgb), 0.16);
}

.dashboard-tab-badge {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(10, 16, 22, 0.96);
}

.today-panel,
.collection-panel,
.sidebar-panel {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(26, 38, 49, 0.96), rgba(13, 21, 29, 0.96));
}

.today-panel {
  border-color: rgba(var(--accent-rgb), 0.38);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.13), transparent 36%),
    linear-gradient(180deg, rgba(28, 43, 50, 0.97), rgba(13, 21, 29, 0.97));
}

.today-head,
.collection-panel .panel-head,
.sidebar-panel .panel-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.today-context,
.section-copy,
.empty-state,
.small,
.opponent-meta {
  color: var(--muted);
}

.subsection {
  padding: 12px;
  border: 1px solid rgba(143, 171, 179, 0.18);
  border-radius: 10px;
  background: rgba(8, 14, 20, 0.32);
}

.subsection + .subsection {
  border-top-color: rgba(143, 171, 179, 0.18);
}

.subsection-title {
  color: #d7e6e7;
}

.today-card,
.list-item,
.auth-panel-start,
.login-form {
  border-color: rgba(143, 171, 179, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    rgba(10, 16, 22, 0.58);
}

.today-card-primary {
  border-color: rgba(var(--accent-rgb), 0.52);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.18), transparent 48%),
    rgba(10, 16, 22, 0.62);
}

.today-card-icon {
  border-color: rgba(var(--accent-rgb), 0.38);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-rgb), 0.06)),
    rgba(8, 14, 20, 0.78);
  color: #75f2aa;
}

.list-item {
  border: 1px solid rgba(143, 171, 179, 0.2);
}

.list-item:hover {
  border-color: rgba(var(--accent-rgb), 0.32);
}

.card-face,
.card {
  border-color: rgba(143, 171, 179, 0.26);
  background:
    linear-gradient(180deg, rgba(35, 47, 58, 0.98), rgba(16, 24, 32, 0.98));
}

.team-grid .card.is-attacker .card-face {
  border-color: rgba(var(--accent-rgb), 0.68);
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.22),
    0 12px 26px rgba(var(--accent-rgb), 0.12);
}

input,
select {
  border-color: var(--line);
  background: rgba(7, 12, 18, 0.74);
  color: var(--text);
}

button {
  border-radius: 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.42);
  background: var(--accent);
  color: #06150d;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}

button:hover {
  border-color: rgba(var(--accent-rgb), 0.68);
  background: var(--accent);
  filter: brightness(0.9);
}

button.secondary-button,
.card-context-bar .card-icon-action.secondary-button {
  border-color: rgba(143, 171, 179, 0.32);
  background: rgba(23, 33, 42, 0.95);
  color: var(--text);
  box-shadow: none;
}

button.secondary-button:hover,
.card-context-bar .card-icon-action.secondary-button:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.1);
}

button.ghost-button,
.card-context-bar .card-icon-action.ghost-button {
  border-color: rgba(143, 171, 179, 0.28);
  background: rgba(255, 255, 255, 0.025);
  color: #d7e6e7;
  box-shadow: none;
}

button.ghost-button:hover,
.card-context-bar .card-icon-action.ghost-button:hover {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: rgba(var(--accent-rgb), 0.09);
  color: var(--accent);
}

.opponent-actions button[data-action="challenge"],
.opponent-actions button[data-action="challenge-bot"] {
  min-width: 136px;
  min-height: 48px;
  border-color: rgba(var(--accent-rgb), 0.52);
  background: var(--accent);
  color: #06150d;
  letter-spacing: 0.01em;
}

.opponent-actions button[data-action="challenge"]:hover,
.opponent-actions button[data-action="challenge-bot"]:hover {
  background: var(--accent);
  filter: brightness(0.9);
}

button:disabled,
.opponent-actions button:disabled {
  border-color: rgba(143, 171, 179, 0.16);
  background: rgba(80, 94, 101, 0.28);
  color: rgba(242, 247, 244, 0.52);
  box-shadow: none;
}

.dashboard-tab:not(.is-active),
button.today-card,
.profile-detail-item,
.shop-ruby-button,
.card-context-bar .card-icon-action,
.card-context-bar .card-action-status,
.color-swatch,
.secret-code-button,
.profile-field-edit-button,
.profile-edit-cancel-button,
.toast-close,
.card-preview-close {
  box-shadow: none;
}

.dashboard-tab.is-active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 8px 18px rgba(var(--accent-rgb), 0.16);
}

@media (max-width: 760px) {
  .page-header {
    padding: 12px;
    border-radius: 10px;
  }

  .dashboard-tabs {
    gap: 6px;
  }

  .subsection {
    padding: 10px;
  }

  .opponent-actions button[data-action="challenge"],
  .opponent-actions button[data-action="challenge-bot"] {
    width: 100%;
  }
}

/* Keep the approved game-bar layout after all legacy theme overrides. */
.page-header {
  grid-template-columns: auto minmax(0, 1fr);
}

.page-header > .brand-lockup {
  justify-self: start;
  width: auto;
}

@media (max-width: 760px) {
  .page-header {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .page-header > .brand-lockup {
    grid-column: 1;
    grid-row: 1;
  }

  .page-header > .brand-lockup .brand-wordmark {
    display: none;
  }

  .page-header > .profile-hero.is-authenticated,
  .page-header > .profile-hero.is-authenticated .profile-shell {
    display: contents;
  }

  .page-header > .profile-hero.is-authenticated .panel-head {
    grid-column: 2;
    grid-row: 1;
    padding: 0;
  }

  .page-header > .profile-hero.is-authenticated .auth-shell {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* One stable action bar with one mutually exclusive disclosure panel. */
.profile-field-edit-button.is-active,
.profile-stat-toggle.is-open {
  border-color: rgba(var(--accent-rgb), 0.58);
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--text);
}

.page-header {
  align-items: start;
}

.page-header > .brand-lockup {
  align-self: start;
}

.page-header > .profile-hero.is-authenticated .profile-shell {
  align-items: start;
}

.page-header > .profile-hero.is-authenticated .profile-disclosure {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 12, 18, 0.68);
}

.profile-disclosure-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-disclosure-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.2;
}

.profile-disclosure-close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 1.2rem;
  box-shadow: none;
}

.profile-disclosure-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.profile-disclosure-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.profile-disclosure-field input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
}

.profile-disclosure-form .profile-edit-save-button {
  min-height: 42px;
  padding-inline: 16px;
}

.page-header > .profile-hero.is-authenticated .profile-disclosure .profile-meta-compact {
  display: grid;
}

@media (max-width: 760px) {
  .page-header > .profile-hero.is-authenticated .profile-disclosure {
    padding: 10px;
  }

  .profile-disclosure-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-disclosure-form .profile-edit-save-button {
    width: 100%;
    min-height: 44px;
  }
}

/* Action icons stay neutral and readable across all highlight themes. */
button svg,
.profile-action-icon,
.today-card-icon,
.card-context-bar .card-icon-action,
.card-context-bar .card-action-status {
  color: #fff;
}

/* Keep card internals inside the width negotiated by the team/collection grid. */
.team-grid > .card,
.team-grid > .card-shell,
.collection-grid > .card,
.collection-grid > .card-shell,
.beast-card,
.beast-card .card-inner,
.beast-card .card-face,
.card-context-bar,
.card-context-bar > * {
  min-width: 0;
}

.card-stats-primary .card-stat > * {
  min-width: 0;
}

/* The media frame owns the crop rule; the card itself never determines it. */
.beast-card .card-front,
.beast-card .card-art,
.beast-card .card-stats-primary,
.beast-card .card-stats-primary .card-stat {
  min-width: 0;
  min-height: 0;
}

.beast-card .card-art {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.beast-card .card-art-image,
.beast-card .card-art-video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.card-stats-primary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tactical command surfaces: opponents and asynchronous battles. */
.battle-command-panel,
.opponent-command-panel {
  overflow: hidden;
  border-color: rgba(var(--accent-rgb), 0.28);
  background:
    radial-gradient(circle at 92% 0, rgba(var(--accent-rgb), 0.13), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 46%),
    var(--surface-soft);
}

.battle-command-overview,
.opponent-loadout {
  display: grid;
  gap: 12px;
}

.battle-command-overview {
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.45fr);
  align-items: stretch;
}

.dashboard-stack.dashboard-view.is-active {
  grid-template-areas:
    "command command"
    "battles history";
}

.battle-command-panel {
  grid-area: command;
}

.battle-command-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(3, 8, 13, 0.4);
}

.battle-command-stats div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 12px;
}

.battle-command-stats div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.battle-command-stats strong,
.opponent-loadout-status strong {
  font-size: 1.35rem;
  line-height: 1;
}

.battle-command-stats span,
.opponent-loadout-status span,
.command-label,
.opponent-loadout-animal .command-stats,
.battle-next-action > div > span:last-child {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.command-label {
  display: block;
  margin-bottom: 3px;
  color: rgba(var(--accent-rgb), 0.92);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.battle-next-action,
.opponent-loadout-empty,
.opponent-loadout-animal {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.battle-next-action {
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(3, 8, 13, 0.4);
}

.battle-next-action.is-urgent {
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: inset 3px 0 0 var(--accent);
}

.battle-next-action > div,
.opponent-loadout-animal > div,
.opponent-loadout-empty > div {
  display: grid;
  min-width: 0;
}

.battle-next-action strong,
.opponent-loadout-animal strong,
.opponent-loadout-empty strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-next-action button,
.opponent-loadout-empty button,
.opponent-loadout > button {
  flex: 0 0 auto;
  margin-left: auto;
  min-height: 38px;
  padding: 7px 11px;
  font-size: 0.76rem;
}

.command-orb,
.opponent-avatar,
.battle-queue-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.command-orb {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(var(--accent-rgb), 0.7);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0 14%, rgba(var(--accent-rgb), 0.32) 16% 35%, transparent 37%);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.28);
}

.command-orb--muted {
  border-color: var(--line);
  background: radial-gradient(circle, var(--muted) 0 12%, rgba(160, 167, 175, 0.18) 14% 34%, transparent 36%);
  box-shadow: none;
}

.battle-next-cue {
  margin-left: auto;
  color: var(--accent);
  font-size: 1.2rem;
}

.opponent-loadout {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  padding: 4px 0 0;
}

.opponent-loadout-animal img {
  width: 54px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  border-radius: 9px;
  background: #0c1116;
  object-fit: contain;
}

.opponent-loadout-status {
  display: grid;
  gap: 2px;
  min-width: 94px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.opponent-battle-card {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 68px;
  border-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 65%);
}

#view-opponents .subsection {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#view-opponents .subsection + .subsection {
  padding-top: 16px;
  border-top: 1px solid rgba(143, 171, 179, 0.18);
}

#view-opponents .subsection-head {
  align-items: baseline;
  padding: 0 2px;
}

#view-opponents .opponent-battle-card {
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 12px;
}

#view-opponents .opponent-card-copy {
  min-width: 0;
}

#view-opponents .opponent-card-copy h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-opponents .opponent-actions {
  grid-column: auto;
  justify-self: end;
}

@media (min-width: 761px) {
  #view-battles .sidebar-panel[data-panel="history"] .mobile-panel-body {
    max-height: min(62vh, 650px);
    overflow: auto;
    padding-right: 2px;
  }
}

.opponent-battle-card--bot {
  border-color: rgba(var(--accent-rgb), 0.22);
}

.opponent-avatar {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.04) 58%), #151c22;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
}

.opponent-avatar--bot {
  border-color: rgba(var(--accent-rgb), 0.58);
  color: var(--accent);
}

.opponent-avatar--alert {
  border-color: rgba(var(--accent-rgb), 0.72);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.18);
}

.opponent-threat {
  display: inline-block;
  margin-right: 6px;
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.opponent-actions {
  justify-content: end;
}

.opponent-actions button:first-child:not(:only-child) {
  margin-right: 0;
}

.battle-decision-card {
  gap: 12px;
  border-color: rgba(var(--accent-rgb), 0.45);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.13), transparent 58%),
    var(--surface-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.battle-decision-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.battle-decision-head h3 {
  margin: 0;
}

.battle-decision-copy {
  color: var(--text);
  font-size: 0.86rem;
}

.battle-decision-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.battle-queue-item {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border-color: rgba(255, 255, 255, 0.09);
}

.battle-queue-item h3 {
  margin: 0 0 3px;
}

.battle-queue-mark {
  width: 10px;
  height: 10px;
  border: 2px solid rgba(var(--accent-rgb), 0.72);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.08);
}

.battle-history-item {
  border-color: rgba(255, 255, 255, 0.09);
}

@media (max-width: 760px) {
  .dashboard-stack.dashboard-view.is-active {
    grid-template-areas:
      "command"
      "battles"
      "history";
  }

  .battle-command-overview,
  .opponent-loadout {
    grid-template-columns: minmax(0, 1fr);
  }

  .battle-next-action,
  .opponent-loadout-empty {
    align-items: flex-start;
  }

  .battle-next-action button,
  .opponent-loadout-empty button,
  .opponent-loadout > button {
    margin-left: 0;
  }

  .opponent-loadout-status {
    min-width: 0;
    padding: 10px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 0;
  }

  #view-opponents .opponent-battle-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #view-opponents .opponent-battle-card .opponent-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  #view-opponents .opponent-battle-card .opponent-actions button {
    flex: 1 1 0;
  }
}
/* Admin dashboard */
.admin-panel {
  display: grid;
  gap: var(--section-gap);
}

.admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.11), var(--surface));
}

.admin-hero h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.admin-stat {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.admin-stat span,
.admin-player-row small,
.admin-activity-row small {
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-stat strong {
  color: var(--accent);
  font-size: 1.55rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--section-gap);
  align-items: start;
}

.admin-activity-list,
.admin-player-list {
  display: grid;
  gap: 2px;
  max-height: 480px;
  overflow: auto;
}

.admin-activity-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(58, 63, 69, 0.55);
  line-height: 1.35;
}

.admin-activity-row small {
  display: block;
  margin-top: 3px;
}

.admin-activity-detail {
  color: var(--accent);
}

.admin-activity-marker {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 10px currentColor;
}

.admin-activity-marker--login { color: var(--accent); background: var(--accent); }
.admin-activity-marker--card { color: #f5ff00; background: #f5ff00; }
.admin-activity-marker--battle { color: #ff4fd8; background: #ff4fd8; }
.admin-activity-marker--admin { color: #2af5ff; background: #2af5ff; }

.admin-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.admin-player-row:hover,
.admin-player-row.is-selected {
  border-color: rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.08);
}

.admin-player-row.is-bot {
  opacity: 0.65;
  cursor: not-allowed;
}

.admin-player-row.is-bot:hover {
  border-color: transparent;
  background: transparent;
}

.app-footer-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex: 0 0 auto;
}

.app-footer #tab-admin {
  min-height: 56px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
}

.app-footer #tab-admin:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
}

@media (max-width: 420px) {
  .app-footer #tab-admin {
    padding-inline: 10px;
  }
}

.admin-player-row > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

/* Asynchronous battle report */
.battle-history-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.battle-history-item.is-unread {
  border-color: rgba(var(--accent-rgb), 0.58);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.16), transparent 62%),
    rgba(255, 255, 255, 0.035);
  box-shadow: inset 3px 0 0 var(--accent);
}

.battle-history-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.battle-report-open {
  min-width: 132px;
  white-space: nowrap;
}

.event-overlay--battle .event-overlay-backdrop {
  background: rgba(3, 8, 13, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.battle-report {
  --battle-blue: #2af5ff;
  --battle-red: #ff4b45;
  --battle-green: #8dfc24;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(100%, 1180px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border-color: rgba(157, 187, 198, 0.56);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(42, 245, 255, 0.06), transparent 34%),
    linear-gradient(225deg, rgba(255, 75, 69, 0.06), transparent 34%),
    #08111a;
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.64),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.battle-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px 15px;
  border-bottom: 1px solid rgba(157, 187, 198, 0.24);
  background: rgba(5, 12, 19, 0.72);
  text-align: center;
}

.battle-report-head > div:first-child {
  flex: 1;
  padding-left: 96px;
  text-align: center;
}

.battle-report-head .event-kicker {
  color: #dce8ec;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
}

.battle-report-head h2 {
  margin: 4px 0 0;
  color: #fff;
  font-size: clamp(1rem, 2vw, 1.35rem);
  line-height: 1.2;
}

.battle-report-head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.battle-report-close,
.battle-report-sound {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border-color: rgba(157, 187, 198, 0.3);
  background: rgba(255, 255, 255, 0.04);
  color: #c7d4d9;
  font-size: 1.65rem;
  line-height: 1;
  box-shadow: none;
}

.battle-report-sound svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.battle-report-sound[aria-pressed="true"] {
  border-color: rgba(255, 75, 69, 0.48);
  color: #ff918c;
}

.battle-arena {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.battle-fighter {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  background: #071019;
  transition: opacity 260ms ease, filter 260ms ease, transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.battle-scan-line {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.92), transparent);
  box-shadow: 0 0 18px currentColor;
  opacity: 0;
  pointer-events: none;
}

.battle-fighter--attacker {
  border-right: 1px solid rgba(42, 245, 255, 0.3);
  transform: translateX(-24px);
}

.battle-fighter--defender {
  border-left: 1px solid rgba(255, 75, 69, 0.3);
  transform: translateX(24px);
}

.battle-fighter-media {
  position: relative;
  min-height: 300px;
  overflow: hidden;
}

.battle-fighter-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 48%, rgba(3, 8, 13, 0.95) 100%);
  pointer-events: none;
}

.battle-fighter--attacker .battle-fighter-media::before,
.battle-fighter--defender .battle-fighter-media::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.battle-fighter--attacker .battle-fighter-media::before {
  background: linear-gradient(90deg, transparent 55%, rgba(42, 245, 255, 0.16));
}

.battle-fighter--defender .battle-fighter-media::before {
  background: linear-gradient(270deg, transparent 55%, rgba(255, 75, 69, 0.16));
}

.battle-fighter-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms ease, filter 300ms ease;
}

.battle-charge-lines {
  position: absolute;
  z-index: 5;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.battle-charge-lines span {
  position: absolute;
  top: calc(38% - 1px);
  width: calc(50% - 48px);
  height: 2px;
  opacity: 0;
  transform: scaleX(0);
}

.battle-charge-lines span:first-child {
  left: 0;
  background: linear-gradient(90deg, transparent 12%, var(--battle-blue));
  box-shadow: 0 0 16px var(--battle-blue);
  transform-origin: right center;
}

.battle-charge-lines span:last-child {
  right: 0;
  background: linear-gradient(270deg, transparent 12%, var(--battle-red));
  box-shadow: 0 0 16px var(--battle-red);
  transform-origin: left center;
}

.battle-fighter--attacker .battle-fighter-media img {
  transform: scale(1.04);
}

.battle-fighter--defender .battle-fighter-media img {
  transform: scale(1.04) scaleX(-1);
}

.battle-fighter-identity {
  position: absolute;
  z-index: 2;
  left: 18px;
  right: 18px;
  bottom: 14px;
  display: grid;
  gap: 2px;
}

.battle-fighter--defender .battle-fighter-identity {
  text-align: right;
}

.battle-fighter-identity span {
  color: #a8bbc3;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.battle-fighter-identity h3 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.35rem, 2.5vw, 2.15rem);
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.84);
}

.battle-fighter--attacker .battle-fighter-identity h3 {
  color: #bffcff;
}

.battle-fighter--defender .battle-fighter-identity h3 {
  color: #ffd0ce;
}

.battle-fighter-stats {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.3fr);
  min-height: 78px;
  border-top: 1px solid rgba(157, 187, 198, 0.24);
  background: rgba(3, 9, 15, 0.96);
}

.battle-report-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px 16px;
}

.battle-report-stat + .battle-report-stat {
  border-left: 1px solid rgba(157, 187, 198, 0.2);
  padding-left: 20px;
}

.battle-report-stat span {
  color: #9fb0b7;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.battle-report-stat strong {
  justify-self: end;
  color: #f5f8f9;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  line-height: 1;
}

.battle-report-health {
  grid-template-columns: auto 1fr 24px 1fr;
}

.battle-report-health svg {
  width: 24px;
  height: 24px;
  color: var(--battle-red);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.battle-remaining-health {
  color: var(--battle-red) !important;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.battle-versus {
  position: relative;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 7px;
  padding: 12px 8px;
  background:
    linear-gradient(115deg, rgba(42, 245, 255, 0.12), transparent 48%),
    linear-gradient(245deg, rgba(255, 75, 69, 0.12), transparent 48%),
    #080f16;
  text-align: center;
}

.battle-versus::before,
.battle-versus::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 1px;
  height: 36%;
}

.battle-versus::before {
  top: 0;
  background: linear-gradient(180deg, transparent, var(--battle-blue));
}

.battle-versus::after {
  bottom: 0;
  background: linear-gradient(0deg, transparent, var(--battle-red));
}

.battle-versus strong {
  color: #fff;
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-style: italic;
  line-height: 1;
  text-shadow: -4px 0 18px rgba(42, 245, 255, 0.4), 4px 0 18px rgba(255, 75, 69, 0.42);
}

.battle-versus span {
  color: #8599a2;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.battle-impact {
  position: absolute;
  z-index: 4;
  top: 38%;
  left: 50%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 4%, rgba(255, 255, 255, 0.88) 5%, rgba(42, 245, 255, 0.48) 18%, rgba(255, 75, 69, 0.3) 34%, transparent 68%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35);
  pointer-events: none;
}

.battle-result-band {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  min-height: 104px;
  padding: 14px 28px;
  border-top: 1px solid rgba(141, 252, 36, 0.46);
  border-bottom: 1px solid rgba(141, 252, 36, 0.24);
  background:
    linear-gradient(90deg, rgba(141, 252, 36, 0.15), transparent 62%),
    rgba(6, 23, 12, 0.88);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 280ms ease, transform 280ms ease;
}

.battle-result-title {
  position: relative;
  color: var(--battle-green);
  font-size: clamp(2rem, 5vw, 4.4rem);
  font-weight: 950;
  font-style: italic;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(141, 252, 36, 0.28);
}

.battle-result-title::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 1.4em;
  aspect-ratio: 1;
  border: 2px solid currentColor;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
  pointer-events: none;
}

.battle-result-reward {
  display: grid;
  gap: 7px;
  padding-left: 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.26);
  color: #dce7e9;
}

.battle-result-reward strong {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--battle-green);
  font-size: 1.2rem;
}

.battle-ruby-value {
  display: inline-block;
  min-width: 3ch;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.battle-card-reward {
  display: flex;
  align-items: center;
  gap: 9px;
  opacity: 0;
  transform: translateY(8px) scale(0.9);
}

.battle-card-reward img {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(141, 252, 36, 0.5);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 18px rgba(141, 252, 36, 0.18);
}

.battle-result-reward .ruby-icon {
  flex: 0 0 auto;
}

.battle-report-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 20px;
  background: rgba(4, 10, 16, 0.94);
}

.battle-report-actions button {
  min-width: 260px;
  min-height: 48px;
  font-size: 0.95rem;
}

.battle-phase--charge .battle-fighter,
.battle-phase--impact .battle-fighter,
.battle-phase--damage .battle-fighter,
.battle-phase--result .battle-fighter {
  transform: translateX(0);
}

.battle-phase--entrance .battle-fighter--attacker {
  animation: battle-enter-attacker 620ms cubic-bezier(0.16, 0.8, 0.24, 1) both;
}

.battle-phase--entrance .battle-fighter--defender {
  animation: battle-enter-defender 620ms cubic-bezier(0.16, 0.8, 0.24, 1) both;
}

.battle-phase--entrance .battle-scan-line {
  animation: battle-scan 560ms 70ms ease-out both;
}

.battle-phase--entrance .battle-fighter-identity h3 {
  animation: battle-name-glitch 420ms 120ms steps(2, end) both;
}

.battle-phase--charge .battle-report-attack strong {
  animation: battle-attack-pulse 580ms ease-in-out both;
}

.battle-phase--charge .battle-fighter-media img {
  filter: contrast(1.08) brightness(1.08);
}

.battle-phase--charge .battle-charge-lines span {
  animation: battle-charge-line 640ms ease-in both;
}

.battle-phase--charge .battle-versus strong {
  animation: battle-vs-charge 640ms ease-in both;
}

.battle-phase--impact .battle-fighter--attacker .battle-fighter-media img {
  transform: scale(1.1) translateX(2%);
}

.battle-phase--impact .battle-fighter--defender .battle-fighter-media img {
  transform: scale(1.1) scaleX(-1) translateX(2%);
}

.battle-phase--impact .battle-impact {
  animation: battle-impact-flash 720ms ease-out both;
}

.battle-phase--impact .battle-report {
  animation: battle-screen-shake 260ms linear both;
}

.battle-phase--damage .battle-remaining-health,
.battle-phase--result .battle-remaining-health {
  opacity: 1;
  transform: translateX(0);
}

.battle-phase--damage .battle-starting-health,
.battle-phase--result .battle-starting-health {
  color: #74858c;
  text-decoration: line-through;
}

.battle-phase--result .battle-result-band {
  opacity: 1;
  transform: translateY(0);
}

.battle-phase--result .battle-result-title {
  animation: battle-result-stamp 380ms cubic-bezier(0.16, 0.86, 0.32, 1.25) both;
}

.battle-phase--result .battle-result-title::after {
  animation: battle-result-wave 720ms 100ms ease-out both;
}

.battle-phase--result .battle-card-reward {
  animation: battle-card-materialize 460ms 180ms ease-out both;
}

.battle-phase--result .battle-fighter:not(.is-winner) {
  filter: saturate(0.55) brightness(0.72);
}

.battle-outcome--draw .battle-fighter {
  filter: none !important;
}

.battle-outcome--loss .battle-result-band {
  border-color: rgba(255, 75, 69, 0.4);
  background:
    linear-gradient(90deg, rgba(255, 75, 69, 0.15), transparent 62%),
    rgba(27, 8, 10, 0.9);
}

.battle-outcome--loss .battle-result-title {
  color: #ff716b;
  text-shadow: 0 0 24px rgba(255, 75, 69, 0.24);
}

.battle-outcome--draw .battle-result-band {
  border-color: rgba(42, 245, 255, 0.4);
  background:
    linear-gradient(90deg, rgba(42, 245, 255, 0.13), transparent 62%),
    rgba(5, 21, 25, 0.9);
}

.battle-outcome--draw .battle-result-title {
  color: var(--battle-blue);
  text-shadow: 0 0 24px rgba(42, 245, 255, 0.22);
}

@keyframes battle-impact-flash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  24% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.7); }
}

@keyframes battle-enter-attacker {
  from { opacity: 0; transform: translateX(-42px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes battle-enter-defender {
  from { opacity: 0; transform: translateX(42px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes battle-scan {
  0% { opacity: 0; transform: translateY(0); }
  15% { opacity: 0.9; }
  85% { opacity: 0.75; }
  100% { opacity: 0; transform: translateY(300px); }
}

@keyframes battle-name-glitch {
  0%, 20% { opacity: 0; transform: translateX(-6px); text-shadow: 5px 0 var(--battle-red), -5px 0 var(--battle-blue); }
  42% { opacity: 1; transform: translateX(3px); }
  70% { transform: translateX(-1px); text-shadow: 2px 0 var(--battle-red), -2px 0 var(--battle-blue); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes battle-attack-pulse {
  0% { color: #fff; transform: scale(1); text-shadow: none; }
  70% { color: #fff; transform: scale(1.18); text-shadow: 0 0 22px currentColor; }
  100% { color: #fff; transform: scale(1.08); text-shadow: 0 0 12px currentColor; }
}

@keyframes battle-charge-line {
  from { opacity: 0; transform: scaleX(0); }
  35% { opacity: 0.5; }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes battle-vs-charge {
  from { transform: scale(1); filter: brightness(1); }
  to { transform: scale(1.14); filter: brightness(1.5); }
}

@keyframes battle-screen-shake {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-4px, 1px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-2px, 2px); }
  80% { transform: translate(2px, -1px); }
}

@keyframes battle-result-stamp {
  from { opacity: 0; transform: scale(1.35) rotate(-4deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes battle-result-wave {
  0% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.4); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.7); }
}

@keyframes battle-card-materialize {
  from { opacity: 0; filter: brightness(2) blur(5px); transform: translateY(8px) scale(0.9); }
  to { opacity: 1; filter: none; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .battle-history-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .battle-report-open {
    width: 100%;
  }

  .event-overlay--battle .event-overlay-shell {
    overflow: hidden;
  }

  .event-overlay--battle .battle-report {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .battle-report-head {
    padding: 10px 12px 9px;
  }

  .battle-report-head > div:first-child {
    padding-left: 88px;
  }

  .battle-report-head-actions {
    gap: 4px;
  }

  .battle-report-close,
  .battle-report-sound {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }

  .battle-report-head .event-kicker {
    font-size: 0.66rem;
  }

  .battle-report-head h2 {
    margin-top: 2px;
    font-size: 0.9rem;
  }

  .battle-arena {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 46px minmax(0, 1fr);
  }

  .battle-fighter {
    grid-template-rows: minmax(0, 1fr) 58px;
  }

  .battle-fighter--attacker,
  .battle-fighter--defender {
    border: 0;
    transform: translateX(0);
  }

  .battle-fighter--attacker {
    transform: translateY(-14px);
  }

  .battle-fighter--defender {
    transform: translateY(14px);
  }

  .battle-fighter-media {
    min-height: 0;
  }

  .battle-fighter--attacker .battle-fighter-media img,
  .battle-fighter--defender .battle-fighter-media img {
    transform: scale(1.03);
  }

  .battle-fighter--attacker .battle-fighter-identity,
  .battle-fighter--defender .battle-fighter-identity {
    left: 12px;
    right: 12px;
    bottom: 8px;
    text-align: left;
  }

  .battle-fighter-identity span {
    font-size: 0.6rem;
  }

  .battle-fighter-identity h3 {
    font-size: clamp(1.05rem, 6vw, 1.55rem);
  }

  .battle-fighter-stats {
    grid-template-columns: minmax(98px, 0.7fr) minmax(0, 1.3fr);
    min-height: 58px;
  }

  .battle-report-stat {
    gap: 5px;
    padding: 7px 10px;
  }

  .battle-report-stat span {
    font-size: 0.56rem;
  }

  .battle-report-stat strong {
    font-size: clamp(1rem, 5vw, 1.3rem);
  }

  .battle-report-health {
    grid-template-columns: auto 1fr 18px 1fr;
  }

  .battle-report-health svg {
    width: 18px;
    height: 18px;
  }

  .battle-versus {
    padding: 3px 8px;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: center;
  }

  .battle-versus::before,
  .battle-versus::after {
    top: 50%;
    width: 35%;
    height: 1px;
  }

  .battle-versus::before {
    left: 0;
    background: linear-gradient(90deg, transparent, var(--battle-blue));
  }

  .battle-versus::after {
    right: 0;
    bottom: auto;
    left: auto;
    background: linear-gradient(270deg, transparent, var(--battle-red));
  }

  .battle-versus strong {
    font-size: 1.85rem;
  }

  .battle-versus span {
    font-size: 0.5rem;
  }

  .battle-phase--charge .battle-fighter,
  .battle-phase--impact .battle-fighter,
  .battle-phase--damage .battle-fighter,
  .battle-phase--result .battle-fighter {
    transform: translateY(0);
  }

  .battle-phase--entrance .battle-fighter--attacker {
    animation-name: battle-enter-attacker-mobile;
  }

  .battle-phase--entrance .battle-fighter--defender {
    animation-name: battle-enter-defender-mobile;
  }

  .battle-charge-lines span {
    top: 50%;
    width: 50%;
  }

  .battle-charge-lines span:first-child {
    transform-origin: right center;
  }

  .battle-charge-lines span:last-child {
    transform-origin: left center;
  }

  .battle-phase--impact .battle-fighter--attacker .battle-fighter-media img,
  .battle-phase--impact .battle-fighter--defender .battle-fighter-media img {
    transform: scale(1.08);
  }

  .battle-result-band {
    grid-template-columns: minmax(118px, 0.75fr) minmax(0, 1.25fr);
    min-height: 84px;
    padding: 10px 14px;
  }

  .battle-result-title {
    font-size: clamp(1.55rem, 9vw, 2.55rem);
  }

  .battle-result-reward {
    gap: 3px;
    padding-left: 12px;
    font-size: 0.75rem;
  }

  .battle-result-reward strong {
    gap: 6px;
    font-size: 0.86rem;
  }

  .battle-card-reward {
    gap: 6px;
  }

  .battle-card-reward img {
    width: 34px;
    height: 34px;
    border-radius: 6px;
  }

  .battle-report-actions {
    min-height: 96px;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px max(10px, env(safe-area-inset-bottom));
  }

  .battle-report-actions button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding-block: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .battle-fighter,
  .battle-fighter-media img,
  .battle-remaining-health,
  .battle-result-band,
  .battle-result-title,
  .battle-result-title::after,
  .battle-card-reward,
  .battle-scan-line,
  .battle-charge-lines span,
  .battle-versus strong,
  .battle-report-attack strong {
    animation: none !important;
    transition: none;
  }

  .battle-impact {
    display: none;
  }
}

@keyframes battle-enter-attacker-mobile {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes battle-enter-defender-mobile {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-player-metrics {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.admin-player-metrics b {
  color: var(--text);
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.75fr);
  gap: 22px;
}

.admin-detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.admin-detail-stats span {
  padding: 9px 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--muted);
}

.admin-detail-stats b {
  color: var(--text);
}

.admin-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.admin-card-list span {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 0.86rem;
}

.admin-card-list small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.admin-grant-form {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 16px;
  background: rgba(var(--accent-rgb), 0.05);
}

.admin-grant-form h3 {
  margin: 0 0 4px;
}

.admin-grant-form label {
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-grant-form textarea {
  resize: vertical;
}

@media (max-width: 1050px) {
  .admin-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .admin-grid,
  .admin-detail-grid { grid-template-columns: 1fr; }
  .admin-hero { display: grid; }
  .admin-player-row { align-items: flex-start; flex-direction: column; }
  .admin-player-metrics { text-align: left; }
}

@media (max-width: 520px) {
  .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-card-list { grid-template-columns: 1fr; }
}

/* Responsive corrections for the tactical screens and card carousel. */
@media (max-width: 760px) {
  .team-grid > .card,
  .team-grid > .card-shell,
  .team-grid > .card.is-empty,
  .shop-grid > .shop-item {
    flex-basis: min(300px, calc(100% - 12px));
  }

  #view-opponents .opponent-battle-card .opponent-actions {
    justify-self: stretch;
  }

  #view-opponents .opponent-battle-card .opponent-actions button {
    width: 100%;
  }
}

@media (min-width: 561px) and (max-width: 760px) {
  #view-opponents .opponent-battle-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 68px;
  }

  #view-opponents .opponent-battle-card .opponent-actions {
    grid-column: auto;
    justify-self: end;
  }

  #view-opponents .opponent-battle-card .opponent-actions button {
    width: auto;
  }
}

.card-page-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding-top: 6px;
}

.card-page-controls button {
  width: auto;
  min-width: 96px;
  min-height: 44px;
}

.card-page-controls span {
  min-width: 110px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

html.performance-mode *,
html.performance-mode *::before,
html.performance-mode *::after {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  transition: none !important;
}

html.performance-mode .card.is-attacker .card-face,
html.performance-mode .incoming-battle-card,
html.performance-mode .card-preview-window,
html.performance-mode .starter-reveal-card,
html.performance-mode .starter-reveal-stage.is-revealing::after,
html.performance-mode .reward-reveal-stage::after,
html.performance-mode .battle-fighter,
html.performance-mode .battle-fighter-media img,
html.performance-mode .battle-remaining-health,
html.performance-mode .battle-result-band,
html.performance-mode .battle-result-title,
html.performance-mode .battle-result-title::after,
html.performance-mode .battle-card-reward,
html.performance-mode .battle-scan-line,
html.performance-mode .battle-charge-lines span,
html.performance-mode .battle-versus strong,
html.performance-mode .battle-report-attack strong,
html.performance-mode .battle-impact,
html.performance-mode .battle-report {
  animation: none !important;
}

html.performance-mode .card-preview-card {
  transform: none !important;
  filter: none !important;
  will-change: auto;
}

html.performance-mode .card-preview-card::before,
html.performance-mode .card-preview-card::after,
html.performance-mode .battle-impact,
html.performance-mode .battle-charge-lines {
  display: none;
}

@media (max-width: 420px) {
  .card-page-controls {
    gap: 8px;
  }

  .card-page-controls button {
    min-width: 82px;
  }

  .card-page-controls span {
    min-width: 0;
  }
}

/* 2026 tactical command deck redesign — approved desktop and mobile spec. */
:root {
  --bg: #050b11;
  --surface: #0b141d;
  --surface-strong: #070e15;
  --surface-soft: #111c26;
  --surface-raised: #16222d;
  --text: #f4f6f8;
  --muted: #9da8b7;
  --line: rgba(151, 167, 181, 0.24);
  --line-strong: rgba(177, 191, 203, 0.44);
  --danger: #ff3040;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.42);
  --cut-sm: 8px;
  --cut-md: 14px;
  --cut-lg: 22px;
  --section-gap: 16px;
  --subsection-gap: 12px;
}

html {
  min-width: 320px;
  background: #050b11;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -18%, rgba(68, 92, 111, 0.2), transparent 40rem),
    linear-gradient(180deg, #071019 0%, #050b11 54%, #03070b 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

.app {
  width: min(100%, 1540px);
  max-width: 1540px;
  padding: 20px clamp(18px, 4vw, 64px) 26px;
  gap: 14px;
}

h1,
h2,
h3,
button,
.dashboard-tab,
.team-mode-tab,
.battle-mode-tab,
.opponent-mode-tab {
  font-family: "Avenir Next", "Arial Black", "Segoe UI", sans-serif;
}

h2 {
  font-weight: 900;
}

button {
  min-height: 44px;
  border-radius: 3px;
  border: 1px solid rgba(var(--accent-rgb), 0.56);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #071016;
  font-weight: 900;
  box-shadow: none;
}

button:hover,
button:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.9);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  filter: brightness(1.08);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.72);
  outline-offset: 3px;
}

button.ghost-button,
button.secondary-button {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(26, 39, 50, 0.95), rgba(10, 18, 25, 0.95));
  color: #dbe1e7;
  box-shadow: none;
}

button.ghost-button:hover,
button.secondary-button:hover {
  border-color: rgba(var(--accent-rgb), 0.48);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--text);
}

button:disabled,
button:disabled:hover {
  border-color: rgba(151, 167, 181, 0.13);
  background: rgba(52, 66, 78, 0.3);
  color: rgba(215, 224, 231, 0.36);
  filter: none;
  cursor: not-allowed;
}

.panel,
.profile-hero {
  border-radius: 3px;
  border-color: var(--line-strong);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.028), transparent 42%),
    linear-gradient(180deg, rgba(13, 23, 32, 0.98), rgba(6, 13, 20, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), var(--shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.panel {
  padding: clamp(18px, 2vw, 26px);
}

.page-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  min-height: 106px;
  padding: 14px 20px;
  overflow: visible;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background:
    linear-gradient(100deg, rgba(var(--accent-rgb), 0.035), transparent 31%),
    linear-gradient(180deg, rgba(17, 27, 36, 0.98), rgba(7, 14, 21, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.045), 0 16px 42px rgba(0, 0, 0, 0.28);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
}

.page-header > .brand-lockup {
  align-self: center;
  gap: 14px;
}

.page-header > .brand-lockup .brand-logo {
  width: 68px;
  height: 68px;
  filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), 0.2));
}

.page-header > .brand-lockup .brand-wordmark {
  width: clamp(210px, 21vw, 320px);
  max-height: 62px;
}

.page-header > .profile-hero.is-authenticated {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.page-header > .profile-hero.is-authenticated .profile-shell {
  display: grid;
  grid-template-columns: minmax(112px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.page-header > .profile-hero.is-authenticated .panel-head {
  min-height: 58px;
  padding: 0;
  border: 0;
  background: none;
}

.page-header > .profile-hero.is-authenticated .profile-title-row {
  justify-content: flex-end;
  gap: 10px;
}

.page-header > .profile-hero.is-authenticated .profile-title-row h2 {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 900;
}

.profile-field-edit-button,
.profile-disclosure-close {
  border-radius: 2px;
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #17232e, #0b131a);
  color: var(--text);
}

.page-header > .profile-hero.is-authenticated .profile-summary,
.page-header > .profile-hero.is-authenticated .profile-identity,
.page-header > .profile-hero.is-authenticated #account-box {
  width: 100%;
  min-width: 0;
}

.page-header > .profile-hero.is-authenticated .profile-detail-strip {
  grid-template-columns: minmax(210px, 1fr) 64px minmax(220px, 1.12fr);
  gap: 10px;
}

.page-header > .profile-hero.is-authenticated .profile-detail-item {
  min-height: 58px;
  padding: 8px 16px;
  border-radius: 2px;
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(15, 25, 34, 0.92), rgba(6, 13, 20, 0.92));
  color: var(--text);
}

.profile-detail-label,
.shop-ruby-label {
  color: var(--muted);
  font-weight: 800;
}

.shop-ruby-button {
  border-color: var(--line) !important;
  background: linear-gradient(180deg, rgba(15, 25, 34, 0.92), rgba(6, 13, 20, 0.92)) !important;
}

.shop-ruby-button.is-active {
  border-color: rgba(var(--accent-rgb), 0.8) !important;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-rgb), 0.04)),
    #0a1118 !important;
  color: var(--accent);
}

.shop-ruby-value .diamond-icon,
.shop-price .diamond-icon,
.cosmetic-card .diamond-icon {
  color: var(--accent);
}

.dashboard {
  gap: 14px;
}

.dashboard-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  height: 62px;
  min-height: 62px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.dashboard-tab {
  height: 62px;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(20, 31, 41, 0.96), rgba(8, 15, 22, 0.96));
  color: #aeb8c4;
  font-size: 1rem;
  font-weight: 900;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
}

.dashboard-tab:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
}

.dashboard-tab.is-active {
  border-color: rgba(var(--accent-rgb), 0.95);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #071016;
  box-shadow: inset 0 0 0 4px rgba(6, 13, 20, 0.42);
}

.dashboard-tab-badge {
  min-width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #ff3b4d;
  color: #fff;
  font-size: 0.72rem;
  box-shadow: 0 0 0 2px #0b141d;
}

.dashboard-view.is-active {
  min-width: 0;
}

.today-panel {
  padding: 0 0 20px;
  overflow: hidden;
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(11, 20, 29, 0.99), rgba(5, 12, 18, 0.99));
  box-shadow: none;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
}

.today-head {
  min-height: 74px;
  margin: 0;
  padding: 20px 26px 14px;
  border: 0;
}

.today-head h2,
.collection-panel .panel-head h2,
.battle-center-head h2,
.opponent-picker-head h2,
.shop-page > .panel-head h2 {
  margin: 0;
  font-size: clamp(2rem, 3.3vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.035em;
}

.today-context,
.view-status-chip {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(15, 25, 34, 0.74);
  color: var(--muted);
  font-weight: 800;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
}

.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 0 20px;
}

.today-event {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 264px;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.72);
  background: #070e15;
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

.today-event-art,
.battle-feature-art,
.shop-feature-art {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  pointer-events: none;
}

.today-event-art,
.battle-feature-art {
  background-image:
    linear-gradient(90deg, transparent 0 38%, rgba(6, 13, 20, 0.36) 47%, rgba(6, 13, 20, 0.97) 70%),
    url("assets/ui/battle-report-lion.webp");
  background-position: left center;
  background-size: cover;
}

.today-event-copy {
  position: relative;
  z-index: 1;
  width: 52%;
  margin-left: auto;
  padding: 28px 32px;
}

.today-event-kicker,
.shop-kicker {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.today-event h3,
.battle-feature-card h3 {
  margin: 0 0 12px;
  overflow: visible;
  color: var(--text);
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  font-weight: 900;
  line-height: 1.08;
  white-space: normal;
  overflow-wrap: anywhere;
}

.today-event-meta,
.battle-feature-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
}

.today-event-meta strong::before,
.battle-feature-meta strong::before {
  content: "·";
  margin-right: 12px;
  color: var(--muted);
}

.battle-outcome--win {
  color: #51e234;
}

.battle-outcome--loss {
  color: #ff4353;
}

.today-event p,
.battle-feature-card p {
  margin: 12px 0 18px;
  color: #b8c1cb;
  line-height: 1.45;
}

.today-event-copy > button {
  width: min(100%, 300px);
  min-height: 58px;
  margin-left: auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.05rem;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
}

.today-event-new,
.battle-feature-new,
.battle-row-new {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 24px;
  padding: 4px 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.8);
  color: var(--accent);
  font-weight: 900;
}

.mission-route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mission-route::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 8%;
  left: 8%;
  height: 4px;
  background: rgba(var(--accent-rgb), 0.66);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.38);
}

.mission-step {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 142px;
  padding: 18px 20px;
  border-color: var(--line-strong);
  background: linear-gradient(135deg, #15212b, #081018 72%);
  color: var(--text);
  text-align: left;
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

.mission-step:hover {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.16), #081018 70%);
  color: var(--text);
}

.mission-step.is-urgent {
  border-color: rgba(var(--accent-rgb), 0.88);
  box-shadow: inset 0 0 26px rgba(var(--accent-rgb), 0.1);
}

.mission-step-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 70px;
  border: 1px solid var(--line-strong);
  background: #09111a;
  color: var(--text);
  clip-path: polygon(25% 0, 75% 0, 100% 28%, 100% 72%, 75% 100%, 25% 100%, 0 72%, 0 28%);
}

.mission-step-icon svg,
.opponent-loadout-target svg,
.loadout-battle-icon svg,
.battle-history-icon svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mission-step-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.mission-step-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mission-step-heading b {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  background: var(--surface-raised);
  color: var(--text);
  clip-path: polygon(24% 0, 76% 0, 100% 24%, 100% 76%, 76% 100%, 24% 100%, 0 76%, 0 24%);
}

.mission-step.is-urgent .mission-step-heading b {
  background: var(--accent);
  color: #071016;
}

.mission-step-heading strong {
  font-size: 1.06rem;
}

.mission-step-copy > span:last-child {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.mission-step.is-urgent .mission-step-copy > span:last-child {
  color: var(--accent);
}

.mission-step-cue {
  color: var(--muted);
  font-size: 2rem;
}

.today-status-rail,
.battle-summary-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: rgba(8, 16, 23, 0.82);
}

.today-status-rail > div,
.battle-summary-rail > div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 66px;
  padding: 10px 16px;
}

.today-status-rail > div + div,
.battle-summary-rail > div + div {
  border-left: 1px solid var(--line);
}

.today-status-rail > div > span,
.battle-summary-rail > div > span {
  color: var(--text);
  font-size: 1.5rem;
}

.today-status-rail strong,
.battle-summary-rail strong {
  font-size: 1.65rem;
}

.today-status-rail small,
.battle-summary-rail small {
  color: var(--muted);
  font-size: 0.86rem;
}

.battle-summary-rail .is-urgent strong,
.battle-summary-rail .is-urgent > span {
  color: var(--accent);
}

/* Team */
.collection-panel {
  padding: 18px;
  overflow: hidden;
  box-shadow: none;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
}

.collection-panel .panel-head {
  min-height: 54px;
  margin: 0;
  padding: 0 8px 12px;
  border-bottom: 1px solid var(--line);
}

.team-heading-copy {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.team-card-count {
  color: var(--muted);
  font-size: 1rem;
}

.team-loadout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 92px;
  margin: 12px 2px;
  padding: 12px 24px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.045), transparent 35%), #09121a;
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

.team-loadout-main {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.loadout-target {
  display: grid;
  place-items: center;
  width: 56px;
  height: 62px;
  flex: 0 0 auto;
  border: 1px solid rgba(var(--accent-rgb), 0.52);
  background: #0e1821;
  color: var(--text);
  clip-path: polygon(24% 0, 76% 0, 100% 24%, 100% 76%, 76% 100%, 24% 100%, 0 76%, 0 24%);
}

.loadout-target svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.team-loadout-main > div,
.team-loadout-battles {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.team-loadout-main strong {
  font-size: 1.12rem;
}

.team-loadout-main span,
.team-loadout-battles span {
  color: var(--muted);
}

.team-loadout-battles {
  min-width: 160px;
  padding-left: 28px;
  border-left: 1px solid var(--line);
  text-align: center;
}

.team-loadout-battles strong {
  font-size: 2rem;
  line-height: 1;
}

.team-mode-tabs,
.battle-mode-tabs,
.opponent-mode-tabs,
.shop-category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  margin: 10px 0 12px;
  padding: 2px;
  border: 1px solid var(--line);
  background: #071018;
}

.team-mode-tabs {
  grid-template-columns: repeat(2, minmax(0, 250px));
  justify-content: start;
}

.team-mode-tab,
.battle-mode-tab,
.opponent-mode-tab,
.shop-category-tabs button {
  min-height: 48px;
  border-color: transparent;
  background: linear-gradient(180deg, rgba(22, 34, 44, 0.96), rgba(10, 18, 25, 0.96));
  color: #b9c3cd;
  font-size: 0.95rem;
  font-weight: 900;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
}

.team-mode-tab.is-active,
.battle-mode-tab.is-active,
.opponent-mode-tab.is-active,
.shop-category-tabs button.is-active {
  border-color: rgba(var(--accent-rgb), 0.88);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #071016;
  box-shadow: inset 0 0 0 3px rgba(6, 13, 20, 0.34);
}

.team-mode-tab span,
.battle-mode-tab span {
  margin-left: 6px;
}

.team-content-stack,
.team-section,
.collection-section,
.collection-section-inner {
  min-width: 0;
}

.team-grid,
.collection-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  overflow: visible;
  scroll-snap-type: none;
}

.team-grid > .card-shell,
.collection-grid > .card-shell,
.team-grid > .card.is-empty,
.collection-grid > .card.is-empty {
  width: auto;
  min-width: 0;
  flex: none;
}

.card-shell {
  display: grid;
  min-width: 0;
}

.beast-card {
  --card-pad: clamp(8px, 0.9vw, 12px);
  --card-gap: 8px;
}

.beast-card .card-face {
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(var(--rarity-rgb), 0.12), transparent 31%),
    linear-gradient(180deg, #18222b, #091118);
}

.beast-card .card-top h3 {
  font-size: clamp(0.84rem, 1.2vw, 1.08rem);
  font-weight: 900;
}

.beast-card .card-art,
.beast-card .card-art-placeholder {
  border-radius: 3px;
  background: #080e14;
}

.beast-card .card-art-image,
.beast-card .card-art-video {
  object-fit: cover;
}

.beast-card .card-stats-primary div {
  border-radius: 3px;
  background: #111c25;
}

.card-blurb {
  -webkit-line-clamp: 3;
  color: #c5cbd2;
}

.card-context-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 4px 4px;
  background: #0a1219;
}

.card-context-bar .card-icon-action,
.card-context-bar .card-action-status {
  width: 100%;
  height: 44px;
  min-height: 44px;
  border-radius: 2px;
  border-color: var(--line);
  background: #0d161e;
}

.card-context-bar .card-icon-action:hover {
  border-color: rgba(var(--accent-rgb), 0.58);
  background: rgba(var(--accent-rgb), 0.1);
}

.team-pagination {
  margin-top: 12px;
}

/* Battle center */
.battle-center-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
  overflow: hidden;
  box-shadow: none;
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px), 0 16px);
}

.battle-center-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  margin: 0;
  padding: 0 6px;
  border: 0;
}

.battle-command-overview {
  display: block;
}

.battle-feature-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, auto);
  align-items: center;
  min-height: 230px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #070e15;
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

.battle-feature-art {
  background-image:
    linear-gradient(90deg, transparent 0 31%, rgba(6, 13, 20, 0.72) 49%, #060d14 70%),
    url("assets/ui/battle-report-lion.webp");
}

.battle-feature-copy {
  position: relative;
  z-index: 1;
  width: 58%;
  margin-left: 34%;
  padding: 26px 12px;
}

.battle-feature-card h3 {
  font-size: clamp(1.45rem, 2.5vw, 2rem);
}

.battle-feature-actions {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 24px;
}

.battle-feature-actions button {
  min-height: 60px;
  font-size: 1.02rem;
}

.battle-summary-rail {
  margin: 0;
}

.battle-mode-tabs {
  margin: 0;
}

.battle-tab-panels {
  min-width: 0;
  padding: 0 2px;
}

.battle-tab-panel.is-active {
  display: block;
}

.battle-tab-panel .list {
  display: grid;
  gap: 0;
}

.battle-history-item {
  position: relative;
  display: grid;
  grid-template-columns: 16px 52px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 12px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.battle-history-item:hover {
  background: rgba(255, 255, 255, 0.025);
}

.battle-history-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #596573;
}

.battle-history-item.is-unread .battle-history-marker {
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.56);
}

.battle-history-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 52px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  clip-path: polygon(24% 0, 76% 0, 100% 24%, 100% 76%, 76% 100%, 24% 100%, 0 76%, 0 24%);
}

.battle-history-copy h3 {
  margin: 0 0 5px;
  font-size: 1.05rem;
}

.battle-history-copy .small strong {
  font-size: inherit;
}

.battle-row-new {
  position: static;
  color: var(--accent);
}

.battle-report-open {
  min-width: 214px;
  min-height: 50px;
}

.battle-history-item.is-unread .battle-report-open {
  border-color: rgba(var(--accent-rgb), 0.7);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #071016;
}

.battle-load-more {
  justify-self: center;
  min-width: 260px;
  margin-top: 14px;
}

.battle-decision-card,
.battle-queue-item {
  border-radius: 2px;
  border-color: var(--line);
  background: #0b141d;
}

/* Opponents */
#view-opponents.dashboard-view.is-active {
  display: grid;
  gap: 16px;
}

.opponent-command-panel,
.opponent-picker-panel {
  box-shadow: none;
  clip-path: polygon(15px 0, calc(100% - 15px) 0, 100% 15px, 100% calc(100% - 15px), calc(100% - 15px) 100%, 15px 100%, 0 calc(100% - 15px), 0 15px);
}

.opponent-command-panel {
  padding: 12px 20px;
}

.opponent-loadout {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 28px;
  min-height: 140px;
  padding: 0;
}

.opponent-loadout-target {
  display: grid;
  place-items: center;
  width: 148px;
  height: 116px;
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--accent), var(--accent)) left top / 20px 4px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left top / 4px 20px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right top / 20px 4px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right top / 4px 20px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left bottom / 20px 4px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left bottom / 4px 20px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right bottom / 20px 4px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right bottom / 4px 20px no-repeat,
    radial-gradient(circle, rgba(255, 255, 255, 0.04), transparent 68%),
    #09121a;
  color: #697582;
  overflow: hidden;
}

.opponent-loadout-target svg {
  width: 66px;
  height: 66px;
}

.opponent-loadout-target.has-animal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.opponent-loadout-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.opponent-loadout-copy h2 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.opponent-loadout-copy strong {
  font-size: 1.08rem;
}

.opponent-loadout-copy span,
.opponent-loadout-status span {
  color: var(--muted);
  line-height: 1.4;
}

.opponent-loadout-status {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 176px;
  padding: 12px 28px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.opponent-loadout-status > div {
  display: grid;
  gap: 3px;
}

.opponent-loadout-status strong {
  font-size: 2rem;
}

.loadout-battle-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 52px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  clip-path: polygon(24% 0, 76% 0, 100% 24%, 100% 76%, 76% 100%, 24% 100%, 0 76%, 0 24%);
}

.opponent-loadout > button {
  min-width: 180px;
  min-height: 56px;
  margin: 0;
}

.opponent-picker-panel {
  padding: 18px 24px 24px;
}

.opponent-picker-head {
  min-height: 56px;
  margin: 0;
  padding: 0 4px 10px;
  border: 0;
}

.opponent-mode-tabs {
  margin: 0 0 10px;
}

.opponent-tab-panels {
  padding: 10px 14px 0;
  border: 1px solid var(--line);
  background: rgba(5, 12, 18, 0.44);
}

.opponent-tab-panel.is-active {
  display: block;
}

.opponent-tab-panel .subsection-head {
  min-height: 58px;
  padding: 0 8px;
}

.opponent-tab-panel .subsection-title {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.opponent-battle-card,
#view-opponents .opponent-battle-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 78px;
  padding: 12px 16px;
  border-radius: 2px;
  border-color: var(--line);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.025), transparent 66%), #09121a;
}

.opponent-avatar {
  width: 50px;
  height: 50px;
  border-color: rgba(var(--accent-rgb), 0.46);
  background: #091018;
  color: var(--accent);
  font-size: 1rem;
}

.opponent-card-copy h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.opponent-threat {
  color: var(--accent);
}

.opponent-actions button[data-action="challenge"],
.opponent-actions button[data-action="challenge-bot"] {
  min-width: 174px;
  min-height: 50px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #071016;
}

.search-inline {
  padding: 16px 0;
}

/* Shop */
.shop-page {
  padding: 18px;
  overflow: hidden;
  box-shadow: none;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
}

.shop-page > .panel-head {
  min-height: 58px;
  margin: 0;
  padding: 0 6px 12px;
  border: 0;
}

.shop-box {
  display: grid;
  gap: 12px;
}

.shop-feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: center;
  min-height: 250px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.72);
  background: #070e15;
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

.shop-feature-art {
  background-image:
    linear-gradient(90deg, transparent 0 35%, rgba(6, 13, 20, 0.45) 50%, rgba(6, 13, 20, 0.98) 72%),
    url("assets/ui/mystery-crate.webp");
  background-position: left center;
  background-size: cover;
}

.shop-feature-copy {
  position: relative;
  z-index: 1;
  width: 56%;
  margin-left: 38%;
  padding: 22px;
}

.shop-feature h3 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 2.6vw, 2.15rem);
  font-weight: 900;
}

.shop-feature p {
  max-width: 48ch;
  color: #bdc5ce;
  font-size: 0.98rem;
}

.shop-buy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: stretch;
  gap: 10px;
  padding: 18px;
  text-align: center;
}

.shop-price {
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 900;
}

.shop-buy button {
  min-height: 58px;
  font-size: 1.05rem;
}

.shop-category-tabs {
  margin: 0;
}

.shop-category-panel {
  padding: 0 8px 8px;
}

.shop-cosmetics {
  display: block;
}

.cosmetic-shop-group {
  display: grid;
  gap: 12px;
}

.cosmetic-shop-head {
  min-height: 0;
  padding: 4px 0 0;
}

.cosmetic-shop-head h3 {
  display: none;
}

.cosmetic-shop-head p {
  margin: 0;
  font-size: 0.92rem;
}

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

.cosmetic-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 102px;
  padding: 12px 14px;
  border-radius: 2px;
  border-color: var(--line);
  background: #0a131b;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}

.cosmetic-card.is-active {
  border-color: rgba(var(--accent-rgb), 0.8);
  box-shadow: inset 3px 0 var(--accent);
}

.cosmetic-swatch {
  width: 66px;
  height: 66px;
  border-radius: 5px;
  background: #0c151e;
}

.cosmetic-card > div {
  display: grid;
  gap: 6px;
}

.cosmetic-card strong {
  font-size: 1rem;
}

.cosmetic-card button {
  min-width: 104px;
}

.shop-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  overflow: visible;
}

.card-context-bar--shop {
  grid-template-columns: minmax(0, 1fr) auto;
}

.app-footer {
  min-height: 72px;
  padding: 0;
  border: 0;
  background: transparent;
}

.app-footer .highlight-color-picker,
.app-footer #logout-button,
.app-footer #tab-admin {
  min-height: 58px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(18, 29, 39, 0.95), rgba(7, 14, 21, 0.95));
}

.app-footer .color-swatch {
  width: 54px;
  height: 54px;
}

.app-footer-actions {
  gap: 10px;
}

.app-footer-actions button {
  min-width: 150px;
}

@media (min-width: 761px) and (max-width: 1220px) {
  .page-header {
    gap: 24px;
  }

  .page-header > .brand-lockup .brand-wordmark {
    width: clamp(170px, 20vw, 230px);
  }

  .page-header > .profile-hero.is-authenticated .profile-shell {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
  }

  .page-header > .profile-hero.is-authenticated .profile-detail-strip {
    grid-template-columns: minmax(160px, 1fr) 58px minmax(180px, 1fr);
  }

  .team-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }

  .team-grid > .card-shell,
  .team-grid > .card.is-empty {
    flex: 0 0 calc((100% - 30px) / 3.35);
    scroll-snap-align: start;
  }

  .collection-grid,
  .shop-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .cosmetic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .battle-feature-card {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .battle-feature-copy {
    width: 64%;
    margin-left: 28%;
  }

  .opponent-loadout {
    grid-template-columns: 120px minmax(0, 1fr) auto auto;
    gap: 18px;
  }

  .opponent-loadout-target {
    width: 120px;
  }
}

@media (max-width: 900px) {
  .battle-feature-card {
    grid-template-columns: minmax(0, 1fr) 250px;
  }

  .battle-feature-copy {
    width: 68%;
    margin-left: 24%;
  }

  .opponent-loadout {
    grid-template-columns: 112px minmax(0, 1fr) auto;
  }

  .opponent-loadout-target {
    width: 112px;
  }

  .opponent-loadout > button {
    grid-column: 3;
  }

  .opponent-loadout-status {
    grid-column: 3;
    border-right: 0;
  }
}

@media (max-width: 760px) {
  :root {
    --section-gap: 14px;
  }

  body::before {
    opacity: 0.1;
  }

  .app {
    width: 100%;
    padding: 16px 14px 22px;
    gap: 14px;
  }

  .page-header {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    grid-template-rows: 94px auto;
    gap: 12px 14px;
    min-height: 254px;
    padding: 14px 16px 18px;
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  }

  .page-header > .brand-lockup {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    justify-self: start;
  }

  .page-header > .brand-lockup .brand-logo {
    width: 76px;
    height: 76px;
  }

  .page-header > .brand-lockup .brand-wordmark {
    display: none;
  }

  .page-header > .profile-hero.is-authenticated,
  .page-header > .profile-hero.is-authenticated .profile-shell {
    display: contents;
  }

  .page-header > .profile-hero.is-authenticated .panel-head {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    min-height: 72px;
  }

  .page-header > .profile-hero.is-authenticated .profile-title-row {
    justify-content: flex-end;
  }

  .page-header > .profile-hero.is-authenticated .profile-title-row h2 {
    font-size: 2rem;
  }

  .page-header > .profile-hero.is-authenticated .auth-shell {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .page-header > .profile-hero.is-authenticated .profile-detail-strip {
    grid-template-columns: minmax(0, 1.18fr) minmax(70px, 0.72fr) minmax(0, 1.45fr);
    gap: 8px;
  }

  .page-header > .profile-hero.is-authenticated .profile-detail-item {
    min-height: 82px;
    padding: 10px;
  }

  .profile-code-label {
    display: none;
  }

  .profile-action-icon {
    width: 28px;
    height: 28px;
  }

  .shop-ruby-button {
    justify-content: center;
    gap: 8px;
  }

  .shop-ruby-label {
    font-size: 0.95rem;
  }

  .shop-ruby-value {
    gap: 5px;
  }

  .dashboard-tabs {
    gap: 5px;
    height: 64px;
    min-height: 64px;
  }

  .dashboard-tab {
    height: 64px;
    min-height: 64px;
    padding: 6px 4px;
    font-size: clamp(0.78rem, 3.4vw, 0.96rem);
  }

  .dashboard-tab-badge {
    position: absolute;
    top: 5px;
    right: 7px;
  }

  .panel {
    padding: 18px;
  }

  .today-panel {
    padding: 0 0 16px;
  }

  .today-head {
    min-height: 88px;
    padding: 22px 20px 14px;
  }

  .today-head h2,
  .collection-panel .panel-head h2,
  .battle-center-head h2,
  .opponent-picker-head h2,
  .shop-page > .panel-head h2 {
    font-size: clamp(2rem, 9vw, 2.65rem);
  }

  .today-context,
  .view-status-chip {
    padding: 0 12px;
    font-size: 0.82rem;
  }

  .today-grid {
    gap: 14px;
    padding: 0 10px;
  }

  .today-event {
    grid-template-columns: 38% minmax(0, 62%);
    align-items: start;
    min-height: 392px;
    padding-bottom: 88px;
  }

  .today-event-art {
    background-image:
      linear-gradient(90deg, transparent 0 28%, rgba(6, 13, 20, 0.34) 42%, rgba(6, 13, 20, 0.96) 71%),
      linear-gradient(0deg, #060d14 0, transparent 32%),
      url("assets/ui/battle-report-lion.webp");
    background-position: 29% center;
    background-size: auto 100%;
  }

  .today-event-copy {
    position: static;
    z-index: auto;
    grid-column: 2;
    width: auto;
    margin: 0;
    padding: 30px 14px 14px;
  }

  .today-event-copy > * {
    position: relative;
    z-index: 1;
  }

  .today-event-kicker,
  .shop-kicker {
    font-size: 0.72rem;
  }

  .today-event h3,
  .battle-feature-card h3 {
    margin-bottom: 10px;
    font-size: clamp(1.35rem, 6.2vw, 1.72rem);
    line-height: 1.12;
  }

  .today-event-meta,
  .battle-feature-meta {
    gap: 7px;
    font-size: 0.9rem;
  }

  .today-event-meta strong::before,
  .battle-feature-meta strong::before {
    margin-right: 7px;
  }

  .today-event p {
    margin-top: 12px;
    font-size: 0.82rem;
  }

  .today-event-copy > button {
    position: absolute;
    z-index: 2;
    right: 18px;
    bottom: 16px;
    left: 18px;
    width: auto;
    min-height: 58px;
    margin: 0;
  }

  .today-event-new,
  .battle-feature-new {
    top: 18px;
    right: 14px;
    font-size: 0.78rem;
  }

  .mission-route {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding-left: 0;
  }

  .mission-route::before {
    top: 8%;
    bottom: 8%;
    left: 39px;
    width: 4px;
    height: auto;
  }

  .mission-step {
    grid-template-columns: 76px minmax(0, 1fr) auto;
    min-height: 164px;
    padding: 18px 16px;
  }

  .mission-step-icon {
    width: 76px;
    height: 86px;
    margin-left: 0;
  }

  .mission-step-heading {
    align-items: flex-start;
  }

  .mission-step-heading strong {
    font-size: 1rem;
    line-height: 1.3;
    white-space: normal;
  }

  .today-status-rail > div,
  .battle-summary-rail > div {
    min-height: 98px;
    flex-wrap: wrap;
    gap: 7px 10px;
    padding: 12px 8px;
  }

  .today-status-rail small,
  .battle-summary-rail small {
    flex-basis: 100%;
    text-align: center;
  }

  /* Team mobile */
  .collection-panel {
    padding: 18px 10px 28px;
  }

  .collection-panel .panel-head {
    padding: 4px 10px 14px;
  }

  .team-heading-copy {
    gap: 12px;
  }

  .team-card-count {
    font-size: 0.9rem;
  }

  .team-loadout {
    grid-template-columns: minmax(0, 1fr) 108px;
    min-height: 134px;
    padding: 14px;
  }

  .team-loadout-main {
    gap: 12px;
  }

  .loadout-target {
    width: 62px;
    height: 70px;
  }

  .team-loadout-main strong {
    font-size: 0.95rem;
    white-space: normal;
  }

  .team-loadout-main span,
  .team-loadout-battles span {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .team-loadout-battles {
    min-width: 0;
    padding-left: 12px;
  }

  .team-loadout-battles strong {
    font-size: 1.7rem;
  }

  .team-mode-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-inline: 0;
  }

  .team-grid {
    display: flex;
    gap: 10px;
    padding: 4px 0 10px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }

  .team-grid > .card-shell,
  .team-grid > .card.is-empty {
    flex: 0 0 calc((100vw - 58px) / 2);
    width: auto;
    min-width: 0;
    scroll-snap-align: start;
  }

  .collection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .beast-card .card-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .beast-card .card-top-meta {
    justify-content: space-between;
  }

  .rarity-text {
    display: none;
  }

  .beast-card .card-stats-primary strong {
    font-size: 0.82rem;
  }

  .card-context-bar {
    padding: 5px;
  }

  .card-context-bar .card-icon-action,
  .card-context-bar .card-action-status {
    min-height: 42px;
    height: 42px;
  }

  /* Battles mobile */
  .battle-center-panel {
    padding: 20px 10px;
  }

  .battle-center-head {
    flex-wrap: nowrap;
    min-height: 74px;
    padding: 0 8px;
  }

  .battle-feature-card {
    display: grid;
    grid-template-columns: 36% minmax(0, 64%);
    align-items: start;
    min-height: 488px;
    padding-bottom: 150px;
  }

  .battle-feature-art {
    background-image:
      linear-gradient(90deg, transparent 0 25%, rgba(6, 13, 20, 0.46) 43%, #060d14 72%),
      linear-gradient(0deg, #060d14 0, transparent 35%),
      url("assets/ui/battle-report-lion.webp");
    background-position: 31% center;
    background-size: auto 100%;
  }

  .battle-feature-copy {
    position: relative;
    z-index: 1;
    grid-column: 2;
    width: auto;
    margin: 0;
    padding: 32px 14px 8px;
  }

  .battle-feature-copy p {
    font-size: 0.8rem;
  }

  .battle-feature-actions {
    position: absolute;
    right: 16px;
    bottom: 16px;
    left: 16px;
    padding: 0;
  }

  .battle-feature-actions button {
    min-height: 58px;
  }

  .battle-mode-tabs {
    gap: 3px;
  }

  .battle-mode-tab {
    padding: 8px 5px;
    font-size: 0.78rem;
  }

  .battle-history-item {
    grid-template-columns: 12px 44px minmax(0, 1fr);
    gap: 10px;
    min-height: 154px;
    padding: 16px 6px;
  }

  .battle-history-icon {
    width: 42px;
    height: 48px;
  }

  .battle-history-copy h3 {
    font-size: 0.98rem;
    line-height: 1.35;
    white-space: normal;
  }

  .battle-row-new {
    position: absolute;
    top: 14px;
    right: 8px;
  }

  .battle-report-open {
    grid-column: 2 / -1;
    width: 100%;
    min-width: 0;
  }

  .battle-load-more {
    width: calc(100% - 20px);
    min-width: 0;
  }

  /* Opponents mobile */
  .opponent-command-panel {
    padding: 18px 14px;
  }

  .opponent-loadout {
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 12px 16px;
    min-height: 238px;
  }

  .opponent-loadout-target {
    grid-column: 1;
    grid-row: 1 / 4;
    width: 112px;
    height: 188px;
  }

  .opponent-loadout-copy {
    grid-column: 2;
    grid-row: 1;
  }

  .opponent-loadout-copy h2 {
    margin-bottom: 6px;
    font-size: 1.55rem;
    white-space: normal;
  }

  .opponent-loadout-copy strong {
    font-size: 0.94rem;
  }

  .opponent-loadout-copy span {
    font-size: 0.82rem;
  }

  .opponent-loadout-status {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    padding: 8px 0;
    border: 0;
  }

  .opponent-loadout-status strong {
    font-size: 1.7rem;
  }

  .loadout-battle-icon {
    width: 42px;
    height: 46px;
  }

  .opponent-loadout > button {
    grid-column: 2;
    grid-row: 3;
    width: 100%;
    min-width: 0;
    min-height: 54px;
  }

  .opponent-picker-panel {
    padding: 18px 10px 24px;
  }

  .opponent-picker-head {
    padding: 0 10px 14px;
  }

  .opponent-mode-tabs {
    margin: 0 0 10px;
  }

  .opponent-mode-tab {
    padding: 7px 4px;
    font-size: 0.82rem;
  }

  .opponent-tab-panels {
    padding: 8px;
  }

  .opponent-battle-card,
  #view-opponents .opponent-battle-card {
    grid-template-columns: 56px minmax(0, 1fr);
    min-height: 176px;
    padding: 14px 10px;
  }

  #view-opponents .opponent-battle-card .opponent-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .opponent-actions button[data-action="challenge"],
  .opponent-actions button[data-action="challenge-bot"] {
    width: 100%;
    min-width: 0;
  }

  .opponent-card-copy h3 {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  /* Shop mobile */
  .shop-page {
    padding: 18px 10px 24px;
  }

  .shop-page > .panel-head {
    padding: 0 10px 14px;
  }

  .shop-feature {
    display: grid;
    grid-template-columns: 49% minmax(0, 51%);
    align-items: start;
    min-height: 520px;
    padding: 0 14px 18px;
  }

  .shop-feature-art {
    background-image:
      linear-gradient(90deg, transparent 0 27%, rgba(6, 13, 20, 0.38) 43%, rgba(6, 13, 20, 0.94) 75%),
      linear-gradient(0deg, #060d14 0, transparent 35%),
      url("assets/ui/mystery-crate.webp");
    background-position: 28% center;
    background-size: auto 100%;
  }

  .shop-feature-copy {
    position: relative;
    z-index: 1;
    grid-column: 2;
    width: auto;
    margin: 0;
    padding: 30px 4px 0;
  }

  .shop-feature-copy .shop-kicker {
    font-size: 0.62rem;
    letter-spacing: 0.045em;
  }

  .shop-feature h3 {
    font-size: 1.4rem;
    white-space: normal;
  }

  .shop-feature p {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .shop-buy {
    position: absolute;
    z-index: 2;
    right: 18px;
    bottom: 18px;
    left: 49%;
    padding: 0;
  }

  .shop-price {
    justify-content: flex-start;
    font-size: 1.45rem;
  }

  .shop-category-tabs {
    gap: 3px;
  }

  .shop-category-tabs button {
    padding: 6px 4px;
    font-size: clamp(0.63rem, 2.9vw, 0.78rem);
    line-height: 1.2;
    white-space: normal;
  }

  .shop-category-panel {
    padding: 4px 2px 0;
  }

  .cosmetic-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cosmetic-card {
    grid-template-columns: 78px minmax(0, 1fr) auto;
    min-height: 112px;
    padding: 12px;
  }

  .cosmetic-card button {
    min-width: 96px;
  }

  .shop-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .shop-grid > .shop-item {
    flex: 0 0 calc((100vw - 58px) / 2);
    scroll-snap-align: start;
  }

  .app-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .app-footer .highlight-color-picker {
    min-width: 0;
    overflow-x: auto;
  }

  .app-footer .color-swatch {
    width: 44px;
    min-width: 44px;
    height: 54px;
  }

  .app-footer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-footer-actions button {
    min-width: 0;
    padding-inline: 14px;
  }
}

@media (max-width: 480px) {
  .profile-detail-strip .profile-stat-toggle {
    padding-inline: 8px;
  }

  .shop-ruby-button {
    flex-wrap: wrap;
    align-content: center;
  }

  .shop-ruby-label {
    display: none;
  }

  .today-event {
    grid-template-columns: 40% minmax(0, 60%);
  }

  .mission-step {
    grid-template-columns: 68px minmax(0, 1fr) auto;
    padding-inline: 12px;
  }

  .mission-step-icon {
    width: 68px;
    height: 80px;
    margin-left: 0;
  }

  .collection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cosmetic-card {
    grid-template-columns: 68px minmax(0, 1fr) 88px;
    gap: 10px;
  }

  .cosmetic-swatch {
    width: 60px;
    height: 60px;
  }

  .cosmetic-card button {
    min-width: 0;
    padding-inline: 8px;
  }

  .app-footer {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 360px) {
  .app {
    padding-inline: 10px;
  }

  .page-header {
    padding-inline: 12px;
  }

  .dashboard-tab {
    font-size: 0.72rem;
  }

  .today-head h2,
  .collection-panel .panel-head h2,
  .battle-center-head h2,
  .opponent-picker-head h2,
  .shop-page > .panel-head h2 {
    font-size: 1.9rem;
  }

  .team-heading-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .team-grid > .card-shell,
  .team-grid > .card.is-empty,
  .shop-grid > .shop-item {
    flex-basis: calc((100vw - 44px) / 2);
  }

  .opponent-loadout {
    grid-template-columns: 94px minmax(0, 1fr);
  }

  .opponent-loadout-target {
    width: 94px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mission-route::before {
    box-shadow: none;
  }
}

/* Shared command-deck UX primitives */
:root {
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 18px;
  --space-4: 24px;
  --control-sm: 44px;
  --control-md: 50px;
  --control-lg: 58px;
  --deck-cut: 12px;
}

.view-heading {
  min-height: 74px;
  margin: 0;
  padding: 14px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.view-heading h2,
.admin-hero h2 {
  margin: 0;
  font-size: clamp(2rem, 3.3vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.view-status-chip,
.team-card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: var(--control-sm);
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(15, 25, 34, 0.74);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
}

.team-heading-copy {
  display: contents;
}

.team-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.team-mode-tabs,
.battle-mode-tabs,
.opponent-mode-tabs,
.shop-category-tabs {
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  background: #071018;
}

.team-mode-tab,
.battle-mode-tab,
.opponent-mode-tab,
.shop-category-tabs button {
  min-height: var(--control-md);
  padding: 8px 12px;
  border-radius: 0;
  font-size: 0.92rem;
}

.status-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: rgba(8, 16, 23, 0.82);
}

.status-rail > div {
  display: grid;
  grid-template-columns: 30px auto;
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: center;
  column-gap: 10px;
  min-height: 70px;
  padding: 10px 16px;
}

.status-rail > div + div {
  border-left: 1px solid var(--line);
}

.status-rail-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--text);
}

.status-rail-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-rail strong {
  align-self: end;
  font-size: 1.55rem;
  line-height: 1;
}

.status-rail small {
  align-self: start;
  color: var(--muted);
  font-size: 0.78rem;
}

.status-rail .is-urgent,
.status-rail .is-urgent .status-rail-icon {
  color: var(--accent);
}

.empty-state {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  margin: 10px 0 4px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.035), transparent 58%), #09121a;
  color: var(--text);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 58px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  clip-path: polygon(24% 0, 76% 0, 100% 24%, 100% 76%, 76% 100%, 24% 100%, 0 76%, 0 24%);
}

.empty-state-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state-copy {
  display: grid;
  gap: 5px;
}

.empty-state-copy strong {
  color: var(--text);
  font-size: 1rem;
}

.empty-state-copy span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.empty-state > button {
  min-width: 180px;
  min-height: var(--control-md);
}

.today-event,
.battle-feature-card,
.shop-feature {
  min-height: 264px;
}

.today-event-copy,
.battle-feature-copy,
.shop-feature-copy {
  width: 56%;
  margin-left: auto;
  padding: 28px 32px;
}

.today-event h3,
.battle-feature-card h3,
.shop-feature h3 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.battle-feature-card,
.shop-feature {
  grid-template-columns: minmax(0, 1fr) 270px;
}

.battle-feature-actions,
.shop-buy {
  padding: 24px;
}

.battle-feature-actions button,
.shop-buy button,
.today-event-copy > button {
  min-height: var(--control-lg);
}

.beast-card .card-top h3 {
  display: -webkit-box;
  min-height: 2.45em;
  overflow: hidden;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.beast-card .card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 6px;
}

.beast-card .card-top-meta {
  justify-content: space-between;
  width: 100%;
}

.admin-stat {
  min-width: 0;
}

.admin-stat strong {
  max-width: 100%;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-hero,
.admin-activity-panel,
.admin-players-panel,
.admin-detail-panel {
  border-radius: 3px;
  clip-path: polygon(var(--deck-cut) 0, calc(100% - var(--deck-cut)) 0, 100% var(--deck-cut), 100% calc(100% - var(--deck-cut)), calc(100% - var(--deck-cut)) 100%, var(--deck-cut) 100%, 0 calc(100% - var(--deck-cut)), 0 var(--deck-cut));
}

@media (max-width: 760px) {
  .view-heading {
    min-height: 82px;
    padding: 18px 10px 14px;
  }

  .view-heading h2,
  .admin-hero h2 {
    font-size: clamp(1.9rem, 9vw, 2.4rem);
  }

  .view-status-chip,
  .team-card-count {
    min-height: 40px;
    padding-inline: 11px;
    font-size: 0.76rem;
  }

  .battle-center-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .battle-center-head h2 {
    min-width: 0;
    font-size: clamp(1.75rem, 8.1vw, 2.15rem);
  }

  .battle-center-head .view-status-chip {
    padding-inline: 9px;
  }

  .battle-center-head .status-chip-suffix {
    display: none;
  }

  .team-mode-tab,
  .battle-mode-tab,
  .opponent-mode-tab,
  .shop-category-tabs button {
    min-height: 52px;
    padding-inline: 5px;
    font-size: 0.78rem;
    line-height: 1.18;
    white-space: normal;
  }

  .status-rail > div {
    grid-template-columns: auto;
    grid-template-rows: 30px auto auto;
    gap: 5px;
    min-height: 108px;
    padding: 10px 5px;
    text-align: center;
  }

  .status-rail-icon {
    grid-row: auto;
    justify-self: center;
  }

  .status-rail strong {
    align-self: center;
    font-size: 1.45rem;
  }

  .status-rail small {
    align-self: center;
    font-size: 0.72rem;
  }

  .empty-state {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 12px;
    min-height: 126px;
    padding: 16px 12px;
  }

  .empty-state-icon {
    width: 48px;
    height: 54px;
  }

  .empty-state > button {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .today-event,
  .battle-feature-card,
  .shop-feature {
    grid-template-columns: 40% minmax(0, 60%);
    min-height: 420px;
    padding-bottom: 92px;
  }

  .today-event-copy,
  .battle-feature-copy,
  .shop-feature-copy {
    position: relative;
    z-index: 1;
    grid-column: 2;
    width: auto;
    margin: 0;
    padding: 30px 14px 14px;
  }

  .today-event h3,
  .battle-feature-card h3,
  .shop-feature h3 {
    font-size: clamp(1.3rem, 6vw, 1.65rem);
  }

  .today-event-copy > button,
  .battle-feature-actions,
  .shop-buy {
    right: 16px;
    bottom: 16px;
    left: 16px;
  }

  .battle-feature-actions,
  .shop-buy {
    position: absolute;
    padding: 0;
  }

  .shop-buy {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px 12px;
  }

  .shop-buy .small {
    grid-column: 1 / -1;
  }

  .beast-card .card-top h3 {
    min-height: 2.4em;
    font-size: clamp(0.78rem, 3.7vw, 0.96rem);
  }

  .admin-stat strong {
    font-size: clamp(1.35rem, 7vw, 1.85rem);
  }
}
