/* Prototype 2: active UI redesign workspace. */

:root {
  color-scheme: dark;
  --bg-0: #05070d;
  --bg-1: #08111d;
  --glass: rgba(10, 17, 32, 0.74);
  --glass-strong: rgba(10, 18, 34, 0.92);
  --ink: #f6fbff;
  --muted: #aab8cc;
  --dim: #5d7189;
  --gold: #ffd982;
  --gold-2: #b78231;
  --cyan: #39e6ff;
  --blue: #267cff;
  --red: #ff3d72;
  --rose: #ff6f8e;
  --violet: #aa7dff;
  --green: #5effb0;
  --amber: #ffb34a;
  --line: rgba(179, 223, 255, 0.2);
  --shadow: rgba(0, 0, 0, 0.48);
  --radius: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  height: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", "Meiryo", "Yu Gothic", sans-serif;
  background:
    linear-gradient(118deg, rgba(255, 61, 114, 0.17), transparent 31%, rgba(57, 230, 255, 0.18) 70%, transparent),
    linear-gradient(180deg, #05070d 0%, #091424 48%, #050812 100%);
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20vmax;
  pointer-events: none;
}

body::before {
  opacity: 0.46;
  background:
    repeating-linear-gradient(90deg, rgba(65, 231, 255, 0.08) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg, rgba(255, 217, 130, 0.06) 0 1px, transparent 1px 44px);
  transform: rotate(-8deg);
}

body::after {
  opacity: 0.64;
  background:
    conic-gradient(from 110deg at 18% 52%, transparent 0deg, rgba(255, 61, 114, 0.16) 54deg, transparent 100deg),
    conic-gradient(from 290deg at 82% 44%, transparent 0deg, rgba(57, 230, 255, 0.18) 62deg, transparent 118deg),
    radial-gradient(ellipse at 50% 42%, rgba(255, 217, 130, 0.13), transparent 42%);
  filter: blur(1px);
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) 308px;
  gap: 8px;
  width: min(1120px, calc(100% - 48px));
  height: 100svh;
  margin: 0 auto;
  padding: 10px;
  overflow: hidden;
}

.topbar,
.player-panel,
.board-wrap,
.log-panel,
.hand-panel,
.library-drawer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
    var(--glass);
  box-shadow:
    0 18px 40px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(260px, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 0;
  padding: 7px 10px;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(38, 124, 255, 0.18), transparent 24%, transparent 76%, rgba(255, 61, 114, 0.18)),
    repeating-linear-gradient(115deg, transparent 0 22px, rgba(255, 217, 130, 0.05) 22px 23px);
  pointer-events: none;
}

.brand-block,
.turn-badge,
.top-actions {
  position: relative;
  z-index: 1;
}

.brand-block {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.mini-title {
  color: var(--cyan);
  font-size: 10px;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(57, 230, 255, 0.55);
}

.brand-block strong {
  color: #ffffff;
  font-size: clamp(19px, 2vw, 30px);
  line-height: 1;
  text-shadow:
    0 0 16px rgba(57, 230, 255, 0.42),
    0 0 26px rgba(170, 125, 255, 0.28);
}

.turn-badge {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 0 10px;
  min-width: 224px;
  min-height: 44px;
  padding: 5px 22px;
  border: 1px solid rgba(255, 217, 130, 0.64);
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 217, 130, 0.18), transparent),
    rgba(8, 12, 24, 0.92);
  box-shadow:
    inset 0 0 20px rgba(255, 217, 130, 0.12),
    0 0 22px rgba(255, 217, 130, 0.16);
}

.turn-badge span,
.turn-badge em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.1;
}

.turn-badge b {
  color: var(--gold);
  font-size: 28px;
  line-height: 0.9;
  text-shadow: 0 0 14px rgba(255, 217, 130, 0.6);
}

.turn-badge em {
  grid-column: 1 / -1;
  color: var(--ink);
  text-align: center;
}

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

.ghost-btn,
.primary-btn {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(179, 223, 255, 0.28);
  border-radius: 999px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(8, 13, 25, 0.88);
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.ghost-btn:hover,
.ghost-btn:focus-visible,
.primary-btn:hover,
.primary-btn:focus-visible {
  border-color: rgba(57, 230, 255, 0.84);
  box-shadow: 0 0 18px rgba(57, 230, 255, 0.22);
  transform: translate(-1px, -1px);
}

.primary-btn {
  border-color: rgba(255, 217, 130, 0.86);
  color: #1b1005;
  font-weight: 900;
  background:
    linear-gradient(180deg, #fff2ad, #ffb34a 44%, #b86a1e),
    var(--gold);
  box-shadow:
    0 0 22px rgba(255, 179, 74, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.primary-btn:disabled {
  opacity: 0.42;
  cursor: default;
  transform: none;
}

.battle-layout {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr) 176px;
  gap: 8px;
  min-height: 0;
  align-items: stretch;
}

.player-panel {
  --side: var(--cyan);
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 6px;
  min-height: 0;
  padding: 8px;
  overflow: hidden;
}

.player-red {
  --side: var(--red);
}

.player-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid color-mix(in srgb, var(--side) 56%, transparent);
  pointer-events: none;
}

.panel-aura {
  position: absolute;
  inset: -18% -34%;
  opacity: 0.36;
  background:
    conic-gradient(from 180deg at 50% 50%, transparent, color-mix(in srgb, var(--side) 48%, transparent), transparent 42%);
  filter: blur(10px);
  pointer-events: none;
}

.player-panel.is-active {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--side) 70%, transparent),
    0 0 32px color-mix(in srgb, var(--side) 34%, transparent),
    0 18px 40px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.player-panel.is-active .panel-aura {
  animation: auraDrift 3.4s ease-in-out infinite;
}

.panel-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
}

.player-kicker {
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.player-status {
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--side) 64%, transparent);
  border-radius: 999px;
  color: color-mix(in srgb, var(--side) 82%, #ffffff);
  background: rgba(0, 0, 0, 0.22);
  font-size: 10px;
  line-height: 1;
  text-shadow: 0 0 10px color-mix(in srgb, var(--side) 54%, transparent);
}

.player-crest {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--side) 70%, transparent);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--side) 30%, transparent), transparent 48%),
    conic-gradient(from 0deg, rgba(255, 255, 255, 0.18), color-mix(in srgb, var(--side) 66%, transparent), rgba(255, 217, 130, 0.32), color-mix(in srgb, var(--side) 66%, transparent), rgba(255, 255, 255, 0.18));
  box-shadow:
    inset 0 0 0 8px rgba(3, 7, 16, 0.78),
    0 0 22px color-mix(in srgb, var(--side) 32%, transparent);
}

.player-crest::before,
.player-crest::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid color-mix(in srgb, var(--side) 38%, transparent);
  border-radius: 50%;
}

.player-crest::after {
  inset: 19px;
  border-color: rgba(255, 217, 130, 0.32);
}

.player-crest span {
  position: relative;
  z-index: 1;
  color: #ffffff;
  font-size: 19px;
  font-weight: 900;
  text-shadow: 0 0 12px color-mix(in srgb, var(--side) 78%, transparent);
}

.player-name {
  position: relative;
  z-index: 1;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

.counter-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 6px 8px;
  border: 1px solid rgba(179, 223, 255, 0.16);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
  font-size: 12px;
}

.counter-grid b {
  color: var(--ink);
  text-align: right;
}

.resource-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 4px 8px;
  align-items: baseline;
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--side) 42%, transparent);
  border-radius: 7px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--side) 14%, transparent), rgba(0, 0, 0, 0.28)),
    rgba(2, 8, 18, 0.74);
}

.resource-row span {
  color: color-mix(in srgb, var(--side) 78%, #ffffff);
  font-size: 11px;
  font-weight: 900;
}

.resource-row b {
  color: #ffffff;
  font-size: 27px;
  line-height: 0.9;
  text-shadow: 0 0 12px color-mix(in srgb, var(--side) 66%, transparent);
}

.resource-row small {
  color: var(--muted);
  font-size: 12px;
}

.arena-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 66px;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.board-wrap {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  min-height: 0;
  padding: 10px 10px 12px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(8, 53, 96, 0.56), rgba(6, 12, 26, 0.96) 47%, rgba(6, 12, 26, 0.96) 53%, rgba(93, 16, 42, 0.58)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    #040914;
}

.board-wrap::before {
  display: none;
}

.board-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, 0.025) 22px 23px);
  mix-blend-mode: screen;
  pointer-events: none;
}

.beginner-mode-toggle {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  color: rgba(243, 250, 255, 0.92);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  user-select: none;
}

.beginner-mode-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.beginner-mode-switch {
  position: relative;
  display: block;
  width: 32px;
  height: 17px;
  border: 1px solid rgba(154, 205, 224, 0.52);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(24, 38, 54, 0.95), rgba(4, 10, 18, 0.92));
  box-shadow:
    0 0 8px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.beginner-mode-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #ffffff, rgba(255, 255, 255, 0.4) 28%, transparent 29%),
    linear-gradient(180deg, #cfdae7, #7890a7);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.44);
  transition: transform 150ms ease, background 150ms ease;
}

.beginner-mode-toggle input:checked + .beginner-mode-switch {
  border-color: rgba(108, 238, 255, 0.7);
  background:
    linear-gradient(180deg, rgba(27, 111, 134, 0.86), rgba(3, 33, 50, 0.94));
  box-shadow:
    0 0 12px rgba(57, 230, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.beginner-mode-toggle input:checked + .beginner-mode-switch::after {
  transform: translateX(15px);
  background:
    radial-gradient(circle at 35% 28%, #ffffff, rgba(255, 255, 255, 0.42) 28%, transparent 29%),
    linear-gradient(180deg, #dfffff, #62eaff);
}

.beginner-mode-toggle b {
  color: rgba(246, 251, 255, 0.9);
  font-size: 11px;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.78),
    0 0 8px rgba(57, 230, 255, 0.2);
}

.base-lane {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  max-width: 680px;
  padding: 8px 34px 12px;
  transform-origin: 50% 54%;
  will-change: transform;
}

.base-lane.is-final-blow-camera {
  animation: finalBlowCameraZoom 2600ms cubic-bezier(0.03, 0.86, 0.13, 1) both;
}

.base-lane.is-victory-camera-release {
  animation: victoryCameraRelease 3000ms linear both;
  animation-delay: var(--camera-release-delay, 0ms);
}

.base-node {
  position: relative;
  display: grid;
  place-items: center;
  gap: 1px;
  min-height: 84px;
  padding: 8px 4px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  clip-path: polygon(50% 0, 92% 14%, 100% 50%, 92% 86%, 50% 100%, 8% 86%, 0 50%, 8% 14%);
  color: var(--ink);
  background: rgba(5, 10, 19, 0.86);
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    border-color 150ms ease;
}

.base-node:hover,
.base-node:focus-visible {
  transform: scale(1.04);
}

.base-node span {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.base-node b {
  color: var(--gold);
  font-size: 10px;
  line-height: 1;
}

.blue-base {
  border-color: rgba(57, 230, 255, 0.7);
  box-shadow: 0 0 22px rgba(57, 230, 255, 0.22);
}

.red-base {
  border-color: rgba(255, 61, 114, 0.72);
  box-shadow: 0 0 22px rgba(255, 61, 114, 0.22);
}

.battle-board {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 38px minmax(210px, 1fr);
  align-items: center;
  gap: 0;
  width: 100%;
}

.board-side {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(52px, 1fr));
  grid-template-rows: 74px 76px 78px;
  gap: 0;
}

.board-rift {
  align-self: stretch;
  min-height: 224px;
  background: none;
  pointer-events: none;
}

.board-surface {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.22));
}

.board-hp-layer {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: grid;
  grid-template-columns: repeat(3, minmax(52px, 1fr));
  grid-template-rows: 74px 76px 78px;
  pointer-events: none;
  overflow: visible;
}

.board-hp-slot {
  position: relative;
  display: grid;
  justify-items: center;
  align-items: end;
  min-width: 0;
  padding: 5px 5px 0;
  overflow: visible;
}

.board-hp-anchor {
  position: relative;
  top: -18px;
  left: calc(var(--unit-x-offset, 0%) + var(--unit-inner-offset, 0px));
  width: min(76px, 110%);
  aspect-ratio: 1;
  transition: transform 150ms ease;
}

.board-surface-cell {
  fill: var(--surface-fill);
  transition:
    filter 150ms ease,
    stroke 150ms ease,
    stroke-width 150ms ease,
    transform 150ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.board-surface-red {
  fill: var(--surface-fill);
}

.board-surface-cell.move-target,
.board-surface-cell.summon-target,
.board-surface-cell.attack-target {
  animation: targetPulse 3.2s ease-in-out infinite;
}

.board-surface-cell.move-target {
  fill: var(--target-gold-fill);
}

.board-surface-cell.summon-target {
  fill: var(--target-gold-fill);
}

.board-surface-cell.attack-target {
  fill: var(--target-white-fill);
}

.board-surface-cell.random-attack-target {
  fill: var(--target-random-fill);
}

.board-surface-cell.is-selected {
  filter:
    brightness(1.22)
    drop-shadow(0 0 16px rgba(255, 255, 255, 0.24));
}

.board-surface-target-outline {
  fill: none;
  stroke-width: 1.4;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.82;
  transition:
    filter 150ms ease,
    opacity 150ms ease,
    stroke 150ms ease,
    stroke-width 150ms ease,
    transform 150ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.board-surface-target-outline.move-target,
.board-surface-target-outline.summon-target {
  stroke: rgba(255, 239, 151, 0.88);
  filter: drop-shadow(0 0 6px rgba(255, 226, 126, 0.28));
}

.board-surface-target-outline.attack-target {
  stroke: rgba(255, 255, 247, 0.92);
  filter: drop-shadow(0 0 7px rgba(255, 255, 247, 0.34));
}

.board-surface-target-outline.random-attack-target {
  stroke: rgba(194, 247, 255, 0.92);
  filter: drop-shadow(0 0 7px rgba(116, 221, 255, 0.34));
}

.board-surface-line {
  stroke: rgba(177, 230, 255, 0.58);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.board-surface-hitbox {
  fill: transparent;
  stroke: none;
  cursor: pointer;
  pointer-events: all;
}

.board-side-red .board-surface-line {
  stroke: rgba(255, 125, 167, 0.58);
}

.board-cell {
  --tile: var(--cyan);
  --row-offset: 0px;
  --row-lift: 0px;
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  align-items: end;
  min-width: 0;
  min-height: 74px;
  padding: 5px 5px 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  overflow: visible;
  pointer-events: none;
  transform: translateX(var(--row-offset)) translateY(var(--row-lift));
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    filter 150ms ease;
}

.board-row-1 {
  min-height: 76px;
}

.board-row-2 {
  min-height: 78px;
}

.board-cell::before {
  display: none;
}

.board-cell::after {
  display: none;
}

.board-side-blue .board-row-0,
.board-side-red .board-row-2 {
  --row-offset: 0px;
  --row-lift: 0px;
}

.board-side-blue .board-row-1,
.board-side-red .board-row-1 {
  --row-offset: 0px;
  --row-lift: 0px;
}

.board-side-blue .board-row-2,
.board-side-red .board-row-0 {
  --row-offset: 0px;
  --row-lift: 0px;
}

.board-gap {
  pointer-events: none;
}

.board-cell:hover {
  transform: translateX(var(--row-offset)) translateY(var(--row-lift));
}

.void-cell {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
  visibility: hidden;
}

.void-cell::before {
  display: none;
}

.blue-zone {
  --tile: #22a6d8;
}

.red-zone {
  --tile: #db315d;
}

.tile-coord {
  position: absolute;
  left: calc(4px + var(--tile-label-x-offset, 0%));
  bottom: 5px;
  z-index: 1;
  color: rgba(246, 251, 255, 0.42);
  font-size: 10px;
  line-height: 1;
}

.move-target {
  --tile: #ffd982;
}

.summon-target {
  --tile: var(--gold);
}

.attack-target {
  --tile: #f3eef0;
}

.random-attack-target {
  --tile: #bfefff;
}

.is-selected {
  filter: none;
}

.board-side:has(.board-cell.board-col-0.board-row-0:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).board-col-0.board-row-0:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-1.board-row-0:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).board-col-1.board-row-0:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-2.board-row-0:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).board-col-2.board-row-0:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-0.board-row-1:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).board-col-0.board-row-1:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-1.board-row-1:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).board-col-1.board-row-1:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-2.board-row-1:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).board-col-2.board-row-1:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-0.board-row-2:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).board-col-0.board-row-2:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-1.board-row-2:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).board-col-1.board-row-2:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-2.board-row-2:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).board-col-2.board-row-2:is(.move-target, .summon-target, .attack-target) {
  opacity: 1;
  stroke-width: 2.2;
  transform: translateY(-3px);
}

