:root {
  --bg: #171817;
  --panel: #222322;
  --panel-strong: #2d2d2b;
  --line: #5b574e;
  --line-bright: #b9a676;
  --text: #f5ead2;
  --muted: #c9bea7;
  --accent: #d8bd76;
  --accent-strong: #f1d99a;
  --danger: #d6614a;
  --blue: #5fa8c9;
  --red: #cf5d56;
  --green: #86b070;
  --purple: #9c7ebe;
  --colorless: #d8cfbc;
  font-family: "Segoe UI", "Arial Black", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(60deg, rgba(255, 255, 255, 0.035) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.025) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.025) 75%),
    radial-gradient(circle at 22% 12%, rgba(216, 189, 118, 0.13), transparent 34%),
    linear-gradient(135deg, #111211, var(--bg) 58%, #252522);
  background-size: 72px 42px, 72px 42px, auto, auto;
  color: var(--text);
}

.main-menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px 24px 86px;
  overflow: auto;
  background:
    linear-gradient(60deg, rgba(255, 255, 255, 0.035) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.025) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.025) 75%),
    rgb(12, 12, 12);
  background-size: 86px 50px, 86px 50px, auto;
}

.main-menu.hidden {
  display: none;
}

.menu-panel {
  display: grid;
  gap: 16px;
  width: min(520px, 100%);
  max-width: calc(100vw - 48px);
  margin: 0;
  padding: 28px;
  border: 1px solid rgba(216, 189, 118, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(216, 189, 118, 0.08), transparent 34%),
    rgb(28, 29, 28);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.58), inset 0 0 0 1px rgba(255, 247, 218, 0.05);
}

.main-menu.deckbuilder-open {
  place-items: start center;
}

.main-menu.deckbuilder-open .menu-panel {
  width: min(1480px, calc(100vw - 48px));
  max-height: none;
  margin: 0 0 16px;
  padding: 20px;
}

.menu-panel h1,
.menu-panel p {
  margin: 0;
}

.legal-footer {
  color: var(--muted);
  font-family: "Segoe UI", Arial, sans-serif;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.match-row,
.secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 190px);
  gap: 8px;
}

.match-row select,
.secret-row input,
.match-row button,
.secret-row button {
  width: 100%;
  min-height: 40px;
}

.solo-section {
  gap: 8px;
}

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

.solo-deck-row select,
#play-solo-btn,
#tutorial-btn {
  width: 100%;
  min-height: 40px;
}

.menu-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(216, 189, 118, 0.22);
  border-radius: 7px;
  background: rgba(12, 12, 12, 0.28);
}

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

.deck-picker {
  display: grid;
  gap: 8px;
}

.auth-row,
.deck-picker {
  align-items: end;
}

.auth-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.auth-actions {
  display: flex;
  gap: 6px;
  justify-content: end;
}

.deck-picker label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.deckbuilder-toggle {
  width: 100%;
}

.deckbuilder-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 10px;
  width: 100%;
  max-height: none;
  min-height: 650px;
  height: min(76vh, 860px);
  padding: 10px;
  border: 1px solid rgba(216, 189, 118, 0.28);
  border-radius: 8px;
  background: rgba(12, 12, 12, 0.26);
}

.deckbuilder-main,
.deckbuilder-list {
  display: grid;
  min-height: 0;
}

.deckbuilder-main {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.deck-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 6px;
}

.deck-filters label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.range-pair {
  display: grid;
  gap: 2px;
}

.range-pair input {
  width: 100%;
  min-height: 18px;
}

.deckbuilder-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, 116px);
  justify-content: start;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.library-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 4px;
  align-content: start;
  width: 116px;
  height: 224px;
  overflow: hidden;
  padding: 6px;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.library-card img {
  width: 100%;
  max-height: 166px;
  aspect-ratio: 5 / 7.8;
  object-fit: contain;
  border-radius: 5px;
  background: #111110;
}

.library-card strong,
.library-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card strong {
  font-size: 12px;
  text-transform: uppercase;
}

.library-card span {
  color: var(--muted);
  font-size: 10px;
}

.library-card b {
  position: absolute;
  right: 8px;
  top: 8px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #11110f;
  font-size: 12px;
}

