:root {
  --bg: #101312;
  --surface: #181c1f;
  --surface-2: #22272b;
  --surface-3: #2c3135;
  --text: #f4efe4;
  --muted: #b9b0a1;
  --line: rgba(244, 239, 228, 0.12);
  --gold: #d69b38;
  --teal: #47b8a5;
  --red: #c94c4c;
  --violet: #7d6fd6;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  --season-bg: url("assets/backgrounds/sfondo-season0.png");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(4, 8, 14, 0.54), rgba(4, 8, 14, 0.32) 34%, rgba(5, 8, 10, 0.9) 100%),
    radial-gradient(circle at 50% 22%, rgba(44, 116, 220, 0.26), transparent 38%),
    var(--season-bg);
  background-position: center, center, center top;
  background-size: auto, auto, cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

.app {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 260px;
  padding: 20px 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.7rem);
  letter-spacing: 0;
  line-height: 0.95;
}

.hero p {
  color: var(--muted);
  max-width: 660px;
  font-size: 0.94rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 800;
}

.panel {
  background: rgba(24, 28, 31, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 14px;
}

.hidden {
  display: none !important;
}

.orientation-guard {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 22%, rgba(80, 196, 176, 0.18), transparent 34%),
    rgba(4, 7, 10, 0.94);
  color: var(--text);
  text-align: center;
}

.orientation-card {
  width: min(320px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px 20px;
  border: 1px solid rgba(255, 211, 77, 0.34);
  border-radius: 8px;
  background: rgba(12, 17, 22, 0.92);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.45);
}

.orientation-card strong {
  color: #fff5dc;
  font-size: 1.25rem;
  line-height: 1.05;
}

.orientation-card span {
  color: rgba(244, 239, 228, 0.78);
  font-size: 0.9rem;
  line-height: 1.35;
}

.orientation-phone {
  width: 74px;
  height: 46px;
  position: relative;
  border: 3px solid #ffd34d;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(255, 211, 77, 0.22);
}

.orientation-phone::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffd34d;
  transform: translateY(-50%);
}

@media (max-width: 820px) and (orientation: portrait) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app,
  .site-footer,
  .beta-banner {
    pointer-events: none;
    user-select: none;
    filter: blur(2px) brightness(0.58);
  }

  .orientation-guard {
    display: grid;
  }
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 14px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: #0e1112;
  color: var(--text);
  padding: 13px 14px;
  border-radius: 8px;
  outline: none;
  font-size: 1rem;
}

input:focus {
  border-color: var(--gold);
}

button {
  border: 0;
  background: var(--gold);
  color: #17120a;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
  font-size: 0.92rem;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

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

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

button.danger {
  background: var(--red);
  color: white;
}

.quick-controls {
  position: fixed;
  right: 14px;
  bottom: 96px;
  z-index: 135;
  display: flex;
  gap: 8px;
  align-items: center;
}

body.in-game .quick-controls {
  bottom: 54px;
}

.icon-control {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(244, 239, 228, 0.18);
  border-radius: 8px;
  background: rgba(8, 11, 13, 0.86);
  color: #f4efe4;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
}

.icon-control:hover:not(:disabled) {
  border-color: rgba(214, 155, 56, 0.72);
  color: #ffd98a;
}

.icon-control:focus-visible {
  outline: 2px solid rgba(231, 184, 90, 0.75);
  outline-offset: 3px;
}

.icon-control svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.audio-control .icon-audio-off {
  display: none;
}

.audio-control.is-muted .icon-audio-on {
  display: none;
}

.audio-control.is-muted .icon-audio-off {
  display: block;
}

.options-overlay {
  position: fixed;
  inset: 0;
  z-index: 430;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 34%, rgba(214, 155, 56, 0.16), transparent 34%),
    rgba(0, 7, 12, 0.74);
  backdrop-filter: blur(7px);
}

.options-panel {
  position: relative;
  width: min(360px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid rgba(214, 155, 56, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(20, 25, 30, 0.96), rgba(6, 12, 18, 0.96));
  color: #f4efe4;
  text-align: center;
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.58),
    inset 0 0 24px rgba(214, 155, 56, 0.08);
}

.options-panel h2 {
  margin: 4px 0 12px;
  font-size: 1.7rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.options-soon {
  margin: 0;
  color: rgba(244, 239, 228, 0.74);
  font-size: 1rem;
  font-weight: 800;
}

.options-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(244, 239, 228, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #f4efe4;
}

.options-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

body.options-open {
  overflow: hidden;
}

.actions,
.join-box,
.game-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.match-menu button {
  min-height: 72px;
  font-size: 1rem;
}

.primary-action {
  background: linear-gradient(180deg, #f0b64b, #c88621);
}

.queue-panel {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(214, 155, 56, 0.35);
  border-radius: 8px;
  background: rgba(14, 17, 18, 0.78);
}

.queue-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(244, 239, 228, 0.2);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}

.queue-panel strong {
  color: var(--text);
}

.code-room-panel {
  display: grid;
  gap: 14px;
}

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

.code-room-head h3 {
  margin: 0;
}

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

.join-box {
  margin-top: 16px;
  align-items: end;
}

.join-box label {
  flex: 1;
  min-width: 180px;
  margin-bottom: 0;
}

.avatar-select {
  display: grid;
  gap: 10px;
}

.avatar-select-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.avatar-select-head span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.avatar-select-head strong {
  color: var(--gold);
  font-size: 0.86rem;
  text-transform: capitalize;
}

.avatar-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.avatar-choice {
  display: grid;
  gap: 7px;
  padding: 7px;
  border: 1px solid rgba(94, 185, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 14, 21, 0.62);
  color: var(--text);
  text-align: center;
  box-shadow: inset 0 0 18px rgba(55, 167, 255, 0.06);
}

.avatar-choice img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  object-position: center;
  border-radius: 7px;
  background: rgba(1, 10, 15, 0.72);
}

.avatar-choice span {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.avatar-choice.selected {
  border-color: rgba(89, 198, 255, 0.9);
  box-shadow:
    0 0 0 1px rgba(89, 198, 255, 0.28),
    0 0 22px rgba(63, 177, 255, 0.22);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.game-header h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.12em;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.status-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.status-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-card strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  line-height: 1.1;
}

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

.player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #0e1112;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.player-row.active {
  border-color: rgba(214, 155, 56, 0.7);
}

.player-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  color: #091210;
  background: var(--teal);
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  margin-left: 6px;
}

.active-badge {
  background: var(--gold);
}

.battlefield-panel {
  overflow: hidden;
}

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

.battlefield-head h3,
.ability-panel h3,
.hand-panel h3,
.log-panel h3,
.roster-panel h3 {
  margin: 0 0 8px;
}

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

.pile-row {
  display: flex;
  gap: 12px;
}

.battlefield-piles {
  justify-content: flex-end;
  margin-top: 12px;
}