.board-side:has(.board-cell.board-col-0.board-row-0:is(:hover, :focus-within)) .board-surface-cell.board-col-0.board-row-0:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-1.board-row-0:is(:hover, :focus-within)) .board-surface-cell.board-col-1.board-row-0:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-2.board-row-0:is(:hover, :focus-within)) .board-surface-cell.board-col-2.board-row-0:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-0.board-row-1:is(:hover, :focus-within)) .board-surface-cell.board-col-0.board-row-1:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-1.board-row-1:is(:hover, :focus-within)) .board-surface-cell.board-col-1.board-row-1:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-2.board-row-1:is(:hover, :focus-within)) .board-surface-cell.board-col-2.board-row-1:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-0.board-row-2:is(:hover, :focus-within)) .board-surface-cell.board-col-0.board-row-2:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-1.board-row-2:is(:hover, :focus-within)) .board-surface-cell.board-col-1.board-row-2:is(.move-target, .summon-target, .attack-target),
.board-side:has(.board-cell.board-col-2.board-row-2:is(:hover, :focus-within)) .board-surface-cell.board-col-2.board-row-2:is(.move-target, .summon-target, .attack-target) {
  filter:
    brightness(1.12)
    drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 12px rgba(255, 241, 170, 0.3));
}

.battle-board:has(.board-cell.linked-attack-target:is(:hover, :focus-within)) :is(.board-surface-cell, .board-surface-target-outline).linked-attack-target {
  opacity: 1;
  stroke-width: 2.2;
  transform: translateY(-3px);
}

.battle-board:has(.board-cell.linked-attack-target.is-surface-hover) :is(.board-surface-cell, .board-surface-target-outline).linked-attack-target,
:is(.board-surface-cell, .board-surface-target-outline).is-surface-hover:is(.move-target, .summon-target, .attack-target) {
  opacity: 1;
  stroke-width: 2.2;
  transform: translateY(-3px);
}

.battle-board:has(.board-cell.linked-attack-target:is(:hover, :focus-within)) .board-surface-cell.linked-attack-target {
  filter:
    brightness(1.12)
    drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 12px rgba(255, 255, 247, 0.32));
}

.battle-board:has(.board-cell.linked-attack-target.is-surface-hover) .board-surface-cell.linked-attack-target,
.board-surface-cell.is-surface-hover:is(.move-target, .summon-target, .attack-target) {
  filter:
    brightness(1.12)
    drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 12px rgba(255, 255, 247, 0.32));
}

.battle-board:has(.board-cell.random-attack-target:is(:hover, :focus-within)) .board-surface-cell.random-attack-target {
  filter:
    brightness(1.12)
    drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 12px rgba(116, 221, 255, 0.34));
}

.battle-board:has(.board-cell.random-attack-target.is-surface-hover) .board-surface-cell.random-attack-target {
  filter:
    brightness(1.12)
    drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 12px rgba(116, 221, 255, 0.34));
}

.battle-board:has(.board-cell.linked-attack-target:is(:hover, :focus-within)) .board-cell.linked-attack-target .unit-token {
  transform: translateY(-3px) scale(1.04);
}

.battle-board:has(.board-cell.linked-attack-target.is-surface-hover) .board-cell.linked-attack-target .unit-token {
  transform: translateY(-3px) scale(1.04);
}

.is-unit-hover-locked .battle-board:has(.board-cell.linked-attack-target:is(:hover, :focus-within)) .board-cell.linked-attack-target .unit-token {
  transform: none;
}

.is-unit-hover-locked .battle-board:has(.board-cell.linked-attack-target.is-surface-hover) .board-cell.linked-attack-target .unit-token {
  transform: none;
}

.unit-token {
  --unit-sprite-x: -58%;
  --unit-sprite-y: 13px;
  --unit-icon-frame: 76px;
  --unit-sprite-sheet-size: 304px;
  --unit-sprite-x0: 0px;
  --unit-sprite-x1: -76px;
  --unit-sprite-x2: -152px;
  --unit-sprite-x3: -228px;
  --unit-sprite-y0: 0px;
  --unit-sprite-y1: -76px;
  --unit-sprite-y2: -152px;
  --unit-sprite-y3: -228px;
  position: relative;
  top: -18px;
  left: calc(var(--unit-x-offset, 0%) + var(--unit-inner-offset, 0px));
  z-index: 3;
  display: grid;
  place-items: center;
  width: min(76px, 110%);
  aspect-ratio: 1;
  margin-bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  color: #ffffff;
  background: transparent;
  pointer-events: auto;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.42);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    filter 150ms ease,
    box-shadow 150ms ease;
}

.unit-token::before {
  display: none;
}

.unit-token:hover {
  transform: translateY(-3px) scale(1.04);
}

.board-cell:hover .unit-token,
.board-cell:focus-within .unit-token,
.board-cell.is-surface-hover .unit-token {
  transform: translateY(-3px) scale(1.04);
}

.is-unit-hover-locked .unit-token:hover {
  transform: none;
}

.is-unit-hover-locked .board-cell:hover .unit-token,
.is-unit-hover-locked .board-cell:focus-within .unit-token,
.is-unit-hover-locked .board-cell.is-surface-hover .unit-token {
  transform: none;
}

.unit-token.is-moving {
  z-index: 36;
  pointer-events: none;
}

.unit-token.is-attacking {
  animation: unitTokenAttack var(--attack-duration, 1000ms) cubic-bezier(0.16, 0.84, 0.26, 1) both;
}

.unit-token.is-attacking.is-final-attacking {
  animation-name: unitTokenFinalAttack;
  animation-timing-function: linear;
}

.unit-token.is-hit {
  animation: unitHit var(--hit-duration, 260ms) steps(2) var(--hit-delay, 0ms) 2;
}

.unit-token.is-hit.is-final-hit {
  animation-name: unitFinalHit;
  animation-timing-function: cubic-bezier(0.2, 0.72, 0.22, 1);
  animation-iteration-count: 1;
}

.unit-blue {
  border-color: rgba(129, 242, 255, 0.92);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.42),
    0 0 18px rgba(57, 230, 255, 0.38),
    inset 0 0 16px rgba(255, 255, 255, 0.18);
}

.unit-red {
  border-color: rgba(255, 150, 174, 0.94);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.42),
    0 0 18px rgba(255, 61, 114, 0.36),
    inset 0 0 16px rgba(255, 255, 255, 0.18);
}

.unit-token.is-spent {
  opacity: 1;
  border-color: rgba(166, 176, 188, 0.92);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.48),
    0 0 12px rgba(166, 176, 188, 0.2),
    inset 0 0 14px rgba(220, 228, 236, 0.12);
}

.unit-token.is-defeated {
  pointer-events: none;
}

.unit-token.is-spent::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  border-radius: 50%;
  background: rgba(3, 7, 14, 0.54);
  pointer-events: none;
}

.unit-token.is-card-back {
  border-color: rgba(255, 217, 130, 0.92);
  background:
    repeating-linear-gradient(45deg, rgba(255, 217, 130, 0.12) 0 7px, transparent 7px 14px),
    radial-gradient(circle at 50% 50%, rgba(255, 217, 130, 0.34), transparent 35%),
    linear-gradient(180deg, #12233e, #07101f);
}

.unit-card-back-mark,
.unit-sigil {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #06101d;
  background:
    radial-gradient(circle at 35% 26%, #ffffff, rgba(255, 255, 255, 0.4) 20%, transparent 21%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(196, 224, 255, 0.72));
  font-weight: 900;
  text-shadow: none;
}

.unit-card-back-mark {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: auto;
  height: auto;
  border-radius: inherit;
  background-image: url("../assets/cardicons/Cardbackside.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 124% auto;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.42),
    inset 0 -10px 13px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.unit-token.is-summon-entering {
  animation: summonCardBackFloatIn 700ms ease-out both;
  animation-delay: var(--summon-enter-delay, 0ms);
}

.unit-token.is-summon-revealing .unit-card-back-mark {
  animation: summonBackReveal 2160ms ease-in-out forwards;
}

.unit-token.is-summon-revealing .unit-portrait {
  opacity: 0;
  animation: summonPortraitReveal 2160ms ease-in-out forwards;
}

.unit-portrait {
  position: absolute;
  inset: 0;
  z-index: 3;
  isolation: isolate;
  border: 0;
  border-radius: inherit;
  background-position: center 36%;
  background-repeat: no-repeat;
  background-size: 124% auto;
  filter:
    brightness(var(--portrait-brightness, 1.2))
    contrast(var(--portrait-contrast, 1.18))
    saturate(var(--portrait-saturate, 1.2));
  overflow: hidden;
  pointer-events: none;
}

.unit-portrait-gloss {
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  background:
    radial-gradient(circle at 34% 20%, rgba(255, 255, 255, 0.28), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 34%, rgba(0, 0, 0, 0.18));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.42),
    inset 0 -10px 13px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  opacity: 0.72;
  pointer-events: none;
}

.unit-portrait-sprite-sheet {
  --sprite-snap-x: 0px;
  --sprite-snap-y: 0px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: var(--unit-sprite-sheet-size);
  height: var(--unit-sprite-sheet-size);
  border-radius: 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: 0 0;
  animation: unitIconSprite16 2500ms steps(1, end) infinite;
  backface-visibility: hidden;
  pointer-events: none;
  transform: translate3d(
    calc(var(--sprite-snap-x) + var(--unit-sprite-x0)),
    calc(var(--sprite-snap-y) + var(--unit-sprite-y0)),
    0
  );
  will-change: transform;
}

.unit-attack-guide {
  position: absolute;
  left: 50%;
  bottom: 4px;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, 5px);
  grid-template-rows: repeat(3, 5px);
  gap: 1px;
  width: max-content;
  padding: 1px;
  opacity: 0.64;
  pointer-events: none;
  transform: translateX(calc(-50% - 3px));
}

.unit-attack-guide.is-blue {
  transform: translateX(calc(-50% + 3px)) scaleX(-1);
}

.unit-attack-guide i {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
}

.unit-attack-guide i.is-target {
  border-radius: 1px;
  background:
    linear-gradient(180deg, rgba(255, 121, 112, 0.95), rgba(218, 31, 45, 0.95));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.9),
    0 0 4px rgba(255, 34, 54, 0.34);
}

.unit-attack-guide i.is-self::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.96),
    0 0 4px rgba(255, 255, 255, 0.36);
  transform: translate(-50%, -50%);
}

.unit-token.is-attacking .unit-portrait {
  animation: unitPortraitAttack var(--attack-duration, 1000ms) ease-out both;
}

.unit-sprite {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 3;
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: auto 100%;
  animation: unitIdleFrames 960ms linear infinite;
  pointer-events: none;
  transform: translate(var(--unit-sprite-x), var(--unit-sprite-y));
  transform-origin: center bottom;
}