.deckbuilder-list {
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.deck-stats {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(12, 12, 12, 0.38);
  color: var(--muted);
  font-size: 12px;
}

.deck-stats.valid strong {
  color: #9bd890;
}

.deck-stats.invalid strong,
.deck-errors {
  color: #ffb0a2;
}

.deck-errors {
  display: grid;
  gap: 3px;
  max-height: 74px;
  overflow: auto;
  font-size: 11px;
}

.deck-errors p {
  margin: 0;
}

.deck-list-lines {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(216, 189, 118, 0.18);
  border-radius: 6px;
  background: rgba(12, 12, 12, 0.28);
}

.deck-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  color: var(--text);
  font-size: 12px;
}

.deck-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-line button {
  min-width: 26px;
  min-height: 24px;
  padding: 0;
}

.deckbuilder-title-actions {
  display: flex;
  gap: 6px;
}

.deckbuilder-title-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

.deckbuilder-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.deckbuilder-actions button {
  min-height: 30px;
  padding: 0 6px;
  font-size: 11px;
}

.deckbuilder-list textarea {
  min-height: 120px;
  resize: vertical;
  padding: 8px;
  border-color: rgba(216, 189, 118, 0.32);
  border-radius: 6px;
  background: #17283a;
  color: var(--text);
}

.tutorial-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(216, 189, 118, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(216, 189, 118, 0.08), transparent 42%),
    rgba(12, 12, 12, 0.72);
}

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

.tutorial-panel h2 {
  color: var(--accent-strong);
  font-size: 16px;
  line-height: 1.15;
}

.tutorial-panel p {
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.tutorial-panel .control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tutorial-panel .control-row.single {
  grid-template-columns: 1fr;
}

.tutorial-focus-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.tutorial-focus-card {
  display: grid;
  gap: 5px;
  justify-items: center;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(216, 189, 118, 0.26);
  border-radius: 8px;
  background: rgba(28, 29, 28, 0.74);
}

.tutorial-focus-card img {
  width: min(150px, 100%);
  aspect-ratio: 63 / 88;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.46);
}

.tutorial-focus-card strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 11px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #2c2c29;
  color: var(--text);
  font: inherit;
}

button {
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(216, 189, 118, 0.25);
}

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

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(220px, 1fr) minmax(160px, 280px);
  align-items: center;
  gap: 16px;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(216, 189, 118, 0.28);
  background:
    linear-gradient(90deg, rgba(216, 189, 118, 0.08), transparent 44%),
    rgba(17, 18, 17, 0.9);
}

.brand-lockup {
  display: grid;
  align-content: center;
  gap: 1px;
  text-transform: uppercase;
}

.brand-title {
  margin: 0;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5.2vw, 62px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 2px 0 #5d5033, 0 8px 20px rgba(0, 0, 0, 0.58);
}

