:root {
  color-scheme: dark;
  --bg: #111118;
  --panel: #20212b;
  --panel-2: #292a36;
  --grid: #353745;
  --text: #f7f8ff;
  --muted: #aeb3c7;
  --player: #39e75f;
  --player-dark: #1da33d;
  --rival: #ff4fc3;
  --rival-dark: #ba2587;
  --preview: #ffe04b;
  --wall: #6f7484;
  --danger: #ff6a54;
  --ease-out-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.2, 1.35, 0.32, 1);
  --ease-press: cubic-bezier(0.34, 0, 0.66, 1);
  --press-scale: 0.96;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body,
.app-shell {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  padding-bottom: 184px;
  background:
    radial-gradient(circle at 16% 14%, rgba(57, 231, 95, 0.22), transparent 26rem),
    radial-gradient(circle at 88% 80%, rgba(255, 79, 195, 0.2), transparent 24rem),
    linear-gradient(135deg, #111118 0%, #171924 58%, #101014 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.home-active {
  min-height: 100vh;
  padding-bottom: 0;
  overflow: hidden;
}

body.game-active:not(.game-ready) .app-shell {
  opacity: 0;
  transform: translateY(12px) scale(0.99);
}

button {
  font: inherit;
  transform-origin: center;
  transition:
    transform 180ms var(--ease-spring),
    filter 160ms var(--ease-out-soft),
    box-shadow 180ms var(--ease-out-soft),
    background 180ms var(--ease-out-soft),
    border-color 180ms var(--ease-out-soft);
}

a {
  color: inherit;
  text-decoration: none;
}

button:active:not(:disabled) {
  transform: scale(var(--press-scale));
  transition-duration: 80ms;
  transition-timing-function: var(--ease-press);
}

@keyframes idle-breathe {
  0%, 100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.04);
  }
}

@keyframes idle-glow {
  0%, 100% {
    box-shadow: 0 0 0 rgba(255, 224, 75, 0);
  }

  50% {
    box-shadow: 0 0 18px rgba(255, 224, 75, 0.2);
  }
}

@keyframes idle-card-glow {
  0%, 100% {
    filter: brightness(1);
    box-shadow:
      0 18px 28px rgba(0, 0, 0, 0.38),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  50% {
    filter: brightness(1.05);
    box-shadow:
      0 20px 34px rgba(0, 0, 0, 0.42),
      0 0 18px rgba(57, 231, 95, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }

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

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }

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

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }

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

@keyframes hand-dock-in {
  from {
    opacity: 0;
    transform: translateY(34px) scale(0.985);
  }

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

@keyframes match-orb-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 79, 195, 0.08);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 0 12px rgba(255, 79, 195, 0.04);
    transform: scale(1.025);
  }
}

@keyframes match-card-search {
  0%, 100% {
    filter: brightness(1);
    transform: translateY(0) rotate(var(--search-rotate, 0deg));
  }

  50% {
    filter: brightness(1.08);
    transform: translateY(-8px) rotate(var(--search-rotate, 0deg));
  }
}

@keyframes home-arena-drift {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-5px) rotate(0.4deg);
  }
}

@keyframes home-cell-pop {
  0%, 100% {
    opacity: 0.96;
    transform: translateY(0) scale(1);
  }

  45% {
    opacity: 1;
    transform: translateY(-4px) scale(1.025);
  }
}

@keyframes home-attack-float {
  0%, 100% {
    transform: translateY(0) rotate(45deg) scale(0.82);
  }

  50% {
    transform: translateY(-7px) rotate(45deg) scale(0.9);
  }
}

@keyframes home-fortify-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      inset 0 0 0 5px rgba(10, 18, 32, 0.35),
      0 0 18px rgba(104, 214, 255, 0.18);
  }

  50% {
    transform: scale(1.025);
    box-shadow:
      inset 0 0 0 5px rgba(10, 18, 32, 0.35),
      0 0 20px rgba(104, 214, 255, 0.34);
  }
}

.app-shell {
  position: relative;
  width: min(1480px, 100%);
  min-height: calc(100vh - 184px);
  margin: 0 auto;
  padding: clamp(14px, 2vw, 28px);
  display: block;
}

.home-screen {
  position: relative;
  width: min(960px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
  display: grid;
  grid-template-rows: auto minmax(170px, 1fr) auto auto;
  align-items: center;
  gap: clamp(16px, 3vw, 28px);
}

body:not(.is-page-leaving) .home-screen {
  animation: page-enter 360ms var(--ease-out-soft) both;
}

body.game-ready:not(.is-page-leaving) .app-shell {
  opacity: 1;
  transform: none;
}

body.is-page-leaving .home-screen,
body.is-page-leaving .app-shell {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.985);
  transition:
    opacity 180ms var(--ease-out-soft),
    transform 180ms var(--ease-out-soft);
}

.pvp-screen {
  grid-template-rows: auto auto auto minmax(250px, 0.9fr) auto auto;
  align-items: center;
  gap: clamp(10px, 2vh, 18px);
}

.home-top {
  position: relative;
  display: grid;
  gap: 6px;
  padding-right: 132px;
  animation: panel-rise 360ms var(--ease-out-soft) both;
}

.home-top p {
  color: var(--muted);
  font-weight: 800;
}

.home-deck-button {
  position: absolute;
  top: 4px;
  right: 0;
  min-width: 112px;
  height: 54px;
  display: inline-grid;
  grid-template-columns: 34px auto;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid rgba(255, 224, 75, 0.42);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.86);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition:
    transform 180ms var(--ease-spring),
    filter 160ms var(--ease-out-soft),
    border-color 160ms var(--ease-out-soft);
}

.home-deck-button strong {
  color: var(--preview);
  font-size: 0.95rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.home-deck-button:hover {
  filter: brightness(1.12);
  transform: translateY(-2px) scale(1.02);
}

.home-deck-button:active {
  transform: scale(var(--press-scale));
  transition-duration: 80ms;
}

.deck-icon-card {
  position: relative;
  width: 27px;
  height: 32px;
  border: 2px solid var(--preview);
  border-radius: 5px;
  background:
    linear-gradient(90deg, transparent 48%, rgba(255, 224, 75, 0.48) 50%, transparent 52%),
    linear-gradient(0deg, transparent 48%, rgba(57, 231, 95, 0.46) 50%, transparent 52%),
    rgba(15, 16, 24, 0.7);
  transform: rotate(-6deg);
}

.deck-icon-card::after {
  content: "";
  position: absolute;
  right: -8px;
  bottom: -5px;
  width: 23px;
  height: 28px;
  border: 2px solid var(--player);
  border-radius: 5px;
  background: rgba(57, 231, 95, 0.15);
  transform: rotate(11deg);
}

.home-arena {
  width: min(420px, 72vw);
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(21, 22, 33, 0.9);
  animation:
    panel-rise 420ms var(--ease-out-soft) 45ms both,
    home-arena-drift 5.4s var(--ease-out-soft) 700ms infinite;
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 240ms var(--ease-out-soft);
}

.home-cell {
  border-radius: 8px;
  background: var(--grid);
  animation: home-cell-pop 4.8s var(--ease-out-soft) infinite;
  animation-delay: calc(var(--home-cell-index, 0) * -360ms);
  transform-origin: center;
  will-change: transform;
}

.home-cell.player {
  background: linear-gradient(145deg, var(--player), var(--player-dark));
}

.home-cell.rival {
  background: linear-gradient(145deg, var(--rival), var(--rival-dark));
}

.home-cell.preview {
  background: linear-gradient(145deg, var(--preview), #ff9e2c);
}

.home-cell.attack {
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.72), transparent 20%),
    linear-gradient(145deg, var(--danger), #ff2f91);
  animation: home-attack-float 3.2s var(--ease-spring) infinite;
}

.home-cell.fortified {
  background: linear-gradient(145deg, #68d6ff, #2679ff);
  animation: home-fortify-pulse 3.6s var(--ease-out-soft) infinite;
  box-shadow:
    inset 0 0 0 5px rgba(10, 18, 32, 0.35),
    0 0 18px rgba(104, 214, 255, 0.22);
}

.home-cell:nth-child(1) {
  --home-cell-index: 1;
}

.home-cell:nth-child(2) {
  --home-cell-index: 4;
}

.home-cell:nth-child(3) {
  --home-cell-index: 2;
}

.home-cell:nth-child(4) {
  --home-cell-index: 6;
}

.home-cell:nth-child(5) {
  --home-cell-index: 3;
}

.home-cell:nth-child(6) {
  --home-cell-index: 8;
}

.home-cell:nth-child(9) {
  --home-cell-index: 5;
}

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

.mode-card {
  position: relative;
  min-height: 154px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, #303242, #1d1e29);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: panel-rise 420ms var(--ease-out-soft) both;
  transition:
    transform 180ms var(--ease-spring),
    opacity 180ms var(--ease-out-soft),
    filter 180ms var(--ease-out-soft),
    border-color 180ms var(--ease-out-soft),
    box-shadow 180ms var(--ease-out-soft);
}

.mode-card:nth-child(2) {
  animation-delay: 70ms;
}

.mode-card:hover {
  transform: translateY(-3px) scale(1.01);
}

.mode-card:active {
  transform: translateY(0) scale(var(--press-scale));
}

.mode-card strong {
  font-size: clamp(2rem, 8vw, 4.4rem);
  line-height: 0.86;
}

.mode-card span:last-child {
  color: var(--muted);
  font-weight: 850;
}

.mode-card.pve {
  border-color: rgba(57, 231, 95, 0.36);
}

.mode-card.pvp {
  border-color: rgba(255, 79, 195, 0.36);
}

.deck-page {
  height: 100vh;
  padding-bottom: 0;
  overflow: hidden;
}

.deck-builder {
  width: min(1180px, 100%);
  height: 100vh;
  margin: 0 auto;
  padding: clamp(14px, 3vw, 30px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.deck-topbar {
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  backdrop-filter: blur(14px);
}

.deck-topbar h1 {
  font-size: clamp(2.2rem, 9vw, 4.2rem);
  line-height: 0.9;
}

.deck-topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 850;
}

.deck-home-button {
  width: 42px;
  height: 42px;
  font-size: 1.42rem;
}

.deck-summary,
.deck-selected-panel,
.deck-library-panel {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.86);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.26);
  animation: panel-rise 320ms var(--ease-out-soft) both;
}

.deck-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 130px 130px;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
}