.pile {
  display: grid;
  justify-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.pile-art {
  width: 48px;
  height: 66px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0e1112;
}

.pile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.combatant-board {
  background: rgba(14, 17, 18, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.opponent-board {
  border-color: rgba(201, 76, 76, 0.34);
}

.player-board {
  border-color: rgba(71, 184, 165, 0.34);
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.board-header strong {
  color: var(--text);
  font-size: 1rem;
}

.frontline {
  text-align: center;
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
  padding: 10px 0;
}

.zone-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 8px;
}

.zone {
  min-height: 192px;
  border: 1px dashed rgba(244, 239, 228, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(244, 239, 228, 0.38);
  font-weight: 900;
  position: relative;
  padding: 6px;
}

.zone.occupied {
  align-items: stretch;
  color: var(--text);
  border-style: solid;
  background: rgba(255, 255, 255, 0.05);
}

.zone.enemy.drop-target,
.avatar.enemy.drop-target {
  outline: 1px solid rgba(214, 155, 56, 0.34);
  outline-offset: -3px;
}

.zone.mine.play-drop-target,
.player-board.play-drop-target,
.opponent-board.play-drop-target {
  outline: 1px solid rgba(80, 196, 176, 0.26);
  outline-offset: -3px;
}

.zone.enemy.drag-over,
.avatar.enemy.drag-over,
.zone.mine.drag-over,
.player-board.drag-over,
.opponent-board.drag-over {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(214, 155, 56, 0.28), inset 0 0 28px rgba(214, 155, 56, 0.16);
}

.zone .card {
  width: 100%;
  min-width: 0;
  height: 176px;
}

.zone-footer {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  pointer-events: none;
}

.zone-footer .small-action {
  pointer-events: auto;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(90deg, rgba(125, 111, 214, 0.16), rgba(71, 184, 165, 0.08));
  border: 1px solid rgba(125, 111, 214, 0.28);
  border-radius: 8px;
  padding: 11px 12px;
  margin: 10px 0;
}

.avatar.active {
  border-color: rgba(214, 155, 56, 0.76);
}

.avatar.enemy.guarded {
  border-color: rgba(201, 76, 76, 0.46);
  background: linear-gradient(90deg, rgba(201, 76, 76, 0.16), rgba(125, 111, 214, 0.09));
}

.avatar.enemy.open {
  border-color: rgba(214, 155, 56, 0.6);
}

.avatar-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.avatar-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 900;
}

.avatar-stats span {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
}

.small-action {
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 0.76rem;
}

.ability-cards,
.hand-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 94px;
}

.ability-card {
  width: min(230px, 100%);
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.ability-card strong,
.ability-card span {
  display: block;
}

.ability-card span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.ability-card p {
  color: var(--muted);
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.35;
}

.ability-card.locked,
.ability-card.used {
  opacity: 0.62;
}

.card {
  --card-frame-url: url("assets/effects/card-frame-creature.svg");
  --card-accent: #50c4b0;
  --card-accent-soft: rgba(80, 196, 176, 0.22);
  width: 140px;
  height: 204px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.65), transparent 28%),
    linear-gradient(180deg, #f8efd8 0 55%, #e7d1a8 100%);
  color: #1d1811;
  border: 0;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(255, 239, 181, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  cursor: default;
  isolation: isolate;
}

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

.card::before {
  z-index: 1;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), transparent 18%),
    radial-gradient(circle at 82% 18%, var(--card-accent-soft), transparent 31%),
    linear-gradient(180deg, transparent 0 63%, rgba(42, 19, 8, 0.18) 100%);
  mix-blend-mode: multiply;
}

.card::after {
  z-index: 5;
  background-image: var(--card-frame-url);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  opacity: 0.72;
}

.card > * {
  position: relative;
  z-index: 2;
}

.card.playable {
  cursor: grab;
}

.card.playable:hover {
  transform: translateY(-2px);
}

.card.playable:active {
  cursor: grabbing;
}

.drag-source {
  cursor: grab;
}

.drag-source:active {
  cursor: grabbing;
}

.drag-source.dragging {
  opacity: 0.42;
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.86;
  transform-origin: center;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.5));
}

.drag-hit-test-hidden {
  pointer-events: none !important;
}

.avatar.drag-source {
  cursor: grab;
}

.card.disabled {
  filter: grayscale(0.8);
  opacity: 0.55;
}

.card.creature {
  --card-frame-url: url("assets/effects/card-frame-creature.svg");
  --card-accent: #50c4b0;
  --card-accent-soft: rgba(80, 196, 176, 0.24);
}

.card.spell {
  --card-frame-url: url("assets/effects/card-frame-spell.svg");
  --card-accent: #9d7cff;
  --card-accent-soft: rgba(157, 124, 255, 0.24);
}

.card.weapon {
  --card-frame-url: url("assets/effects/card-frame-weapon.svg");
  --card-accent: #d69b38;
  --card-accent-soft: rgba(214, 155, 56, 0.25);
}

.card-cost {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.32), transparent 26%),
    linear-gradient(180deg, #1c2830, #0d1318);
  color: #fff5dc;
  display: grid;
  place-items: center;
  font-weight: 950;
  z-index: 7;
  border: 2px solid rgba(255, 220, 114, 0.82);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.38);
}

.card-art {
  height: 78px;
  width: calc(100% + 2px);
  margin: -1px -1px 0;
  background: #1c2427;
  border: 0;
  clip-path: none;
  overflow: hidden;
}

.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0%;
  display: block;
}

.card-info {
  flex: 1;
  padding: 5px 10px 9px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 3px;
  z-index: 6;
}

.card-type {
  color: #6c5e47;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.62rem;
  font-weight: 950;
  z-index: 6;
}

.card-name {
  width: calc(100% + 10px);
  margin: -2px -5px 1px;
  padding: 4px 7px;
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(36, 17, 10, 0.92), rgba(95, 42, 21, 0.86), rgba(36, 17, 10, 0.92));
  color: #fff3cf;
  border-top: 1px solid rgba(255, 225, 147, 0.44);
  border-bottom: 1px solid rgba(61, 24, 10, 0.6);
  font-weight: 950;
  font-size: 0.78rem;
  line-height: 1.08;
  z-index: 6;
  box-shadow: 0 2px 8px rgba(32, 16, 8, 0.28);
}

.card-text {
  color: #4d4438;
  font-size: 0.68rem;
  line-height: 1.22;
  overflow: hidden;
  z-index: 6;
  text-align: center;
}

.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 6px;
  color: #241d14;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1.05;
  z-index: 6;
}

.card-stats span {
  min-width: 0;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 247, 221, 0.74);
  box-shadow: inset 0 0 0 1px rgba(75, 42, 17, 0.18);
}

.card-stat {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}

.card-stat small {
  font-size: 0.72em;
  font-weight: 950;
}

.card-stat-atk {
  justify-self: start;
}

.card-stat-hp {
  justify-self: end;
}

.card-stat-effect {
  grid-column: 1 / -1;
  justify-self: center;
  min-width: 72%;
  text-align: center;
}

.card-zoom-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 5, 9, 0.72);
  backdrop-filter: blur(8px);
}

.card-zoom-dialog {
  position: relative;
  display: grid;
  place-items: center;
}

.card-zoom-close {
  position: absolute;
  right: -12px;
  top: -14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 239, 181, 0.45);
  background: rgba(12, 17, 22, 0.92);
  color: #fff5dc;
  font-size: 1.35rem;
  font-weight: 950;
  line-height: 1;
  z-index: 12;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.42);
}

.card-zoom-card {
  width: min(340px, 80vw);
  height: min(520px, 90vh);
  cursor: zoom-out;
  transform: none !important;
  container-type: inline-size;
}

.card-zoom-card::after {
  opacity: 0.68;
}

.card-zoom-card .card-art {
  height: 256px;
  margin: -1px -1px 0;
  clip-path: none;
}

.card-zoom-card .card-info {
  min-height: 0;
  padding: 10px 20px 22px;
  grid-template-rows: auto auto minmax(46px, 1fr) auto;
  gap: 7px;
}

.card-zoom-card .card-type {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
}

.card-zoom-card .card-name {
  width: 100%;
  margin: 0;
  padding: 6px 10px;
  font-size: clamp(0.88rem, 4.5cqw, 1.16rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.card-zoom-card .card-text {
  display: block;
  font-size: clamp(0.76rem, 3.35cqw, 0.94rem);
  line-height: 1.32;
  padding-right: 2px;
  overflow: auto;
  scrollbar-width: thin;
}

.card-zoom-card .card-text::-webkit-scrollbar {
  width: 5px;
}

.card-zoom-card .card-text::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(95, 42, 21, 0.36);
}

.card-zoom-card .card-stats {
  grid-template-columns: 1fr 1fr;
  align-items: flex-end;
  gap: 8px;
  font-size: clamp(1rem, 4.1cqw, 1.18rem);
  margin-top: 4px;
}

.card-zoom-card .card-stats span {
  min-width: 58px;
  padding: 6px 8px;
  background: rgba(255, 247, 221, 0.9);
  box-shadow: 0 2px 8px rgba(32, 16, 8, 0.16), inset 0 0 0 1px rgba(75, 42, 17, 0.18);
  text-align: center;
}

.card-zoom-card .card-cost {
  width: 42px;
  height: 42px;
  top: 8px;
  left: 8px;
  font-size: 1.05rem;
}

.graveyard-backdrop {
  position: fixed;
  inset: 0;
  z-index: 290;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 5, 9, 0.72);
  backdrop-filter: blur(8px);
}

.graveyard-dialog {
  width: min(620px, 92vw);
  max-height: min(620px, 84vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(244, 239, 228, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(10, 14, 17, 0.94);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
  overflow: hidden;
}

.graveyard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(244, 239, 228, 0.12);
}

.graveyard-header span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.graveyard-header strong {
  color: var(--text);
  font-size: 1.08rem;
}

.graveyard-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 239, 181, 0.45);
  background: rgba(12, 17, 22, 0.92);
  color: #fff5dc;
  font-size: 1.25rem;
  line-height: 1;
}