.brand-subtitle {
  color: var(--accent-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(14px, 1.8vw, 22px);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.brand-fanmade {
  width: fit-content;
  max-width: 100%;
  margin-top: 5px;
  padding: 2px 7px;
  border: 1px solid rgba(216, 189, 118, 0.58);
  color: #141413;
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.15;
}

.menu-brand {
  justify-items: center;
  text-align: center;
}

.app-brand .brand-title {
  font-size: clamp(22px, 2.6vw, 34px);
}

.app-brand .brand-subtitle {
  font-size: clamp(10px, 1vw, 13px);
}

.app-brand .brand-fanmade {
  margin-top: 2px;
  font-size: 8px;
}

.legal-footer {
  display: grid;
  gap: 2px;
  margin: 0 10px 10px;
  padding: 6px 10px;
  border: 1px solid rgba(216, 189, 118, 0.22);
  border-radius: 8px;
  background: rgba(12, 12, 12, 0.44);
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
}

.menu-legal-footer {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 101;
  width: min(980px, calc(100vw - 48px));
  margin: 0;
  background: rgba(12, 12, 12, 0.58);
  transform: translateX(-50%);
}

.main-menu.deckbuilder-open .menu-legal-footer {
  position: static;
  transform: none;
}

.game-status {
  justify-self: center;
  margin: 0;
  color: var(--accent-strong);
  font-size: clamp(20px, 2.15vw, 34px);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

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

.menu-panel button,
.topbar-actions button {
  border-color: rgba(216, 189, 118, 0.46);
  background:
    linear-gradient(180deg, rgba(245, 234, 210, 0.08), transparent),
    #2b2b28;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#queue-public-btn,
#queue-secret-btn,
#play-solo-btn,
#tutorial-btn,
.menu-panel .deckbuilder-toggle {
  background: var(--accent);
  color: #12110f;
}

.layout {
  display: grid;
  grid-template-columns: minmax(190px, 250px) minmax(560px, 1fr) minmax(220px, 300px);
  align-items: stretch;
  gap: 10px;
  padding: 10px;
}

.side-panel,
.table,
.hand-panel,
.chat-panel {
  border: 1px solid rgba(216, 189, 118, 0.25);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 28%),
    rgba(31, 32, 31, 0.86);
  border-radius: 8px;
}

.side-panel {
  display: grid;
  align-content: stretch;
  gap: 8px;
  padding: 8px;
  min-height: 0;
}

#left-panel {
  grid-template-rows: minmax(220px, 320px) minmax(0, 1fr);
}

.player-card {
  display: grid;
  gap: 6px;
}

.player-card h2 {
  margin: 0;
  font-size: 18px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.stat {
  min-height: 46px;
  padding: 6px;
  border-radius: 6px;
  background: #181918;
}

.stat strong {
  display: block;
  font-size: 18px;
}

.soul-row-wrap {
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(216, 189, 118, 0.28);
  border-radius: 6px;
  background: rgba(12, 12, 12, 0.34);
}

.soul-row-wrap > span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.soul-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.soul-mini-card {
  position: relative;
  display: grid;
  place-items: end center;
  width: 26px;
  aspect-ratio: 2 / 3;
  padding: 4px 2px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: #111714 url("assets/cards/soul.png") center / contain no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 2px 4px rgba(0, 0, 0, 0.35);
  color: #f8f2db;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  transition: transform 120ms ease, opacity 120ms ease;
}

.soul-mini-card span {
  opacity: 0;
}

.soul-mini-card.tapped {
  opacity: 0.64;
  transform: rotate(90deg) scale(0.9);
}

.empty-soul {
  color: var(--muted);
  font-size: 13px;
}

.battlefield-souls {
  justify-self: center;
  width: min(100%, 360px);
  padding: 4px 6px;
}

.board-tools {
  display: grid;
  align-items: center;
  gap: 8px;
  min-height: 74px;
}

.board-tools.opponent {
  grid-template-columns: max-content minmax(120px, 1fr) minmax(300px, 352px) max-content;
}

.board-tools.current {
  grid-template-columns: max-content minmax(180px, 1fr) max-content max-content;
}

.board-tools .battlefield-souls {
  width: 100%;
  min-height: 60px;
  align-self: stretch;
}

.board-tools.current .battlefield-souls {
  justify-self: center;
  max-width: 360px;
}

.soul-draw-board-btn {
  align-self: center;
  justify-self: center;
  width: min(120px, 100%);
  min-height: 44px;
  padding: 0 8px;
  border-color: rgba(216, 189, 118, 0.54);
  font-size: 11px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.board-tools.opponent .opponent-hand-wrap,
.board-tools.opponent .battlefield-souls {
  align-self: stretch;
}

@media (min-width: 1280px) {
  .board-tools.opponent .battlefield-souls .soul-row {
    flex-wrap: nowrap;
  }
}

.life-badge {
  display: grid;
  justify-self: start;
  width: max-content;
  min-width: 74px;
  max-width: 120px;
  padding: 6px 8px;
  border: 1px solid rgba(216, 189, 118, 0.46);
  border-radius: 7px;
  background: rgba(12, 12, 12, 0.62);
}

.board-tools.current .pile-row,
.board-tools.opponent .life-badge {
  justify-self: end;
}

button.life-badge {
  min-height: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

body[data-action-mode="attack"] .targetable-life {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(242, 187, 76, 0.22);
}

.life-badge span {
  color: var(--muted);
  font-size: 11px;
}

.life-badge strong {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--accent);
  line-height: 1;
}

.life-badge.combat-target-player {
  border-color: #f3dc9c;
  background:
    radial-gradient(circle at 50% 40%, rgba(243, 220, 156, 0.2), transparent 64%),
    rgba(12, 12, 12, 0.76);
  box-shadow: 0 0 0 2px rgba(243, 220, 156, 0.34), 0 0 22px rgba(243, 220, 156, 0.55);
  animation: combatPulseGold 720ms ease-in-out infinite alternate;
}

.life-badge.combat-target-player .life-value,
.life-badge.combat-target-player .life-unit {
  color: #fff2bf;
}

.life-value {
  font-size: 26px;
}

.life-unit {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pile-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-pile {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 5 / 7.8;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111110;
  color: var(--text);
  overflow: hidden;
}

button.board-pile {
  min-height: 0;
  padding: 0;
  cursor: pointer;
}

.board-pile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.board-pile strong {
  position: absolute;
  right: 3px;
  bottom: 3px;
  min-width: 20px;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(10, 15, 13, 0.86);
  color: #fff7d7;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

.discard-pile.empty {
  background: rgba(12, 12, 12, 0.38);
  color: var(--muted);
  font-size: 10px;
}

.table {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
  grid-template-rows: auto auto;
  min-height: 0;
  padding: 8px;
}

.battlefield {
  display: grid;
  gap: 4px;
}

.battlefield.opponent {
  align-content: start;
}

.battlefield.current {
  align-content: start;
}

.zone-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.field-band {
  display: grid;
  gap: 6px;
  min-height: 186px;
  padding: 8px;
  border: 1px solid rgba(216, 189, 118, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(216, 189, 118, 0.045), transparent 34%, rgba(255, 255, 255, 0.018)),
    rgba(12, 12, 12, 0.13);
}

.field-band.opponent {
  border-color: rgba(216, 189, 118, 0.22);
}

.field-band.current {
  border-color: rgba(216, 189, 118, 0.32);
}

.field-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.field-priority-btn {
  min-height: 24px;
  padding: 0 8px;
  border-color: rgba(242, 187, 76, 0.48);
  font-size: 11px;
  font-weight: 800;
}

.field-priority-btn:disabled {
  border-color: rgba(199, 194, 173, 0.28);
}

.zone,
.field-zone {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 92px));
  justify-content: center;
  gap: 6px;
  min-height: 142px;
}

.field-zone {
  align-items: start;
}

.opponent-hand-wrap {
  display: grid;
  gap: 4px;
  min-height: 60px;
  padding: 4px 6px;
  border: 1px solid rgba(216, 189, 118, 0.28);
  border-radius: 6px;
  background: rgba(12, 12, 12, 0.34);
}

.opponent-hand-row {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 0 10px;
  overflow: hidden;
}

.opponent-hand-card {
  flex: 0 0 38px;
  aspect-ratio: 5 / 7;
  margin-left: -10px;
  border: 1px solid rgba(215, 208, 191, 0.7);
  border-radius: 5px;
  background: #111714;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.34);
  transform: rotate(180deg) translateY(calc((var(--hand-index) % 2) * -2px));
}

.opponent-hand-card:first-child {
  margin-left: 0;
}

.opponent-hand-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.opponent-hand-empty {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
}

.structure-stack {
  position: relative;
  grid-column: span 2;
  justify-self: center;
  width: 100%;
  max-width: 226px;
}

.structure-stack > .card {
  width: 100%;
}

.assigned-pal-slot {
  position: absolute;
  top: 7%;
  right: 4%;
  z-index: 70;
  display: grid;
  place-items: center;
  width: 48%;
  height: 86%;
  padding: 4px;
  border: 1px solid rgba(242, 187, 76, 0.55);
  border-radius: 6px;
  background: rgba(10, 15, 13, 0.86);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.48);
}

.assigned-pal-slot:hover {
  z-index: 90;
}

.assigned-pal-slot .card.assigned-overlay-card {
  width: auto;
  height: 100%;
  max-width: 100%;
  padding: 2px;
  border-width: 1px;
  border-radius: 5px;
  aspect-ratio: 5 / 7.8;
}

.assigned-pal-slot .card.assigned-overlay-card:hover {
  z-index: 91;
}

.card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(64px, 0.8fr) minmax(88px, 1fr) auto;
  gap: 6px;
  width: 100%;
  min-height: 0;
  aspect-ratio: 5 / 7.8;
  padding: 8px;
  border: 2px solid var(--colorless);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.1), transparent 42%),
    #2b2b28;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.card.real-card {
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 4px;
  padding: 5px;
  overflow: visible;
  background: #111110;
}