.deck-meter,
.deck-count {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(15, 16, 24, 0.32);
}

.deck-meter {
  position: relative;
  overflow: hidden;
}

.deck-meter span,
.deck-count span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.deck-meter strong,
.deck-count strong {
  position: relative;
  z-index: 1;
  color: var(--preview);
  font-size: 1.6rem;
  line-height: 1;
}

.deck-meter strong {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.deck-meter strong small {
  color: var(--preview);
  font-size: 0.88em;
}

#deckPointTotal {
  font-size: 1.25em;
}

.deck-meter i {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--player), var(--preview));
  transition: width 220ms var(--ease-out-soft);
}

.deck-selected-panel,
.deck-library-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.deck-library-panel {
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.deck-summary .primary-button,
.deck-summary .secondary-button {
  width: 100%;
  height: 100%;
  min-height: 74px;
  margin-top: 0;
  align-self: stretch;
  font-size: 1.08rem;
}

.deck-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.deck-section-head h2 {
  font-size: 1rem;
}

.deck-section-head span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.deck-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.deck-auto-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 224, 75, 0.42);
  border-radius: 8px;
  background: rgba(255, 224, 75, 0.12);
  color: var(--preview);
  font-size: 0.78rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}

.deck-library-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(12, 13, 20, 0.34);
}

.deck-library-tab {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 950;
  cursor: pointer;
  transition:
    background 160ms var(--ease-out-soft),
    border-color 160ms var(--ease-out-soft),
    color 160ms var(--ease-out-soft),
    transform 160ms var(--ease-out-soft);
}

.deck-library-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.deck-library-tab.active {
  border-color: rgba(255, 224, 75, 0.42);
  background: rgba(255, 224, 75, 0.13);
  color: var(--preview);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.deck-tab-badge {
  min-width: 28px;
  padding: 2px 6px;
  border: 1px solid rgba(88, 214, 255, 0.68);
  border-radius: 999px;
  background: rgba(88, 214, 255, 0.14);
  color: #72e8ff;
  font-size: 0.64rem;
  font-weight: 1000;
  line-height: 1;
}

.selected-deck-list {
  min-height: 124px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
  scroll-snap-type: x proximity;
}

.deck-empty {
  width: 100%;
  min-height: 104px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 850;
}

.base-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 9px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.base-card-grid[hidden] {
  display: none;
}

.deck-card-button {
  --deck-dot-size: 12px;
  position: relative;
  min-height: 142px;
  display: grid;
  grid-template-rows: auto 1fr;
  place-items: center;
  gap: 8px;
  padding: 9px 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    radial-gradient(circle at 24% 16%, rgba(57, 231, 95, 0.2), transparent 42px),
    linear-gradient(180deg, rgba(48, 50, 66, 0.96), rgba(26, 27, 38, 0.98));
  color: var(--text);
  cursor: pointer;
  box-shadow:
    0 12px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition:
    transform 180ms var(--ease-spring),
    filter 160ms var(--ease-out-soft),
    border-color 160ms var(--ease-out-soft),
    opacity 160ms var(--ease-out-soft);
  scroll-snap-align: start;
}

.deck-card-button:hover {
  transform: translateY(-3px) scale(1.015);
  border-color: rgba(255, 224, 75, 0.34);
  filter: brightness(1.08);
}

.deck-card-button:active {
  transform: scale(var(--press-scale));
}

.deck-card-button.selected {
  border-color: rgba(57, 231, 95, 0.58);
  box-shadow:
    0 0 0 2px rgba(57, 231, 95, 0.18),
    0 12px 20px rgba(0, 0, 0, 0.28);
}

.deck-card-button.s0-card,
.reward-pack-choice.s0-card {
  border-color: rgba(88, 214, 255, 0.34);
  background:
    radial-gradient(circle at 22% 14%, rgba(88, 214, 255, 0.28), transparent 46px),
    linear-gradient(180deg, rgba(36, 48, 76, 0.98), rgba(18, 22, 38, 0.98));
}

.deck-card-button.s0-card:hover,
.reward-pack-choice.s0-card:hover {
  border-color: rgba(88, 214, 255, 0.72);
  filter: brightness(1.12) saturate(1.08);
}

.deck-card-button.s0-card.selected {
  border-color: rgba(88, 214, 255, 0.78);
  box-shadow:
    0 0 0 2px rgba(88, 214, 255, 0.2),
    0 12px 20px rgba(0, 0, 0, 0.28);
}

.deck-card-button.locked {
  cursor: not-allowed;
  opacity: 0.38;
}

.deck-card-button.compact {
  flex: 0 0 90px;
  min-height: 112px;
  --deck-dot-size: 9px;
}

.deck-card-badge {
  justify-self: start;
  padding: 2px 5px;
  border: 1px solid rgba(255, 224, 75, 0.38);
  border-radius: 6px;
  background: rgba(255, 224, 75, 0.1);
  color: var(--preview);
  font-size: 0.62rem;
  font-weight: 950;
}

.deck-card-score {
  justify-self: start;
  margin-top: -5px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
}

.deck-card-button.s0-card .deck-card-score,
.reward-pack-choice.s0-card .deck-card-score {
  color: #a8f4ff;
}

.deck-card-button.s0-card .deck-card-badge,
.reward-pack-choice.s0-card .deck-card-badge {
  border-color: rgba(88, 214, 255, 0.64);
  background: rgba(88, 214, 255, 0.16);
  color: #72e8ff;
}

.deck-card-button.s0-card .deck-card-point,
.reward-pack-choice.s0-card .deck-card-point {
  background: linear-gradient(145deg, #72e8ff, #5b7cff);
  color: #06101d;
}

.deck-card-point {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--player), #12b8ff);
  color: #07100a;
  font-size: 0.82rem;
  line-height: 1;
}

.deck-card-shape {
  display: grid;
  gap: 3px;
  place-content: center;
  min-width: 64px;
  min-height: 64px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(15, 16, 24, 0.28);
}

.deck-shape-dot {
  width: var(--deck-dot-size);
  height: var(--deck-dot-size);
  border-radius: 3px;
}

.deck-shape-dot.filled {
  background: linear-gradient(145deg, var(--player), var(--player-dark));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.deck-shape-dot.attack {
  border-radius: 3px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7), transparent 30%),
    linear-gradient(145deg, var(--danger), #ff2f91);
  transform: rotate(45deg) scale(0.86);
}

.deck-shape-dot.fortified {
  background: linear-gradient(145deg, #68d6ff, #2679ff);
  box-shadow:
    inset 0 0 0 3px rgba(10, 18, 32, 0.32),
    0 0 8px rgba(104, 214, 255, 0.22);
}

.mode-card.matching {
  border-color: rgba(255, 224, 75, 0.58);
  animation: idle-glow 1.6s var(--ease-out-soft) infinite;
}

.mode-kicker {
  color: var(--preview);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.mode-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  max-width: calc(100% - 18px);
  padding: 4px 7px;
  border: 1px solid rgba(255, 224, 75, 0.46);
  border-radius: 8px;
  background: rgba(255, 224, 75, 0.13);
  color: var(--preview);
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.mode-capacity {
  position: absolute;
  top: 36px;
  right: 9px;
  min-width: 48px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(15, 16, 24, 0.36);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.mode-card.full {
  opacity: 0.58;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.mode-card.full .mode-capacity {
  border-color: rgba(255, 106, 84, 0.48);
  background: rgba(255, 106, 84, 0.16);
  color: #ffb8ad;
}

.pvp-match {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 224, 75, 0.36);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.88);
  color: var(--preview);
  font-weight: 850;
  animation: panel-rise 360ms var(--ease-out-soft) 120ms both;
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 240ms var(--ease-out-soft),
    border-color 200ms var(--ease-out-soft),
    box-shadow 220ms var(--ease-out-soft);
}

.pvp-match > span {
  min-width: 0;
}

.pvp-match.standalone {
  width: min(520px, 100%);
  justify-self: center;
}

.pvp-room {
  width: min(520px, 100%);
  justify-self: center;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.9);
  animation: panel-rise 280ms var(--ease-spring) both;
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 240ms var(--ease-out-soft);
}

.room-head,
.room-player,
.room-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-head span,
.room-player span {
  color: var(--muted);
  font-weight: 850;
}

.room-head strong {
  color: var(--preview);
  font-size: 0.86rem;
}

.room-players {
  display: grid;
  gap: 8px;
}

.room-player {
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(15, 16, 24, 0.28);
}

.room-player.ready {
  border-color: rgba(57, 231, 95, 0.42);
}

.room-player strong {
  color: var(--text);
  font-size: 0.86rem;
}

.room-player.ready strong {
  color: var(--player);
}

.room-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

.room-actions .primary-button,
.room-actions .secondary-button {
  width: 100%;
  margin-top: 0;
}

.home-icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.42rem;
  font-weight: 950;
  line-height: 1;
}

.home-icon-button.power {
  border-color: rgba(255, 106, 84, 0.5);
  background: rgba(255, 106, 84, 0.16);
  color: #ff6a54;
}

.home-icon-button:hover {
  filter: brightness(1.12);
}

.pvp-exit-top,
.pve-exit-top {
  position: absolute;
  top: 2px;
  right: 0;
}

.match-orb {
  position: relative;
  width: min(260px, 58vw, 34vh);
  aspect-ratio: 1;
  justify-self: center;
  align-self: center;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 79, 195, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 224, 75, 0.16), transparent 34%),
    rgba(21, 22, 33, 0.86);
  animation: panel-rise 420ms var(--ease-out-soft) 80ms both;
  transition:
    opacity 240ms var(--ease-out-soft),
    transform 260ms var(--ease-out-soft),
    border-color 220ms var(--ease-out-soft);
}