.graveyard-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  overflow: auto;
}

.graveyard-item {
  display: grid;
  grid-template-columns: 86px minmax(120px, 1fr) minmax(160px, 1.6fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(244, 239, 228, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
}

.graveyard-item:hover {
  border-color: rgba(214, 155, 56, 0.48);
  background: rgba(214, 155, 56, 0.08);
}

.graveyard-card-type {
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.graveyard-item > span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 34%, rgba(83, 177, 255, 0.2), transparent 34%),
    rgba(0, 7, 12, 0.78);
  backdrop-filter: blur(7px);
}

.result-card {
  width: min(440px, 92vw);
  padding: 22px;
  border: 1px solid rgba(103, 197, 255, 0.46);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(20, 37, 51, 0.96), rgba(6, 14, 21, 0.96));
  color: #f6fbff;
  text-align: center;
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.58),
    inset 0 0 24px rgba(79, 186, 255, 0.1);
}

.result-art {
  min-height: 116px;
  margin-bottom: 16px;
  border: 1px dashed rgba(140, 210, 255, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(79, 173, 255, 0.18), transparent 42%),
    radial-gradient(circle at 50% 50%, rgba(214, 166, 58, 0.18), transparent 45%),
    rgba(255, 255, 255, 0.04);
}

.result-card h2 {
  margin: 5px 0 8px;
  font-size: clamp(2.1rem, 8vw, 4rem);
  letter-spacing: 0;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.46);
}

.result-card p:not(.eyebrow) {
  margin: 0 0 18px;
  color: rgba(246, 251, 255, 0.82);
  font-weight: 800;
}

.result-win .result-card {
  border-color: rgba(95, 206, 255, 0.76);
}

.result-loss .result-card {
  border-color: rgba(255, 93, 93, 0.74);
}

.result-draw .result-card {
  border-color: rgba(225, 183, 84, 0.74);
}

.turn-banner {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 68;
  transform: translate(-50%, -50%) scale(0.98);
  min-width: min(340px, calc(100vw - 48px));
  padding: 16px 24px;
  border: 1px solid rgba(225, 183, 84, 0.74);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(21, 30, 38, 0.94), rgba(7, 13, 18, 0.94));
  color: #fff6d8;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.5),
    inset 0 0 26px rgba(214, 155, 56, 0.12);
  font-size: clamp(1.8rem, 6vw, 3.2rem);
  font-weight: 950;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
}

.turn-banner-visible {
  animation: turn-banner-pop 1.7s ease both;
}

.game-log {
  display: grid;
  gap: 6px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(214, 155, 56, 0.68) rgba(8, 11, 13, 0.72);
}

.game-log::-webkit-scrollbar,
.log-panel::-webkit-scrollbar {
  width: 8px;
}

.game-log::-webkit-scrollbar-track,
.log-panel::-webkit-scrollbar-track {
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)),
    rgba(8, 11, 13, 0.78);
  box-shadow: inset 0 0 0 1px rgba(244, 239, 228, 0.08);
}

.game-log::-webkit-scrollbar-thumb,
.log-panel::-webkit-scrollbar-thumb {
  border: 2px solid rgba(8, 11, 13, 0.78);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(244, 239, 228, 0.88), rgba(214, 155, 56, 0.72) 48%, rgba(80, 196, 176, 0.58));
  box-shadow: 0 0 10px rgba(214, 155, 56, 0.18);
}

.game-log::-webkit-scrollbar-thumb:hover,
.log-panel::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(255, 247, 221, 0.95), rgba(236, 177, 67, 0.86) 48%, rgba(92, 218, 194, 0.72));
}

.log-entry {
  border-left: 3px solid var(--gold);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 700;
  border-radius: 6px;
}

@keyframes turn-banner-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }

  18%,
  74% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.03);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #f8fafc;
  color: #111827;
  padding: 12px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 800;
  z-index: 20;
}

.effect-tooltip {
  position: fixed;
  z-index: 80;
  max-width: min(340px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(214, 155, 56, 0.42);
  border-radius: 8px;
  background: rgba(8, 11, 13, 0.96);
  color: #f4efe4;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.effect-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .battlefield-head,
  .game-header,
  .player-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .zone-grid {
    grid-template-columns: repeat(3, minmax(82px, 1fr));
  }

  .zone {
    min-height: 174px;
  }
}

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

  .hero {
    min-height: auto;
    padding: 14px 0 18px;
  }

  .game-actions,
  .actions,
  .join-box {
    width: 100%;
  }

  .game-actions button,
  .actions button,
  .join-box button {
    flex: 1;
  }

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

  .pile-row {
    width: 100%;
    justify-content: space-between;
  }

  .zone-grid {
    gap: 6px;
  }

  .zone {
    min-height: 150px;
    padding: 4px;
  }

  .zone .card {
    height: 138px;
  }

  .card {
    width: 118px;
    height: 178px;
  }

  .card-art {
    height: 56px;
  }

  .card-text {
    display: none;
  }

  .card-zoom-card {
    width: min(340px, calc(100vw - 32px));
    height: min(520px, calc(100vh - 48px));
  }

  .card-zoom-card .card-art {
    height: min(256px, 48vh);
  }

  .card-zoom-card .card-text {
    display: block;
  }

  .avatar {
    align-items: flex-start;
    flex-direction: column;
  }
}

body.in-game .hero {
  display: none;
}

.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  grid-template-areas:
    "header header"
    "status status"
    "battlefield roster"
    "battlefield ability"
    "hand log";
  gap: 14px;
}

.game .panel {
  margin-bottom: 0;
}

.game-header {
  grid-area: header;
}

.status-grid {
  grid-area: status;
  grid-template-columns: 1fr 1.22fr 1fr 1.45fr;
}

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

.battlefield-panel {
  grid-area: battlefield;
  position: relative;
  background:
    linear-gradient(90deg, rgba(80, 196, 176, 0.09), transparent 18%, transparent 82%, rgba(201, 76, 76, 0.1)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 46%, rgba(0, 0, 0, 0.22)),
    #10161c;
}

.battlefield-panel::before {
  content: "";
  position: absolute;
  inset: 66px 18px 18px;
  border: 1px solid rgba(214, 155, 56, 0.16);
  background:
    linear-gradient(90deg, transparent 0 49%, rgba(214, 155, 56, 0.2) 49% 51%, transparent 51%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 34px);
  pointer-events: none;
}

.battlefield-panel > * {
  position: relative;
  z-index: 1;
}

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

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

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

.mana-status {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  grid-template-areas:
    "wheel label"
    "wheel value";
  align-items: center;
  gap: 4px 12px;
  min-height: 118px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(25, 40, 55, 0.95), rgba(18, 21, 23, 0.95)),
    var(--surface);
}

.mana-status > span {
  grid-area: label;
}

.mana-status > strong {
  grid-area: value;
  color: #dffcf7;
}

.mana-wheel {
  grid-area: wheel;
  width: 88px;
  height: 88px;
  position: relative;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(16, 22, 28, 0.86) 0 33%, transparent 34%);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

.mana-wheel::before {
  content: "";
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  background: url("assets/ui/mana-wheel-ice.svg") center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(73, 172, 255, 0.35));
  pointer-events: none;
  z-index: 0;
}

.mana-wheel-core {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: baseline;
  justify-content: center;
  background: #10161c;
  border: 1px solid rgba(244, 239, 228, 0.18);
  color: #f4efe4;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.54), 0 0 16px rgba(70, 160, 255, 0.18);
  z-index: 3;
}

.mana-wheel-core strong {
  display: inline;
  margin: 0;
  font-size: 1.28rem;
  line-height: 1;
}

.mana-wheel-core span {
  display: inline;
  color: var(--muted);
  font-weight: 900;
  font-size: 0.78rem;
}

.mana-pip {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 18px;
  border-radius: 8px;
  background: #20272e;
  border: 1px solid rgba(244, 239, 228, 0.14);
  transform:
    translate(-50%, -50%)
    rotate(calc(var(--i) * 40deg))
    translateY(-35px)
    rotate(calc(var(--i) * -40deg));
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.42);
  z-index: 2;
}

.mana-pip.unlocked {
  background: #233543;
  border-color: rgba(80, 196, 176, 0.4);
}