.unit-blue .unit-sprite {
  transform: translate(var(--unit-sprite-x), var(--unit-sprite-y)) scaleX(-1);
}

.unit-token.is-attacking .unit-sprite {
  background-size: auto 100%;
  animation: unitAttackFrames 1000ms linear forwards;
}

.unit-token.is-spent .unit-sprite {
  filter: brightness(0.56) saturate(0.78);
}

.board-effect {
  --effect-delay: 0ms;
  --effect-opacity: 1;
  --effect-scale: 1;
  --effect-y: 0px;
  position: absolute;
  left: calc(50% + var(--unit-x-offset, 0%) + var(--unit-inner-offset, 0px));
  bottom: 3px;
  z-index: 5;
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(var(--effect-y)) scale(var(--effect-scale));
}

.effect-hit {
  background-image: url("../assets/effects/AttackSlash.png");
  background-position: 0 0;
  background-size: auto 100%;
  animation:
    effect8Frames var(--effect-frame-duration, var(--effect-duration, 420ms)) linear var(--effect-delay) forwards,
    effectOpacity var(--effect-duration, 420ms) linear var(--effect-delay) forwards;
}

.effect-hit.is-final-blow {
  animation:
    effect8Frames var(--effect-frame-duration, 420ms) linear var(--effect-delay) forwards,
    effectFinalHitOpacity var(--effect-duration, 980ms) linear var(--effect-delay) forwards;
}

.effect-poison {
  background-image: url("../assets/effects/PoisonBurst.png");
  background-position: 0 0;
  background-size: auto 100%;
  animation:
    effect8Frames 560ms linear var(--effect-delay) forwards,
    effectOpacity 560ms linear var(--effect-delay) forwards;
}

.effect-poison-damage {
  --effect-scale: 0.6;
  background-image: url("../assets/effects/PoisonBurst.png");
  background-position: 0 0;
  background-size: auto 100%;
  animation:
    effect8Frames 560ms linear var(--effect-delay) forwards,
    effectOpacity 560ms linear var(--effect-delay) forwards;
}

.effect-heal {
  background-image: url("../assets/effects/HealSparkle.png");
  background-position: 0 0;
  background-size: auto 100%;
  animation:
    effect8Frames 620ms linear var(--effect-delay) forwards,
    effectOpacity 620ms linear var(--effect-delay) forwards;
}

.effect-death {
  background-image: url("../assets/effects/DeathSmoke.png");
  background-position: 0 0;
  background-size: auto 100%;
  animation:
    effect8Frames var(--effect-frame-duration, var(--effect-duration, 700ms)) linear var(--effect-delay) forwards,
    effectOpacity var(--effect-duration, 700ms) linear var(--effect-delay) forwards;
}

.effect-death.is-final-blow {
  animation:
    effect8Frames var(--effect-frame-duration, 700ms) linear var(--effect-delay) forwards,
    effectFinalDeathOpacity var(--effect-duration, 1500ms) linear var(--effect-delay) forwards;
}

.effect-summon-burst {
  --effect-scale: 0.8;
  --effect-y: 8px;
  background-image: url("../assets/effects/SummonBurst.png");
  background-position: 0 0;
  background-size: auto 100%;
  animation:
    effect8Frames 720ms linear var(--effect-delay) forwards,
    effectOpacity 720ms linear var(--effect-delay) forwards;
}

.unit-buff-mark {
  position: absolute;
  top: 14px;
  right: -4px;
  z-index: 18;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 241, 170, 0.88);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #fff7b8, rgba(255, 247, 184, 0.34) 23%, transparent 24%),
    linear-gradient(180deg, #ffcf52, #ff7a2f 66%, #b72a12);
  box-shadow:
    0 0 8px rgba(255, 157, 58, 0.66),
    0 0 0 1px rgba(255, 206, 82, 0.42),
    inset 0 0 0 2px rgba(56, 9, 6, 0.28);
}

.unit-buff-mark.is-status-delayed,
.unit-poison-mark.is-status-delayed {
  opacity: 0;
  animation: statusIconReveal 150ms ease var(--status-delay, 0ms) forwards;
}

.unit-buff-mark::before {
  content: "";
  position: absolute;
  width: 13px;
  height: 15px;
  background: #5c1308;
  clip-path: polygon(50% 0, 100% 48%, 72% 48%, 72% 100%, 28% 100%, 28% 48%, 0 48%);
}

.unit-buff-mark::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 11px;
  background: #fff2a6;
  clip-path: polygon(50% 0, 100% 48%, 72% 48%, 72% 100%, 28% 100%, 28% 48%, 0 48%);
}

.unit-poison-mark {
  position: absolute;
  top: 14px;
  left: -4px;
  z-index: 18;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, #ffe6ff, rgba(255, 230, 255, 0.34) 22%, transparent 23%),
    linear-gradient(180deg, #b46cff, #7b2dd6 63%, #32105c);
  box-shadow:
    0 0 8px rgba(181, 91, 255, 0.58),
    inset 0 0 0 2px rgba(29, 6, 55, 0.32);
}

.unit-poison-mark::before {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #ffffff, #eab8ff 28%, #9b42ef 70%);
  box-shadow:
    0 0 0 1px #35105c;
  transform: translate(-1px, -1px);
}

.unit-poison-mark::after {
  content: "";
  position: absolute;
  z-index: 1;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #ffffff, #f0c5ff 30%, #d884ff 72%);
  box-shadow: 0 0 0 1px #35105c;
  transform: translate(3px, 3px);
}

.unit-name {
  display: none;
}

.unit-stats {
  display: flex;
  gap: 3px;
  font-size: 12px;
  font-style: normal;
}

.unit-stats b,
.unit-stats i {
  display: grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  color: #111;
  background: var(--gold);
  font-style: normal;
}

.unit-stats i {
  background: var(--green);
}

.unit-hp {
  position: absolute;
  left: calc(100% - 17px);
  bottom: -5px;
  z-index: 30;
  display: inline-grid;
  grid-template-columns: 18px;
  align-items: center;
  justify-items: center;
  min-width: 18px;
  height: 19px;
  padding: 0;
  border: 0.5px solid transparent;
  border-radius: 3px 8px 3px 8px;
  color: #f8fffb;
  background: transparent;
  box-shadow: none;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  transform-origin: left center;
  transition:
    background 130ms ease,
    border-color 130ms ease,
    box-shadow 130ms ease,
    padding 130ms ease,
    min-width 130ms ease,
    width 130ms ease;
}

.unit-hp i {
  display: none;
  margin: 0;
  color: rgba(176, 238, 207, 0.72);
  font-style: normal;
  font-size: 9px;
  transform: translate(-2px, 1px);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.62);
}

.unit-hp em {
  display: none;
}

.unit-hp b,
.unit-hp em {
  min-width: 7px;
  font-style: normal;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.72),
    0 0 8px rgba(94, 255, 176, 0.28);
}

.unit-hp b {
  display: block;
  color: #fbfffc;
  font-size: 15px;
  transform: translate(-1px, -1px);
  text-shadow:
    -1px -1px 0 #02130f,
    1px -1px 0 #02130f,
    -1px 1px 0 #02130f,
    1px 1px 0 #02130f,
    0 0 5px rgba(54, 255, 172, 0.46),
    0 1px 1px rgba(0, 0, 0, 0.8);
}

.unit-hp em {
  color: #7fbd9a;
  min-width: 5px;
  font-size: 9px;
  transform: translate(-1px, 1px);
}