.match-orb span {
  position: absolute;
  width: 44%;
  aspect-ratio: 1;
  border-radius: 8px;
}

.match-orb span:first-child {
  --search-rotate: 0deg;
  left: 18%;
  top: 22%;
  background: linear-gradient(145deg, var(--player), var(--player-dark));
}

.match-orb span:nth-child(2) {
  --search-rotate: 0deg;
  right: 18%;
  bottom: 22%;
  background: linear-gradient(145deg, var(--rival), var(--rival-dark));
}

.match-orb i {
  --search-rotate: 45deg;
  position: relative;
  width: 30%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--preview), #ff9e2c);
  transform: rotate(45deg);
  animation: idle-breathe 1.4s var(--ease-out-soft) infinite;
}

.pvp-matching .match-orb {
  animation: match-orb-pulse 1.35s var(--ease-out-soft) infinite;
}

.pvp-matching .match-orb span:first-child {
  --search-rotate: -2deg;
  animation: match-card-search 1.15s var(--ease-spring) infinite;
}

.pvp-matching .match-orb span:nth-child(2) {
  --search-rotate: 2deg;
  animation: match-card-search 1.15s var(--ease-spring) 140ms infinite;
}

.pvp-matching .match-orb i {
  animation:
    idle-breathe 900ms var(--ease-out-soft) infinite,
    match-card-search 1.15s var(--ease-spring) 70ms infinite;
}

.pvp-matching .pvp-start-button.cancel {
  animation: idle-glow 1.15s var(--ease-out-soft) infinite;
}

.pvp-room-active .match-orb {
  opacity: 0.58;
  transform: translateY(-8px) scale(0.92);
}

.pvp-room-active .pvp-stats {
  opacity: 0.78;
  transform: translateY(-4px);
}

.pvp-room-active .pvp-name-card,
.pvp-matching .pvp-name-card {
  opacity: 0.82;
  transform: translateY(-6px) scale(0.98);
}

.pvp-state-shift .pvp-match,
.pvp-state-shift .pvp-room,
.pvp-state-shift .pvp-game,
.pvp-state-shift .match-orb,
.pvp-state-shift .pvp-stats,
.pvp-state-shift .pvp-leaderboard {
  will-change: opacity, transform;
}

.pvp-stats {
  width: min(520px, 100%);
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  animation: panel-rise 360ms var(--ease-out-soft) 35ms both;
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 240ms var(--ease-out-soft);
}

.pvp-stats span {
  min-height: 34px;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.82);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.pvp-stats strong {
  color: var(--preview);
  font-size: 1rem;
}

.pvp-leaderboard {
  width: min(660px, 100%);
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 224, 75, 0.16);
  border-radius: 8px;
  background: rgba(16, 18, 26, 0.46);
  animation: panel-rise 360ms var(--ease-out-soft) 55ms both;
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 240ms var(--ease-out-soft);
}

.pvp-leaderboard-item {
  min-width: 0;
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "name"
    "score";
  place-items: center;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.82);
}

.pvp-leaderboard-item.gold {
  border-color: rgba(255, 224, 75, 0.4);
}

.pvp-leaderboard-item.silver {
  border-color: rgba(205, 214, 232, 0.32);
}

.pvp-leaderboard-item.bronze {
  border-color: rgba(218, 139, 82, 0.36);
}

.rank-medal {
  display: inline-block;
  margin-right: 6px;
  font-size: 1.1rem;
  line-height: 1;
  vertical-align: -0.08em;
}

.pvp-leaderboard-item strong {
  grid-area: name;
  width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 950;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pvp-leaderboard-item small {
  grid-area: score;
  width: 100%;
  color: var(--preview);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1;
  text-align: center;
}

.pvp-name-card {
  width: min(520px, 100%);
  justify-self: center;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 224, 75, 0.2);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.76);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.2);
  animation: panel-rise 360ms var(--ease-out-soft) 70ms both;
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 240ms var(--ease-out-soft);
}

body:not(.pvp-name-editing) .pvp-name-card {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);
}

.pvp-rank-card {
  width: min(320px, 70vw);
  justify-self: center;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 224, 75, 0.38);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.82);
  color: var(--muted);
  font-weight: 950;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.2);
  animation: panel-rise 360ms var(--ease-out-soft) 85ms both;
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 240ms var(--ease-out-soft);
}

.pvp-name-editing .pvp-rank-card {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
}

.pvp-rank-card strong {
  position: relative;
  color: var(--preview);
  font-size: 1.6rem;
  line-height: 1;
}

.pvp-rank-card strong::after {
  content: attr(data-delta);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  color: var(--preview);
  font-size: 0.78rem;
  transform: translateY(-50%);
}

.pvp-rank-card strong.up::after {
  color: var(--player);
}

.pvp-rank-card strong.down::after {
  color: #ff6a54;
}

.pvp-name-card label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.pvp-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
}

.pvp-name-row input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 224, 75, 0.34);
  border-radius: 8px;
  background: rgba(14, 16, 24, 0.72);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  outline: none;
  transition:
    border-color 180ms var(--ease-out-soft),
    box-shadow 180ms var(--ease-out-soft),
    transform 180ms var(--ease-spring);
}

.pvp-name-row input:focus {
  border-color: rgba(255, 224, 75, 0.78);
  box-shadow: 0 0 0 3px rgba(255, 224, 75, 0.14);
}

.pvp-name-row button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(57, 231, 95, 0.42);
  border-radius: 8px;
  background: rgba(57, 231, 95, 0.16);
  color: var(--preview);
  font-weight: 950;
}