.mana-pip.filled {
  background: linear-gradient(180deg, #dffcf7, #50c4b0 48%, #2f7fb8);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 13px rgba(80, 196, 176, 0.62);
}

.combatant-board {
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
    rgba(9, 12, 15, 0.72);
  backdrop-filter: blur(4px);
}

.zone-grid {
  grid-template-columns: repeat(6, minmax(86px, 1fr));
}

.zone {
  min-height: 184px;
  border-radius: 4px;
  border-color: rgba(244, 239, 228, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.14)),
    rgba(14, 17, 18, 0.64);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.zone.occupied {
  background:
    linear-gradient(180deg, rgba(80, 196, 176, 0.08), rgba(0, 0, 0, 0.16)),
    rgba(14, 17, 18, 0.82);
}

.frontline {
  margin: 8px 0;
  border-top: 1px solid rgba(214, 155, 56, 0.26);
  border-bottom: 1px solid rgba(214, 155, 56, 0.26);
  background: rgba(214, 155, 56, 0.07);
}

.avatar {
  width: min(168px, 100%);
  min-height: 238px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
  margin: 12px auto;
  overflow: visible;
  color: #1d1811;
  background:
    linear-gradient(180deg, rgba(255, 250, 225, 0.98), rgba(209, 178, 125, 0.98));
  border: 2px solid rgba(97, 196, 255, 0.58);
  border-radius: 9px 9px 4px 4px;
  clip-path: polygon(50% 0, 94% 12%, 100% 36%, 100% 100%, 0 100%, 0 36%, 6% 12%);
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.38),
    0 0 22px rgba(84, 190, 255, 0.18);
}

.avatar.mine,
.avatar.enemy.open,
.avatar.enemy.guarded {
  background: #efe1c5;
}

.avatar.mine {
  border-color: rgba(80, 196, 176, 0.72);
}

.avatar.enemy.guarded {
  border-color: rgba(201, 76, 76, 0.72);
}

.avatar.enemy.open {
  border-color: rgba(214, 155, 56, 0.9);
}

.avatar.active {
  box-shadow: 0 0 0 2px rgba(214, 155, 56, 0.4), 0 14px 32px rgba(0, 0, 0, 0.38);
}

.avatar-portrait {
  height: 118px;
  position: relative;
  overflow: hidden;
  margin: 0;
  border: 0;
  background: #111923;
  border-radius: 7px 7px 0 0;
}

.avatar-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.avatar-state {
  position: absolute;
  top: 7px;
  right: 7px;
  max-width: calc(100% - 14px);
  padding: 4px 7px;
  border-radius: 999px;
  color: #fff6df;
  background: rgba(11, 15, 20, 0.78);
  border: 1px solid rgba(244, 239, 228, 0.2);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}

.avatar-body {
  padding: 8px 10px 5px;
  display: grid;
  gap: 3px;
  justify-items: center;
  text-align: center;
}

.avatar-label {
  color: #6c5e47;
  font-size: 0.6rem;
}

.avatar-name {
  color: #1d1811;
  font-size: 0.95rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.avatar-weapon {
  color: #5f5345;
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1.15;
  min-height: 1.2em;
}

.avatar-stats {
  padding: 2px 9px 12px;
  margin-top: auto;
  display: flex;
  justify-content: center;
  gap: 12px;
  color: #f8fbff;
}

.avatar-stats span {
  flex: 0 0 auto;
  text-align: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.72), transparent 28%),
    linear-gradient(180deg, #1b3c55, #07131d);
  border: 1px solid rgba(106, 205, 255, 0.68);
  padding: 6px 8px;
  min-width: 44px;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.35),
    inset 0 0 12px rgba(78, 188, 255, 0.18);
}

.avatar-stat {
  display: grid;
  gap: 1px;
  line-height: 1;
  font-size: 0.9rem;
  font-weight: 950;
}

.avatar-stat small {
  color: rgba(228, 246, 255, 0.78);
  font-size: 0.52rem;
  font-weight: 950;
  letter-spacing: 0;
}

.attack-ready {
  outline: 1px solid rgba(214, 155, 56, 0.42);
  outline-offset: -3px;
}

.attack-ready:hover {
  transform: translateY(-2px);
}

.selected-attacker {
  border-color: rgba(214, 155, 56, 0.98) !important;
  box-shadow: 0 0 0 2px rgba(214, 155, 56, 0.3), 0 16px 36px rgba(0, 0, 0, 0.34);
}

.zone.selected-attacker {
  box-shadow: inset 0 0 24px rgba(214, 155, 56, 0.16), 0 0 0 2px rgba(214, 155, 56, 0.34);
}

.attack-hint {
  min-width: 72px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(214, 155, 56, 0.88);
  color: #17120a;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.zone,
.avatar,
.card {
  position: relative;
}

.damage-fx {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  color: #ffd2d2;
  font-size: 0.9rem;
  font-weight: 900;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
  pointer-events: none;
  animation: damage-pop 0.85s ease forwards;
}

.action-asset-fx {
  position: absolute;
  left: var(--fx-x, 50%);
  top: var(--fx-y, 50%);
  z-index: 35;
  width: 78px;
  height: 78px;
  transform: translate(-50%, -50%) scale(0.78);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  animation: action-asset-pop 0.72s ease-out forwards;
}

.action-asset-fx-card {
  width: 70px;
  height: 70px;
}

.action-asset-fx-skill {
  width: 96px;
  height: 96px;
}

.action-asset-fx-attack {
  width: 84px;
  height: 84px;
}

.hit-flash {
  animation: hit-pulse 0.45s ease;
  box-shadow: 0 0 0 4px rgba(201, 76, 76, 0.2);
}

.attack-swing {
  animation: attack-swing 0.45s ease;
}

@keyframes damage-pop {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-28px) scale(1.1);
  }
}

@keyframes action-asset-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.54) rotate(-8deg);
  }
  18% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18) rotate(8deg);
  }
}

@keyframes hit-pulse {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes attack-swing {
  0% {
    transform: translateX(0) scale(1);
  }
  50% {
    transform: translateX(-6px) scale(1.02);
  }
  100% {
    transform: translateX(0) scale(1);
  }
}

.zone.enemy.attack-target-hot,
.avatar.enemy.attack-target-hot {
  border-color: rgba(214, 155, 56, 0.96);
  box-shadow: 0 0 0 2px rgba(214, 155, 56, 0.25), inset 0 0 28px rgba(214, 155, 56, 0.13);
}

.zone.enemy.drop-target,
.avatar.enemy.drop-target {
  cursor: crosshair;
}

.hand-cards {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 6px;
}

.ability-cards {
  align-items: stretch;
}

.ability-card {
  width: 100%;
}

@media (max-width: 1040px) {
  .game {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "status"
      "battlefield"
      "hand"
      "roster"
      "ability"
      "log";
  }

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

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

  .mana-status {
    grid-template-columns: 86px minmax(0, 1fr);
    min-height: 108px;
  }

  .mana-wheel {
    width: 80px;
    height: 80px;
  }

  .mana-pip {
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--i) * 40deg))
      translateY(-31px)
      rotate(calc(var(--i) * -40deg));
  }

  .battlefield-panel::before {
    inset: 56px 10px 10px;
  }

  .zone-grid {
    grid-template-columns: repeat(3, minmax(74px, 1fr));
  }

  .zone {
    min-height: 154px;
  }

  .avatar {
    width: 142px;
    min-height: 214px;
  }

  .avatar-portrait {
    height: 104px;
  }
}

@media (min-width: 761px) {
  .app {
    padding-top: 12px;
  }

  .game {
    gap: 10px;
  }

  .game-header {
    margin-bottom: 0;
  }

  .game-header h2 {
    font-size: 1.7rem;
  }

  .status-card {
    min-height: 86px;
    padding: 10px 12px;
  }

  .status-card strong {
    font-size: 1.48rem;
  }

  .mana-status {
    min-height: 86px;
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .mana-wheel {
    width: 72px;
    height: 72px;
  }

  .mana-wheel-core {
    width: 38px;
    height: 38px;
  }

  .mana-wheel-core strong {
    font-size: 1.05rem;
  }

  .mana-pip {
    width: 10px;
    height: 15px;
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--i) * 40deg))
      translateY(-28px)
      rotate(calc(var(--i) * -40deg));
  }

  .battlefield-panel {
    padding: 14px;
  }

  .combatant-board {
    display: grid;
    grid-template-columns: minmax(142px, 170px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 10px 12px;
    align-items: center;
  }

  .combatant-board .board-header {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-bottom: 0;
  }

  .combatant-board .avatar {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    margin: 0;
    width: 156px;
    min-height: 206px;
  }

  .combatant-board .avatar-portrait {
    height: 96px;
  }

  .combatant-board .avatar-body {
    padding: 7px 8px 4px;
  }

  .combatant-board .avatar-stats {
    padding: 0 8px 8px;
  }

  .combatant-board .zone-grid {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
  }

  .battlefield-head {
    margin-bottom: 8px;
  }

  .zone {
    min-height: 150px;
  }

  .zone .card {
    height: 138px;
  }

  .frontline {
    margin: 6px 0;
    padding: 6px 0;
  }
}