.board-side:has(.board-cell.board-col-0.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-0 .board-hp-anchor,
.board-side:has(.board-cell.board-col-1.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-0 .board-hp-anchor,
.board-side:has(.board-cell.board-col-2.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-0 .board-hp-anchor,
.board-side:has(.board-cell.board-col-0.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-1 .board-hp-anchor,
.board-side:has(.board-cell.board-col-1.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-1 .board-hp-anchor,
.board-side:has(.board-cell.board-col-2.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-1 .board-hp-anchor,
.board-side:has(.board-cell.board-col-0.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-2 .board-hp-anchor,
.board-side:has(.board-cell.board-col-1.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-2 .board-hp-anchor,
.board-side:has(.board-cell.board-col-2.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-2 .board-hp-anchor {
  transform: translateY(-3px) scale(1.04);
}

.board-hp-slot.is-surface-hover .board-hp-anchor {
  transform: translateY(-3px) scale(1.04);
}

.is-unit-hover-locked .board-side:has(.board-cell:is(:hover, :focus-within)) .board-hp-anchor {
  transform: none;
}

.is-unit-hover-locked .board-hp-slot.is-surface-hover .board-hp-anchor {
  transform: none;
}

.board-side:has(.board-cell.board-col-0.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-0 .unit-hp,
.board-side:has(.board-cell.board-col-1.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-0 .unit-hp,
.board-side:has(.board-cell.board-col-2.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-0 .unit-hp,
.board-side:has(.board-cell.board-col-0.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-1 .unit-hp,
.board-side:has(.board-cell.board-col-1.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-1 .unit-hp,
.board-side:has(.board-cell.board-col-2.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-1 .unit-hp,
.board-side:has(.board-cell.board-col-0.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-2 .unit-hp,
.board-side:has(.board-cell.board-col-1.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-2 .unit-hp,
.board-side:has(.board-cell.board-col-2.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-2 .unit-hp,
.board-hp-slot.is-surface-hover .unit-hp {
  grid-template-columns: 18px 3px 5px;
  justify-items: center;
  width: 32px;
  min-width: 32px;
  padding: 0 1px 0 0;
  border-color: rgba(61, 139, 105, 0.86);
  background:
    linear-gradient(180deg, rgba(71, 179, 128, 0.13), rgba(0, 0, 0, 0.16) 42%),
    linear-gradient(180deg, #0d241b 0%, #041310 52%, #010807 100%);
  box-shadow:
    0 0 0 1px rgba(0, 30, 24, 0.88),
    0 0 9px rgba(54, 168, 112, 0.24),
    inset 0 1px 0 rgba(179, 236, 209, 0.32),
    inset 0 -2px 0 rgba(0, 0, 0, 0.28);
}

.board-side:has(.board-cell.board-col-0.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-0 .unit-hp i,
.board-side:has(.board-cell.board-col-0.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-0 .unit-hp em,
.board-side:has(.board-cell.board-col-1.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-0 .unit-hp i,
.board-side:has(.board-cell.board-col-1.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-0 .unit-hp em,
.board-side:has(.board-cell.board-col-2.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-0 .unit-hp i,
.board-side:has(.board-cell.board-col-2.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-0 .unit-hp em,
.board-side:has(.board-cell.board-col-0.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-1 .unit-hp i,
.board-side:has(.board-cell.board-col-0.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-1 .unit-hp em,
.board-side:has(.board-cell.board-col-1.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-1 .unit-hp i,
.board-side:has(.board-cell.board-col-1.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-1 .unit-hp em,
.board-side:has(.board-cell.board-col-2.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-1 .unit-hp i,
.board-side:has(.board-cell.board-col-2.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-1 .unit-hp em,
.board-side:has(.board-cell.board-col-0.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-2 .unit-hp i,
.board-side:has(.board-cell.board-col-0.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-2 .unit-hp em,
.board-side:has(.board-cell.board-col-1.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-2 .unit-hp i,
.board-side:has(.board-cell.board-col-1.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-2 .unit-hp em,
.board-side:has(.board-cell.board-col-2.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-2 .unit-hp i,
.board-side:has(.board-cell.board-col-2.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-2 .unit-hp em,
.board-hp-slot.is-surface-hover .unit-hp i,
.board-hp-slot.is-surface-hover .unit-hp em {
  display: block;
}

.unit-menu {
  position: absolute;
  inset: -3px;
  z-index: 7;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  padding: 5px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 130ms ease;
}

.board-cell:hover .unit-menu,
.board-cell:focus-within .unit-menu,
.board-cell.is-surface-hover .unit-menu,
.unit-token:hover .unit-menu,
.unit-token:focus-within .unit-menu {
  opacity: 1;
  pointer-events: auto;
}

.is-unit-hover-locked .board-cell:hover .unit-menu,
.is-unit-hover-locked .board-cell:focus-within .unit-menu,
.is-unit-hover-locked .board-cell.is-surface-hover .unit-menu,
.is-unit-hover-locked .unit-token:hover .unit-menu,
.is-unit-hover-locked .unit-token:focus-within .unit-menu {
  opacity: 0;
  pointer-events: none;
}

.unit-choice {
  min-width: 0;
  min-height: 0;
  padding: 0 5px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(5, 9, 18, 0.9);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.42);
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.unit-choice:hover,
.unit-choice:focus-visible {
  color: #04111a;
  background: var(--cyan);
}

.unit-choice.attack-choice:hover,
.unit-choice.attack-choice:focus-visible {
  color: #ffffff;
  background: var(--red);
}

.unit-choice:disabled {
  opacity: 0.35;
  cursor: default;
}

.log-panel {
  display: grid;
  grid-template-columns: 24px minmax(0, 0.86fr) minmax(220px, 0.64fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 0;
  padding: 9px 10px;
  overflow: hidden;
}

.message-glyph {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 217, 130, 0.55);
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, transparent, rgba(255, 217, 130, 0.56), transparent 42%),
    rgba(255, 217, 130, 0.08);
  animation: circuitSpin 5s linear infinite;
}

.message-line {
  min-width: 0;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.32;
  text-shadow: 0 0 12px rgba(57, 230, 255, 0.24);
}

.discard-message {
  grid-column: 3 / 4;
  justify-self: center;
  transform: translateX(28px);
  color: #ffffff;
  font-size: 16px;
  font-weight: 1000;
  letter-spacing: 0.02em;
  text-align: center;
  text-shadow:
    0 0 8px rgba(255, 217, 130, 0.42),
    0 0 18px rgba(255, 255, 255, 0.22);
}

.log-panel ol {
  display: grid;
  gap: 2px;
  max-height: 50px;
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--muted);
  overflow: auto;
  font-size: 11px;
  line-height: 1.25;
}

.log-end-btn {
  min-width: 108px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
}

.hand-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 4px;
  min-height: 0;
  padding: 8px;
  overflow: hidden;
}

.hand-head {
  position: relative;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
  color: var(--ink);
  font-weight: 900;
}

.hand-head span {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.hand-head span b {
  white-space: nowrap;
}

.audio-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  color: #ffffff;
}

.audio-mute {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.audio-mute img {
  display: block;
  width: 16px;
  height: 16px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.24));
}

.audio-mute[aria-pressed="true"] {
  color: rgba(255, 255, 255, 0.74);
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.04);
}

.audio-volume {
  width: 92px;
  height: 4px;
  accent-color: #ffffff;
  cursor: pointer;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
}

.audio-volume::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.audio-volume::-webkit-slider-thumb {
  margin-top: -5px;
}

.hand-head small {
  color: var(--cyan);
  font-size: 11px;
  text-shadow: 0 0 10px rgba(57, 230, 255, 0.5);
}

.field-mana {
  position: absolute;
  left: -8px;
  bottom: 17px;
  z-index: 6;
  display: inline-grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  grid-template-rows: auto 7px;
  align-items: baseline;
  column-gap: 5px;
  row-gap: 7px;
  width: 156px;
  min-width: 156px;
  min-height: 42px;
  padding: 0;
  color: var(--gold);
  font-size: 14px;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 217, 130, 0.42);
  white-space: nowrap;
}

.field-mana span,
.field-mana small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.field-mana span {
  grid-column: 2;
  margin-right: 10px;
}

.field-mana small {
  grid-column: 4;
  margin-left: -1px;
}

.field-mana strong {
  grid-column: 3;
  color: #fff3b1;
  font-size: 24px;
  line-height: 0.9;
  text-shadow:
    0 0 12px rgba(255, 217, 130, 0.75),
    0 0 22px rgba(255, 179, 74, 0.34);
}

.hand-mana-track {
  grid-column: 1 / -1;
  display: block;
  justify-self: center;
  width: 102px;
  height: 7px;
  margin-top: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 12px rgba(255, 217, 130, 0.14);
  overflow: hidden;
}

.hand-mana-track em {
  display: block;
  width: var(--hand-mana-pct);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #39e6ff, #fff3b1);
  box-shadow: 0 0 12px rgba(255, 243, 177, 0.48);
}

.hand-row,
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
  min-height: 0;
}

.hand-row {
  grid-template-columns: repeat(auto-fit, minmax(138px, 164px));
  justify-content: center;
  align-items: start;
  padding-top: 4px;
  overflow: visible;
}

.card-shell {
  position: relative;
  display: grid;
  gap: 0;
  width: min(164px, 100%);
  align-items: start;
}

.hand-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 224px;
  padding: 0;
  border: 1px solid rgba(255, 217, 130, 0.74);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    #060a12;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  cursor: pointer;
  isolation: isolate;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    filter 160ms ease;
}

.hand-card::before {
  content: "";
  position: absolute;
  z-index: 4;
  inset: -40% -70%;
  background: linear-gradient(115deg, transparent 36%, rgba(255, 255, 255, 0.22) 48%, transparent 60%);
  opacity: 0;
  transform: translateX(-18%);
  pointer-events: none;
}

.hand-card::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  pointer-events: none;
}

.hand-card:hover,
.hand-card:focus-visible {
  z-index: 4;
  border-color: rgba(57, 230, 255, 0.86);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.52),
    0 0 26px rgba(57, 230, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transform: translateY(-6px);
}

.hand-card:hover::before,
.hand-card:focus-visible::before {
  opacity: 1;
  animation: cardShine 1.1s ease forwards;
}

.hand-card.spell {
  border-color: rgba(170, 125, 255, 0.82);
}

.hand-card.is-selected {
  border-color: #ffffff;
  box-shadow:
    0 0 0 2px rgba(255, 217, 130, 0.9),
    0 0 32px rgba(255, 217, 130, 0.34),
    0 18px 34px rgba(0, 0, 0, 0.56);
  transform: translateY(-8px) scale(1.015);
}

.hand-card.is-locked {
  filter: saturate(0.45) brightness(0.58);
}

.hand-card.compact {
  width: 164px;
  min-height: 224px;
  height: 224px;
  cursor: default;
}

.card-cost {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 50%;
  color: #fffdda;
  background:
    radial-gradient(circle at 34% 26%, #ffffff, rgba(255, 255, 255, 0.5) 19%, transparent 20%),
    linear-gradient(180deg, #f4ffff, #39e6ff 48%, #267cff);
  box-shadow:
    0 0 18px rgba(57, 230, 255, 0.54),
    inset 0 0 0 3px rgba(5, 10, 18, 0.34);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 1px 0 #061633,
    1px 0 0 #061633,
    0 -1px 0 #061633,
    -1px 0 0 #061633,
    0 0 7px rgba(13, 25, 68, 0.72);
}

.card-art {
  position: absolute;
  z-index: 0;
  inset: 5px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background:
    radial-gradient(circle at 36% 28%, var(--c1), transparent 20%),
    radial-gradient(circle at 68% 58%, var(--c2), transparent 44%),
    linear-gradient(135deg, var(--c3), #070b13);
}

.card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 26%, rgba(3, 7, 14, 0.16) 58%, rgba(3, 7, 14, 0.82)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.34), transparent 24%, transparent 72%, rgba(0, 0, 0, 0.32));
}

.card-illustration {
  min-height: 0;
  border: 0;
  background-position: center;
  background-size: cover;
  filter: saturate(1.18) contrast(1.04);
}

.card-art span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.96);
  background: rgba(0, 0, 0, 0.42);
  font-size: 24px;
  font-weight: 900;
  text-shadow: 0 2px 3px #000;
}

.card-nameplate {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 61px;
  z-index: 2;
  display: grid;
  gap: 0;
  padding: 5px 7px;
  border-left: 2px solid var(--gold);
  border-radius: 5px;
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(2, 5, 11, 0.92), rgba(2, 5, 11, 0.5));
  text-shadow: 0 1px 2px #000;
}

.card-nameplate strong {
  min-height: 17px;
  font-size: 14px;
  line-height: 1.1;
}

.card-nameplate em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.1;
}

.card-type {
  position: absolute;
  top: 10px;
  right: 8px;
  z-index: 5;
  width: fit-content;
  max-width: 84px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 217, 130, 0.44);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(5, 8, 14, 0.72);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.card-bottom {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 6px;
  align-items: center;
  min-height: 48px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(5, 9, 17, 0.82);
}

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

.icon-stat {
  display: grid;
  grid-template-columns: 15px minmax(10px, 1fr);
  align-items: center;
  gap: 3px;
  min-width: 0;
  height: 18px;
  padding: 1px 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.26);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.icon-stat img {
  width: 14px;
  height: 14px;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.28));
}

.icon-stat b {
  min-width: 0;
  text-align: right;
}

.card-tactic {
  min-width: 0;
}

.card-range {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  gap: 1px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.card-range img {
  width: 38px;
  height: 29px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.86);
  image-rendering: pixelated;
}

.card-description {
  display: block;
  min-height: calc(4em * 1.25 + 12px);
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  color: #ffffff;
  background: rgba(3, 7, 14, 0.78);
  font-size: 10px;
  line-height: 1.25;
}

.hand-panel .card-description {
  position: absolute;
  top: calc(50% - 38px);
  left: 10px;
  right: 10px;
  z-index: 6;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(3, 7, 14, 0.86);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translateY(-42%);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
  pointer-events: none;
}

.hand-panel .card-shell:hover .card-description,
.hand-panel .card-shell:focus-within .card-description {
  opacity: 1;
  transform: translateY(-50%);
}

.hand-empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--gold);
  font-size: 32px;
  font-weight: 900;
  text-shadow: 0 0 24px rgba(255, 217, 130, 0.34);
}

.library-drawer {
  position: fixed;
  inset: 16px;
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(38, 124, 255, 0.12), transparent 34%, rgba(255, 61, 114, 0.12)),
    rgba(5, 9, 18, 0.96);
}

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

.library-head h2 {
  margin: 0;
  color: var(--gold);
  font-size: 24px;
  line-height: 1;
}

.library-grid {
  grid-template-columns: repeat(auto-fill, 164px);
  grid-auto-rows: auto;
  align-content: start;
  justify-content: center;
  align-items: start;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px;
}

@keyframes circuitSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes auraDrift {
  0%,
  100% {
    transform: translateY(-2%) scale(1);
    opacity: 0.32;
  }
  50% {
    transform: translateY(2%) scale(1.04);
    opacity: 0.5;
  }
}

@keyframes targetPulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.18);
  }
}

@keyframes cardShine {
  to {
    transform: translateX(36%);
  }
}

@keyframes unitIdleFrames {
  0%,
  16.65% {
    background-position: 0 0;
  }
  16.66%,
  33.32% {
    background-position: -96px 0;
  }
  33.33%,
  49.99% {
    background-position: -192px 0;
  }
  50%,
  66.65% {
    background-position: -288px 0;
  }
  66.66%,
  83.32% {
    background-position: -384px 0;
  }
  83.33%,
  100% {
    background-position: -480px 0;
  }
}

@keyframes unitAttackFrames {
  0%,
  16.65% {
    background-position: 0 0;
  }
  16.66%,
  33.32% {
    background-position: -96px 0;
  }
  33.33%,
  49.99% {
    background-position: -192px 0;
  }
  50%,
  66.65% {
    background-position: -288px 0;
  }
  66.66%,
  83.32% {
    background-position: -384px 0;
  }
  83.33%,
  100% {
    background-position: -480px 0;
  }
}

@keyframes unitTokenAttack {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    filter: brightness(1);
  }
  32% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -9px),
        calc(var(--attack-y, 0) * -6px)
      )
      scale(0.96);
    filter: brightness(0.96);
  }
  48% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      scale(0.94);
    filter: brightness(0.98);
  }
  58% {
    transform:
      translate(
        calc(var(--attack-x, 1) * 18px),
        calc(var(--attack-y, 0) * 11px)
      )
      scale(1.08);
    filter: brightness(1.22);
  }
  72% {
    transform:
      translate(
        calc(var(--attack-x, 1) * 5px),
        calc(var(--attack-y, 0) * 3px)
      )
      scale(1.02);
    filter: brightness(1.06);
  }
}

@keyframes unitTokenFinalAttack {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    filter: brightness(1);
  }
  10% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -5px),
        calc(var(--attack-y, 0) * -3px)
      )
      translateX(-1px)
      scale(0.98);
    filter: brightness(0.96);
  }
  16% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -10px),
        calc(var(--attack-y, 0) * -6px)
      )
      translateX(1.5px)
      scale(0.96);
    filter: brightness(0.98);
  }
  20% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -11px),
        calc(var(--attack-y, 0) * -7px)
      )
      translateX(-1.5px)
      scale(0.95);
    filter: brightness(0.98);
  }
  23% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(2px)
      scale(0.94);
    filter: brightness(1);
  }
  26% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(-2px)
      scale(0.94);
    filter: brightness(0.98);
  }
  29% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(1.5px)
      scale(0.94);
    filter: brightness(1.02);
  }
  32% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(-1.5px)
      scale(0.94);
    filter: brightness(1);
  }
  35% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(2px)
      scale(0.94);
    filter: brightness(1.06);
  }
  38% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(-2px)
      scale(0.94);
    filter: brightness(1.02);
  }
  41% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(1.5px)
      scale(0.94);
    filter: brightness(1.05);
  }
  44% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(-1.5px)
      scale(0.94);
    filter: brightness(1.02);
  }
  47% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(2px)
      scale(0.94);
    filter: brightness(1.07);
  }
  50% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(-2px)
      scale(0.94);
    filter: brightness(1.04);
  }
  53% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(1.5px)
      scale(0.94);
    filter: brightness(1.08);
  }
  56% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(-1.5px)
      scale(0.94);
    filter: brightness(1.05);
  }
  59% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(2px)
      scale(0.94);
    filter: brightness(1.1);
  }
  62% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(-2px)
      scale(0.94);
    filter: brightness(1.06);
  }
  64% {
    transform:
      translate(
        calc(var(--attack-x, 1) * -12px),
        calc(var(--attack-y, 0) * -8px)
      )
      translateX(1px)
      scale(0.94);
    filter: brightness(1.06);
  }
  65% {
    transform:
      translate(
        calc(var(--attack-x, 1) * 20px),
        calc(var(--attack-y, 0) * 12px)
      )
      scale(1.1);
    filter: brightness(1.26);
  }
  82% {
    transform:
      translate(
        calc(var(--attack-x, 1) * 5px),
        calc(var(--attack-y, 0) * 3px)
      )
      scale(1.02);
    filter: brightness(1.06);
  }
}

@keyframes finalBlowCameraZoom {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.165);
  }
}