.pvp-game {
  width: min(760px, 100%);
  justify-self: center;
  display: grid;
  gap: 12px;
  animation: panel-rise 320ms var(--ease-spring) both;
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 240ms var(--ease-out-soft);
}

.pvp-in-game .pvp-screen {
  width: min(820px, 100%);
  min-height: 100vh;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 10px;
  padding-top: clamp(10px, 2vw, 18px);
}

.pvp-in-game .home-top,
.pvp-in-game .match-orb,
.pvp-in-game .pvp-stats,
.pvp-in-game .pvp-leaderboard,
.pvp-in-game .pvp-name-card,
.pvp-in-game .pvp-rank-card {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.96);
  visibility: hidden;
}

.pvp-in-game .pvp-start-button,
.pvp-in-game .pvp-test-button,
.pvp-in-game .pvp-edit-name-button {
  display: none;
}

.pvp-in-game .pvp-match.standalone {
  width: min(760px, 100%);
  min-height: 46px;
  padding: 8px 10px;
}

.pvp-in-game .pvp-game,
.pvp-in-game .pvp-match.standalone {
  justify-self: center;
}

.pvp-in-game .pvp-board {
  width: min(100%, 620px);
  min-width: 0;
  max-height: min(62vh, 620px);
}

.pvp-in-game .pvp-hand-grid {
  width: 100%;
  justify-self: center;
}

.pvp-in-game .pvp-drag-actions {
  left: 50%;
  right: auto;
  transform: translate(-50%, 10px);
}

.pvp-in-game .pvp-drag-actions.visible {
  transform: translate(-50%, 0);
}

.pvp-in-game .home-icon-button:not(.pvp-exit-top) {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  font-size: 1.24rem;
}

.pvp-start-button,
.pvp-test-button,
.pvp-edit-name-button {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 224, 75, 0.32);
  border-radius: 8px;
  background: rgba(255, 224, 75, 0.12);
  color: var(--preview);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.pvp-edit-name-button {
  width: 34px;
  padding: 0;
  border-color: rgba(255, 224, 75, 0.52);
  background: rgba(255, 224, 75, 0.08);
  color: var(--preview);
  font-size: 1rem;
}

.pvp-start-button {
  background: linear-gradient(135deg, var(--player), #12b8ff);
  border-color: rgba(57, 231, 95, 0.46);
  color: #07100a;
}

.pvp-start-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.pvp-start-button.cancel {
  background: rgba(255, 106, 84, 0.16);
  border-color: rgba(255, 106, 84, 0.5);
  color: #ffb8ad;
}

.pvp-result-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 10, 16, 0.68);
  backdrop-filter: blur(10px);
  animation: pvp-result-fade 240ms var(--ease-out-soft) both;
}

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

.pvp-result-card {
  position: relative;
  width: min(380px, 92vw);
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(255, 224, 75, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(32, 33, 43, 0.98), rgba(17, 17, 24, 0.98)),
    var(--panel);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  animation: pvp-result-card-in 360ms var(--ease-spring) both;
}

.pvp-result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(255, 224, 75, 0.16), transparent 62%);
}

.pvp-result-modal.win .pvp-result-card {
  border-color: rgba(57, 231, 95, 0.42);
}

.pvp-result-modal.lose .pvp-result-card {
  border-color: rgba(255, 106, 84, 0.46);
}

.pvp-result-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
}

.pvp-result-kicker {
  color: var(--preview);
  font-size: 0.78rem;
  font-weight: 950;
}

.pvp-result-card h2 {
  margin: 0;
  color: var(--preview);
  font-size: clamp(2.25rem, 10vw, 4rem);
  line-height: 1;
}

.pvp-result-modal.win .pvp-result-card h2 {
  color: var(--player);
}

.pvp-result-modal.lose .pvp-result-card h2 {
  color: #ff8d7c;
}

.pvp-result-score {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.pvp-rank-change {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "label delta"
    "text text";
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  min-height: 82px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.pvp-rank-change.bonus-merged {
  animation: rank-bonus-panel 620ms var(--ease-spring) both;
}

.pvp-rank-change span {
  grid-area: label;
  color: var(--muted);
  font-weight: 950;
}

.pvp-rank-change strong {
  grid-area: delta;
  color: var(--preview);
  font-size: 2rem;
  line-height: 1;
}

.pvp-rank-change strong.up {
  color: var(--player);
}

.pvp-rank-change strong.down {
  color: #ff6a54;
}

.pvp-rank-change strong.bonus-bump {
  animation: rank-bonus-bump 620ms var(--ease-spring) both;
}

.pvp-rank-change small {
  grid-area: text;
  color: var(--muted);
  font-weight: 850;
}

.rank-bonus-fly {
  position: fixed;
  z-index: 90;
  width: 52px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(57, 231, 95, 0.88);
  border-radius: 8px;
  background: rgba(12, 20, 16, 0.94);
  color: var(--player);
  font-size: 1.35rem;
  font-weight: 1000;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 0 12px rgba(57, 231, 95, 0.74);
  box-shadow:
    0 0 0 3px rgba(57, 231, 95, 0.12),
    0 12px 24px rgba(0, 0, 0, 0.36);
}

.reward-pack-modal {
  position: fixed;
  inset: 0;
  z-index: 86;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 10, 16, 0.72);
  backdrop-filter: blur(10px);
  animation: pvp-result-fade 240ms var(--ease-out-soft) both;
}

.reward-pack-modal[hidden],
.reward-pack-section[hidden] {
  display: none;
}

.reward-pack-card,
.reward-pack-section {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 224, 75, 0.3);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 224, 75, 0.14), transparent 58%),
    linear-gradient(145deg, rgba(32, 33, 43, 0.98), rgba(17, 17, 24, 0.98));
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
  text-align: center;
  animation: pvp-result-card-in 360ms var(--ease-spring) both;
}

.reward-pack-card {
  width: min(520px, 94vw);
}

.reward-pack-section {
  padding: 14px;
  box-shadow: none;
}

.reward-pack-kicker {
  color: var(--preview);
  font-size: 0.74rem;
  font-weight: 950;
}

.reward-pack-card h2,
.reward-pack-section p,
.reward-pack-card p {
  margin: 0;
}

.reward-pack-card h2 {
  color: var(--preview);
  font-size: clamp(1.55rem, 6vw, 2.6rem);
  line-height: 1;
}

.reward-pack-card p,
.reward-pack-section p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.reward-pack-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.reward-pack-choice {
  --deck-dot-size: 10px;
  position: relative;
  min-height: 142px;
  display: grid;
  grid-template-rows: auto 1fr;
  place-items: center;
  gap: 8px;
  padding: 10px 7px;
  border: 1px solid rgba(255, 224, 75, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(circle at 26% 16%, rgba(57, 231, 95, 0.18), transparent 42px),
    linear-gradient(180deg, rgba(48, 50, 66, 0.96), rgba(26, 27, 38, 0.98));
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition:
    transform 180ms var(--ease-spring),
    border-color 160ms var(--ease-out-soft),
    filter 160ms var(--ease-out-soft);
}

.reward-pack-choice::before {
  content: "?";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 224, 75, 0.2), transparent 44%),
    repeating-linear-gradient(45deg, #242634 0 8px, #1a1b26 8px 16px);
  color: rgba(255, 224, 75, 0.86);
  font-size: 3rem;
  font-weight: 1000;
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 260ms var(--ease-spring);
  z-index: 2;
}

.reward-pack-choice:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(255, 224, 75, 0.52);
  filter: brightness(1.08);
}

.reward-pack-choice:active {
  transform: scale(var(--press-scale));
}

.reward-pack-choice.revealed::before,
.reward-pack-choice.chosen::before {
  opacity: 0;
  transform: rotateY(76deg) scale(0.8);
  pointer-events: none;
}

.reward-pack-choice.chosen {
  border-color: rgba(57, 231, 95, 0.72);
  box-shadow:
    0 0 0 2px rgba(57, 231, 95, 0.18),
    0 16px 28px rgba(0, 0, 0, 0.34);
}

.reward-pack-choice.duplicate {
  border-color: rgba(255, 224, 75, 0.48);
}

.reward-duplicate-tag {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 1;
  padding: 3px 5px;
  border: 1px solid rgba(255, 224, 75, 0.46);
  border-radius: 6px;
  background: rgba(255, 224, 75, 0.14);
  color: var(--preview);
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
}

.reward-pack-choice:disabled {
  cursor: default;
}

.reward-pack-choice:not(.chosen):disabled {
  opacity: 0.46;
}

@keyframes pvp-result-fade {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }

  to {
    opacity: 1;
    backdrop-filter: blur(10px);
  }
}

@keyframes pvp-result-card-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.94);
  }

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