@media (max-width: 760px) {
  .combatant-board {
    display: block;
  }
}

/* Simplified arena view */
body.in-game {
  background-color: #070b10;
  background-image:
    linear-gradient(180deg, rgba(4, 8, 14, 0.46), rgba(4, 8, 14, 0.38) 42%, rgba(5, 8, 10, 0.92) 100%),
    radial-gradient(circle at 50% 50%, rgba(40, 118, 220, 0.22), transparent 36%),
    var(--season-bg);
  background-position: center, center, center center;
  background-size: auto, auto, cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.in-game .app {
  width: min(1500px, 100%);
  padding: 8px 12px 54px;
}

body.in-game .game {
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(190px, 230px);
  grid-template-areas:
    "log battlefield ability"
    "log hand ability"
    "log status ability";
  gap: 8px;
  min-width: 0;
  align-items: start;
}

body.in-game .game > * {
  min-width: 0;
  max-width: 100%;
}

body.in-game .game-header {
  display: contents;
}

body.in-game .game-header .eyebrow {
  display: none;
}

body.in-game .game-header h2 {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 120;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid rgba(244, 239, 228, 0.16);
  border-radius: 6px;
  background: rgba(8, 11, 13, 0.86);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38);
  letter-spacing: 0.12em;
  color: rgba(244, 239, 228, 0.72);
  font-size: 0.78rem;
  line-height: 1;
}

body.in-game .game-actions {
  display: contents;
}

body.in-game .game-actions button {
  padding: 10px 13px;
  border-radius: 6px;
}

body.in-game #startGameBtn {
  position: fixed;
  left: 14px;
  bottom: 12px;
  z-index: 120;
}

body.in-game #surrenderBtn {
  position: fixed;
  left: 14px;
  bottom: 12px;
  z-index: 120;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38);
}

body.in-game .status-grid {
  display: grid;
  grid-template-columns: minmax(72px, 0.46fr) minmax(0, 1fr);
  gap: 6px;
  width: min(560px, 100%);
  margin: -2px auto 0;
  justify-self: center;
}

body.in-game .mana-status,
body.in-game .deck-status {
  display: none;
}

body.in-game .status-card {
  min-width: 0;
  min-height: 36px;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(14, 17, 18, 0.84);
  box-shadow: none;
}

body.in-game .status-card span {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.in-game .status-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
  font-size: 0.9rem;
}

body.in-game .mana-status {
  grid-template-columns: 56px minmax(0, 1fr);
  min-height: 56px;
  gap: 4px 9px;
}

body.in-game .mana-wheel {
  width: 50px;
  height: 50px;
}

body.in-game .mana-wheel-core {
  width: 29px;
  height: 29px;
}

body.in-game .mana-wheel-core strong {
  font-size: 0.82rem;
}

body.in-game .mana-wheel-core span {
  font-size: 0.58rem;
}

body.in-game .mana-pip {
  width: 7px;
  height: 10px;
  transform:
    translate(-50%, -50%)
    rotate(calc(var(--i) * 40deg))
    translateY(-19px)
    rotate(calc(var(--i) * -40deg));
}

body.in-game .roster-panel {
  display: none;
}

body.in-game .battlefield-panel {
  min-height: 570px;
  min-width: 0;
  padding: 10px 12px 12px;
  overflow: hidden;
  border-radius: 8px;
  border-color: rgba(214, 155, 56, 0.2);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(80, 196, 176, 0.07), transparent 22%),
    linear-gradient(180deg, rgba(32, 48, 60, 0.72), rgba(12, 16, 18, 0.96) 44%, rgba(38, 45, 45, 0.84)),
    #10161c;
}

body.in-game .battlefield-panel::before {
  inset: 42px 12px 12px;
  border-radius: 8px;
  border-color: rgba(244, 239, 228, 0.1);
  background: linear-gradient(180deg, rgba(201, 76, 76, 0.1), transparent 42%, transparent 58%, rgba(80, 196, 176, 0.11));
}

body.in-game .battlefield-head {
  display: none;
}

body.in-game .battlefield-piles {
  position: absolute;
  z-index: 5;
  margin: 0;
  gap: 10px;
  align-items: flex-end;
}

body.in-game .battlefield-piles.enemy {
  left: 18px;
  top: 14px;
  transform: scale(0.84);
  transform-origin: top left;
}

body.in-game .battlefield-piles.mine {
  right: 16px;
  bottom: 14px;
  gap: 12px;
}

body.in-game .board-mana {
  position: absolute;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 168px;
  padding: 7px 12px 7px 8px;
  border: 1px solid rgba(244, 239, 228, 0.1);
  border-radius: 2px;
  background:
    linear-gradient(90deg, rgba(8, 11, 13, 0.98), rgba(14, 25, 29, 0.92));
  color: #f4efe4;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.36);
}

body.in-game .board-mana.mine {
  left: 16px;
  bottom: 12px;
  min-width: 184px;
  padding: 8px 13px 8px 9px;
  gap: 10px;
}

body.in-game .board-mana.enemy {
  right: 16px;
  top: 12px;
  flex-direction: row-reverse;
  padding: 7px 8px 7px 12px;
  border-radius: 2px;
  text-align: right;
}

body.in-game .board-mana-wheel {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 8px rgba(73, 172, 255, 0.28));
}

body.in-game .board-mana-wheel .mana-wheel-core {
  width: 25px;
  height: 25px;
}

body.in-game .board-mana-wheel .mana-wheel-core strong {
  font-size: 0.72rem;
}

body.in-game .board-mana-wheel .mana-wheel-core span {
  font-size: 0.5rem;
}

body.in-game .board-mana-wheel .mana-pip {
  width: 6px;
  height: 9px;
  transform:
    translate(-50%, -50%)
    rotate(calc(var(--i) * 40deg))
    translateY(-16px)
    rotate(calc(var(--i) * -40deg));
}

body.in-game .board-mana.mine .board-mana-wheel {
  width: 50px;
  height: 50px;
}

body.in-game .board-mana.mine .board-mana-wheel .mana-wheel-core {
  width: 29px;
  height: 29px;
}

body.in-game .board-mana.mine .board-mana-wheel .mana-wheel-core strong {
  font-size: 0.82rem;
}

body.in-game .board-mana.mine .board-mana-wheel .mana-wheel-core span {
  font-size: 0.56rem;
}

body.in-game .board-mana.mine .board-mana-wheel .mana-pip {
  width: 7px;
  height: 10px;
  transform:
    translate(-50%, -50%)
    rotate(calc(var(--i) * 40deg))
    translateY(-19px)
    rotate(calc(var(--i) * -40deg));
}

body.in-game .board-mana-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

body.in-game .board-mana-text strong {
  overflow: hidden;
  color: #fff5dc;
  font-size: 0.82rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.in-game .board-mana-text span {
  color: rgba(244, 239, 228, 0.86);
  font-size: 0.66rem;
  font-weight: 950;
  line-height: 1.05;
}

body.in-game .pile {
  width: 84px;
  padding: 0;
  border: 0;
  background: transparent;
  gap: 4px;
  color: #f4efe4;
  font-size: 0.62rem;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
  cursor: default;
  font: inherit;
}

body.in-game .grave-pile {
  cursor: pointer;
}

body.in-game .grave-pile:hover .pile-art {
  border-color: rgba(214, 155, 56, 0.74);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42), 0 0 0 2px rgba(214, 155, 56, 0.22);
}

body.in-game .pile span {
  color: rgba(244, 239, 228, 0.88);
  font-weight: 950;
}

body.in-game .pile strong {
  color: #f4efe4;
  font-size: 0.82rem;
}