@keyframes victoryCameraRelease {
  0% {
    transform: scale(1.165);
  }
  25% {
    transform: scale(1.112);
  }
  50% {
    transform: scale(1.052);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes unitPortraitAttack {
  0%,
  100% {
    transform: scale(1);
  }
  42% {
    transform: scale(0.96);
  }
  58% {
    transform: scale(1.08);
  }
}

@keyframes summonCardBackFloatIn {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes summonBackReveal {
  0% {
    opacity: 0.86;
    transform: scale(1);
  }
  32%,
  100% {
    opacity: 0;
    transform: scale(1.06);
  }
}

@keyframes summonPortraitReveal {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }
  28%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes unitIconSprite16 {
  0% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x0)), calc(var(--sprite-snap-y) + var(--unit-sprite-y0)), 0);
  }
  6.25% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x1)), calc(var(--sprite-snap-y) + var(--unit-sprite-y0)), 0);
  }
  12.5% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x2)), calc(var(--sprite-snap-y) + var(--unit-sprite-y0)), 0);
  }
  18.75% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x3)), calc(var(--sprite-snap-y) + var(--unit-sprite-y0)), 0);
  }
  25% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x0)), calc(var(--sprite-snap-y) + var(--unit-sprite-y1)), 0);
  }
  31.25% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x1)), calc(var(--sprite-snap-y) + var(--unit-sprite-y1)), 0);
  }
  37.5% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x2)), calc(var(--sprite-snap-y) + var(--unit-sprite-y1)), 0);
  }
  43.75% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x3)), calc(var(--sprite-snap-y) + var(--unit-sprite-y1)), 0);
  }
  50% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x0)), calc(var(--sprite-snap-y) + var(--unit-sprite-y2)), 0);
  }
  56.25% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x1)), calc(var(--sprite-snap-y) + var(--unit-sprite-y2)), 0);
  }
  62.5% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x2)), calc(var(--sprite-snap-y) + var(--unit-sprite-y2)), 0);
  }
  68.75% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x3)), calc(var(--sprite-snap-y) + var(--unit-sprite-y2)), 0);
  }
  75% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x0)), calc(var(--sprite-snap-y) + var(--unit-sprite-y3)), 0);
  }
  81.25% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x1)), calc(var(--sprite-snap-y) + var(--unit-sprite-y3)), 0);
  }
  87.5% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x2)), calc(var(--sprite-snap-y) + var(--unit-sprite-y3)), 0);
  }
  93.75%,
  100% {
    transform: translate3d(calc(var(--sprite-snap-x) + var(--unit-sprite-x3)), calc(var(--sprite-snap-y) + var(--unit-sprite-y3)), 0);
  }
}

@keyframes unitHit {
  0%,
  100% {
    transform: translate(0, 0);
    filter: brightness(1);
  }
  25% {
    transform: translateX(3px);
    filter: brightness(1.55);
  }
  50% {
    transform: translateX(-5px);
    filter: brightness(1.25);
  }
  75% {
    transform: translateX(4px);
    filter: brightness(1.42);
  }
}

@keyframes unitFinalHit {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    filter: brightness(1);
  }
  12% {
    transform: translateX(5px) scale(1.02);
    filter: brightness(1.6);
  }
  28% {
    transform: translateX(-7px) scale(0.98);
    filter: brightness(1.34);
  }
  44% {
    transform: translateX(4px) scale(1.01);
    filter: brightness(1.5);
  }
  62% {
    transform: translateX(-3px) scale(0.99);
    filter: brightness(1.18);
  }
  80% {
    transform: translateX(1px) scale(1);
    filter: brightness(1.08);
  }
}

@keyframes effect8Frames {
  0%,
  12.49% {
    background-position: 0 0;
  }
  12.5%,
  24.99% {
    background-position: -96px 0;
  }
  25%,
  37.49% {
    background-position: -192px 0;
  }
  37.5%,
  49.99% {
    background-position: -288px 0;
  }
  50%,
  62.49% {
    background-position: -384px 0;
  }
  62.5%,
  74.99% {
    background-position: -480px 0;
  }
  75%,
  87.49% {
    background-position: -576px 0;
  }
  87.5%,
  100% {
    background-position: -672px 0;
  }
}

@keyframes effectOpacity {
  0%,
  100% {
    opacity: var(--effect-opacity, 1);
  }
}

@keyframes effectFinalHitOpacity {
  0%,
  48% {
    opacity: var(--effect-opacity, 1);
  }
  70%,
  100% {
    opacity: 0;
  }
}

@keyframes effectFinalDeathOpacity {
  0%,
  54% {
    opacity: var(--effect-opacity, 1);
  }
  100% {
    opacity: 0;
  }
}

@keyframes victoryOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes victoryOverlayOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(calc(var(--modal-y, 0px) + 10px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(var(--modal-y, 0px)) scale(1);
  }
}

@keyframes victoryFlashSweep {
  0% {
    transform: translateX(-130%) skewX(-22deg);
    opacity: 0;
  }
  22% {
    opacity: 0.95;
  }
  62% {
    opacity: 0.75;
  }
  100% {
    transform: translateX(130%) skewX(-22deg);
    opacity: 0;
  }
}

@keyframes victoryPortraitDrop {
  0% {
    opacity: 0;
    transform: translateY(-18px) scale(0.78);
    filter: contrast(1.16) brightness(0.88);
  }
  42% {
    opacity: 1;
    transform: translateY(3px) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: contrast(1.16) brightness(0.98);
  }
}

@keyframes victoryRingPulse {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.18);
  }
  18% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.55);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(7.2);
  }
}

@keyframes victoryTextSlam {
  0% {
    opacity: 0;
    transform: translateY(26px) scale(1.18);
    letter-spacing: 0.08em;
    filter: blur(4px);
  }
  48% {
    opacity: 1;
    transform: translateY(-2px) scale(0.98);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    letter-spacing: 0.03em;
    filter: blur(0);
  }
}

.victory-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  pointer-events: auto;
  overflow: hidden;
  isolation: isolate;
  animation: victoryOverlayIn 260ms ease-out both;
  background: rgba(2, 5, 12, 0.58);
}

.victory-overlay.is-clickable {
  cursor: pointer;
}

.victory-overlay.is-dismissing {
  pointer-events: none;
  animation: victoryOverlayOut 300ms ease-in both;
}

.victory-overlay::before,
.victory-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.victory-overlay::before {
  z-index: -2;
  opacity: 1;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 0 28%, rgba(0, 0, 0, 0.42) 72%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.44));
}

.victory-overlay::after {
  z-index: -1;
  background:
    radial-gradient(circle at 50% 47%, rgba(255, 217, 130, 0.18), transparent 26%),
    linear-gradient(90deg, transparent 0 28%, rgba(255, 255, 255, 0.08) 50%, transparent 72%);
  mix-blend-mode: screen;
}

.victory-win {
  --victory-main: #fff8d7;
  --victory-soft: rgba(255, 217, 130, 0.48);
  --victory-edge: rgba(255, 217, 130, 0.96);
  --victory-ring: rgba(255, 217, 130, 0.86);
  --victory-ring-soft: rgba(255, 217, 130, 0.5);
  --victory-line: linear-gradient(90deg, transparent, rgba(255, 217, 130, 0.58), rgba(255, 255, 255, 0.95), rgba(255, 217, 130, 0.58), transparent);
}

.victory-lose {
  --victory-main: #fff0f3;
  --victory-soft: rgba(190, 0, 35, 0.72);
  --victory-edge: rgba(255, 165, 178, 0.96);
  --victory-ring: rgba(255, 92, 122, 0.9);
  --victory-ring-soft: rgba(180, 0, 34, 0.58);
  --victory-line: linear-gradient(90deg, transparent, rgba(255, 93, 119, 0.5), rgba(255, 214, 220, 0.9), rgba(255, 93, 119, 0.5), transparent);
}

.victory-flash {
  position: absolute;
  left: -18%;
  top: 42%;
  width: 136%;
  height: 18%;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08) 22%, rgba(255, 246, 206, 0.9) 48%, rgba(255, 255, 255, 0.08) 74%, transparent);
  filter: blur(0.5px);
  animation: victoryFlashSweep 980ms cubic-bezier(0.18, 0.78, 0.18, 1) both;
}

.victory-ring {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(30vw, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--victory-ring);
  box-shadow:
    0 0 0 1px rgba(92, 56, 13, 0.86),
    0 0 30px var(--victory-ring-soft),
    inset 0 0 28px var(--victory-ring-soft);
  animation: victoryRingPulse 1200ms cubic-bezier(0.08, 0.76, 0.18, 1) 80ms both;
}

.victory-portrait {
  position: relative;
  z-index: 2;
  width: 104px;
  margin: 0 auto 10px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 217, 130, 0.95);
  background-color: rgba(0, 0, 0, 0.42);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow:
    0 0 0 1px rgba(78, 45, 10, 0.92),
    0 0 18px rgba(255, 217, 130, 0.46),
    inset 0 0 0 1px rgba(255, 250, 216, 0.34),
    inset 0 -22px 42px rgba(0, 0, 0, 0.36),
    0 14px 30px rgba(0, 0, 0, 0.52);
  animation: victoryPortraitDrop 980ms cubic-bezier(0.16, 0.84, 0.26, 1) 90ms both;
}

.victory-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.18), transparent 28%),
    radial-gradient(circle, rgba(255, 217, 130, 0.1), rgba(0, 0, 0, 0.46) 72%);
}

.victory-copy {
  position: relative;
  display: grid;
  place-items: center;
  min-width: min(78vw, 760px);
  padding: 18px 24px;
  text-align: center;
  text-transform: uppercase;
  animation: victoryTextSlam 720ms cubic-bezier(0.16, 0.84, 0.26, 1) 360ms both;
}

.victory-copy::before,
.victory-copy::after {
  content: "";
  position: absolute;
  left: 50%;
  width: min(72vw, 680px);
  height: 1px;
  background: var(--victory-line);
  box-shadow: 0 0 18px var(--victory-soft);
  transform: translateX(-50%);
}

.victory-copy::before {
  top: 0;
}

.victory-copy::after {
  bottom: 0;
}

.victory-winner {
  position: absolute;
  left: 50%;
  top: -168px;
  display: grid;
  justify-items: center;
  gap: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 2;
}

.victory-player {
  position: relative;
  display: inline-block;
  --winner-line-length: clamp(110px, 18vw, 220px);
  --winner-line-gap: 30px;
  color: #fffdf2;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: clamp(22px, 3.6vw, 48px);
  line-height: 0.9;
  font-weight: 1000;
  letter-spacing: 0.03em;
  text-shadow:
    0 0 2px #fff,
    0 0 18px rgba(255, 255, 255, 0.38),
    0 12px 24px rgba(0, 0, 0, 0.64);
}

.victory-player::before,
.victory-player::after {
  content: "";
  position: absolute;
  top: 50%;
  width: var(--winner-line-length);
  height: 3px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 217, 130, 0.5), rgba(255, 246, 210, 0.96), rgba(255, 217, 130, 0.5), transparent);
  box-shadow:
    0 0 10px rgba(255, 217, 130, 0.48),
    0 -1px 0 rgba(255, 246, 210, 0.54);
  clip-path: polygon(0 50%, 6% 34%, 56% 34%, 70% 20%, 94% 20%, 100% 50%, 94% 80%, 70% 80%, 56% 66%, 6% 66%);
  transform: translateY(-50%);
}

.victory-player::before {
  right: calc(100% + var(--winner-line-gap));
}

.victory-player::after {
  left: calc(100% + var(--winner-line-gap));
  clip-path: polygon(0 50%, 6% 20%, 30% 20%, 44% 34%, 94% 34%, 100% 50%, 94% 66%, 44% 66%, 30% 80%, 6% 80%);
}

.victory-player b {
  position: relative;
  display: block;
  font: inherit;
}

.victory-player b::before,
.victory-player b::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  background: #fff7cf;
  box-shadow:
    0 0 0 1px rgba(116, 70, 14, 0.72),
    0 0 10px rgba(255, 217, 130, 0.82);
  transform: translateY(-50%) rotate(45deg);
}

.victory-player b::before {
  left: -18px;
}

.victory-player b::after {
  right: -18px;
}

.victory-copy strong {
  color: var(--victory-main);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: clamp(54px, 10vw, 128px);
  line-height: 0.88;
  font-weight: 1000;
  letter-spacing: 0.03em;
  text-shadow:
    0 2px 0 #5a310a,
    0 0 2px #fff,
    0 0 18px rgba(255, 217, 130, 0.78),
    0 0 42px var(--victory-soft),
    0 16px 32px rgba(0, 0, 0, 0.72);
}

.victory-lose .victory-copy strong {
  text-shadow:
    0 2px 0 #520c19,
    0 0 3px #fff,
    0 0 16px rgba(255, 218, 224, 0.86),
    0 0 44px rgba(190, 0, 35, 0.9),
    0 0 72px rgba(128, 0, 24, 0.72),
    0 16px 32px rgba(0, 0, 0, 0.72);
}

.lesson-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 5, 12, 0.58);
  backdrop-filter: blur(3px);
}

.lesson-result-panel {
  --modal-y: clamp(-116px, -13vh, -82px);
  width: min(430px, 100%);
  border: 1px solid rgba(255, 217, 130, 0.72);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 38%),
    linear-gradient(160deg, rgba(16, 31, 54, 0.98), rgba(5, 10, 20, 0.98));
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.66),
    0 0 30px rgba(255, 217, 130, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  padding: 22px;
  text-align: center;
  animation: modalIn 180ms ease-out both;
}

.lesson-result-kicker {
  display: block;
  color: #fff3b1;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.14em;
  text-shadow: 0 0 10px rgba(255, 217, 130, 0.48);
}

.lesson-result-panel h2 {
  margin: 6px 0 8px;
  color: #fff;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 34px;
  line-height: 1;
  text-shadow:
    0 0 2px #fff,
    0 0 18px rgba(255, 255, 255, 0.34),
    0 8px 18px rgba(0, 0, 0, 0.62);
}

.lesson-result-panel p {
  margin: 0 0 18px;
  color: rgba(232, 242, 255, 0.84);
  font-size: 13px;
  font-weight: 800;
}

.lesson-result-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.lesson-result-actions .ghost-btn,
.lesson-result-actions .primary-btn {
  min-width: 132px;
}

.cheat-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 5, 12, 0.62);
  backdrop-filter: blur(4px);
}

.cheat-panel {
  width: min(560px, 100%);
  border: 1px solid rgba(255, 217, 130, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 42%),
    rgba(8, 15, 30, 0.96);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.62),
    0 0 32px rgba(255, 217, 130, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  padding: 14px;
}

.cheat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 12px;
}