.battlefield .card.real-card {
  gap: 2px;
  padding: 3px;
  border-width: 1px;
  border-radius: 6px;
}

.card.small {
  aspect-ratio: 5 / 7.8;
}

.card.selected {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.card.click-target {
  cursor: crosshair;
  outline: 2px solid rgba(242, 187, 76, 0.86);
  outline-offset: 2px;
}

.card.blocker-selected {
  outline: 3px solid #5da9e9;
  outline-offset: 2px;
}

.card.effect-selected {
  outline: 3px solid var(--danger);
  outline-offset: 2px;
}

.card.combat-attacker {
  border-color: #ffe08a;
  box-shadow:
    0 0 0 2px rgba(255, 224, 138, 0.62),
    0 0 22px rgba(255, 224, 138, 0.72),
    inset 0 0 0 1px rgba(255, 244, 204, 0.32);
  animation: combatPulseGold 720ms ease-in-out infinite alternate;
}

.card.combat-defender {
  border-color: #c9f6ff;
  box-shadow:
    0 0 0 3px rgba(120, 232, 255, 0.92),
    0 0 10px rgba(255, 255, 255, 0.72),
    0 0 32px rgba(72, 219, 255, 0.92),
    inset 0 0 0 1px rgba(236, 252, 255, 0.52);
  animation: combatPulseBlue 720ms ease-in-out infinite alternate;
}

.card.combat-blocker {
  border-color: #ff765f;
  box-shadow:
    0 0 0 2px rgba(255, 118, 95, 0.6),
    0 0 20px rgba(255, 118, 95, 0.68),
    inset 0 0 0 1px rgba(255, 223, 214, 0.24);
  animation: combatPulseRed 720ms ease-in-out infinite alternate;
}

.card.tapped {
  transform: rotate(3deg);
  opacity: 0.78;
}

.card:hover,
.card.tapped:hover {
  z-index: 50;
}

.card.assigned {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

.card.red {
  border-color: var(--red);
}

.card.blue {
  border-color: var(--blue);
}

.card.green {
  border-color: var(--green);
}

.card.purple {
  border-color: var(--purple);
}

.card.colorless {
  border-color: var(--colorless);
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
}

.card-type {
  color: var(--muted);
  font-size: 12px;
}

.card-art {
  display: grid;
  place-items: center;
  min-height: 36px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.24);
  font-size: 24px;
}

.card-art svg {
  width: 100%;
  max-width: 96px;
  height: 46px;
}

.card-face-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.24);
}