body.in-game .pile-art {
  width: 78px;
  height: 112px;
  border-radius: 6px;
  border-color: rgba(244, 239, 228, 0.22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
}

body.in-game .battlefield-piles.enemy .pile {
  font-size: 0.68rem;
}

body.in-game .battlefield-piles.enemy .pile strong {
  font-size: 0.78rem;
}

body.in-game .battlefield-piles.mine .pile {
  width: 94px;
  font-size: 0.68rem;
}

body.in-game .battlefield-piles.mine .pile strong {
  font-size: 0.9rem;
}

body.in-game .battlefield-piles.mine .pile-art {
  width: 88px;
  height: 126px;
}

body.in-game .pass-turn-control {
  position: absolute;
  right: 10px;
  top: calc(50% + 24px);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  transform: translateY(-50%);
}

body.in-game .pass-turn-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 86px;
  min-height: 72px;
  padding: 7px 8px 8px;
  border-radius: 7px;
  border-color: rgba(88, 190, 255, 0.62);
  background:
    linear-gradient(180deg, rgba(28, 47, 61, 0.88), rgba(6, 18, 27, 0.88));
  color: #f3fbff;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.32),
    0 0 12px rgba(57, 170, 255, 0.12);
  font-size: 0.94rem;
}

body.in-game .pass-turn-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(126, 212, 255, 0.94);
}

body.in-game .pass-turn-btn:disabled {
  cursor: default;
  opacity: 0.74;
  filter: saturate(0.78);
}

body.in-game .turn-timer {
  min-width: 86px;
  padding: 4px 10px;
  border: 1px solid rgba(88, 190, 255, 0.48);
  border-radius: 6px;
  background: rgba(3, 14, 21, 0.7);
  color: #dff6ff;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 950;
  text-shadow: 0 0 10px rgba(90, 200, 255, 0.35);
  box-shadow: inset 0 0 16px rgba(48, 155, 220, 0.12);
}

body.in-game .pass-turn-icon {
  display: block;
  width: 58px;
  height: 40px;
  flex: 0 0 40px;
  background: url("assets/ui/pass-icon.svg") center / contain no-repeat;
  color: transparent;
  font-size: 0;
  line-height: 1;
  filter:
    brightness(1.45)
    saturate(1.25)
    drop-shadow(0 0 8px rgba(89, 198, 255, 0.62));
}

body.in-game .timer-watch .turn-timer {
  animation: timer-blue-pulse 1.35s ease-in-out infinite;
}

body.in-game .timer-low .turn-timer,
body.in-game .timer-low .pass-turn-btn {
  animation: timer-red-pulse 0.9s ease-in-out infinite;
}

body.in-game .timer-critical {
  animation: timer-critical-pulse 0.42s ease-in-out infinite;
}

@keyframes timer-blue-pulse {
  50% {
    border-color: rgba(110, 215, 255, 1);
    box-shadow: 0 0 18px rgba(63, 185, 255, 0.42);
  }
}

@keyframes timer-red-pulse {
  50% {
    border-color: rgba(255, 84, 84, 0.98);
    color: #fff2f0;
    box-shadow: 0 0 20px rgba(255, 56, 56, 0.42);
  }
}

@keyframes timer-critical-pulse {
  50% {
    filter: drop-shadow(0 0 18px rgba(255, 37, 37, 0.72));
  }
}

body.in-game .combatant-board {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px 8px 10px;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

body.in-game .opponent-board {
  grid-template-rows: auto auto;
  min-height: 292px;
}

body.in-game .player-board {
  grid-template-rows: auto auto;
  min-height: 320px;
}

body.in-game .board-header {
  display: none;
}

body.in-game .opponent-board .board-header {
  left: 214px;
  top: -13px;
  transform: none;
}

body.in-game .player-board .board-header {
  left: 16px;
  top: auto;
  bottom: 12px;
  transform: none;
}

body.in-game .board-header strong {
  font-size: 0.84rem;
}

body.in-game .opponent-board .avatar {
  grid-row: 1;
}

body.in-game .opponent-board .zone-grid {
  grid-column: 1;
  grid-row: 2;
}

body.in-game .player-board .zone-grid {
  grid-column: 1;
  grid-row: 1;
}

body.in-game .player-board .avatar {
  grid-row: 2;
}

body.in-game .combatant-board .avatar {
  grid-column: 1;
  width: 122px;
  min-height: 160px;
  margin: 0 auto;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.36);
}

body.in-game .combatant-board .avatar-portrait {
  height: 72px;
  margin: 0;
}

body.in-game .avatar-state {
  top: 5px;
  right: 5px;
  padding: 3px 5px;
  font-size: 0.46rem;
}

body.in-game .avatar-body {
  padding: 7px 10px 4px;
  align-content: center;
  min-height: 42px;
}

body.in-game .avatar-label {
  font-size: 0.48rem;
}

body.in-game .avatar-name {
  font-size: 0.76rem;
}

body.in-game .avatar-weapon {
  display: none;
}

body.in-game .avatar-stats {
  padding: 2px 8px 11px;
  gap: 8px;
  font-size: 0.76rem;
}

body.in-game .avatar-stats span {
  min-width: 38px;
  padding: 5px 6px;
}

body.in-game .avatar-stat small {
  font-size: 0.46rem;
}

body.in-game .zone-grid {
  width: 100%;
  max-width: min(780px, calc(100% - 104px));
  grid-template-columns: repeat(6, minmax(82px, 1fr));
  gap: 10px;
  margin: 0 auto;
}

body.in-game .zone {
  min-height: 172px;
  border-radius: 6px;
  padding: 5px;
  font-size: 0.78rem;
  background: rgba(4, 7, 8, 0.5);
}

body.in-game .zone.empty {
  color: rgba(244, 239, 228, 0.24);
}

body.in-game .zone .card {
  height: 168px;
  border-radius: 6px;
}

body.in-game .zone .card::before,
body.in-game .hand-cards .card::before {
  opacity: 0.72;
}

body.in-game .zone .card::after {
  opacity: 0.38;
}

body.in-game .hand-cards .card::after {
  opacity: 0.32;
}

body.in-game .zone .card-cost {
  width: 22px;
  height: 22px;
  font-size: 0.72rem;
  top: 4px;
  left: 4px;
  border-width: 1px;
}

body.in-game .zone .card-art {
  height: 96px;
  margin: 0;
}

body.in-game .zone .card-art img,
body.in-game .hand-cards .card-art img,
.card-zoom-card .card-art img {
  object-position: 50% 0%;
}

body.in-game .zone .card-info {
  padding: 2px 7px 6px;
  gap: 1px;
}

body.in-game .zone .card-type {
  display: none;
}