@keyframes rank-bonus-panel {
  0% {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
  }

  38% {
    border-color: rgba(57, 231, 95, 0.82);
    box-shadow:
      0 0 0 3px rgba(57, 231, 95, 0.18),
      0 0 26px rgba(57, 231, 95, 0.26);
  }

  100% {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
  }
}

@keyframes rank-bonus-bump {
  0% {
    transform: scale(1);
    text-shadow: none;
  }

  36% {
    transform: scale(1.28);
    text-shadow: 0 0 18px rgba(57, 231, 95, 0.72);
  }

  100% {
    transform: scale(1);
    text-shadow: none;
  }
}

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

.pvp-board {
  width: min(100%, 620px);
  min-width: 0;
  max-height: none;
  justify-self: center;
}

.pvp-board .cell.valid-preview {
  outline-width: 4px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.2),
    0 0 14px rgba(255, 224, 75, 0.38);
}

.pvp-board .cell.invalid-preview {
  outline-width: 4px;
  box-shadow: 0 0 12px rgba(255, 106, 84, 0.34);
}

.pvp-playbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.9);
}

.pvp-playbar p {
  color: var(--preview);
  font-weight: 900;
}

.pvp-opponent-disconnected .pvp-playbar p {
  color: #ffe7a8;
  animation: disconnectPulse 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.pvp-playbar span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

@keyframes disconnectPulse {
  0%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    opacity: 0.78;
    transform: translateY(-1px);
  }
}

.pvp-tools {
  display: grid;
  grid-template-columns: minmax(70px, auto) minmax(78px, auto);
  gap: 8px;
}

.pvp-surrender-button {
  min-width: 70px;
  padding-inline: 12px;
}

.pvp-hand-grid {
  position: relative;
  min-height: 154px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

.pvp-card {
  position: relative;
  flex: 0 0 118px;
  width: 118px;
  height: 142px;
  transform:
    translateY(calc(var(--card-abs-offset) * 5px))
    rotate(calc(var(--card-offset) * 3deg));
}

.pvp-card + .pvp-card {
  margin-left: -24px;
}

.pvp-card:hover,
.pvp-card:focus-visible,
.pvp-card.selected {
  transform: translateY(-20px) rotate(0deg) scale(1.04);
}

.pvp-card:active:not(:disabled) {
  transform: translateY(calc(var(--card-abs-offset) * 5px)) scale(var(--press-scale));
}

.pvp-drag-ghost {
  z-index: 40;
}

.pvp-drag-actions {
  left: 50%;
  right: auto;
  bottom: 132px;
  width: min(520px, calc(100vw - 48px));
  transform: translate(-50%, 10px);
}

.pvp-drag-actions.visible {
  transform: translate(-50%, 0);
}

.board-panel,
.control-panel {
  min-width: 0;
}

.game-ready .board-panel {
  animation: panel-rise 360ms var(--ease-out-soft) both;
}

.game-ready .control-panel {
  animation: panel-rise 380ms var(--ease-out-soft) 50ms both;
}

.game-ready .hand-section {
  animation: hand-dock-in 420ms var(--ease-spring) 90ms both;
}

.game-ready .board {
  transition:
    transform 220ms var(--ease-out-soft),
    opacity 220ms var(--ease-out-soft),
    box-shadow 220ms var(--ease-out-soft);
}

.topbar {
  position: relative;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pve-topbar {
  padding-right: 54px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3vw, 4rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.title-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.version-badge {
  margin-top: 3px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 224, 75, 0.42);
  border-radius: 8px;
  background: rgba(255, 224, 75, 0.12);
  color: var(--preview);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  animation: idle-breathe 3.4s var(--ease-out-soft) infinite;
}

.topbar p,
.phase-card p,
.status-text,
.section-head span {
  color: var(--muted);
}

.score-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.exit-button {
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(41, 42, 54, 0.92);
  color: var(--text);
  font-weight: 900;
  white-space: nowrap;
}

.exit-button:hover {
  filter: brightness(1.12);
}

.score-chip {
  min-width: 92px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.9);
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  transition:
    transform 180ms var(--ease-spring),
    border-color 180ms var(--ease-out-soft),
    filter 180ms var(--ease-out-soft);
}

.score-chip strong {
  margin-left: 4px;
  color: var(--text);
}

.score-chip.player {
  border-color: rgba(57, 231, 95, 0.45);
  animation: idle-glow 3.8s var(--ease-out-soft) infinite;
}

.score-chip.rival {
  border-color: rgba(255, 79, 195, 0.45);
}

.score-chip.ai {
  border-color: rgba(255, 224, 75, 0.42);
  color: var(--preview);
}

.map-bar {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 8px;
}

.map-bar > span {
  color: var(--preview);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.map-picker {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0;
}

.map-button,
.map-select {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(41, 42, 54, 0.92);
  color: var(--muted);
  cursor: pointer;
}

.map-button {
  border-radius: 8px 0 0 8px;
  border-right: 0;
  color: var(--text);
  font-weight: 850;
}

.map-button.sound {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 0;
  border-radius: 0 8px 8px 0;
}

.map-select {
  max-width: 190px;
  border-radius: 0;
  color: var(--text);
}

.map-button:hover,
.map-select:hover {
  filter: brightness(1.12);
}

.board-wrap {
  position: relative;
  display: grid;
  justify-items: center;
  align-items: start;
  min-height: calc(100vh - 260px);
  width: 100%;
  padding-bottom: 18px;
}

.board {
  width: min(calc(100vw - 460px), calc(100vh - 540px), 900px);
  max-height: none;
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #151621;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
}

.cell {
  position: relative;
  min-width: 0;
  border: 0;
  border-radius: 5px;
  background: var(--grid);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: crosshair;
}

.cell.player {
  background: linear-gradient(145deg, var(--player), var(--player-dark));
}

.cell.rival {
  background: linear-gradient(145deg, var(--rival), var(--rival-dark));
}

.cell.fortified::before {
  content: "";
  position: absolute;
  inset: 18%;
  border: 2px solid rgba(104, 214, 255, 0.92);
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.26),
    0 0 8px rgba(104, 214, 255, 0.42);
  pointer-events: none;
}

.cell.wall {
  background: repeating-linear-gradient(135deg, #6e7382, #6e7382 7px, #555a68 7px, #555a68 14px);
}

.cell.void {
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.cell.anchor::after {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.52);
}

.cell.valid-preview {
  outline: 3px solid var(--preview);
  outline-offset: -3px;
  background: color-mix(in srgb, var(--preview) 58%, var(--grid));
}

.cell.rival.valid-preview.attack-preview {
  outline-color: var(--danger);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 224, 75, 0.86) 0 18%, transparent 20%),
    linear-gradient(145deg, var(--danger), var(--rival-dark));
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.22),
    0 0 14px rgba(255, 106, 84, 0.52);
}

.cell.invalid-preview {
  outline: 3px solid var(--danger);
  outline-offset: -3px;
}

.tutorial-coach {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 11;
  width: min(320px, calc(100% - 36px));
  padding: 12px;
  border: 1px solid rgba(255, 224, 75, 0.45);
  border-radius: 8px;
  background: rgba(18, 18, 26, 0.88);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(8px);
  animation: pop-in 260ms var(--ease-spring);
  transition:
    opacity 220ms var(--ease-out-soft),
    transform 260ms var(--ease-spring),
    box-shadow 220ms var(--ease-out-soft);
}

.tutorial-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.tutorial-close:hover {
  color: var(--text);
  filter: brightness(1.12);
}

.tutorial-step {
  display: block;
  padding-right: 30px;
  margin-bottom: 5px;
  color: var(--preview);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tutorial-coach p {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.35;
}

.tutorial-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tutorial-button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--preview);
  color: #15130a;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.tutorial-button.ghost {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.tutorial-button.danger {
  background: rgba(255, 106, 84, 0.2);
  color: #ffb8ad;
}

.tutorial-board {
  box-shadow:
    0 0 0 2px rgba(255, 224, 75, 0.28),
    0 18px 52px rgba(0, 0, 0, 0.35);
  animation: idle-glow 3.2s var(--ease-out-soft) infinite;
}

.tutorial-highlight {
  outline: 2px solid rgba(255, 224, 75, 0.82);
  outline-offset: 4px;
  animation: idle-breathe 2.8s var(--ease-out-soft) infinite;
}

.drag-actions.tutorial-highlight .drag-action-zone {
  border-color: var(--preview);
  background: rgba(255, 224, 75, 0.18);
  box-shadow:
    0 0 0 3px rgba(255, 224, 75, 0.14),
    0 12px 26px rgba(0, 0, 0, 0.32);
}