.cheat-head strong {
  color: #fff8d7;
  font-size: 16px;
  font-weight: 1000;
  text-shadow: 0 0 14px rgba(255, 217, 130, 0.42);
}

.cheat-head button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

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

.cheat-grid button {
  min-height: 44px;
  border: 1px solid rgba(105, 232, 255, 0.3);
  border-radius: 8px;
  color: #f7fbff;
  font-weight: 800;
  background:
    linear-gradient(180deg, rgba(93, 226, 255, 0.16), rgba(255, 255, 255, 0.04)),
    rgba(6, 12, 24, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.cheat-grid button:hover {
  border-color: rgba(255, 217, 130, 0.72);
  color: #fff8d7;
  box-shadow:
    0 0 16px rgba(255, 217, 130, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

@keyframes statusIconReveal {
  from {
    opacity: 0;
    transform: scale(0.72);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100svh;
    grid-template-rows: auto auto auto;
    width: 100%;
    overflow: visible;
  }

  .topbar,
  .battle-layout {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions > button {
    flex: 1 1 120px;
  }

  .battle-layout {
    grid-template-areas:
      "arena"
      "p1"
      "p2";
  }

  .player-blue {
    grid-area: p1;
  }

  .player-red {
    grid-area: p2;
  }

  .player-panel {
    grid-template-columns: auto minmax(0, 1fr) minmax(120px, auto);
    grid-template-rows: auto auto;
    align-items: center;
  }

  .panel-head {
    grid-column: 1 / -1;
  }

  .player-crest {
    width: 58px;
    height: 58px;
    margin: 0;
  }

  .player-name {
    text-align: left;
  }

  .counter-grid,
  .resource-row {
    align-self: stretch;
  }

  .arena-panel {
    grid-area: arena;
    grid-template-rows: minmax(310px, auto) auto;
  }

  .base-lane {
    max-width: 100%;
    padding: 14px 26px 10px;
  }

  .base-node {
    min-height: 68px;
    font-size: 10px;
  }

  .battle-board {
    grid-template-columns: minmax(150px, 1fr) 38px minmax(150px, 1fr);
  }

  .board-side {
    grid-template-columns: repeat(3, minmax(40px, 1fr));
    grid-template-rows: 58px 60px 62px;
    gap: 0;
  }

  .board-hp-layer {
    grid-template-columns: repeat(3, minmax(40px, 1fr));
    grid-template-rows: 58px 60px 62px;
  }

  .board-cell {
    min-height: 58px;
  }

  .board-row-1 {
    min-height: 60px;
  }

  .board-row-2 {
    min-height: 62px;
  }

  .board-rift {
    min-height: 176px;
  }

  .board-side-blue .board-row-0,
  .board-side-red .board-row-2 {
    --row-offset: 0px;
    --row-lift: 0px;
  }

  .board-side-blue .board-row-2,
  .board-side-red .board-row-0 {
    --row-offset: 0px;
    --row-lift: 0px;
  }

  .unit-token {
    --unit-icon-frame: 58px;
    --unit-sprite-sheet-size: 232px;
    --unit-sprite-x1: -58px;
    --unit-sprite-x2: -116px;
    --unit-sprite-x3: -174px;
    --unit-sprite-y1: -58px;
    --unit-sprite-y2: -116px;
    --unit-sprite-y3: -174px;
    width: min(58px, 96%);
  }

  .board-hp-anchor {
    width: min(58px, 96%);
  }

  .hand-row {
    overflow-x: auto;
    grid-auto-flow: column;
    grid-auto-columns: minmax(142px, 164px);
    grid-template-columns: none;
    padding-top: 16px;
    padding-bottom: 4px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 8px;
  }

  .turn-badge {
    min-width: 0;
    width: 100%;
  }

  .player-panel {
    grid-template-columns: 1fr;
  }

  .player-name {
    text-align: center;
  }

  .board-wrap {
    padding: 10px 4px;
  }

  .base-lane {
    max-width: 100%;
    padding: 10px 16px 8px;
  }

  .base-node {
    min-height: 44px;
    clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0 50%);
  }

  .battle-board {
    transform: none;
    grid-template-columns: minmax(120px, 1fr) 22px minmax(120px, 1fr);
  }

  .board-side {
    grid-template-columns: repeat(3, minmax(34px, 1fr));
    grid-template-rows: 52px 54px 56px;
    gap: 0;
  }

  .board-hp-layer {
    grid-template-columns: repeat(3, minmax(34px, 1fr));
    grid-template-rows: 52px 54px 56px;
  }

  .board-cell {
    min-height: 52px;
  }

  .board-row-1 {
    min-height: 54px;
  }

  .board-row-2 {
    min-height: 56px;
  }

  .board-rift {
    min-height: 160px;
  }

  .board-side-blue .board-row-0,
  .board-side-red .board-row-2 {
    --row-offset: 0px;
    --row-lift: 0px;
  }

  .board-side-blue .board-row-2,
  .board-side-red .board-row-0 {
    --row-offset: 0px;
    --row-lift: 0px;
  }

  .unit-token {
    --unit-icon-frame: 52px;
    --unit-sprite-sheet-size: 208px;
    --unit-sprite-x1: -52px;
    --unit-sprite-x2: -104px;
    --unit-sprite-x3: -156px;
    --unit-sprite-y1: -52px;
    --unit-sprite-y2: -104px;
    --unit-sprite-y3: -156px;
    width: min(52px, 98%);
  }

  .board-hp-anchor {
    width: min(52px, 98%);
  }

  .unit-name {
    display: none;
  }

  .log-panel {
    grid-template-columns: 24px minmax(0, 1fr) auto;
  }

  .log-panel ol {
    display: none;
  }

  .log-end-btn {
    min-width: 92px;
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
  }

  .hand-card {
    min-height: 214px;
  }
}

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

/* Prototype 2 skin: prestige combat UI pass. */

:root {
  --bg-0: #02050b;
  --bg-1: #07101a;
  --glass: rgba(7, 12, 20, 0.82);
  --glass-strong: rgba(5, 9, 16, 0.96);
  --ink: #f8fbff;
  --muted: #97a8b8;
  --dim: #526678;
  --gold: #f4d586;
  --gold-2: #8f6424;
  --cyan: #4ce7ff;
  --blue: #2577ff;
  --red: #ff496e;
  --rose: #ff7990;
  --violet: #b58cff;
  --green: #69e6a7;
  --amber: #f3a94c;
  --line: rgba(206, 229, 255, 0.18);
  --shadow: rgba(0, 0, 0, 0.62);
  --radius: 6px;
}

body {
  background:
    linear-gradient(115deg, rgba(255, 73, 110, 0.17) 0%, transparent 28%, transparent 72%, rgba(76, 231, 255, 0.16) 100%),
    conic-gradient(from 225deg at 50% 50%, rgba(244, 213, 134, 0.09), transparent 28%, rgba(76, 231, 255, 0.09), transparent 62%, rgba(255, 73, 110, 0.1), transparent 86%),
    linear-gradient(180deg, #02040a 0%, #07101a 47%, #03050b 100%);
}

body::before {
  opacity: 0.32;
  background:
    repeating-linear-gradient(90deg, rgba(111, 205, 255, 0.08) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(244, 213, 134, 0.055) 0 1px, transparent 1px 48px);
  transform: rotate(-7deg) scale(1.08);
}

body::after {
  opacity: 0.66;
  background:
    linear-gradient(100deg, transparent 0 13%, rgba(244, 213, 134, 0.08) 13.4%, transparent 14.2% 84%, rgba(244, 213, 134, 0.06) 84.4%, transparent 85%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 24%, transparent 72%, rgba(0, 0, 0, 0.38));
  filter: none;
}

.app-shell {
  grid-template-rows: 62px minmax(0, 1fr) 292px;
  gap: 10px;
  width: min(1210px, calc(100% - 34px));
  padding: 10px 8px;
}

.topbar,
.player-panel,
.board-wrap,
.log-panel,
.hand-panel,
.library-drawer {
  border-color: rgba(244, 213, 134, 0.22);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.018) 36%, rgba(0, 0, 0, 0.24)),
    linear-gradient(135deg, rgba(76, 231, 255, 0.08), transparent 33%, rgba(255, 73, 110, 0.07) 76%, transparent),
    rgba(5, 10, 18, 0.9);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.045);
}

.topbar {
  grid-template-columns: minmax(240px, 1fr) auto minmax(280px, 1fr);
  padding: 8px 12px;
  border-color: rgba(244, 213, 134, 0.36);
  background:
    linear-gradient(90deg, rgba(27, 74, 113, 0.55), rgba(6, 10, 18, 0.94) 38%, rgba(6, 10, 18, 0.94) 62%, rgba(100, 24, 48, 0.55)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 46%),
    #050912;
}

.topbar::before {
  background:
    linear-gradient(90deg, transparent, rgba(244, 213, 134, 0.22), transparent),
    repeating-linear-gradient(90deg, transparent 0 58px, rgba(244, 213, 134, 0.055) 58px 59px);
  opacity: 0.82;
}

.mini-title {
  color: rgba(244, 213, 134, 0.86);
  font-weight: 900;
  text-shadow: 0 0 10px rgba(244, 213, 134, 0.36);
}

.brand-block strong {
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, "Yu Mincho", serif;
  font-size: clamp(22px, 2.2vw, 32px);
  color: #fff9df;
  text-shadow:
    0 1px 0 #3b2308,
    0 0 18px rgba(244, 213, 134, 0.34),
    0 0 34px rgba(76, 231, 255, 0.18);
}

.turn-badge {
  min-width: 246px;
  min-height: 48px;
  border-color: rgba(244, 213, 134, 0.78);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(244, 213, 134, 0.08), rgba(244, 213, 134, 0.22), rgba(244, 213, 134, 0.08)),
    linear-gradient(180deg, #141827, #060914 62%, #02040a);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.9),
    0 0 22px rgba(244, 213, 134, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.turn-badge b {
  color: #fff2b8;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 30px;
  text-shadow:
    0 1px 0 #3d2608,
    0 0 16px rgba(244, 213, 134, 0.72);
}

.ghost-btn,
.primary-btn {
  border-radius: 5px;
  font-weight: 900;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    0 10px 18px rgba(0, 0, 0, 0.22);
}

.primary-btn {
  color: #1d1205;
  background:
    linear-gradient(180deg, #fff5c4, #e5b85f 48%, #7f551c),
    #d7a848;
}

.battle-layout {
  grid-template-columns: 184px minmax(0, 1fr) 184px;
  gap: 10px;
}

.player-panel {
  padding: 9px;
  border-color: color-mix(in srgb, var(--side) 34%, var(--gold) 26%);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--side) 14%, transparent), transparent 36%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 34%, rgba(0, 0, 0, 0.28)),
    #050a13;
}

.player-panel::before {
  inset: 3px;
  border-color: color-mix(in srgb, var(--side) 46%, var(--gold) 24%);
  border-radius: 4px;
}

.player-panel::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, transparent, var(--side), var(--gold), var(--side), transparent);
  opacity: 0.82;
  pointer-events: none;
}

.player-red::after {
  right: 0;
  left: auto;
}

.panel-aura {
  opacity: 0.28;
  filter: blur(14px);
}

.player-status {
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)),
    rgba(0, 0, 0, 0.36);
}

.player-crest {
  width: 74px;
  height: 74px;
  border-color: color-mix(in srgb, var(--side) 54%, var(--gold) 38%);
  background:
    conic-gradient(from 0deg, rgba(244, 213, 134, 0.78), color-mix(in srgb, var(--side) 72%, transparent), rgba(255, 255, 255, 0.34), color-mix(in srgb, var(--side) 72%, transparent), rgba(244, 213, 134, 0.78)),
    #050811;
  box-shadow:
    inset 0 0 0 8px rgba(1, 4, 9, 0.82),
    inset 0 0 18px color-mix(in srgb, var(--side) 25%, transparent),
    0 0 26px color-mix(in srgb, var(--side) 32%, transparent);
}

.counter-grid,
.resource-row {
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 44%),
    rgba(0, 0, 0, 0.3);
}

.arena-panel {
  grid-template-rows: minmax(0, 1fr) 68px;
  gap: 10px;
}

.board-wrap {
  padding: 12px 12px 14px;
  border-color: rgba(244, 213, 134, 0.28);
  background:
    linear-gradient(90deg, rgba(16, 58, 92, 0.78), rgba(4, 8, 14, 0.98) 43%, rgba(4, 8, 14, 0.98) 57%, rgba(92, 20, 43, 0.78)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 36%, rgba(0, 0, 0, 0.28)),
    #030711;
}

.board-wrap::before {
  display: block;
  content: "";
  position: absolute;
  inset: 10px 12px;
  border: 1px solid rgba(244, 213, 134, 0.14);
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent, rgba(244, 213, 134, 0.06), transparent),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 255, 255, 0.025) 31px 32px);
  pointer-events: none;
}

.board-wrap::after {
  opacity: 0.72;
  background:
    linear-gradient(115deg, transparent 0 42%, rgba(244, 213, 134, 0.08) 42.3%, transparent 43.2%),
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(76, 231, 255, 0.028) 38px 39px);
}

.beginner-mode-toggle {
  top: 12px;
  left: 14px;
  padding: 3px 6px;
  border: 1px solid rgba(244, 213, 134, 0.18);
  border-radius: 4px;
  background: rgba(2, 5, 10, 0.54);
}

.beginner-mode-switch {
  border-radius: 4px;
}