body.in-game .zone .card-text {
  display: -webkit-box;
  min-height: 1.15em;
  max-height: 2.3em;
  overflow: hidden;
  color: #3f382e;
  font-size: 0.54rem;
  line-height: 1.15;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.in-game .zone .card.spell .card-text,
body.in-game .zone .card.weapon .card-text,
body.in-game .hand-cards .card.spell .card-text,
body.in-game .hand-cards .card.weapon .card-text {
  display: none;
}

body.in-game .zone .card-name {
  width: auto;
  margin: 0;
  padding: 1px 4px 2px;
  border: 0;
  border-radius: 3px;
  background: rgba(255, 247, 221, 0.72);
  color: #1d1811;
  font-size: 0.66rem;
  line-height: 1.08;
}

body.in-game .zone .card-stats {
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  font-size: 0.62rem;
}

body.in-game .zone .card-stats span {
  padding: 2px 4px;
}

body.in-game .zone .card-stat-effect {
  min-width: 70%;
}

body.in-game .zone-footer {
  min-height: 22px;
  bottom: 4px;
}

body.in-game .attack-hint {
  min-width: 58px;
  padding: 4px 6px;
  font-size: 0.58rem;
}

body.in-game .frontline {
  width: 100%;
  max-width: 780px;
  height: 1px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0;
}

body.in-game .ability-panel {
  position: sticky;
  top: 10px;
  align-self: stretch;
  max-height: calc(100vh - 126px);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid rgba(244, 239, 228, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    rgba(9, 13, 15, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(214, 155, 56, 0.68) rgba(8, 11, 13, 0.72);
}

body.in-game .ability-panel::-webkit-scrollbar {
  width: 8px;
}

body.in-game .ability-panel::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(8, 11, 13, 0.78);
  box-shadow: inset 0 0 0 1px rgba(244, 239, 228, 0.08);
}

body.in-game .ability-panel::-webkit-scrollbar-thumb {
  border: 2px solid rgba(8, 11, 13, 0.78);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(244, 239, 228, 0.88), rgba(214, 155, 56, 0.72));
}

body.in-game .ability-panel h3 {
  display: block;
  margin: 0 0 8px;
  color: rgba(244, 239, 228, 0.82);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.in-game .hand-panel h3 {
  display: none;
}

body.in-game .ability-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-height: 0;
  overflow: visible;
}

body.in-game .ability-card {
  width: 100%;
  min-width: 0;
  padding: 8px;
  gap: 4px;
  border-radius: 6px;
}

body.in-game .ability-card strong {
  font-size: 0.88rem;
  line-height: 1.08;
}

body.in-game .ability-card span {
  font-size: 0.66rem;
}

body.in-game .ability-card p {
  display: block;
  font-size: 0.68rem;
  line-height: 1.2;
}

body.in-game .ability-card button {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
}

body.in-game .hand-panel {
  padding: 8px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.in-game .hand-cards {
  justify-content: center;
  align-items: flex-end;
  min-height: 204px;
  gap: 8px;
  padding: 0 6px 6px;
}

body.in-game .hand-cards .card {
  width: 124px;
  height: 190px;
}

body.in-game .hand-cards .card-art {
  height: 110px;
  margin: 0;
}

body.in-game .hand-cards .card-info {
  padding: 2px 7px 6px;
}

body.in-game .hand-cards .card-text {
  display: -webkit-box;
  min-height: 1.15em;
  max-height: 2.3em;
  overflow: hidden;
  color: #3f382e;
  font-size: 0.56rem;
  line-height: 1.15;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.in-game .hand-cards .card-cost {
  width: 24px;
  height: 24px;
  top: 5px;
  left: 5px;
  border-width: 1px;
}

body.in-game .hand-cards .card-name {
  width: auto;
  margin: 0 0 1px;
  padding: 1px 4px 2px;
  border: 0;
  border-radius: 3px;
  background: rgba(255, 247, 221, 0.72);
  color: #1d1811;
  font-size: 0.67rem;
  line-height: 1.08;
}

body.in-game .hand-cards .card-stats {
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  font-size: 0.62rem;
}

body.in-game .hand-cards .card-stat-effect {
  min-width: 70%;
}

body.in-game .log-panel {
  position: sticky;
  top: 10px;
  align-self: stretch;
  min-height: 0;
  max-height: calc(100vh - 126px);
  padding: 10px;
  overflow: auto;
  border-radius: 6px;
  border: 1px solid rgba(244, 239, 228, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    rgba(9, 13, 15, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(214, 155, 56, 0.68) rgba(8, 11, 13, 0.72);
}

body.in-game .log-panel h3 {
  display: block;
  margin: 0 0 8px;
  color: rgba(244, 239, 228, 0.82);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.in-game .game-log {
  gap: 4px;
}

body.in-game .log-entry {
  padding: 6px 9px;
  font-size: 0.74rem;
  border-radius: 4px;
  border-left-color: rgba(214, 155, 56, 0.78);
  background: rgba(255, 255, 255, 0.045);
}

@media (max-width: 760px) {
  body.in-game .game {
    grid-template-columns: 1fr;
    grid-template-areas:
      "battlefield"
      "hand"
      "status"
      "ability"
      "log";
  }

  body.in-game .ability-panel,
  body.in-game .log-panel {
    position: static;
    max-height: none;
  }

  body.in-game .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.in-game .battlefield-panel {
    min-height: auto;
  }

  body.in-game .board-header {
    position: static;
    max-width: 100%;
    margin-bottom: 4px;
    border-radius: 6px;
    clip-path: none;
    transform: none;
  }

  body.in-game .player-board {
    padding-right: 8px;
  }

  body.in-game .battlefield-piles {
    position: static;
    justify-content: flex-end;
    margin-top: 6px;
    padding-right: 4px;
  }

  body.in-game .battlefield-piles.enemy {
    justify-content: flex-start;
    padding-left: 4px;
    padding-right: 0;
  }

  body.in-game .pass-turn-control {
    position: static;
    margin: 8px 4px 0 auto;
    transform: none;
  }

  body.in-game .pass-turn-btn {
    min-width: 86px;
    min-height: 70px;
  }

  body.in-game .pass-turn-btn:hover {
    transform: translateY(-1px);
  }

  body.in-game .turn-timer {
    min-width: 86px;
  }

  body.in-game .pile {
    width: 68px;
  }

  body.in-game .pile-art {
    width: 64px;
    height: 92px;
  }

  body.in-game .battlefield-piles.mine .pile {
    width: 76px;
  }

  body.in-game .battlefield-piles.mine .pile-art {
    width: 72px;
    height: 102px;
  }

  body.in-game .board-mana.mine .board-mana-wheel {
    width: 42px;
    height: 42px;
  }

  body.in-game .board-mana.mine .board-mana-wheel .mana-pip {
    width: 6px;
    height: 9px;
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--i) * 40deg))
      translateY(-16px)
      rotate(calc(var(--i) * -40deg));
  }

  body.in-game .zone-grid {
    grid-template-columns: repeat(3, minmax(76px, 1fr));
  }

  body.in-game .combatant-board .avatar {
    width: 104px;
    min-height: 136px;
  }
}

@media (max-width: 520px) {
  body.in-game .status-grid {
    grid-template-columns: 1fr;
  }

  body.in-game .game-header {
    display: contents;
  }

  body.in-game .game-actions button {
    flex: initial;
  }

  body.in-game .zone-grid {
    gap: 6px;
  }

  body.in-game .zone {
    min-height: 142px;
  }

  body.in-game .battlefield-piles {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .graveyard-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  body.in-game .pass-turn-control {
    margin-right: auto;
  }

  body.in-game .pile {
    width: 62px;
  }

  body.in-game .pile-art {
    width: 58px;
    height: 82px;
  }

  body.in-game .battlefield-piles.mine .pile {
    width: 68px;
  }

  body.in-game .battlefield-piles.mine .pile-art {
    width: 64px;
    height: 90px;
  }

  body.in-game .zone .card {
    height: 134px;
  }

  body.in-game .zone .card-art {
    height: 78px;
  }
}

@media (max-width: 940px) and (max-height: 520px) and (orientation: landscape) {
  body.in-game {
    background-attachment: scroll;
  }

  body.in-game .app {
    width: 100%;
    padding: 4px 6px 8px;
  }

  body.in-game .quick-controls {
    right: 8px;
    bottom: 8px;
    gap: 6px;
  }

  body.in-game .icon-control {
    width: 36px;
    height: 36px;
    border-radius: 7px;
  }

  body.in-game .icon-control svg {
    width: 18px;
    height: 18px;
  }

  body.in-game .site-footer {
    display: none;
  }

  body.in-game .game {
    grid-template-columns: minmax(92px, 118px) minmax(0, 1fr) minmax(112px, 146px);
    grid-template-areas:
      "log battlefield ability"
      "log hand ability"
      "log status ability";
    gap: 6px;
  }

  body.in-game .status-grid {
    grid-template-columns: minmax(62px, 0.44fr) minmax(0, 1fr);
    gap: 6px;
    width: 100%;
    margin: 0;
    padding: 0 72px 0 84px;
  }

  body.in-game .status-card {
    min-height: 32px;
    padding: 4px 7px;
  }

  body.in-game .status-card span {
    font-size: 0.48rem;
  }

  body.in-game .status-card strong {
    font-size: 0.76rem;
    line-height: 1.05;
  }

  body.in-game .battlefield-panel {
    min-height: 264px;
    padding: 5px 7px;
  }

  body.in-game .battlefield-panel::before {
    inset: 24px 8px 8px;
  }

  body.in-game .combatant-board {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 3px 4px 4px;
  }

  body.in-game .opponent-board {
    min-height: 0;
  }

  body.in-game .player-board {
    min-height: 0;
  }

  body.in-game .combatant-board .avatar {
    width: 58px;
    min-height: 66px;
  }

  body.in-game .combatant-board .avatar-portrait {
    height: 24px;
  }

  body.in-game .avatar-state,
  body.in-game .avatar-label,
  body.in-game .avatar-weapon {
    display: none;
  }

  body.in-game .avatar-body {
    min-height: 18px;
    padding: 2px 3px 1px;
  }

  body.in-game .avatar-name {
    font-size: 0.44rem;
    line-height: 1.02;
  }

  body.in-game .avatar-stats {
    gap: 3px;
    padding: 1px 3px 3px;
  }

  body.in-game .avatar-stats span {
    min-width: 20px;
    padding: 2px;
  }

  body.in-game .avatar-stat {
    font-size: 0.44rem;
  }

  body.in-game .avatar-stat small {
    font-size: 0.34rem;
  }

  body.in-game .zone-grid {
    max-width: calc(100% - 116px);
    grid-template-columns: repeat(6, minmax(36px, 1fr));
    gap: 3px;
    margin: 0 auto;
  }

  body.in-game .zone {
    min-height: 66px;
    padding: 2px;
    font-size: 0.48rem;
  }

  body.in-game .zone .card {
    height: 62px;
    border-radius: 4px;
  }

  body.in-game .zone .card-cost {
    width: 17px;
    height: 17px;
    top: 2px;
    left: 2px;
    font-size: 0.55rem;
  }

  body.in-game .zone .card-art {
    height: 34px;
    margin: -1px -1px 0;
  }

  body.in-game .zone .card-info {
    padding: 1px 3px 3px;
    gap: 1px;
  }

  body.in-game .zone .card-name {
    padding: 1px 2px;
    font-size: 0.42rem;
  }

  body.in-game .zone .card-stats {
    gap: 1px;
    font-size: 0.42rem;
  }

  body.in-game .zone .card-stats span {
    padding: 1px 2px;
  }

  body.in-game .frontline {
    max-width: calc(100% - 116px);
    margin: 0 auto;
  }

  body.in-game .pass-turn-control {
    position: absolute;
    right: 7px;
    top: 50%;
    gap: 3px;
    margin: 0;
    transform: translateY(-50%);
  }

  body.in-game .pass-turn-btn {
    min-width: 48px;
    min-height: 48px;
    padding: 4px;
    font-size: 0.64rem;
  }

  body.in-game .pass-turn-icon {
    width: 34px;
    height: 20px;
    flex: 0 0 20px;
  }

  body.in-game .turn-timer {
    min-width: 48px;
    padding: 2px 5px;
    font-size: 0.64rem;
  }

  body.in-game .battlefield-piles.enemy {
    left: 8px;
    top: 6px;
    transform: scale(0.52);
  }

  body.in-game .battlefield-piles.mine {
    right: 58px;
    bottom: 4px;
    transform: scale(0.52);
    transform-origin: bottom right;
  }

  body.in-game .battlefield-piles {
    position: absolute;
    justify-content: initial;
    margin: 0;
    padding: 0;
  }

  body.in-game .board-mana {
    min-width: 92px;
    padding: 5px 8px 5px 6px;
    gap: 5px;
  }

  body.in-game .board-mana.mine {
    left: 8px;
    bottom: 6px;
    transform: scale(0.64);
    transform-origin: bottom left;
  }

  body.in-game .board-mana.enemy {
    right: 64px;
    top: 6px;
    transform: scale(0.64);
    transform-origin: top right;
  }

  body.in-game .board-mana-wheel {
    width: 34px;
    height: 34px;
  }

  body.in-game .board-mana.mine .board-mana-wheel {
    width: 38px;
    height: 38px;
  }

  body.in-game .board-mana.mine .board-mana-wheel .mana-pip {
    width: 6px;
    height: 9px;
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--i) * 40deg))
      translateY(-15px)
      rotate(calc(var(--i) * -40deg));
  }

  body.in-game .board-mana-text strong {
    font-size: 0.64rem;
  }

  body.in-game .board-mana-text span {
    font-size: 0.5rem;
  }

  body.in-game .hand-panel {
    padding-top: 4px;
  }

  body.in-game .hand-cards {
    justify-content: flex-start;
    min-height: 112px;
    gap: 5px;
    padding: 0 2px 4px;
  }

  body.in-game .hand-cards .card {
    width: 74px;
    height: 112px;
    flex: 0 0 74px;
  }

  body.in-game .hand-cards .card-art {
    height: 60px;
    margin: -1px -1px 0;
  }

  body.in-game .hand-cards .card-cost {
    width: 20px;
    height: 20px;
    top: 4px;
    left: 4px;
    font-size: 0.62rem;
  }

  body.in-game .hand-cards .card-info {
    padding: 2px 5px 5px;
  }

  body.in-game .hand-cards .card-name {
    font-size: 0.52rem;
  }

  body.in-game .hand-cards .card-stats {
    font-size: 0.5rem;
  }

  body.in-game .ability-panel,
  body.in-game .log-panel {
    position: sticky;
    align-self: stretch;
    max-height: calc(100vh - 52px);
    padding: 6px;
    top: 6px;
  }

  body.in-game .ability-panel h3,
  body.in-game .log-panel h3 {
    margin-bottom: 5px;
    font-size: 0.58rem;
  }

  body.in-game .ability-card {
    padding: 6px;
    gap: 2px;
  }

  body.in-game .ability-card strong {
    font-size: 0.68rem;
  }

  body.in-game .ability-card span,
  body.in-game .ability-card p {
    font-size: 0.54rem;
    line-height: 1.12;
  }

  body.in-game .ability-card p {
    display: none;
  }

  body.in-game .ability-card button {
    padding: 6px 7px;
    font-size: 0.7rem;
  }

  body.in-game .log-entry {
    padding: 5px 6px;
    font-size: 0.58rem;
    line-height: 1.2;
  }

  body.in-game .game-header > div:first-child {
    display: contents;
  }

  body.in-game #surrenderBtn {
    position: relative;
    left: auto;
    bottom: auto;
    grid-area: status;
    align-self: center;
    justify-self: start;
    z-index: 8;
    padding: 7px 9px;
    font-size: 0.72rem;
  }

  body.in-game .game-header h2 {
    position: relative;
    right: auto;
    bottom: auto;
    grid-area: status;
    align-self: center;
    justify-self: end;
    z-index: 8;
    padding: 7px 9px;
    font-size: 0.72rem;
  }

  .card-zoom-backdrop {
    padding: 10px;
  }

  .card-zoom-card {
    width: min(300px, calc(100vw - 28px));
    height: min(360px, calc(100vh - 24px));
  }

  .card-zoom-card .card-art {
    height: min(172px, 43vh);
  }

  .card-zoom-card .card-info {
    padding: 8px 14px 12px;
    gap: 5px;
  }

  .card-zoom-card .card-text {
    font-size: clamp(0.68rem, 3cqw, 0.82rem);
    line-height: 1.24;
  }

  .card-zoom-card .card-stats {
    margin-top: 0;
    font-size: clamp(0.74rem, 3.2cqw, 0.9rem);
  }
}