.control-panel {
  position: fixed;
  top: clamp(92px, 8vw, 140px);
  right: max(12px, calc((100vw - 1480px) / 2 + 12px));
  z-index: 18;
  width: min(300px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 0;
  max-height: calc(100vh - 28px);
}

.phase-card,
.legend {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.88);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.phase-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.phase-card.is-hidden {
  display: none;
}

.status-text {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.88);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--preview);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.phase-card h2,
.section-head h2 {
  font-size: 1.15rem;
}

.mini-preview {
  --mini-size: 18px;
  min-height: 82px;
  display: grid;
  place-content: center;
  grid-auto-rows: var(--mini-size);
  gap: 3px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  cursor: grab;
  touch-action: none;
}

.mini-cell {
  width: var(--mini-size);
  height: var(--mini-size);
  border-radius: 4px;
  background: transparent;
}

.mini-cell.filled {
  background: var(--player);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.tool-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.icon-button,
.primary-button,
.secondary-button {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  font-size: 1.35rem;
  font-weight: 900;
}

.icon-button:hover,
.card-button:hover,
.primary-button:hover,
.secondary-button:hover {
  filter: brightness(1.12);
}

.icon-button:disabled,
.card-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.secondary-button {
  font-weight: 850;
}

.secondary-button.danger {
  background: rgba(255, 106, 84, 0.18);
  color: #ffb8ad;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.hand-section {
  position: fixed;
  left: max(12px, calc((100vw - min(900px, calc(100vw - 24px))) / 2));
  bottom: 0;
  z-index: 12;
  width: min(900px, calc(100vw - 24px));
  min-height: 196px;
  padding: 12px 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(180deg, rgba(33, 34, 45, 0.95), rgba(18, 18, 26, 0.98)),
    rgba(32, 33, 43, 0.94);
  box-shadow: 0 -18px 52px rgba(0, 0, 0, 0.34);
}

.hand-play-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: end;
  gap: 14px;
}

.hand-grid {
  position: relative;
  height: 144px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
  perspective: 900px;
}

.game-actions {
  display: grid;
  gap: 8px;
  align-self: end;
}

.card-button {
  position: absolute;
  bottom: 0;
  width: 128px;
  height: 154px;
  display: grid;
  grid-template-rows: 1fr;
  gap: 0;
  justify-items: center;
  align-content: center;
  place-items: center;
  padding: 16px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    radial-gradient(circle at 25% 12%, rgba(57, 231, 95, 0.24), transparent 46px),
    linear-gradient(180deg, #303242, #1f202d 68%, #171822);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  touch-action: none;
  box-shadow:
    0 18px 28px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform:
    translateX(calc(var(--card-offset) * 74px))
    translateY(calc(var(--card-abs-offset) * 8px))
    rotate(calc(var(--card-offset) * 5deg));
  transition:
    transform 240ms var(--ease-spring),
    filter 180ms var(--ease-out-soft),
    box-shadow 220ms var(--ease-out-soft),
    border-color 180ms var(--ease-out-soft);
}

.card-button * {
  pointer-events: none;
}

.card-button.selected {
  border-color: var(--preview);
  box-shadow:
    0 0 0 2px rgba(255, 224, 75, 0.34),
    0 18px 34px rgba(0, 0, 0, 0.42);
}

.card-button:hover,
.card-button:focus-visible,
.card-button.selected {
  z-index: 4;
  filter: brightness(1.08);
  transform:
    translateX(calc(var(--card-offset) * 74px))
    translateY(-34px)
    rotate(0deg)
    scale(1.06);
}

.card-button:not(:disabled):not(:hover):not(:focus-visible):not(.selected) {
  animation: idle-card-glow 4.2s var(--ease-out-soft) infinite;
  animation-delay: calc(var(--card-index) * -420ms);
}

.card-button:active:not(:disabled) {
  transform:
    translateX(calc(var(--card-offset) * 74px))
    translateY(calc(var(--card-abs-offset) * 8px))
    rotate(calc(var(--card-offset) * 5deg))
    scale(var(--press-scale));
}

.card-cost {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--player), #15b9ff);
  color: #07100a;
  font-size: 0.9rem;
  font-weight: 950;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.24);
}

.card-button:active,
.mini-preview:active {
  cursor: grabbing;
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 24;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid rgba(255, 224, 75, 0.65);
  border-radius: 8px;
  background: rgba(15, 16, 24, 0.9);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  opacity: 0;
  pointer-events: none;
  transform: translate(-9999px, -9999px);
}

.drag-ghost.visible {
  opacity: 1;
}

.drag-actions {
  position: fixed;
  left: max(10px, calc(50vw - 220px));
  right: max(10px, calc(50vw - 220px));
  bottom: 194px;
  z-index: 21;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 180ms var(--ease-out-soft),
    transform 240ms var(--ease-spring);
}

.drag-actions.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.drag-action-zone {
  min-height: 104px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(255, 224, 75, 0.62);
  border-radius: 8px;
  background: rgba(32, 33, 43, 0.72);
  color: var(--text);
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(5px);
  transition:
    background 180ms var(--ease-out-soft),
    border-color 180ms var(--ease-out-soft),
    transform 220ms var(--ease-spring),
    box-shadow 180ms var(--ease-out-soft);
  animation: idle-breathe 3.6s var(--ease-out-soft) infinite;
}

.drag-action-zone.armed {
  border-color: var(--preview);
  background: rgba(255, 224, 75, 0.2);
  transform: scale(1.03);
  animation: idle-glow 1.4s var(--ease-out-soft) infinite;
}

.drag-action-zone span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  border-radius: 6px;
  background: var(--preview);
  color: #17120a;
  font-size: 0.78rem;
}


.card-shape {
  --shape-size: 15px;
  display: grid;
  gap: 4px;
  place-self: center;
  place-content: center;
  min-width: 88px;
  min-height: 88px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(15, 16, 24, 0.28);
}

.shape-dot {
  width: var(--shape-size);
  height: var(--shape-size);
  border-radius: 4px;
  background: transparent;
}

.shape-dot.filled {
  background: linear-gradient(145deg, var(--player), var(--player-dark));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 5px 10px rgba(57, 231, 95, 0.2);
}

.shape-dot.attack {
  border-radius: 3px;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.74), transparent 22%),
    linear-gradient(145deg, var(--danger), #ff2f91);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.28),
    0 0 10px rgba(255, 106, 84, 0.38),
    0 5px 12px rgba(255, 47, 145, 0.22);
  transform: rotate(45deg) scale(0.88);
}