.base-node {
  min-height: 88px;
  border-color: rgba(244, 213, 134, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 32%, rgba(0, 0, 0, 0.24)),
    rgba(5, 10, 18, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 14px 24px rgba(0, 0, 0, 0.32);
}

.battle-board {
  grid-template-columns: minmax(220px, 1fr) 46px minmax(220px, 1fr);
}

.board-surface {
  filter:
    drop-shadow(0 16px 22px rgba(0, 0, 0, 0.38))
    drop-shadow(0 0 8px rgba(244, 213, 134, 0.08));
}

.board-surface-cell {
  filter: saturate(1.08) contrast(1.05);
}

.board-surface-line {
  stroke: rgba(149, 226, 255, 0.7);
  stroke-width: 1.25;
}

.board-side-red .board-surface-line {
  stroke: rgba(255, 133, 166, 0.72);
}

.board-surface-corner-line {
  stroke: rgba(244, 213, 134, 0.46);
}

.board-surface-target-outline {
  stroke-width: 1.8;
}

.board-surface-target-outline.move-target,
.board-surface-target-outline.summon-target {
  stroke: rgba(255, 231, 132, 0.96);
  filter: drop-shadow(0 0 9px rgba(244, 213, 134, 0.42));
}

.board-surface-target-outline.attack-target {
  stroke: rgba(255, 255, 255, 0.98);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.46));
}

.board-surface-target-outline.random-attack-target {
  stroke: rgba(142, 241, 255, 0.98);
  filter: drop-shadow(0 0 10px rgba(76, 231, 255, 0.44));
}

.unit-token {
  border-width: 1px;
  box-shadow:
    0 9px 16px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(244, 213, 134, 0.22),
    0 0 20px color-mix(in srgb, var(--unit-side, #ffffff) 22%, transparent);
}

.unit-token::before {
  border-width: 1px;
  opacity: 0.82;
}

.unit-portrait-gloss {
  z-index: 20;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.24), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 42%, rgba(0, 0, 0, 0.22));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.38),
    inset 0 -12px 15px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(244, 213, 134, 0.2);
  opacity: 0.82;
}

.unit-hp {
  color: #fafff7;
  text-shadow:
    0 1px 0 #001e13,
    1px 0 0 #001e13,
    0 -1px 0 #001e13,
    -1px 0 0 #001e13,
    0 0 8px rgba(105, 230, 167, 0.38);
}

.board-side:has(.board-cell.board-col-0.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-0 .unit-hp,
.board-side:has(.board-cell.board-col-1.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-0 .unit-hp,
.board-side:has(.board-cell.board-col-2.board-row-0:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-0 .unit-hp,
.board-side:has(.board-cell.board-col-0.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-1 .unit-hp,
.board-side:has(.board-cell.board-col-1.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-1 .unit-hp,
.board-side:has(.board-cell.board-col-2.board-row-1:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-1 .unit-hp,
.board-side:has(.board-cell.board-col-0.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-0.board-row-2 .unit-hp,
.board-side:has(.board-cell.board-col-1.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-1.board-row-2 .unit-hp,
.board-side:has(.board-cell.board-col-2.board-row-2:is(:hover, :focus-within)) .board-hp-slot.board-col-2.board-row-2 .unit-hp,
.board-hp-slot.is-surface-hover .unit-hp {
  border-color: rgba(105, 230, 167, 0.68);
  background:
    linear-gradient(180deg, rgba(105, 230, 167, 0.17), rgba(2, 15, 11, 0.94)),
    #020806;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.log-panel {
  grid-template-columns: 26px minmax(0, 0.95fr) minmax(220px, 0.7fr) auto;
  padding: 9px 12px;
  border-color: rgba(244, 213, 134, 0.26);
  background:
    linear-gradient(90deg, rgba(13, 32, 48, 0.86), rgba(5, 9, 16, 0.94) 42%, rgba(43, 18, 32, 0.78)),
    #050912;
}

.message-glyph {
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(244, 213, 134, 0.24), rgba(244, 213, 134, 0.04)),
    rgba(0, 0, 0, 0.24);
}

.message-line {
  color: #fff9e4;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.9),
    0 0 12px rgba(244, 213, 134, 0.22);
}

.hand-panel {
  padding: 8px 10px 10px;
  border-color: rgba(244, 213, 134, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), transparent 26%, rgba(0, 0, 0, 0.2)),
    linear-gradient(90deg, rgba(15, 45, 66, 0.64), rgba(4, 8, 15, 0.96) 38%, rgba(4, 8, 15, 0.96) 62%, rgba(68, 20, 39, 0.58)),
    #040811;
}

.hand-head {
  min-height: 24px;
  padding: 0 2px;
}

.hand-head span b {
  color: #fff5c7;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  text-shadow: 0 0 12px rgba(244, 213, 134, 0.32);
}

.audio-mute {
  border-radius: 4px;
  border-color: rgba(244, 213, 134, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02)),
    rgba(0, 0, 0, 0.3);
}

.audio-volume::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, rgba(76, 231, 255, 0.55), rgba(244, 213, 134, 0.62));
}

.field-mana {
  left: -13px;
  bottom: 18px;
  color: #fff3b1;
  text-shadow: 0 0 14px rgba(244, 213, 134, 0.48);
}

.field-mana span,
.field-mana small {
  color: rgba(220, 229, 237, 0.82);
}

.hand-mana-track {
  height: 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.24)),
    rgba(0, 0, 0, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(244, 213, 134, 0.18),
    0 0 14px rgba(244, 213, 134, 0.16);
}

.hand-mana-track em {
  background: linear-gradient(90deg, #4ce7ff, #fff3b1 64%, #f3a94c);
}

.hand-row {
  gap: 10px;
}

.card-shell {
  width: min(166px, 100%);
}

.hand-card {
  min-height: 226px;
  border-color: rgba(244, 213, 134, 0.76);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 26%, rgba(0, 0, 0, 0.22)),
    #050811;
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(0, 0, 0, 0.8),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.hand-card::after {
  inset: 5px;
  border-color: rgba(244, 213, 134, 0.18);
  border-radius: 4px;
}

.hand-card:hover,
.hand-card:focus-visible {
  border-color: rgba(255, 245, 198, 0.94);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.62),
    0 0 24px rgba(244, 213, 134, 0.24),
    0 0 28px rgba(76, 231, 255, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.13);
  transform: translateY(-7px) scale(1.01);
}

.hand-card.spell {
  border-color: rgba(181, 140, 255, 0.86);
}

.hand-card.is-selected {
  border-color: #fff7c9;
  box-shadow:
    0 0 0 2px rgba(244, 213, 134, 0.92),
    0 0 34px rgba(244, 213, 134, 0.38),
    0 18px 36px rgba(0, 0, 0, 0.66);
}

.card-cost {
  top: 7px;
  left: 7px;
  width: 36px;
  height: 36px;
  border-color: rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 32% 22%, #ffffff, rgba(255, 255, 255, 0.5) 18%, transparent 19%),
    linear-gradient(180deg, #dffcff, #4ce7ff 44%, #245fd2);
  box-shadow:
    0 0 20px rgba(76, 231, 255, 0.5),
    inset 0 0 0 3px rgba(1, 8, 21, 0.42);
}

.card-art {
  inset: 5px;
  border-radius: 4px;
}

.card-art::after {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 22%, rgba(3, 7, 14, 0.24) 58%, rgba(3, 7, 14, 0.88)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent 25%, transparent 75%, rgba(0, 0, 0, 0.4));
}

.card-illustration {
  filter: saturate(1.18) contrast(1.08) brightness(1.03);
}

.card-nameplate {
  left: 9px;
  right: 9px;
  bottom: 62px;
  border-left-color: #f4d586;
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(1, 5, 12, 0.94), rgba(1, 5, 12, 0.62) 72%, transparent);
}

.card-nameplate strong {
  color: #fff9e6;
  text-shadow: 0 1px 2px #000, 0 0 10px rgba(244, 213, 134, 0.18);
}

.card-type {
  border-radius: 4px;
  border-color: rgba(244, 213, 134, 0.56);
  background:
    linear-gradient(180deg, rgba(244, 213, 134, 0.12), rgba(0, 0, 0, 0.18)),
    rgba(2, 5, 11, 0.78);
}

.card-bottom {
  border-radius: 4px;
  border-color: rgba(244, 213, 134, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.035)),
    rgba(3, 7, 14, 0.88);
}

.icon-stat {
  border-radius: 4px;
  border-color: rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.12)),
    rgba(0, 0, 0, 0.28);
}

.card-range img {
  border-radius: 2px;
  background: rgba(255, 250, 223, 0.9);
}

.card-description {
  border-color: rgba(244, 213, 134, 0.18);
  border-radius: 0 0 4px 4px;
  background:
    linear-gradient(180deg, rgba(244, 213, 134, 0.07), rgba(0, 0, 0, 0.16)),
    rgba(3, 7, 14, 0.86);
}

.hand-panel .card-description {
  border-color: rgba(244, 213, 134, 0.26);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(244, 213, 134, 0.09), rgba(0, 0, 0, 0.2)),
    rgba(3, 7, 14, 0.92);
}

.library-drawer {
  border-color: rgba(244, 213, 134, 0.36);
  background:
    linear-gradient(135deg, rgba(31, 74, 110, 0.38), transparent 35%, rgba(100, 24, 48, 0.32)),
    rgba(3, 7, 14, 0.98);
}

/* Prototype 2 tuning after side-by-side review. */

.topbar {
  grid-template-columns: minmax(190px, 1fr) auto minmax(260px, 1fr);
  gap: 14px;
  padding: 7px 10px;
  border-color: rgba(179, 223, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
    rgba(10, 17, 32, 0.74);
}

.topbar::before {
  background:
    linear-gradient(90deg, rgba(38, 124, 255, 0.18), transparent 24%, transparent 76%, rgba(255, 61, 114, 0.18)),
    repeating-linear-gradient(115deg, transparent 0 22px, rgba(255, 217, 130, 0.05) 22px 23px);
  opacity: 1;
}

.mini-title {
  color: #39e6ff;
  font-size: 10px;
  font-weight: 900;
  text-shadow: 0 0 10px rgba(57, 230, 255, 0.55);
}

.brand-block strong {
  color: #ffffff;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, "Yu Mincho", serif;
  font-size: clamp(22px, 2.2vw, 32px);
  text-shadow:
    0 0 16px rgba(57, 230, 255, 0.42),
    0 0 26px rgba(170, 125, 255, 0.28);
}

.turn-badge {
  min-width: 224px;
  min-height: 44px;
  padding: 5px 22px;
  border-color: rgba(255, 217, 130, 0.64);
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 217, 130, 0.18), transparent),
    rgba(8, 12, 24, 0.92);
  box-shadow:
    inset 0 0 20px rgba(255, 217, 130, 0.12),
    0 0 22px rgba(255, 217, 130, 0.16);
}

.turn-badge b {
  color: #f4d586;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 28px;
  text-shadow: 0 0 14px rgba(255, 217, 130, 0.6);
}

.ghost-btn,
.primary-btn {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
}

.ghost-btn {
  border-color: rgba(179, 223, 255, 0.28);
  color: #f8fbff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(8, 13, 25, 0.88);
}

.primary-btn {
  border-color: rgba(255, 217, 130, 0.86);
  color: #1b1005;
  background:
    linear-gradient(180deg, #fff2ad, #ffb34a 44%, #b86a1e),
    #ffd982;
  box-shadow:
    0 0 22px rgba(255, 179, 74, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.board-wrap {
  border-color: rgba(179, 223, 255, 0.2);
  background:
    linear-gradient(90deg, rgba(8, 53, 96, 0.56), rgba(6, 12, 26, 0.96) 47%, rgba(6, 12, 26, 0.96) 53%, rgba(93, 16, 42, 0.58)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    #040914;
}

.board-wrap::before {
  inset: 10px 12px;
  border-color: rgba(244, 213, 134, 0.14);
  background:
    linear-gradient(90deg, transparent, rgba(244, 213, 134, 0.06), transparent),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 255, 255, 0.025) 31px 32px);
}

.beginner-mode-toggle {
  top: 10px;
  left: 12px;
  gap: 7px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: rgba(243, 250, 255, 0.92);
  background: transparent;
  font-size: 11px;
}

.beginner-mode-switch {
  width: 32px;
  height: 17px;
  border-color: rgba(154, 205, 224, 0.52);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(24, 38, 54, 0.95), rgba(4, 10, 18, 0.92));
  box-shadow:
    0 0 8px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.beginner-mode-switch::after {
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.beginner-mode-toggle input:checked + .beginner-mode-switch {
  border-color: rgba(108, 238, 255, 0.7);
  background:
    linear-gradient(180deg, rgba(27, 111, 134, 0.86), rgba(3, 33, 50, 0.94));
  box-shadow:
    0 0 12px rgba(57, 230, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.beginner-mode-toggle input:checked + .beginner-mode-switch::after {
  transform: translateX(15px);
}

.beginner-mode-toggle b {
  color: rgba(246, 251, 255, 0.9);
  font-size: 11px;
}

.player-red {
  --side: #ff2758;
}

.player-red .panel-aura {
  opacity: 0.4;
}

.player-red .player-status,
.player-red .resource-row {
  border-color: rgba(255, 39, 88, 0.62);
}

.player-status {
  padding: 4px 8px;
  min-width: 74px;
  white-space: nowrap;
  text-align: center;
  font-size: 10px;
  font-weight: 900;
}

.player-red .player-crest {
  box-shadow:
    inset 0 0 18px rgba(255, 39, 88, 0.22),
    0 0 24px rgba(255, 39, 88, 0.28);
}

.player-crest {
  position: relative;
  width: 100%;
  height: 104px;
  border-radius: 7px;
  border-width: 1px;
  border-color: color-mix(in srgb, var(--side) 42%, transparent);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%, rgba(0, 0, 0, 0.36)),
    linear-gradient(90deg, color-mix(in srgb, var(--side) 18%, transparent), transparent 28%, transparent 72%, color-mix(in srgb, var(--side) 14%, transparent)),
    #050811;
  background-position: center;
  background-size: cover;
  box-shadow:
    inset 0 0 18px color-mix(in srgb, var(--side) 25%, transparent),
    0 0 22px color-mix(in srgb, var(--side) 26%, transparent);
  overflow: hidden;
}

.player-crest .player-profile-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: cover;
  filter: saturate(1.06) contrast(1.04) brightness(0.92);
}

.player-crest::before {
  display: block;
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%, rgba(0, 0, 0, 0.36)),
    linear-gradient(90deg, color-mix(in srgb, var(--side) 18%, transparent), transparent 28%, transparent 72%, color-mix(in srgb, var(--side) 14%, transparent));
  pointer-events: none;
}

.player-crest::after {
  display: none;
}

.counter-grid {
  align-self: end;
  grid-template-rows: repeat(3, 20px);
  align-items: center;
  height: 85px;
  min-height: 85px;
  max-height: 85px;
  padding: 7px 9px 10px;
  margin-bottom: -1px;
  overflow: hidden;
}

.player-name {
  top: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  color: #ffffff;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 0 8px rgba(255, 255, 255, 0.62),
    0 0 16px color-mix(in srgb, var(--side) 38%, transparent);
}

.player-name::after {
  content: "";
  display: block;
  width: 100%;
  min-width: 72px;
  max-width: 100%;
  height: 1px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9) 50%, transparent),
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--side) 70%, #ffffff) 50%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--side) 45%, rgba(255, 255, 255, 0.3));
}