.beta-banner {
  position: relative;
  z-index: 20;
  padding: 10px 16px;
  text-align: center;
  color: #f8e7b0;
  background: rgba(10, 14, 22, 0.92);
  border-bottom: 1px solid rgba(255, 196, 87, 0.28);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-footer {
  padding: 28px 16px 36px;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(5, 8, 14, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 6px 0;
}

.site-footer .footer-copyright {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.78rem;
}

.site-footer a {
  color: #f2b544;
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* =========================
   Privacy / Legal pages
========================= */

.privacy-panel {
  max-width: 980px;
  margin: 0 auto 48px;
  padding: 32px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.7;
  font-size: 0.98rem;
}

.privacy-panel h2,
.privacy-panel h3 {
  color: #fff7df;
}

.privacy-panel h2 {
  margin-bottom: 18px;
  font-size: 1.7rem;
}

.privacy-panel h3 {
  margin-top: 28px;
  margin-bottom: 8px;
  font-size: 1.12rem;
}

.privacy-panel p,
.privacy-panel li {
  color: rgba(255, 255, 255, 0.78);
}

.privacy-panel ul {
  margin: 12px 0 20px 22px;
  padding: 0;
}

.privacy-panel a,
.site-footer a {
  color: #e7b85a;
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px solid rgba(231, 184, 90, 0.35);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.privacy-panel a:hover,
.site-footer a:hover {
  color: #ffd98a;
  border-bottom-color: rgba(255, 217, 138, 0.8);
}

.privacy-panel a:visited,
.site-footer a:visited {
  color: #d8a94f;
}

.privacy-panel a:focus-visible,
.site-footer a:focus-visible {
  outline: 2px solid rgba(231, 184, 90, 0.75);
  outline-offset: 3px;
  border-radius: 4px;
}

.site-footer .support-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.support-heart {
  color: #ffd34d;
  font-size: 1.05em;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 211, 77, 0.42);
  transform-origin: center;
  animation: support-heart-pulse 2.4s ease-in-out infinite;
}

@keyframes support-heart-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.86;
  }

  50% {
    transform: scale(1.22);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .support-heart {
    animation: none;
  }

  .turn-banner-visible {
    animation: none;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (max-width: 700px) {
  .privacy-panel {
    padding: 22px;
    font-size: 0.95rem;
  }
}