.battlefield .card-face-wrap {
  border-radius: 4px;
}

.card-face {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card.real-card[data-card-type="Structure"] .card-face {
  width: 156%;
  height: auto;
  max-width: none;
  transform: rotate(90deg);
}

.battlefield .card.real-card[data-card-type="Structure"] {
  aspect-ratio: 454 / 313;
}

.battlefield .card.real-card[data-card-type="Structure"] .card-face-wrap {
  aspect-ratio: 454 / 313;
}

.battlefield .card.real-card[data-card-type="Structure"] .card-face {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  transform: none;
}

.battlefield .card.real-card.structure-covered .card-game-overlay {
  display: none;
}

.card-zoom {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  display: none;
  width: min(320px, 42vw);
  max-height: min(78vh, 520px);
  object-fit: contain;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: #111110;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.72);
  pointer-events: none;
  transform: translateX(-50%);
}

.card:hover .card-zoom {
  display: none;
}

.attack-notice {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid rgba(242, 187, 76, 0.45);
  border-radius: 8px;
  background: rgba(10, 15, 13, 0.88);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
}

.attack-notice strong,
.attack-notice b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attack-notice strong {
  color: var(--text);
  font-size: 12px;
}

.attack-notice div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.attack-notice b {
  color: var(--accent);
  font-weight: 800;
}

.attack-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 40;
  width: min(48vw, 520px);
  height: 120px;
  color: var(--text);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.attack-arrow-source {
  position: absolute;
  left: 0;
  top: 50%;
  max-width: 130px;
  padding: 3px 6px;
  border: 1px solid rgba(114, 190, 154, 0.45);
  border-radius: 999px;
  background: rgba(10, 15, 13, 0.74);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateY(-50%);
}

.attack-arrow-lines {
  position: absolute;
  inset: 0 0 0 112px;
}

.attack-arrow-path {
  position: absolute;
  left: 0;
  top: 50%;
  width: calc(100% - 16px);
  height: 0;
  border-top: 3px solid var(--accent);
  filter: drop-shadow(0 0 7px rgba(114, 190, 154, 0.55));
  transform: translateY(calc((var(--arrow-index) - (var(--arrow-count) - 1) / 2) * 24px)) rotate(calc((var(--arrow-index) - (var(--arrow-count) - 1) / 2) * 7deg));
  transform-origin: left center;
}

.attack-arrow.redirected .attack-arrow-path {
  border-top-color: var(--danger);
  filter: drop-shadow(0 0 7px rgba(232, 93, 117, 0.58));
}

.attack-arrow-path::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -8px;
  border-left: 14px solid currentColor;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  color: var(--accent);
}