.shape-dot.fortified {
  position: relative;
  background: linear-gradient(145deg, #68d6ff, #2679ff);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.32),
    0 0 10px rgba(104, 214, 255, 0.38),
    inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.shape-dot.fortified::after {
  content: "";
  position: absolute;
  inset: 24%;
  border: 2px solid rgba(7, 16, 31, 0.76);
  border-top-width: 3px;
  border-radius: 3px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.swatch.player {
  background: var(--player);
}

.swatch.rival {
  background: var(--rival);
}

.swatch.preview {
  background: var(--preview);
}

.swatch.wall {
  background: var(--wall);
}

.game-over {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 10, 14, 0.65);
  backdrop-filter: blur(6px);
  animation: pop-in 240ms var(--ease-out-soft);
  transition:
    opacity 220ms var(--ease-out-soft),
    backdrop-filter 220ms var(--ease-out-soft);
}

.game-over[hidden] {
  display: none;
}

.result-card {
  width: min(390px, 92vw);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #20212b;
  text-align: center;
  animation: pop-in 300ms var(--ease-spring);
  transition:
    transform 260ms var(--ease-spring),
    box-shadow 220ms var(--ease-out-soft);
}

.result-card span {
  color: var(--preview);
  font-weight: 800;
  text-transform: uppercase;
}

.result-card h2 {
  margin: 6px 0 8px;
  font-size: 2.2rem;
}

.result-card p {
  color: var(--muted);
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  background: linear-gradient(135deg, var(--player), #12b8ff);
  color: #07100a;
  font-weight: 900;
}

@media (max-width: 1060px) {
  .app-shell {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
    width: min(760px, calc(100vw - 32px));
    margin: 8px auto 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding-top: 0;
    max-height: none;
  }

  .board-wrap {
    min-height: auto;
  }

  .board {
    width: min(100%, calc(100vh - 540px), 760px);
    max-height: none;
    min-width: 0;
  }

  .hand-grid {
    height: 132px;
  }

  .card-button {
    width: 116px;
    height: 142px;
    transform:
      translateX(calc(var(--card-offset) * 64px))
      translateY(calc(var(--card-abs-offset) * 7px))
      rotate(calc(var(--card-offset) * 5deg));
  }

  .card-button:hover,
  .card-button:focus-visible,
  .card-button.selected {
    transform:
      translateX(calc(var(--card-offset) * 64px))
      translateY(-30px)
      rotate(0deg)
      scale(1.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 640px), (pointer: coarse) {
  body {
    background: #111118;
  }

  body.home-active {
    overflow-y: auto;
  }

  button {
    transition:
      transform 150ms var(--ease-spring),
      background 140ms var(--ease-out-soft),
      border-color 140ms var(--ease-out-soft);
  }

  .version-badge,
  .score-chip.player,
  .tutorial-highlight,
  .drag-action-zone,
  .drag-action-zone.armed,
  .mode-card.matching,
  .home-arena,
  .card-button:not(:disabled):not(:hover):not(:focus-visible):not(.selected) {
    animation: none;
  }

  .home-cell {
    animation-duration: 6.4s;
  }

  .home-cell.attack {
    animation-duration: 4.6s;
  }

  .home-cell.fortified {
    animation-duration: 5.2s;
  }

  .board,
  .home-arena,
  .mode-card,
  .hand-section,
  .tutorial-coach,
  .drag-ghost,
  .drag-action-zone,
  .game-over,
  .result-card {
    box-shadow: none;
  }

  .tutorial-coach,
  .drag-action-zone,
  .game-over {
    backdrop-filter: none;
  }

  .card-button {
    box-shadow:
      0 8px 14px rgba(0, 0, 0, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition:
      transform 160ms var(--ease-spring),
      border-color 140ms var(--ease-out-soft);
  }

  .card-button.selected {
    box-shadow: 0 0 0 2px rgba(255, 224, 75, 0.34);
  }

  .card-button:hover,
  .card-button:focus-visible,
  .card-button.selected {
    filter: none;
  }

  .cell {
    box-shadow: none;
  }

  .drag-action-zone {
    background: rgba(32, 33, 43, 0.88);
    transition:
      background 150ms var(--ease-out-soft),
      border-color 150ms var(--ease-out-soft),
      transform 170ms var(--ease-spring);
  }
}

@media (max-width: 640px) {
  body {
    --mobile-hand-height: 122px;
    padding-bottom: calc(var(--mobile-hand-height) + env(safe-area-inset-bottom, 0px));
  }

  body.game-active {
    min-height: 100svh;
    overflow-x: hidden;
    padding-bottom: calc(var(--mobile-hand-height) + env(safe-area-inset-bottom, 0px) + 10px);
  }

  body.pvp-page {
    height: 100svh;
    padding-bottom: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.pvp-in-game {
    --pvp-mobile-hand-space: 122px;
    --pvp-mobile-zone-space: 62px;
    --pvp-mobile-stage-width: 100vw;
    height: 100svh;
    padding-bottom: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .home-screen {
    min-height: 100svh;
    padding: 14px 12px 18px;
    grid-template-rows: auto minmax(140px, 1fr) auto auto;
    gap: 14px;
  }

  .pvp-screen {
    width: 100vw;
    min-height: 100svh;
    height: 100svh;
    padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
    grid-template-rows: auto auto auto minmax(140px, 1fr) auto;
    align-content: stretch;
    gap: 9px;
    overflow: hidden;
  }

  .home-top h1 {
    font-size: 2.15rem;
  }

  .home-top {
    min-height: 44px;
    gap: 2px;
    padding-right: 54px;
  }

  .pvp-page .home-top p {
    font-size: 0.78rem;
    line-height: 1;
  }

  .home-deck-button {
    top: 2px;
    min-width: 92px;
    height: 48px;
    grid-template-columns: 30px auto;
    gap: 7px;
    padding: 0 9px;
  }

  .home-deck-button strong {
    font-size: 0.82rem;
  }

  .deck-icon-card {
    width: 24px;
    height: 29px;
  }

  .deck-topbar {
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .deck-home-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 1.28rem;
  }

  .deck-summary {
    grid-template-columns: minmax(0, 1fr) 70px 76px 76px;
    gap: 6px;
    padding: 8px;
  }

  .deck-meter,
  .deck-count,
  .deck-summary .primary-button,
  .deck-summary .secondary-button {
    min-height: 58px;
  }

  .deck-meter,
  .deck-count {
    padding: 7px 8px;
  }

  .deck-meter strong,
  .deck-count strong {
    font-size: 1.25rem;
  }

  .deck-summary .primary-button,
  .deck-summary .secondary-button {
    font-size: 0.9rem;
  }

  .deck-section-head {
    align-items: start;
  }

  .deck-head-actions {
    flex-wrap: wrap;
    gap: 5px;
  }

  .deck-auto-button {
    min-height: 28px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .home-arena {
    width: min(300px, 70vw);
    gap: 6px;
    padding: 8px;
  }

  .mode-grid {
    gap: 8px;
  }

  .mode-card {
    min-height: 126px;
    padding: 13px;
  }

  .mode-badge {
    top: 7px;
    right: 7px;
    padding: 3px 5px;
    font-size: 0.58rem;
  }

  .mode-capacity {
    top: 28px;
    right: 7px;
    min-width: 42px;
    padding: 2px 5px;
    font-size: 0.58rem;
  }

  .mode-card strong {
    font-size: 2.3rem;
  }

  .pvp-match {
    min-height: 42px;
    padding: 7px 8px;
    font-size: 0.84rem;
  }

  .pvp-stats {
    width: min(100%, 330px);
    gap: 6px;
  }

  .pvp-stats span {
    min-height: 30px;
    gap: 4px;
    font-size: 0.7rem;
  }

  .pvp-stats strong {
    font-size: 0.88rem;
  }

  .pvp-leaderboard {
    width: 100%;
    gap: 5px;
    padding: 6px;
  }

  .pvp-leaderboard-item {
    min-height: 50px;
    gap: 3px;
    padding: 6px 5px;
  }

  .pvp-leaderboard-item strong {
    font-size: 0.72rem;
  }

  .pvp-leaderboard-item small {
    font-size: 0.9rem;
  }

  .rank-medal {
    margin-right: 3px;
    font-size: 0.95rem;
  }

  .match-orb {
    width: min(190px, 48vw, 24svh);
  }

  .pvp-rank-card {
    min-height: 46px;
    padding: 7px 12px;
  }

  .pvp-rank-card strong {
    font-size: 1.34rem;
  }

  .pvp-room-active .pvp-rank-card {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }

  .pvp-room-active .pvp-screen {
    grid-template-rows: auto auto auto minmax(126px, 0.8fr) auto;
  }

  .pvp-room-active .match-orb {
    width: min(142px, 36vw, 16svh);
    opacity: 0.9;
    transform: none;
  }

  .pvp-room-active .match-orb span {
    border-radius: 5px;
  }

  .pvp-room-active .match-orb i {
    border-radius: 5px;
  }

  .pvp-room-active .pvp-leaderboard {
    transform: none;
  }

  .pvp-room {
    width: 100%;
    gap: 7px;
    padding: 9px;
    align-self: stretch;
  }

  .room-head,
  .room-player {
    min-height: 38px;
    padding: 7px 9px;
  }

  .room-actions {
    gap: 6px;
  }

  .room-actions .primary-button,
  .room-actions .secondary-button {
    min-height: 36px;
    margin-top: 0;
    font-size: 0.82rem;
  }

  .home-icon-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 1.15rem;
  }

  .app-shell {
    gap: 6px;
    padding: 4px 6px;
  }

  body.game-active .app-shell {
    min-height: calc(100svh - var(--mobile-hand-height) - env(safe-area-inset-bottom, 0px));
    padding-bottom: 0;
    animation: none !important;
    transform: none !important;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 0;
  }

  .exit-button {
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  h1 {
    font-size: 1.6rem;
    line-height: 0.82;
  }

  .title-line {
    gap: 6px;
  }

  .version-badge {
    margin-top: 0;
    padding: 2px 5px;
    font-size: 0.62rem;
  }

  .topbar p {
    font-size: 0.74rem;
    line-height: 1;
  }

  .score-strip {
    width: 100%;
    justify-content: stretch;
    gap: 5px;
  }

  .map-bar {
    align-items: center;
    flex-direction: row;
    gap: 5px;
    margin: 0 0 4px;
    min-height: 0;
  }

  .map-picker {
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
  }

  .map-button,
  .map-select {
    min-height: 26px;
    padding: 0 6px;
    font-size: 0.74rem;
  }

  .map-select {
    max-width: 104px;
    min-width: 0;
  }

  .map-button {
    white-space: nowrap;
  }

  .map-button.home {
    max-width: 42px;
  }

  .map-bar > span {
    font-size: 0.72rem;
  }

  .score-chip {
    flex: 1 1 30%;
    min-width: 0;
    padding: 5px 6px;
    font-size: 0.76rem;
  }

  .score-chip strong {
    margin-left: 3px;
  }

  .board-panel {
    display: grid;
    gap: 4px;
  }

  .board {
    gap: 2px;
    width: min(100%, calc(100vw - 34px), calc(100svh - var(--mobile-hand-height) - 222px));
    padding: 8px;
  }

  .board-wrap {
    min-height: 0;
    padding: 0 11px;
  }

  .control-panel {
    gap: 8px;
  }

  .phase-card {
    padding: 8px 12px;
    gap: 6px;
  }

  .phase-card h2,
  .section-head h2 {
    font-size: 1rem;
  }

  .mini-preview {
    --mini-size: 12px;
    min-height: 42px;
    padding: 8px;
  }

  .phase-card p,
  .status-text {
    font-size: 0.9rem;
    line-height: 1.2;
    display: none;
  }

  .icon-button,
  .primary-button,
  .secondary-button {
    min-height: 38px;
  }

  .game-actions {
    gap: 6px;
  }

  .drag-actions {
    left: 30px;
    right: 30px;
    bottom: calc(var(--mobile-hand-height) + 8px);
    gap: 28px;
  }

  .drag-action-zone {
    min-height: 56px;
  }

  .legend {
    display: none;
  }

  .cell {
    border-radius: 3px;
  }

  .pvp-in-game .pvp-screen {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: none;
    height: 100svh;
    min-height: 0;
    gap: 5px;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    animation: none;
    padding:
      calc(env(safe-area-inset-top, 0px) + 6px)
      8px
      calc(env(safe-area-inset-bottom, 0px) + var(--pvp-mobile-zone-space) + 10px);
    overflow-x: hidden;
    overflow-y: hidden;
    transform: none;
  }

  .pvp-in-game .pvp-match.standalone {
    width: 100%;
    min-height: 32px;
    padding: 3px 8px;
    font-size: 0.72rem;
  }

  .pvp-in-game .home-icon-button:not(.pvp-exit-top),
  .pve-topbar .home-icon-button {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .pvp-start-button,
  .pvp-test-button,
  .pvp-edit-name-button {
    min-height: 32px;
    padding: 0 8px;
    font-size: 0.74rem;
  }

  .pvp-edit-name-button {
    width: 32px;
    padding: 0;
    font-size: 0.9rem;
  }

  .pvp-name-card {
    width: min(520px, 100%);
    padding: 8px 10px;
    gap: 6px;
  }

  .pvp-name-row {
    grid-template-columns: minmax(0, 1fr) 66px;
    gap: 6px;
  }

  .pvp-name-row input,
  .pvp-name-row button {
    height: 34px;
    min-height: 34px;
    font-size: 0.82rem;
  }

  .pvp-rank-card {
    min-height: 50px;
    padding: 8px 14px;
  }

  .pvp-rank-card strong {
    font-size: 1.42rem;
  }

  .pvp-game {
    gap: 5px;
    width: 100%;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto var(--pvp-mobile-hand-space);
    align-content: stretch;
  }

  .pvp-scorebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .pvp-scorebar .score-chip {
    min-height: 30px;
    padding: 3px 6px;
    font-size: 0.7rem;
  }

  .pvp-in-game .pvp-board {
    width: min(
      100%,
      calc(100vw - 24px),
      calc(100svh - var(--pvp-mobile-hand-space) - var(--pvp-mobile-zone-space) - 190px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
    );
    justify-self: center;
    max-height: 100%;
    gap: 2px;
    padding: 6px;
  }

  .pvp-playbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
    min-height: 40px;
    margin-bottom: 0;
    padding: 4px 7px;
    align-items: center;
  }

  .pvp-tools {
    grid-template-columns: repeat(2, 52px);
    gap: 5px;
  }

  .pvp-playbar p {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.76rem;
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pvp-playbar span {
    margin-top: 1px;
    overflow: hidden;
    font-size: 0.62rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pvp-tools .icon-button,
  .pvp-tools .secondary-button {
    min-width: 0;
    min-height: 32px;
    padding: 0;
    font-size: 0.76rem;
  }

  .pvp-tools .pvp-surrender-button {
    min-width: 0;
    padding: 0;
  }

  .pvp-hand-grid {
    position: relative;
    left: auto;
    right: auto;
    width: min(100%, 520px);
    bottom: auto;
    z-index: 18;
    height: var(--pvp-mobile-hand-space);
    min-height: 0;
    align-items: flex-end;
    overflow: visible;
    pointer-events: auto;
    border: 1px solid rgba(255, 224, 75, 0.36);
    border-radius: 8px;
    background:
      linear-gradient(180deg, rgba(33, 34, 45, 0.72), rgba(18, 18, 26, 0.88)),
      rgba(32, 33, 43, 0.78);
    transform: none;
    transition:
      opacity 160ms var(--ease-out-soft),
      transform 180ms var(--ease-out-soft);
  }

  .pvp-card {
    position: absolute;
    left: 50%;
    bottom: 10px;
    flex-basis: 62px;
    width: 62px;
    height: 82px;
    padding: 8px 5px 6px;
    z-index: calc(20 + var(--card-index));
    transform:
      translateX(calc(-50% + var(--card-offset) * 44px))
      translateY(calc(var(--card-abs-offset) * 4px))
      rotate(calc(var(--card-offset) * 5deg));
  }

  .pvp-card .card-shape {
    --shape-size: 8px;
    min-width: 52px;
    min-height: 52px;
    gap: 2px;
    padding: 5px;
  }

  .pvp-card .card-cost {
    width: 20px;
    height: 20px;
    font-size: 0.72rem;
  }

  .pvp-card + .pvp-card {
    margin-left: 0;
  }

  .pvp-card:hover,
  .pvp-card:focus-visible,
  .pvp-card.selected {
    transform:
      translateX(calc(-50% + var(--card-offset) * 44px))
      translateY(-8px)
      rotate(0deg)
      scale(1.03);
  }

  .pvp-card:active:not(:disabled) {
    transform:
      translateX(calc(-50% + var(--card-offset) * 44px))
      translateY(calc(var(--card-abs-offset) * 4px))
      scale(var(--press-scale));
  }

  .pvp-drag-actions {
    left: 50%;
    right: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--pvp-mobile-hand-space) + 8px);
    width: min(320px, calc(100vw - 42px));
    gap: 10px;
    transform: translate(-50%, 10px);
  }

  .pvp-drag-actions.visible {
    transform: translate(-50%, 0);
  }

  .pvp-drag-actions .drag-action-zone {
    min-height: 46px;
    font-size: 0.78rem;
  }

  .pvp-dragging .pvp-hand-grid {
    opacity: 0.82;
    transform: translateY(6px) scale(0.96);
  }

  .tutorial-coach {
    left: 10px;
    top: 10px;
    width: calc(100% - 20px);
    padding: 9px 10px;
  }

  .tutorial-coach p {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .tutorial-step {
    margin-bottom: 3px;
    font-size: 0.66rem;
  }

  .tutorial-actions {
    margin-top: 7px;
  }

  .tutorial-button {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.74rem;
  }

  .hand-grid {
    height: 86px;
  }

  .hand-section {
    position: fixed;
    left: 6px;
    right: 6px;
    bottom: env(safe-area-inset-bottom, 0px);
    z-index: 30;
    width: auto;
    min-height: var(--mobile-hand-height);
    padding: 6px 10px 8px;
    transform: none;
  }

  .section-head {
    margin-bottom: 3px;
  }

  .hand-play-area {
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 6px;
  }

  .card-button {
    width: 76px;
    height: 94px;
    padding: 10px 6px 7px;
    transform:
      translateX(calc(var(--card-offset) * 44px))
      translateY(calc(var(--card-abs-offset) * 4px))
      rotate(calc(var(--card-offset) * 5deg));
  }

  .card-button:hover,
  .card-button:focus-visible,
  .card-button.selected {
    transform:
      translateX(calc(var(--card-offset) * 44px))
      translateY(-18px)
      rotate(0deg)
      scale(1.04);
  }

  .card-shape {
    --shape-size: 8px;
    min-width: 52px;
    min-height: 52px;
    gap: 2px;
    padding: 5px;
  }

  .card-cost {
    width: 20px;
    height: 20px;
    font-size: 0.72rem;
  }
}