.message-glyph {
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, transparent, rgba(255, 217, 130, 0.56), transparent 42%),
    rgba(255, 217, 130, 0.08);
}

.log-end-btn {
  border-radius: 999px;
  border-color: rgba(244, 213, 134, 0.92);
  color: #1d1205;
  background:
    linear-gradient(180deg, #fff1b0, #ffbd52 46%, #c87524 72%, #7f4318),
    #e19637;
  box-shadow:
    0 0 24px rgba(255, 166, 52, 0.34),
    0 10px 18px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.hand-panel {
  padding: 8px 10px 10px;
  border-color: rgba(244, 213, 134, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), transparent 26%, rgba(0, 0, 0, 0.2)),
    linear-gradient(90deg, rgba(15, 45, 66, 0.64), rgba(4, 8, 15, 0.96) 38%, rgba(4, 8, 15, 0.96) 62%, rgba(68, 20, 39, 0.58)),
    #040811;
}

.audio-mute {
  border-color: rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.audio-mute[aria-pressed="true"] {
  color: rgba(255, 255, 255, 0.74);
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.04);
}

.audio-volume::-webkit-slider-runnable-track {
  background: rgba(255, 255, 255, 0.34);
}

.hand-card {
  min-height: 224px;
  border-color: rgba(255, 217, 130, 0.74);
  border-radius: 8px;
  color: #f8fbff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    #060a12;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.hand-card::after {
  inset: 5px;
  border-color: rgba(255, 255, 255, 0.16);
  border-radius: 6px;
}

.hand-card:hover,
.hand-card:focus-visible {
  border-color: rgba(57, 230, 255, 0.86);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.52),
    0 0 26px rgba(57, 230, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transform: translateY(-6px);
}

.hand-card.spell {
  border-color: rgba(170, 125, 255, 0.82);
}

.hand-card.is-selected {
  border-color: #ffffff;
  box-shadow:
    0 0 0 2px rgba(255, 217, 130, 0.9),
    0 0 32px rgba(255, 217, 130, 0.34),
    0 18px 34px rgba(0, 0, 0, 0.56);
  transform: translateY(-8px) scale(1.015);
}

.hand-card.compact {
  width: 164px;
  min-height: 224px;
  height: 224px;
}

.card-nameplate strong {
  color: #ffffff;
}

.icon-stat {
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.26);
}

/* Prototype 2 tuning: hand/header audio and combat text polish. */

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

.top-actions > .ghost-btn {
  order: 1;
}

.top-actions .audio-controls {
  order: 2;
  margin-left: 2px;
}

.hand-panel {
  position: relative;
  padding: 8px;
  border-color: rgba(179, 223, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
    rgba(10, 17, 32, 0.74);
}

.beginner-mode-toggle {
  top: 18px;
  left: 32px;
}

.beginner-mode-switch {
  transition:
    background 260ms ease,
    border-color 260ms ease,
    box-shadow 260ms ease;
}

.beginner-mode-switch::after {
  transition:
    transform 260ms cubic-bezier(0.16, 0.84, 0.24, 1),
    background 260ms ease,
    border-color 260ms ease,
    box-shadow 260ms ease;
}

.hand-action-timer {
  position: absolute;
  top: 4px;
  left: 50%;
  z-index: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 7px;
  align-items: baseline;
  justify-items: stretch;
  gap: 0;
  width: 184px;
  min-height: 36px;
  padding: 5px 34px 5px;
  transform: translateX(-50%);
  color: #dffaff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 34%, rgba(0, 0, 0, 0.26)),
    linear-gradient(90deg, rgba(22, 26, 38, 0.94), rgba(5, 8, 16, 0.98) 52%, rgba(18, 22, 34, 0.94));
  clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%);
  filter: drop-shadow(0 0 12px rgba(244, 213, 134, 0.15));
  pointer-events: none;
}

.hand-action-timer::before,
.hand-action-timer::after {
  content: "";
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  background: none;
  border: 1px solid rgba(244, 213, 134, 0.58);
  clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%);
  filter: none;
  opacity: 1;
  pointer-events: none;
}

.hand-action-timer::before {
  inset: 0;
  padding: 1px;
  background: rgba(255, 217, 130, 0.64);
  border: 0;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 0 16px rgba(0, 0, 0, 0.42);
}

.hand-action-timer::after {
  inset: 0;
  border: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cline x1='0' y1='0' x2='14' y2='100' stroke='%23ffd982' stroke-opacity='.78' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3Cline x1='100' y1='0' x2='86' y2='100' stroke='%23ffd982' stroke-opacity='.78' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hand-action-timer span {
  grid-row: 2;
  position: relative;
  top: -10px;
  left: 5px;
  color: #f7ffff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-align: left;
  text-shadow:
    0 0 8px rgba(57, 230, 255, 0.72),
    0 0 16px rgba(57, 230, 255, 0.34);
}

.hand-action-timer b {
  grid-row: 1;
  display: block;
  min-width: 2.2ch;
  color: #f7ffff;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 18px;
  line-height: 0.9;
  text-align: center;
  text-shadow:
    0 0 8px rgba(57, 230, 255, 0.72),
    0 0 16px rgba(57, 230, 255, 0.34);
}

.hand-action-timer i {
  position: relative;
  display: block;
  top: -7px;
  height: 7px;
  width: 100px;
  justify-self: center;
  border: 1px solid rgba(255, 217, 130, 0.64);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.24)),
    rgba(0, 14, 26, 0.74);
  clip-path: polygon(0 0, 100% 0, 96% 100%, 4% 100%);
  box-shadow:
    0 0 12px rgba(57, 230, 255, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.hand-action-timer i::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cline x1='0' y1='0' x2='4' y2='100' stroke='%23ffd982' stroke-opacity='.82' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3Cline x1='100.5' y1='0' x2='96.5' y2='100' stroke='%23ffd982' stroke-opacity='.82' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  pointer-events: none;
}

.hand-action-timer em {
  display: block;
  width: var(--timer-pct, 100%);
  height: 100%;
  border-radius: 0;
  clip-path: inherit;
  background:
    linear-gradient(90deg, #208cff, #39e6ff 52%, #dfffff);
  box-shadow:
    0 0 12px rgba(57, 230, 255, 0.72),
    0 0 22px rgba(57, 230, 255, 0.34);
  transition:
    width 100ms linear,
    background 180ms ease,
    box-shadow 180ms ease;
}

.hand-action-timer em.is-resetting {
  transition:
    width 360ms cubic-bezier(0.12, 0.92, 0.18, 1),
    background 180ms ease,
    box-shadow 180ms ease;
}

.hand-action-timer.is-critical span,
.hand-action-timer.is-critical b {
  color: #fff0f0;
  text-shadow:
    0 0 8px rgba(255, 61, 114, 0.82),
    0 0 18px rgba(255, 61, 114, 0.42);
}

.hand-action-timer.is-critical i {
  border-color: rgba(255, 87, 115, 0.54);
  box-shadow:
    0 0 14px rgba(255, 61, 114, 0.26),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.hand-action-timer.is-critical em {
  background:
    linear-gradient(90deg, #ff315e, #ff796b 60%, #ffe1c0);
  box-shadow:
    0 0 14px rgba(255, 61, 114, 0.76),
    0 0 24px rgba(255, 61, 114, 0.38);
}

.hand-timer-prompt {
  position: absolute;
  left: calc(50% + 124px);
  top: 17px;
  z-index: 3;
  width: max-content;
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.9),
    0 0 10px rgba(255, 255, 255, 0.32);
  pointer-events: none;
}

.log-panel {
  border-color: rgba(179, 223, 255, 0.2);
  background:
    linear-gradient(90deg, rgba(8, 34, 57, 0.82), rgba(5, 10, 20, 0.96) 46%, rgba(4, 8, 17, 0.98)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    #030812;
}

.hand-head {
  min-height: 22px;
  padding: 0;
  color: #f8fbff;
  font-weight: 900;
}

.hand-head span {
  gap: 8px;
}

.hand-head span b {
  color: inherit;
  font-family: inherit;
  white-space: nowrap;
  text-shadow: none;
}

.hand-head small {
  color: #39e6ff;
  font-size: 11px;
  text-shadow: 0 0 10px rgba(57, 230, 255, 0.5);
}

.hand-row {
  position: relative;
  z-index: 1;
  padding-top: 19px;
}

.hand-card.spell:hover,
.hand-card.spell:focus-visible {
  border-color: rgba(57, 230, 255, 0.86);
}

.message-line {
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.32;
  text-shadow: 0 0 12px rgba(57, 230, 255, 0.24);
}

.message-line.discard-message {
  color: #ffffff;
  font-size: 16px;
  font-weight: 1000;
}

.field-mana strong {
  font-size: 31px;
}

.top-actions .ghost-btn {
  min-height: 29px;
  padding: 0 10px;
  font-size: 12px;
}

.audio-volume {
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  background: transparent;
}

.audio-volume::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
}

.audio-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 7px;
  height: 15px;
  margin-top: -5.5px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 2px;
  background:
    linear-gradient(180deg, #ffffff, #dcecff 48%, #a7bed8);
  box-shadow:
    0 0 8px rgba(255, 255, 255, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.audio-volume::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.audio-volume::-moz-range-thumb {
  width: 7px;
  height: 15px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 2px;
  background:
    linear-gradient(180deg, #ffffff, #dcecff 48%, #a7bed8);
  box-shadow:
    0 0 8px rgba(255, 255, 255, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.audio-options {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.audio-options:hover,
.audio-options:focus-visible {
  border-color: rgba(244, 213, 134, 0.82);
  color: #fff3b1;
  box-shadow:
    0 0 14px rgba(244, 213, 134, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.options-overlay {
  position: fixed;
  inset: 0;
  z-index: 145;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 5, 12, 0.58);
  backdrop-filter: blur(4px);
}

.options-panel {
  --modal-y: clamp(-210px, -24vh, -142px);
  width: min(470px, 100%);
  border: 1px solid rgba(255, 217, 130, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), transparent 34%),
    linear-gradient(160deg, rgba(14, 26, 46, 0.98), rgba(5, 9, 18, 0.98));
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.68),
    0 0 30px rgba(255, 217, 130, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  padding: 16px;
  animation: modalIn 180ms ease-out both;
}

.options-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: #fff3b1;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-shadow: 0 0 10px rgba(255, 217, 130, 0.38);
}

.options-head button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.options-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(179, 223, 255, 0.16);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    rgba(0, 0, 0, 0.22);
}

.option-volume-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 12px;
  color: #eef8ff;
  font-size: 12px;
  font-weight: 900;
}

.option-volume-row b {
  color: #ffffff;
  text-align: right;
  font-size: 12px;
  text-shadow: 0 0 8px rgba(57, 230, 255, 0.32);
}

.option-volume {
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  background: transparent;
  cursor: pointer;
}

.option-volume::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.option-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 7px;
  height: 15px;
  margin-top: -5.5px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 2px;
  background:
    linear-gradient(180deg, #ffffff, #dcecff 48%, #a7bed8);
  box-shadow:
    0 0 8px rgba(255, 255, 255, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.option-volume::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.option-volume::-moz-range-thumb {
  width: 7px;
  height: 15px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 2px;
  background:
    linear-gradient(180deg, #ffffff, #dcecff 48%, #a7bed8);
  box-shadow:
    0 0 8px rgba(255, 255, 255, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.lesson-drawer {
  grid-template-rows: auto 1fr;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  align-content: start;
  overflow-y: auto;
  padding: 4px;
}

.lesson-card {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto auto;
  gap: 8px;
  min-height: 252px;
  padding: 13px;
  border: 1px solid rgba(244, 213, 134, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), transparent 34%, rgba(0, 0, 0, 0.24)),
    rgba(5, 10, 18, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 14px 24px rgba(0, 0, 0, 0.28);
}

.lesson-number {
  color: #39e6ff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 10px rgba(57, 230, 255, 0.38);
}

.lesson-card h3 {
  margin: 0;
  color: #ffffff;
  font-size: 18px;
  line-height: 1.15;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.lesson-card b {
  color: #fff3b1;
  font-size: 11px;
  line-height: 1;
}

.lesson-card p,
.lesson-card small {
  margin: 0;
  color: rgba(246, 251, 255, 0.82);
  font-size: 12px;
  line-height: 1.45;
}

.lesson-card small {
  color: rgba(179, 223, 255, 0.82);
}

.lesson-card .primary-btn {
  justify-self: start;
  min-height: 30px;
  padding: 0 14px;
  font-size: 12px;
}