.attack-arrow.redirected .attack-arrow-path::after {
  color: var(--danger);
}

.attack-arrow-label {
  position: absolute;
  right: 4px;
  bottom: 8px;
  max-width: 150px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(10, 15, 13, 0.74);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-art-fallback {
  display: none;
  width: 100%;
  height: 100%;
}

.card-face-wrap.missing-image .card-art-fallback {
  display: grid;
}

.card-game-overlay {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  border-radius: 5px;
  background: rgba(12, 12, 12, 0.9);
  font-size: 11px;
}

.battlefield .card-game-overlay {
  gap: 3px;
  padding: 3px;
  font-size: 9px;
  line-height: 1.1;
}

.card-game-overlay button,
.card-game-overlay .card-target {
  width: 100%;
  min-height: 28px;
  font-size: 11px;
}

.battlefield .card-game-overlay button,
.battlefield .card-game-overlay .card-target {
  min-height: 22px;
  padding: 0 4px;
  font-size: 9px;
}

.card-text {
  color: var(--muted);
  line-height: 1.24;
  overflow-wrap: anywhere;
}

.card-text.text-lg {
  font-size: 12px;
}

.card-text.text-md {
  font-size: 11px;
}

.card-text.text-sm {
  font-size: 10px;
}

.card-text.text-xs {
  font-size: 9px;
  line-height: 1.18;
}

.card-stats {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
}

.card-stats button,
.card-target {
  width: 100%;
  min-height: 30px;
  font-size: 12px;
}

.pengullet-actions {
  display: grid;
  gap: 4px;
}

.quick-option .pengullet-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pengullet-actions button {
  min-height: 26px;
  padding: 0 6px;
  font-size: 10px;
}

.damage {
  color: var(--danger);
  font-weight: 700;
}

.power-buffed {
  color: #65c18c;
  font-weight: 800;
}

.base-power {
  color: var(--muted);
  font-size: 0.9em;
}

.controls {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 100%;
}

.control-top,
.control-info,
.control-bottom {
  display: grid;
  gap: 8px;
}

.control-bottom {
  align-content: end;
}

.end-turn-control {
  min-height: 52px;
  border-color: rgba(216, 189, 118, 0.72);
  background:
    linear-gradient(180deg, rgba(216, 189, 118, 0.12), transparent),
    #2c2c29;
  font-size: 15px;
}

.surrender-control {
  border-color: rgba(214, 97, 74, 0.78);
  color: #ffd4cb;
}

.control-bottom button {
  min-height: 40px;
  border-color: rgba(216, 189, 118, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control-bottom .end-turn-control {
  min-height: 52px;
}

.hover-preview-panel {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 260px;
  padding: 10px;
  border: 1px solid rgba(216, 189, 118, 0.32);
  border-radius: 8px;
  background: rgba(12, 12, 12, 0.42);
}

.hover-preview-panel.empty {
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.hover-preview-panel img {
  width: min(210px, 100%);
  max-height: 48vh;
  object-fit: contain;
  border: 2px solid rgba(216, 189, 118, 0.68);
  border-radius: 10px;
  background: #111110;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}

.hover-preview-panel strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 13px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-panel {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: rgba(31, 32, 31, 0.9);
}

.target-panel label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.target-panel select {
  width: 100%;
}

.damage-assignment {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #181918;
}

.quick-window {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: rgba(31, 32, 31, 0.9);
}

.quick-window p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.quick-option {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #242522;
}

.quick-option span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.quick-option select,
.quick-option button {
  width: 100%;
  min-height: 30px;
  font-size: 12px;
}

.damage-assignment label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.damage-assignment input,
.damage-assignment select {
  width: 100%;
  min-height: 30px;
  padding: 0 8px;
}

.control-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hand-panel {
  margin: 0 10px 10px;
  padding: 8px 12px 10px;
  overflow-x: clip;
}

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

.mulligan-grid.single {
  grid-template-columns: 1fr;
}

.mulligan-status {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.mulligan-player {
  display: grid;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.mulligan-hand-row {
  display: block;
  min-width: 0;
}

.setup-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
}

.setup-actions strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.controls > button,
.setup-actions button {
  min-height: 46px;
  border-color: rgba(216, 189, 118, 0.54);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.setup-actions button {
  min-height: 50px;
  padding: 0 18px;
  font-size: 16px;
}

.hand-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.hand-grid > .card {
  flex: 0 1 132px;
  max-width: 132px;
}

.hand-grid.crowded {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0;
  overflow: visible;
  padding-inline: 4px;
  max-width: 100%;
  --hand-overlap-min: -96px;
  --hand-edge-buffer: 18px;
}

.hand-grid.crowded > .card {
  flex: 0 0 132px;
  margin-right: clamp(
    var(--hand-overlap-min),
    calc((100% - var(--hand-edge-buffer) - (132px * var(--hand-count))) / var(--hand-gaps)),
    -2px
  );
  transition: margin 140ms ease, transform 140ms ease, filter 140ms ease;
}

.hand-grid.more-crowded {
  --hand-overlap-min: -104px;
}

.hand-grid.very-crowded {
  --hand-overlap-min: -112px;
}

.hand-grid.crowded > .card:last-child {
  margin-right: 0;
}

.hand-grid.crowded > .card:hover,
.hand-grid.crowded > .card.hand-drop-target,
.hand-grid.crowded > .card.hand-dragging {
  z-index: 30;
  transform: translateY(-8px);
}

.hand-grid .card.hand-dragging {
  opacity: 0.45;
}

.hand-grid .card.hand-drop-target {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  height: 320px;
  max-height: 320px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

#left-panel .chat-panel {
  height: 320px;
  max-height: 320px;
  min-height: 0;
}

.game-notices {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(216, 189, 118, 0.25);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 28%),
    rgba(31, 32, 31, 0.72);
}

.game-notices.empty {
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chat-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  overflow: auto;
}

.chat-list p {
  margin: 0;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-list strong {
  color: var(--text);
}

.chat-empty {
  color: var(--muted);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.chat-form input {
  min-width: 0;
}

.chat-form button {
  min-height: 34px;
}

dialog {
  max-width: 760px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.winner-dialog {
  min-width: min(360px, calc(100vw - 32px));
  text-align: center;
}

.surrender-dialog {
  min-width: min(420px, calc(100vw - 32px));
}

.winner-dialog article {
  display: grid;
  gap: 16px;
}

.surrender-dialog article {
  display: grid;
  gap: 14px;
}

.winner-dialog h2 {
  margin: 0;
  font-size: 28px;
}

.surrender-dialog h2,
.surrender-dialog p {
  margin: 0;
}

.winner-dialog button {
  justify-self: center;
  min-width: 96px;
}

.discard-dialog {
  width: min(900px, calc(100vw - 32px));
}

.discard-dialog article {
  display: grid;
  gap: 14px;
}

.discard-dialog-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.discard-column {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.discard-list {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 62vh;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 15, 13, 0.28);
}

.discard-list p {
  margin: 0;
  color: var(--muted);
}

.discard-list-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(36, 37, 34, 0.88);
}

.discard-list-item img {
  width: 42px;
  aspect-ratio: 5 / 7.8;
  object-fit: contain;
  border-radius: 4px;
  background: #111110;
}

.discard-list-item div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.discard-list-item strong,
.discard-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discard-list-item span {
  color: var(--muted);
  font-size: 12px;
}

.hand-actions {
  display: flex;
  justify-content: flex-end;
  margin: 6px 0 8px;
}

.effect-order-dialog article {
  display: grid;
  gap: 12px;
  max-width: 420px;
}

.pal-effect-discard-dialog,
.damage-order-dialog,
.rewind-request-dialog {
  max-width: calc(100vw - 24px);
}

.pal-effect-discard-dialog article {
  display: grid;
  gap: 12px;
  width: min(1180px, calc(100vw - 24px));
  max-height: min(82vh, 720px);
  overflow: hidden;
}

.pal-effect-discard-content {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 10px;
  max-width: 100%;
  max-height: min(76vh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
}

.damage-order-dialog article {
  display: grid;
  gap: 12px;
  width: min(820px, 92vw);
}

.damage-order-dialog p {
  margin: 0;
  color: var(--muted);
}

.damage-order-list {
  display: flex;
  gap: 10px;
  min-height: 190px;
  overflow: hidden;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 12, 12, 0.34);
}

.damage-order-card {
  position: relative;
  display: grid;
  flex: 0 0 128px;
  gap: 5px;
  align-content: start;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(36, 37, 34, 0.94);
  color: var(--text);
  cursor: grab;
}

.damage-order-card:active {
  cursor: grabbing;
}

.damage-order-card.drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.damage-order-card img {
  width: 100%;
  aspect-ratio: 5 / 7.8;
  object-fit: contain;
  border-radius: 5px;
  background: #111714;
}

.damage-order-card strong,
.damage-order-card span:not(.damage-order-index) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.damage-order-index {
  position: absolute;
  left: 8px;
  top: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #07110d;
  font-weight: 900;
}

.discard-choice-card {
  display: grid;
  min-width: 0;
  gap: 6px;
  align-content: start;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(31, 32, 31, 0.95);
  color: var(--text);
  cursor: pointer;
}

.discard-choice-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card.discard-fly,
.discard-choice-card.discard-fly {
  z-index: 200;
  pointer-events: none;
  animation: flyToDiscard 520ms cubic-bezier(0.2, 0.8, 0.25, 1) forwards;
}

.card.deploy-fly {
  z-index: 200;
  pointer-events: none;
  animation: flyToField 520ms cubic-bezier(0.2, 0.8, 0.25, 1) forwards;
}

.battlefield-discard-clone {
  pointer-events: none;
  will-change: transform, opacity;
}

@keyframes combatPulseGold {
  from { filter: brightness(1); }
  to { filter: brightness(1.16); }
}

@keyframes combatPulseBlue {
  from { filter: brightness(1.08) saturate(1.16); }
  to { filter: brightness(1.34) saturate(1.34); }
}

@keyframes combatPulseRed {
  from { filter: brightness(1); }
  to { filter: brightness(1.15); }
}

@keyframes flyToDiscard {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  55% {
    opacity: 0.82;
    transform: translate(22vw, -10vh) scale(0.62) rotate(5deg);
  }
  100% {
    opacity: 0;
    transform: translate(34vw, -18vh) scale(0.28) rotate(10deg);
  }
}

@keyframes flyToField {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  60% {
    opacity: 0.9;
    transform: translate(0, -15vh) scale(0.9) rotate(-2deg);
  }
  100% {
    opacity: 0;
    transform: translate(0, -28vh) scale(0.74) rotate(-4deg);
  }
}

.discard-choice-card img {
  width: 100%;
  aspect-ratio: 5 / 7.8;
  object-fit: contain;
  border-radius: 5px;
  background: #111110;
}

.discard-choice-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

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

.dialog-header h2 {
  margin: 0;
}

.dialog-board-btn,
.restore-choice-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.restore-choice-btn {
  border-color: rgba(242, 187, 76, 0.72);
  background: rgba(242, 187, 76, 0.14);
  color: #fff2bf;
}

.rewind-request-dialog article {
  display: grid;
  gap: 14px;
  width: min(420px, calc(100vw - 32px));
}

.rewind-request-dialog h2,
.rewind-request-dialog p {
  margin: 0;
}

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

.rules-grid p {
  margin: 0;
  padding: 10px;
  border-radius: 6px;
  background: #181918;
  color: var(--muted);
}

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

  .board-tools.opponent,
  .board-tools.current {
    grid-template-columns: 1fr;
  }

  .board-tools.current .pile-row,
  .board-tools.opponent .pile-row,
  .board-tools.current .life-badge,
  .board-tools.opponent .life-badge {
    justify-self: center;
  }

  .zone,
  .field-zone {
    grid-template-columns: repeat(auto-fit, minmax(66px, 92px));
  }

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

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

  .mulligan-hand-row {
    grid-template-columns: 1fr;
  }

  .discard-dialog-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .game-status {
    justify-self: start;
    text-align: left;
  }

  .hand-grid {
    gap: 5px;
  }

  .hand-grid > .card {
    flex-basis: 126px;
    max-width: 126px;
  }
}
