:root {
  --bg: #f3efe4;
  --panel: #fffaf0;
  --ink: #2b2418;
  --muted: #6c604d;
  --accent: #b65a2a;
  --accent-dark: #7e3714;
  --line: #d7c7aa;
  --shadow: 0 18px 50px rgba(70, 42, 16, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top, rgba(255, 208, 145, 0.45), transparent 35%),
    linear-gradient(180deg, #efe6d4 0%, var(--bg) 100%);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: inherit;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

button.secondary {
  color: var(--ink);
  background: #eadfc8;
}

.header-utility-button.secondary {
  color: #fff4dc;
  background: #4c2b1b;
  box-shadow: inset 0 0 0 1px rgba(255, 232, 190, 0.16);
}

.header-utility-button.secondary:hover {
  background: #65351f;
}

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

.shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.5rem;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.hero-logo {
  width: clamp(60px, 8vw, 104px);
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.hero-logo-return {
  cursor: pointer;
  border-radius: 999px;
}

.hero-logo-return:focus-visible {
  outline: 3px solid rgba(182, 90, 42, 0.45);
  outline-offset: 4px;
}

.hero-logo-return:hover {
  filter: brightness(1.08);
}

.hero h1,
.panel h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}

.subcopy {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.multiplayer-bar {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

.app-menu-wrap {
  display: none;
  position: relative;
}

.app-menu-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: #fff4dc;
  background: #4c2b1b;
  box-shadow: inset 0 0 0 1px rgba(255, 232, 190, 0.16);
}

.app-menu-icon {
  width: 18px;
  display: grid;
  gap: 4px;
}

.app-menu-icon span {
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.app-menu-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 0.45rem);
  right: 0;
  width: min(240px, 76vw);
  padding: 0.4rem;
  border: 1px solid rgba(255, 232, 190, 0.22);
  border-radius: 12px;
  background: rgba(36, 22, 15, 0.98);
  box-shadow: 0 18px 44px rgba(18, 11, 7, 0.32);
}

.app-menu-panel[hidden] {
  display: none;
}

.app-menu-item {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.58rem 0.72rem;
  border-radius: 8px;
  color: #fff4dc;
  background: transparent;
  text-align: left;
  font-size: 0.95rem;
}

.app-menu-item:hover,
.app-menu-item:focus-visible {
  background: rgba(255, 244, 220, 0.1);
}

.lobby-list {
  display: grid;
  gap: 0.8rem;
}

.lobby-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.85rem;
  background: rgba(255, 250, 240, 0.72);
}

.lobby-card-header,
.lobby-meta,
.lobby-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.lobby-card-header {
  margin-bottom: 0.4rem;
}

.lobby-meta {
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.lobby-actions {
  flex-wrap: wrap;
}

.lobby-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
}

.lobby-chip.waiting {
  background: #fff1df;
  border-color: #d3a56d;
  color: #7b4f12;
}

.lobby-chip.active {
  background: #e9f8ee;
  border-color: #6aa57d;
  color: #21522e;
}

.multiplayer-bar button {
  white-space: nowrap;
}

.room-status {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.88);
  color: var(--ink);
  font-size: 0.9rem;
}

.room-input {
  min-height: 42px;
  min-width: 110px;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.92);
  color: var(--ink);
  font: inherit;
  text-transform: uppercase;
}

#player-name-input {
  min-width: 196px;
  text-transform: none;
}

.perspective-toggle {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 1.25rem;
}

body.app-mode-lobby .layout {
  grid-template-columns: 1fr;
}

body.app-mode-lobby .board-panel {
  min-height: 620px;
  padding: 1.5rem;
  background:
    radial-gradient(circle at top, rgba(255, 214, 153, 0.16), transparent 32%),
    linear-gradient(180deg, #17110c 0%, #21170f 100%);
}

body.app-mode-lobby .side-panel,
body.app-mode-lobby #status-root {
  display: none !important;
}

body.app-mode-lobby .hero {
  align-items: flex-start;
  gap: 1.25rem;
}

body.app-mode-lobby .hero h1 {
  font-size: clamp(2.1rem, 4vw, 3rem);
  color: #2b2418;
}

body.app-mode-lobby .subcopy {
  max-width: 760px;
  font-size: 1rem;
  line-height: 1.55;
}

body.app-mode-lobby .toolbar {
  margin-left: auto;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

body.app-mode-lobby .multiplayer-bar {
  justify-content: flex-end;
  align-items: center;
  flex: 0 1 auto;
}

.status-banner {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.status-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.status-chip.player {
  border-color: #d3a56d;
  background: #fff1df;
}

.status-chip.phase {
  border-color: #b0a4d8;
  background: #f0ecff;
}

.status-chip.turn {
  border-color: #c7c2b3;
  background: #faf6ec;
}

.status-chip.selection {
  border-color: #d3a56d;
  background: #fff1df;
  font-weight: 700;
}

.status-chip.connection {
  font-weight: 700;
}

.status-chip.connection-connected {
  border-color: #6aa57d;
  background: #e9f8ee;
  color: #21522e;
}

.status-chip.connection-connecting,
.status-chip.connection-reconnecting {
  border-color: #d3a56d;
  background: #fff1df;
  color: #7b4f12;
}

.status-chip.connection-idle {
  border-color: #c7c2b3;
  background: #faf6ec;
  color: #6c5a45;
}

.status-chip.presence-open {
  border-color: #c7c2b3;
  background: #faf6ec;
  color: #6c5a45;
}

.status-chip.presence-connected {
  border-color: #6aa57d;
  background: #e9f8ee;
  color: #21522e;
}

.status-chip.presence-away {
  border-color: #d3a56d;
  background: #fff1df;
  color: #7b4f12;
}

.status-copy {
  line-height: 1.45;
}

.status-subcopy {
  margin-top: 0.38rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.status-clear-button {
  margin-top: 0.7rem;
}

.status-banner.info {
  background: #fff7e7;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.75), rgba(255,247,231,0.98));
}

.status-banner.error {
  background: #ffe7de;
  border-color: #d08a69;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,231,222,0.98));
}

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

.board-panel {
  padding: 1.25rem;
  background:
    radial-gradient(circle at top, rgba(255, 214, 153, 0.12), transparent 28%),
    linear-gradient(180deg, #16110d 0%, #1f1710 100%);
  border-color: rgba(214, 183, 130, 0.35);
}

.panel {
  padding: 1rem;
}

.panel-header {
  margin-bottom: 0.85rem;
}

.lobby-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.lobby-refresh-button {
  flex: 0 0 auto;
  min-width: 96px;
  padding: 0.58rem 0.85rem;
}

.panel-header .eyebrow {
  margin-bottom: 0.2rem;
}

.side-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.lobby-page {
  display: grid;
  gap: 1.35rem;
}

.lobby-page-section {
  border: 1px solid rgba(214, 183, 130, 0.26);
  border-radius: 24px;
  padding: 1.25rem 1.25rem 1.2rem;
  background:
    linear-gradient(180deg, rgba(255, 236, 197, 0.05), rgba(255, 236, 197, 0.01)),
    rgba(24, 17, 13, 0.44);
  color: #f8ecd0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 220, 0.03),
    0 16px 36px rgba(0, 0, 0, 0.2);
}

.lobby-room-top h3 {
  margin: 0;
}

.lobby-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.lobby-summary-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.32rem 0.68rem;
  border: 1px solid rgba(214, 183, 130, 0.26);
  background: rgba(255, 250, 240, 0.08);
  color: #fff0cf;
  font-size: 0.84rem;
  letter-spacing: 0.03em;
}

.lobby-join-note {
  margin-top: 0.2rem;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(214, 183, 130, 0.18);
  background: rgba(255, 250, 240, 0.06);
  color: rgba(244, 224, 184, 0.88);
  line-height: 1.5;
}

.lobby-join-note strong {
  color: #fff0cf;
}

.lobby-page-section .eyebrow {
  color: #d8a45d;
}

.lobby-page-section .small-copy {
  color: rgba(244, 224, 184, 0.82);
  line-height: 1.55;
}

.lobby-credit {
  margin: 0.9rem auto 0;
  text-align: center;
  color: #8d765f;
  font-size: 0.95rem;
}

.lobby-credit a {
  color: #5a2c1b;
  font-weight: 700;
  text-decoration: none;
}

.lobby-credit a:hover,
.lobby-credit a:focus-visible {
  color: #7e3714;
  text-decoration: underline;
}

.lobby-empty-note {
  margin: 0.45rem 0 0;
}

.lobby-page-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.lobby-room-tools {
  display: grid;
  gap: 0.75rem;
  margin: 0.85rem 0 1rem;
  padding: 0.85rem;
  border-radius: 16px;
  border: 1px solid rgba(214, 183, 130, 0.16);
  background: rgba(255, 250, 240, 0.06);
}

.lobby-room-create-actions,
.lobby-room-code-join {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.lobby-room-create-actions button {
  flex: 1 1 150px;
}

.lobby-room-code-join .room-input {
  flex: 1 1 180px;
  min-width: 0;
}

.lobby-room-code-join button {
  flex: 0 0 auto;
}

.lobby-room-card {
  border: 1px solid rgba(214, 183, 130, 0.2);
  border-radius: 20px;
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 240, 206, 0.07), rgba(255, 240, 206, 0.02)),
    rgba(255, 250, 240, 0.06);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.lobby-room-card:hover {
  transform: translateY(-2px);
  border-color: rgba(214, 183, 130, 0.34);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.18);
}

.lobby-room-top,
.lobby-room-meta,
.lobby-room-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.lobby-room-top {
  margin-bottom: 0.5rem;
}

.lobby-room-top .eyebrow {
  margin-bottom: 0.18rem;
  color: rgba(216, 164, 93, 0.86);
}

.lobby-room-top h3 {
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: #fff0cf;
}

.lobby-room-meta {
  margin-bottom: 0.85rem;
  color: rgba(244, 224, 184, 0.8);
  font-size: 0.92rem;
  padding: 0.55rem 0.65rem;
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.06);
  border: 1px solid rgba(214, 183, 130, 0.12);
}

.lobby-room-actions {
  flex-wrap: wrap;
  padding-top: 0.1rem;
}

.lobby-room-actions .secondary {
  flex: 1 1 140px;
}

.lobby-room-card .small-copy {
  margin: 0.7rem 0 0;
  color: rgba(244, 224, 184, 0.72);
}

.deckbuilder-section {
  display: grid;
  gap: 1rem;
  min-height: 0;
}

.deckbuilder-toolbar {
  display: grid;
  gap: 0.6rem;
}

.deckbuilder-active {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.deckbuilder-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.32rem 0.68rem;
  border: 1px solid rgba(214, 183, 130, 0.22);
  background: rgba(255, 250, 240, 0.08);
  color: #fff0cf;
  font-size: 0.82rem;
}

.deckbuilder-chip.playable {
  border-color: rgba(106, 165, 125, 0.4);
  background: rgba(31, 74, 40, 0.32);
  color: #dff5e5;
}

.deckbuilder-chip.invalid {
  border-color: rgba(210, 122, 88, 0.38);
  background: rgba(94, 30, 18, 0.3);
  color: #ffd8cf;
}

.deckbuilder-chip.inactive {
  color: rgba(244, 224, 184, 0.82);
}

.deckbuilder-message {
  padding: 0.75rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(214, 183, 130, 0.18);
  background: rgba(255, 250, 240, 0.06);
  color: rgba(244, 224, 184, 0.9);
}

.deckbuilder-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.95fr) minmax(300px, 1.15fr) minmax(320px, 1.5fr);
  gap: 1rem;
  align-items: stretch;
  height: min(68vh, 820px);
  min-height: min(68vh, 820px);
  max-height: min(68vh, 820px);
  overflow: hidden;
}

.deckbuilder-panel {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 0.8rem;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(214, 183, 130, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 240, 206, 0.06), rgba(255, 240, 206, 0.02)),
    rgba(255, 250, 240, 0.05);
  overflow: hidden;
}

.deckbuilder-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.deckbuilder-panel h3 {
  margin: 0;
  color: #fff0cf;
  font-size: 1.1rem;
}

.deckbuilder-saved-list,
.deckbuilder-draft-list,
.deckbuilder-library-list {
  display: grid;
  gap: 0.75rem;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.2rem;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 152, 78, 0.55) rgba(44, 30, 20, 0.18);
}

.deckbuilder-saved-list {
  max-height: none;
}

.deckbuilder-draft-list {
  max-height: none;
}

.deckbuilder-library-list {
  max-height: none;
}

.deck-saved-card,
.deck-card-row,
.deck-library-card {
  display: grid;
  gap: 0.7rem;
  padding: 0.78rem;
  border-radius: 16px;
  border: 1px solid rgba(214, 183, 130, 0.16);
  background: rgba(255, 250, 240, 0.05);
}

.deck-saved-card.is-active {
  border-color: rgba(106, 165, 125, 0.34);
  background: rgba(31, 74, 40, 0.16);
}

.deck-saved-title-row,
.deckbuilder-actions,
.deckbuilder-filter-row,
.deck-card-actions,
.deck-saved-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.deckbuilder-field {
  display: grid;
  gap: 0.35rem;
}

.deckbuilder-field span {
  color: rgba(244, 224, 184, 0.86);
  font-size: 0.86rem;
}

.deckbuilder-field input,
.deckbuilder-filter-row input,
.deckbuilder-filter-row select {
  width: 100%;
  min-height: 42px;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(214, 183, 130, 0.22);
  background: rgba(255, 250, 240, 0.92);
  color: var(--ink);
  font: inherit;
}

.deckbuilder-filter-row input {
  flex: 1 1 180px;
}

.deckbuilder-filter-row select {
  flex: 0 0 160px;
}

.deckbuilder-validation {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.deck-card-row,
.deck-library-card {
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
}

.deck-card-thumb {
  width: 68px;
  aspect-ratio: 3 / 4.2;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(214, 183, 130, 0.22);
  background: rgba(255, 250, 240, 0.08);
}

.deck-card-info {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.deck-card-info strong {
  color: #fff0cf;
}

.deck-card-info .small-copy {
  margin: 0;
  color: rgba(244, 224, 184, 0.74);
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .deckbuilder-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .deckbuilder-panel {
    grid-template-rows: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .deckbuilder-saved-list,
  .deckbuilder-draft-list,
  .deckbuilder-library-list {
    overflow-y: visible;
    max-height: none;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .shell {
    padding: 0.65rem;
  }

  body.app-mode-lobby .hero {
    display: grid;
    grid-template-columns: minmax(190px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
  }

  body.app-mode-lobby .hero-brand {
    min-width: 190px;
  }

  body.app-mode-lobby .hero-logo {
    width: 52px;
  }

  body.app-mode-lobby .hero h1 {
    font-size: 1.35rem;
    line-height: 1;
  }

  body.app-mode-lobby .subcopy,
  body.app-mode-lobby .eyebrow {
    display: none;
  }

  body.app-mode-lobby .toolbar {
    width: auto;
    margin-left: 0;
    min-width: 0;
    justify-content: flex-end;
  }

  body.app-mode-lobby .multiplayer-bar {
    justify-content: flex-end;
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    padding: 0.1rem 0;
  }

  body.app-mode-lobby .room-input,
  body.app-mode-lobby .toolbar button {
    min-height: 36px;
    padding: 0.48rem 0.78rem;
    font-size: 0.86rem;
  }

  body.app-mode-lobby .toolbar button {
    flex: 0 0 auto;
  }

  body.app-mode-lobby .board-panel {
    min-height: 0;
    padding: 0.75rem;
    border-radius: 18px;
  }

  .lobby-page {
    gap: 0.85rem;
  }

  .lobby-page-section {
    padding: 0.85rem;
    border-radius: 18px;
  }

  .deckbuilder-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .deckbuilder-panel {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding: 0.85rem;
    border-radius: 16px;
  }

  .deckbuilder-saved-list,
  .deckbuilder-draft-list,
  .deckbuilder-library-list {
    max-height: 260px;
    overflow-y: auto;
  }

  .deck-card-row,
  .deck-library-card {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    padding: 0.58rem;
  }

  .deck-card-thumb {
    width: 52px;
    border-radius: 8px;
  }

  .deckbuilder-panel h3 {
    font-size: 1rem;
  }

  .deckbuilder-field input,
  .deckbuilder-filter-row input,
  .deckbuilder-filter-row select {
    min-height: 36px;
    padding: 0.48rem 0.68rem;
  }

  body:not(.app-mode-lobby) .shell {
    padding: 0.35rem 0.35rem 0.45rem;
  }

  body:not(.app-mode-lobby) .hero {
    gap: 0.38rem;
    margin-bottom: 0.18rem;
  }

  body:not(.app-mode-lobby) .hero-logo {
    width: 34px;
  }

  body:not(.app-mode-lobby) .hero h1 {
    font-size: 0.92rem;
  }

  body:not(.app-mode-lobby) .toolbar {
    gap: 0.26rem;
  }

  body:not(.app-mode-lobby) .multiplayer-bar {
    gap: 0.24rem;
  }

  body:not(.app-mode-lobby) .room-input,
  body:not(.app-mode-lobby) .toolbar button {
    min-height: 28px;
    padding: 0.28rem 0.55rem;
    font-size: 0.74rem;
  }

  body:not(.app-mode-lobby) .board-panel {
    border-radius: 18px;
  }

  body:not(.app-mode-lobby) .gameboard-shell {
    grid-template-columns: 220px 600px 450px;
    gap: 0.55rem;
  }

  body:not(.app-mode-lobby) .gameboard-main {
    width: 600px;
  }

  body:not(.app-mode-lobby) .board-embedded-panel {
    padding: 0.48rem;
    border-radius: 14px;
  }

  body:not(.app-mode-lobby) .board-embedded-panel .panel-header {
    margin-bottom: 0.24rem;
  }

  body:not(.app-mode-lobby) .gameboard-rail-block .player-header h2 {
    font-size: 1.72rem;
  }

  body:not(.app-mode-lobby) .gameboard-rail-block .player-header .small-copy {
    font-size: 0.82rem;
  }

  body:not(.app-mode-lobby) .gameboard-rail-block .center-plaque-identity {
    padding: 0.58rem 1rem;
    border-radius: 14px;
  }

  body:not(.app-mode-lobby) .gameboard-rail-block .stat-pill.center-plaque {
    min-width: 124px;
    padding: 0.3rem 0.72rem;
  }

  body:not(.app-mode-lobby) .gameboard-rail-block .rail-hand .hand-card {
    flex-basis: 118px;
    min-width: 118px;
    max-width: 118px;
    width: 118px;
  }

  body:not(.app-mode-lobby) .battle-divider-action {
    min-width: 146px;
    padding: 0.48rem 0.72rem;
    font-size: 0.84rem;
  }

  body:not(.app-mode-lobby) .playmat {
    padding: 0.2rem;
    border-radius: 18px;
  }

  body:not(.app-mode-lobby) .playmat .pile-label,
  body:not(.app-mode-lobby) .playmat .value-label {
    font-size: 0.56rem;
  }

  body:not(.app-mode-lobby) #board-log-root.log-list,
  body:not(.app-mode-lobby) #board-log-root {
    max-height: 160px;
  }
}

@media (orientation: landscape) and (max-height: 560px) and (display-mode: standalone),
       (orientation: landscape) and (max-height: 560px) and (display-mode: fullscreen) {
  .app-menu-wrap {
    display: block;
    flex: 0 0 auto;
  }

  .hero {
    position: relative;
  }

  .toolbar {
    align-items: center;
  }

  .multiplayer-bar {
    min-width: 0;
  }

  .header-utility-button,
  #room-code-input {
    display: none !important;
  }

  body.app-mode-lobby .hero {
    grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
  }

  body.app-mode-lobby .hero-brand {
    min-width: 150px;
  }

  body.app-mode-lobby .toolbar {
    gap: 0.35rem;
  }

  body.app-mode-lobby .multiplayer-bar {
    flex: 1 1 auto;
  }

  body:not(.app-mode-lobby) .hero {
    display: grid;
    grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
    align-items: center;
  }

  body:not(.app-mode-lobby) .toolbar {
    justify-content: flex-end;
  }
}

.player-section + .player-section {
  margin-top: 0.5rem;
}

.gameboard-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 180px;
  gap: 0.8rem;
  align-items: start;
  position: relative;
}

.gameboard-aux-rail {
  display: grid;
  gap: 0.5rem;
  align-content: center;
  align-self: center;
}

.gameboard-main {
  min-width: 0;
}

.gameboard-info-rail {
  display: grid;
  gap: 0.5rem;
  align-content: center;
  align-self: center;
}

.gameboard-rail-block {
  display: grid;
  gap: 0.2rem;
}

.gameboard-rail-block .rail-hand {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.38rem;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.12rem 0 0.08rem;
  align-items: flex-start;
  scrollbar-width: thin;
}

.gameboard-rail-block .rail-hand .hand-card {
  flex: 0 0 118px;
  min-width: 118px;
  max-width: 118px;
  width: 118px;
}

.gameboard-rail-block .rail-hand.opponent-hand {
  opacity: 0.95;
}

.gameboard-rail-block .player-identity {
  margin: 0;
  padding-top: 0;
}

.gameboard-rail-block .stat-row {
  margin-bottom: 0;
}

.gameboard-rail-block .center-plaque-identity {
  padding: 0.62rem 1.05rem 0.66rem;
  border-radius: 20px;
}

.gameboard-rail-block .stat-pill.center-plaque {
  min-width: 96px;
  padding: 0.34rem 0.74rem;
}

.battle-divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.2rem 0 0.3rem;
  padding: 0.08rem 0 0;
  color: var(--muted);
}

.battle-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(191, 145, 65, 0.05), rgba(191, 145, 65, 0.55), rgba(191, 145, 65, 0.05), transparent);
}

.battle-divider-label {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b76a1f;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 204, 120, 0.06);
  border: 1px solid rgba(191, 145, 65, 0.12);
}

.gameboard-info-rail .battle-divider {
  display: flex;
  justify-content: center;
  margin: 0.18rem 0;
  padding: 0;
}

.battle-divider-action {
  min-width: 132px;
  padding: 0.62rem 0.9rem;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.1;
  box-shadow: 0 10px 20px rgba(126, 55, 20, 0.22);
}

.winner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(18, 11, 8, 0.58);
  backdrop-filter: blur(3px);
  z-index: 20;
  border-radius: 28px;
}

.winner-dialog {
  width: min(100%, 420px);
  padding: 1.2rem 1.2rem 1.3rem;
  border-radius: 24px;
  border: 1px solid rgba(195, 156, 94, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 250, 239, 0.98), rgba(250, 241, 222, 0.96));
  box-shadow:
    0 20px 50px rgba(19, 11, 7, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  text-align: center;
}

.pending-choice-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(18, 11, 8, 0.58);
  backdrop-filter: blur(3px);
  z-index: 18;
  border-radius: 28px;
}

.pending-choice-overlay-passive {
  pointer-events: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2rem;
  background: rgba(18, 11, 8, 0.34);
}

.pending-choice-dialog {
  width: min(100%, 920px);
  max-height: 100%;
  overflow: auto;
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid rgba(195, 156, 94, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 250, 239, 0.98), rgba(250, 241, 222, 0.96));
  box-shadow:
    0 20px 50px rgba(19, 11, 7, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.pending-choice-dialog-passive {
  pointer-events: auto;
}

.pending-choice-modal-panel {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.pending-choice-dialog .pending-choice-title {
  font-size: 1.26rem;
  margin-bottom: 0.35rem;
}

.pending-choice-dialog .small-copy {
  font-size: 0.98rem;
  line-height: 1.45;
}

.pending-choice-dialog .choice-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pending-choice-dialog .choice-card {
  min-height: 320px;
}

.pending-choice-dialog .genesis-flip-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.pending-choice-dialog .genesis-flip-card {
  min-height: 0;
  padding: 0.55rem;
  background: rgba(28, 22, 18, 0.82);
}

.signal-received-preview {
  display: grid;
  grid-template-columns: minmax(170px, 240px) 1fr;
  gap: 1rem;
  align-items: start;
  margin-top: 0.85rem;
}

.signal-received-art {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4.2;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #120d0a;
}

.signal-received-detail {
  display: grid;
  gap: 0.35rem;
}

.genesis-flip-art {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4.2;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #120d0a;
}

.pending-choice-dialog .target-list {
  margin-top: 0.85rem;
}

.pending-choice-dialog .target-list .board-action {
  min-width: 140px;
}

.winner-dialog h2 {
  margin: 0.15rem 0 0.45rem;
  font-size: 2rem;
}

.winner-copy {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1rem;
}

.winner-return-button {
  min-width: 190px;
  padding: 0.85rem 1.2rem;
  border-radius: 18px;
  font-size: 1rem;
}

.player-opponent .player-card {
  background-image: none;
}

.player-opponent .player-header {
  flex-direction: row-reverse;
}

.player-opponent .player-header h2,
.player-opponent .small-copy {
  text-align: right;
}

.player-opponent .player-flags {
  justify-content: flex-start;
}

.player-opponent .resource-rail {
  justify-content: flex-end;
}

.player-card {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #f8ecd0;
}

.player-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0;
}

.player-identity {
  justify-content: center;
  text-align: center;
  margin-bottom: 0.18rem;
  gap: 0.24rem;
  padding: 0.08rem 0 0.02rem;
}

.player-identity-main {
  display: grid;
  gap: 0.05rem;
  justify-items: center;
  min-width: min(100%, 340px);
  width: min(100%, 340px);
}

.center-plaque {
  border-radius: 999px;
  border: 1px solid rgba(196, 152, 78, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 229, 174, 0.06), rgba(255, 215, 141, 0.02)),
    rgba(38, 26, 17, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(255, 242, 214, 0.03),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.center-plaque-identity {
  border-radius: 18px;
  padding: 0.48rem 0.95rem 0.52rem;
}

.player-name-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.player-header h2 {
  color: #fff2d5;
  font-size: 1.54rem;
  line-height: 1;
  letter-spacing: 0.01em;
  margin: 0;
}

.player-header .small-copy {
  color: rgba(244, 224, 184, 0.78);
  font-size: 0.84rem;
  letter-spacing: 0.03em;
}

.mulligan-button {
  padding: 0.36rem 0.72rem;
  font-size: 0.82rem;
  line-height: 1;
}

.player-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}

.player-flag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.46rem;
  font-size: 0.74rem;
  border: 1px solid var(--line);
  background: #f5ebd9;
}

.player-flag.active {
  background: linear-gradient(180deg, #f4d486, #d89f39);
  border-color: #f0cf85;
  color: #2b1b08;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(176, 118, 25, 0.22);
}

.player-flag.winner {
  background: #e7f5e8;
  border-color: #8ebb93;
}

.stat-row,
.hand-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.stat-row {
  margin-bottom: 0.12rem;
  justify-content: center;
  gap: 0.4rem;
}

.zone-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}

.hand-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.42rem;
  padding: 0.04rem 0 0.36rem;
  scroll-snap-type: x proximity;
  scroll-behavior: auto;
  overflow-anchor: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 152, 78, 0.55) rgba(44, 30, 20, 0.18);
  align-items: flex-end;
}

.row-label-opponent-hand {
  margin-top: 0.02rem;
  margin-bottom: 0.1rem;
}

.player-opponent .opponent-hand {
  margin-bottom: 0.08rem;
}

.player-self .hand-row {
  margin-top: 0.18rem;
}

.player-opponent .player-identity {
  margin-top: 0.08rem;
  margin-bottom: 0.08rem;
}

.player-opponent .player-identity,
.player-opponent .player-header,
.player-opponent .player-header h2,
.player-opponent .small-copy,
.player-opponent .stat-row {
  text-align: center;
  justify-content: center;
}

.stat-pill,
.slot,
.hand-card,
.target-chip,
.control-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.stat-pill {
  padding: 0.3rem 0.66rem;
  font-size: 0.92rem;
}

.stat-pill.center-plaque {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 88px;
  justify-content: center;
  padding: 0.28rem 0.66rem;
}

.center-plaque-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(244, 224, 184, 0.75);
}

.center-plaque-value {
  font-size: 1rem;
  font-weight: 700;
  color: #fff2d5;
}

.stat-pill.subtle {
  background: rgba(255, 247, 228, 0.08);
  color: rgba(247, 231, 199, 0.82);
  border-color: rgba(214, 183, 130, 0.28);
}

.stat-pill.emphasis {
  background: #fff4e2;
  border-color: #dcbc8e;
  font-weight: 700;
}

.resource-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 0.35rem;
  align-items: stretch;
}

.playmat {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.66rem;
  padding: 0.76rem 0.72rem 0.84rem;
  min-height: 430px;
  margin-top: 0.78rem;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 210, 125, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(18, 13, 9, 0.98), rgba(10, 8, 7, 0.98));
  border: 1px solid rgba(230, 209, 170, 0.22);
  box-shadow:
    inset 0 0 0 1px rgba(255, 243, 220, 0.04),
    0 18px 34px rgba(0, 0, 0, 0.28);
}

.playmat-opponent {
  background-position: center top;
}

.playmat-self {
  background-position: center bottom;
}

.playmat-side {
  position: relative;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.66rem;
  pointer-events: none;
  min-width: 0;
}

.playmat-side-left {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.playmat-side-right {
  grid-column: 5;
  grid-row: 1 / span 2;
}

.playmat-side-well {
  width: 100%;
  height: 100%;
  position: relative;
  pointer-events: auto;
}

.playmat .well-life,
.playmat .well-energy {
  width: 100%;
}

.playmat .value-well,
.playmat .pile-well {
  width: 100%;
  min-height: 138px;
  height: 100%;
  border-radius: 18px;
}

.playmat .value-well {
  min-height: 124px;
  height: 100%;
}

.playmat-zone-upper {
  grid-column: 2 / span 3;
  grid-row: 1;
  align-self: stretch;
  padding-top: 0;
}

.playmat-zone-lower {
  grid-column: 2 / span 3;
  grid-row: 2;
  align-self: stretch;
  padding-bottom: 0;
}

.playmat .zone-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.playmat .zone-wrap.zone-active,
.playmat .zone-wrap.zone-targeting {
  transform: none;
  box-shadow: none;
}

.playmat .row-label {
  margin: 0 0 0.46rem;
  color: #f3ddb0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
}

.playmat .row-label-below {
  margin: 0.46rem 0 0;
}

.playmat .playmat-zone-upper .row-label {
  transform: translateY(-1px);
}

.playmat .playmat-zone-lower .row-label {
  transform: translateY(1px);
}

.playmat-opponent .playmat-zone-upper .row-label {
  transform: translateY(0);
}

.playmat-opponent .playmat-zone-lower .row-label {
  transform: translateY(0);
}

.playmat .zone-hint {
  margin: -0.14rem 0 0.52rem;
  color: rgba(244, 229, 194, 0.88);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.playmat .zone-altar .row-label,
.playmat .zone-vault .row-label,
.playmat .zone-altar .zone-hint,
.playmat .zone-vault .zone-hint {
  color: inherit;
}

.playmat .zone-row {
  flex: 1 1 auto;
  gap: 0.66rem;
}

.playmat .slot {
  aspect-ratio: 3 / 4.2;
  min-width: 0;
  max-width: none;
  width: 100%;
  min-height: 0;
}

.playmat .pile-label,
.playmat .value-label {
  font-size: 0.74rem;
}

.playmat .pile-count {
  font-size: 1.34rem;
}

.playmat .value-number {
  font-size: 1.82rem;
}

.playmat .slot.empty {
  min-height: 0;
  justify-content: center;
  padding-top: 0;
  background: rgba(255, 251, 242, 0.015);
  border-color: rgba(234, 212, 171, 0.28);
}

.playmat .slot-action-copy {
  margin-top: 0;
}

.pile-well {
  width: 112px;
  min-height: 170px;
  padding: 0.55rem 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #1a1510, #251d15);
  color: #f6e6b0;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(241, 188, 89, 0.18);
  display: flex;
  flex-direction: column;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.pile-well.clickable {
  cursor: pointer;
}

.pile-well.targetable {
  border-color: #d8a243;
  box-shadow:
    inset 0 0 0 2px rgba(216, 162, 67, 0.16),
    0 10px 24px rgba(123, 82, 18, 0.14);
  transform: translateY(-2px);
}

.well-action-copy {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff1cd;
}

.pile-art {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4.2;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f6ead3;
}

.pile-label {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: #f1d48f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pile-count {
  margin-top: 0.2rem;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  color: #fff6da;
}

.value-well {
  width: 132px;
  min-height: 170px;
  padding: 0.75rem 0.75rem 0.7rem;
  border: 1px solid #d3a56d;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(54, 40, 25, 0.96), rgba(38, 29, 19, 0.98));
  color: #fff5d8;
  box-shadow: inset 0 0 0 1px rgba(241, 188, 89, 0.14);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.value-well.clickable {
  cursor: pointer;
}

.value-well.targetable {
  border-color: #4d7f5b;
  box-shadow:
    inset 0 0 0 2px rgba(77, 127, 91, 0.16),
    0 10px 24px rgba(39, 78, 52, 0.14);
  transform: translateY(-2px);
}

.value-label {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f1d48f;
  text-align: center;
}

.value-meter {
  position: relative;
  margin-top: 0.65rem;
  flex: 1;
  min-height: 90px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 247, 228, 0.06), rgba(255, 247, 228, 0.14));
  border: 1px solid rgba(241, 212, 143, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 243, 214, 0.04);
}

.value-meter.is-empty {
  background: transparent;
  box-shadow: none;
}

.value-meter-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.5rem;
  padding: 0.5rem 0.35rem;
  transition: height 180ms ease;
}

.value-meter-life {
  background:
    linear-gradient(180deg, rgba(255, 232, 177, 0.88), rgba(236, 181, 86, 0.96)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 251, 236, 0.35);
}

.value-meter-energy {
  background:
    linear-gradient(180deg, rgba(166, 234, 255, 0.86), rgba(85, 194, 230, 0.96)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.08));
  box-shadow: inset 0 1px 0 rgba(232, 252, 255, 0.35);
}

.value-number {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  color: #fff8e1;
  text-shadow: 0 2px 10px rgba(44, 27, 9, 0.48);
  pointer-events: none;
}

.value-number-empty {
  color: #fff3d0;
}

.row-label {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
}

.zone-hint {
  margin: -0.2rem 0 0.65rem;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.35;
}

.zone-wrap {
  margin-top: 0.85rem;
  padding: 0.85rem 0.85rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: box-shadow 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.zone-altar {
  background: linear-gradient(180deg, rgba(62, 36, 28, 0.92), rgba(46, 29, 24, 0.9));
  border-color: #d3a56d;
}

.zone-vault {
  background: linear-gradient(180deg, rgba(16, 49, 58, 0.92), rgba(15, 39, 47, 0.9));
  border-color: #63c5d5;
}

.zone-altar .row-label {
  color: #f0cf85;
}

.zone-altar .zone-hint {
  color: rgba(242, 220, 167, 0.9);
}

.zone-vault .row-label {
  color: #72d7e7;
}

.zone-vault .zone-hint {
  color: rgba(169, 236, 244, 0.9);
}

.zone-wrap.zone-active {
  transform: translateY(-2px);
}

.zone-altar.zone-active {
  border-color: #efc36f;
  box-shadow:
    inset 0 0 0 1px rgba(255, 239, 199, 0.08),
    0 12px 28px rgba(148, 100, 29, 0.18);
}

.zone-vault.zone-active {
  border-color: #8dd9e4;
  box-shadow:
    inset 0 0 0 1px rgba(222, 249, 252, 0.08),
    0 12px 28px rgba(27, 103, 117, 0.18);
}

.zone-wrap.zone-targeting {
  box-shadow:
    inset 0 0 0 1px rgba(238, 248, 239, 0.08),
    0 12px 28px rgba(39, 78, 52, 0.16);
}

.slot,
.hand-card {
  min-width: 145px;
  max-width: 165px;
  position: relative;
  overflow: hidden;
}

.slot {
  width: 100%;
  max-width: none;
  min-height: 100%;
  padding: 0;
  background: transparent;
}

.hand-card {
  flex: 0 0 160px;
  padding: 0;
  scroll-snap-align: start;
  box-shadow: 0 7px 16px rgba(70, 42, 16, 0.09);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  background: linear-gradient(180deg, rgba(33, 24, 18, 0.96), rgba(20, 16, 13, 0.98));
}

.opponent-hand {
  opacity: 0.95;
}

.hand-card-back {
  cursor: default;
  background: linear-gradient(180deg, rgba(28, 22, 18, 0.96), rgba(20, 16, 13, 0.98));
}

.hand-card-back .slot-meta {
  color: rgba(255, 245, 216, 0.82);
}

.hand-card:hover,
.hand-card:focus-within {
  transform: translateY(-4px) scale(1.015);
  box-shadow: 0 12px 22px rgba(70, 42, 16, 0.14);
  border-color: #d3a56d;
}

.player-self .hand-card:nth-child(even) {
  margin-top: 0;
}

.card-art,
.inspector-art {
  display: block;
  width: 100%;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f6ead3;
}

.card-art {
  aspect-ratio: 3 / 4.2;
  max-height: 170px;
  margin-bottom: 0.5rem;
}

.slot .card-art {
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 14px;
}

.hand-card .card-art {
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 14px;
}

.inspector-art {
  max-width: 260px;
  margin: 0 0 0.85rem;
  aspect-ratio: 3 / 4.2;
}

.slot.clickable,
.hand-card.clickable {
  cursor: pointer;
}

.slot.clickable:hover,
.slot.clickable:focus-within {
  transform: translateY(-3px);
}

.slot.empty {
  color: rgba(255, 250, 240, 0.82);
  background: rgba(255, 250, 240, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 96px;
  text-align: center;
  border-style: dashed;
  border-width: 2px;
  padding-top: 0.75rem;
}

.slot-empty-copy {
  margin-top: 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}

.slot-action-copy {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 248, 232, 0.92);
}

.slot-target-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #244b31;
  background: rgba(228, 244, 232, 0.96);
  border: 1px solid rgba(77, 127, 91, 0.34);
}

.slot .actions {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  margin: 0;
}

.slot.selectable {
  border-color: #cf9a59;
}

.slot.actionable,
.hand-card.actionable {
  border-color: #d8a243;
  box-shadow:
    inset 0 0 0 2px rgba(216, 162, 67, 0.18),
    0 10px 24px rgba(123, 82, 18, 0.12);
}

.slot.actionable:hover,
.slot.actionable:focus-within,
.hand-card.actionable:hover,
.hand-card.actionable:focus-within {
  box-shadow:
    inset 0 0 0 2px rgba(216, 162, 67, 0.22),
    0 16px 30px rgba(123, 82, 18, 0.18);
}

.slot.placeable {
  border-color: #cf9a59;
  box-shadow: inset 0 0 0 2px rgba(207, 154, 89, 0.16);
  background: rgba(255, 244, 226, 0.1);
}

.slot.selected {
  border-color: var(--accent-dark);
  box-shadow: inset 0 0 0 2px rgba(126, 55, 20, 0.18);
  background: #fff1df;
}

.slot.targetable {
  border-color: #4d7f5b;
  box-shadow: inset 0 0 0 2px rgba(77, 127, 91, 0.16);
  background: #eef8ef;
}

.slot.targetable:hover,
.slot.targetable:focus-within,
.pile-well.targetable:hover,
.pile-well.targetable:focus-within,
.value-well.targetable:hover,
.value-well.targetable:focus-within {
  box-shadow:
    inset 0 0 0 2px rgba(77, 127, 91, 0.22),
    0 16px 30px rgba(39, 78, 52, 0.18);
}

.slot.placeable:hover,
.slot.placeable:focus-within {
  box-shadow:
    inset 0 0 0 2px rgba(207, 154, 89, 0.22),
    0 14px 28px rgba(123, 82, 18, 0.14);
}

.pile-well.clickable:hover,
.pile-well.clickable:focus-within,
.value-well.clickable:hover,
.value-well.clickable:focus-within {
  transform: translateY(-4px);
}

.slot.feedback-card-place {
  animation: feedback-card-place 360ms ease-out;
}

.slot.feedback-card-move {
  animation: feedback-card-move 360ms ease-out;
}

.slot.feedback-attack {
  animation: feedback-attack 260ms ease-out;
}

.slot.feedback-card-hit,
.value-well.feedback-life-hit {
  animation: feedback-hit 520ms ease-out;
}

.slot.feedback-card-hit::after,
.value-well.feedback-life-hit::after {
  content: attr(data-feedback-label);
  position: absolute;
  inset: auto 50% 50% auto;
  z-index: 5;
  transform: translate(50%, 50%) scale(0.92);
  min-width: 2.3rem;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 229, 183, 0.86);
  background: rgba(118, 24, 18, 0.9);
  color: #fff2cf;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: feedback-damage-badge 520ms ease-out;
}

.value-well.feedback-life-hit {
  position: relative;
}

.pile-well.feedback-discard {
  animation: feedback-discard 360ms ease-out;
}

@keyframes feedback-card-place {
  0% {
    filter: brightness(1.18);
    transform: scale(0.985);
    box-shadow:
      inset 0 0 0 2px rgba(240, 207, 133, 0.42),
      0 0 18px rgba(240, 207, 133, 0.2);
  }

  62% {
    transform: scale(1.018);
  }

  100% {
    filter: none;
    transform: scale(1);
  }
}

@keyframes feedback-card-move {
  0% {
    filter: brightness(1.16);
    transform: translateY(-4px) scale(0.99);
    box-shadow:
      inset 0 0 0 2px rgba(114, 215, 231, 0.42),
      0 0 18px rgba(114, 215, 231, 0.16);
  }

  100% {
    filter: none;
    transform: translateY(0) scale(1);
  }
}

@keyframes feedback-attack {
  0% {
    filter: brightness(1.2);
    transform: translateX(0);
  }

  45% {
    transform: translateX(5px);
  }

  100% {
    filter: none;
    transform: translateX(0);
  }
}

@keyframes feedback-hit {
  0% {
    filter: brightness(1.26) saturate(1.12);
    transform: translateX(0);
    box-shadow:
      inset 0 0 0 3px rgba(216, 69, 38, 0.58),
      0 0 28px rgba(216, 69, 38, 0.32);
  }

  18% {
    transform: translateX(-4px) rotate(-1deg);
  }

  36% {
    transform: translateX(4px) rotate(1deg);
  }

  56% {
    transform: translateX(-2px) rotate(-0.5deg);
  }

  100% {
    filter: none;
    transform: translateX(0) rotate(0);
  }
}

@keyframes feedback-damage-badge {
  0% {
    opacity: 0;
    transform: translate(50%, 50%) scale(0.78);
  }

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

  72% {
    opacity: 1;
    transform: translate(50%, 50%) scale(1);
  }

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

@keyframes feedback-discard {
  0% {
    filter: brightness(1.16) saturate(1.08);
    transform: scale(0.985);
    box-shadow:
      inset 0 0 0 2px rgba(207, 154, 89, 0.36),
      0 0 18px rgba(207, 154, 89, 0.18);
  }

  100% {
    filter: none;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .slot.feedback-card-place,
  .slot.feedback-card-move,
  .slot.feedback-attack,
  .slot.feedback-card-hit,
  .value-well.feedback-life-hit,
  .pile-well.feedback-discard {
    animation: none;
  }

  .slot.feedback-card-hit::after,
  .value-well.feedback-life-hit::after {
    display: none;
  }
}

.hand-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.slot .slot-meta,
.hand-card:not(.hand-card-back) .slot-meta {
  display: none;
}

.slot-badge,
.hand-title,
.status-list,
.actions {
  position: relative;
  z-index: 2;
}

.slot-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.14rem 0.45rem;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--line);
  background: #f4ead7;
  color: var(--ink);
}

.zone-altar .slot.empty .slot-badge {
  background: rgba(240, 207, 133, 0.14);
  color: #f2dca7;
  border-color: rgba(240, 207, 133, 0.28);
}

.zone-vault .slot.empty .slot-badge {
  background: rgba(114, 215, 231, 0.14);
  color: #a9ecf4;
  border-color: rgba(114, 215, 231, 0.28);
}

.status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
}

.slot .status-list {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  margin: 0;
}

.card-hover-overlay {
  position: absolute;
  inset: 0;
  padding: 0.85rem 0.85rem 1rem;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(11, 9, 8, 0.82), rgba(16, 13, 11, 0.94)),
    linear-gradient(180deg, rgba(28, 22, 18, 0.2), rgba(21, 17, 14, 0.94));
  color: #fff8e8;
  opacity: 0;
  transition: opacity 140ms ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.25rem;
  overflow-y: auto;
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 243, 222, 0.08);
}

.slot:hover .card-hover-overlay,
.slot:focus-within .card-hover-overlay,
.hand-card:hover .card-hover-overlay,
.hand-card:focus-within .card-hover-overlay {
  opacity: 1;
  pointer-events: auto;
}

.card-hover-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: #fff8e8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.card-hover-meta,
.card-hover-stats {
  font-size: 0.84rem;
  color: rgba(255, 248, 232, 0.94);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.card-hover-copy {
  margin-top: 0.35rem;
  font-size: 0.86rem;
  line-height: 1.4;
  color: #fff6df;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.leaderboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(18, 11, 8, 0.58);
  backdrop-filter: blur(3px);
}

.leaderboard-dialog {
  width: min(100%, 760px);
  max-height: min(86vh, 720px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(195, 156, 94, 0.48);
  background: linear-gradient(180deg, rgba(255, 250, 239, 0.98), rgba(250, 241, 222, 0.96));
  color: var(--ink);
  padding: 1rem;
  box-shadow: 0 20px 50px rgba(19, 11, 7, 0.28);
}

.leaderboard-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.leaderboard-head h2 {
  margin: 0.1rem 0 0;
}

.leaderboard-table-wrap {
  overflow: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.62rem 0.55rem;
  border-bottom: 1px solid rgba(135, 92, 43, 0.2);
  text-align: left;
}

.leaderboard-table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.leaderboard-table tfoot th,
.leaderboard-table tfoot td {
  font-weight: 800;
  color: var(--ink);
  background: rgba(255, 247, 229, 0.78);
  border-top: 2px solid rgba(135, 92, 43, 0.28);
  border-bottom: 0;
}

.donation-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(18, 11, 8, 0.58);
  backdrop-filter: blur(3px);
}

.donation-dialog {
  width: min(100%, 520px);
  max-height: min(86vh, 620px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(195, 156, 94, 0.48);
  background: linear-gradient(180deg, rgba(255, 250, 239, 0.98), rgba(250, 241, 222, 0.96));
  color: var(--ink);
  padding: 1rem;
  box-shadow: 0 20px 50px rgba(19, 11, 7, 0.28);
}

.donation-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.donation-head h2 {
  margin: 0.1rem 0 0;
}

.donation-address-card {
  border: 1px solid rgba(135, 92, 43, 0.2);
  background: rgba(255, 247, 229, 0.78);
  border-radius: 12px;
  padding: 0.9rem;
}

.donation-qr {
  display: block;
  width: min(100%, 260px);
  aspect-ratio: 1;
  object-fit: contain;
  margin: 0 auto 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(135, 92, 43, 0.22);
  background: #fff;
}

.donation-address {
  margin: 0.35rem 0 0.75rem;
  padding: 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(135, 92, 43, 0.22);
  background: rgba(255, 255, 255, 0.68);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.account-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(18, 11, 8, 0.58);
  backdrop-filter: blur(3px);
}

.account-dialog {
  width: min(100%, 620px);
  max-height: min(86vh, 700px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(195, 156, 94, 0.48);
  background: linear-gradient(180deg, rgba(255, 250, 239, 0.98), rgba(250, 241, 222, 0.96));
  color: var(--ink);
  padding: 1rem;
  box-shadow: 0 20px 50px rgba(19, 11, 7, 0.28);
}

.account-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.account-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.account-head h2,
.account-sleeves h3 {
  margin: 0.1rem 0 0;
}

.account-dialog .deckbuilder-field span {
  color: #4f3b22;
  font-weight: 700;
}

.account-dialog .deckbuilder-field input {
  border-color: rgba(126, 55, 20, 0.34);
  background: rgba(255, 255, 255, 0.86);
  color: #24170f;
}

.account-dialog .deckbuilder-field input::placeholder {
  color: rgba(79, 59, 34, 0.68);
}

.account-dialog .deckbuilder-message {
  border-color: rgba(182, 90, 42, 0.34);
  background: rgba(255, 238, 219, 0.9);
  color: #5c2510;
  font-weight: 700;
}

.account-profile {
  display: grid;
  gap: 1rem;
}

.account-profile-card,
.account-sleeves {
  border: 1px solid rgba(135, 92, 43, 0.2);
  background: rgba(255, 247, 229, 0.78);
  border-radius: 12px;
  padding: 0.9rem;
}

.account-profile-name {
  margin-top: 0.25rem;
  font-size: 1.2rem;
  font-weight: 800;
}

.account-sleeve-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.account-sleeve-card {
  display: flex;
  min-width: 0;
}

.account-sleeve-option {
  display: grid;
  justify-items: center;
  align-content: space-between;
  gap: 0.55rem;
  width: 100%;
  min-height: 202px;
  border-radius: 12px;
  border: 1px solid rgba(135, 92, 43, 0.18);
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  padding: 0.75rem;
}

.account-sleeve-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(182, 90, 42, 0.18);
}

.account-sleeve-option img {
  width: min(100%, 96px);
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(135, 92, 43, 0.22);
}

.account-upload-field {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.account-upload-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.account-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  min-height: 42px;
  border-radius: 999px;
  padding: 0.58rem 0.95rem;
  background: #eadfc8;
  color: var(--ink);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.account-delete-sleeve {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(141, 45, 24, 0.24);
  background: #f4d8cf;
  color: #6d1f12;
  padding: 0.48rem 0.7rem;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: #f5ebd9;
  color: var(--ink);
}

.status-badge.buff {
  background: #e7f5e8;
  border-color: #8ebb93;
}

.status-badge.debuff {
  background: #fde8e2;
  border-color: #d29a88;
}

.status-badge.state {
  background: #ece8fb;
  border-color: #b0a4d8;
}

.hand-card.selected {
  border-color: var(--accent-dark);
  box-shadow: 0 12px 22px rgba(70, 42, 16, 0.16), inset 0 0 0 2px rgba(126, 55, 20, 0.14);
  transform: translateY(-4px);
}

.slot-meta,
.small-copy {
  color: var(--muted);
  font-size: 0.92rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.control-row {
  padding: 0.85rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,250,240,0.96));
}

.pending-choice-panel {
  border: 1px solid #d8b98b;
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(70, 42, 16, 0.08);
}

.pending-choice-title {
  margin-bottom: 0.2rem;
}

.pending-choice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.pending-choice-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: #f8efdf;
  color: var(--ink);
}

.pending-choice-chip.emphasis {
  background: #fff3db;
  border-color: #d8b98b;
  font-weight: 700;
}

.phase-control {
  border: 1px solid #d8b98b;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff6e8, #fff0da);
  box-shadow: 0 12px 26px rgba(123, 82, 18, 0.1);
}

.phase-action {
  margin-top: 0.75rem;
  width: 100%;
  justify-content: center;
  font-weight: 700;
  background: linear-gradient(135deg, #c66c2f, #8f4316);
}

.control-row + .control-row {
  margin-top: 0.75rem;
}

.log-list {
  display: grid;
  gap: 0.65rem;
  max-height: 420px;
  overflow: auto;
}

.log-entry {
  padding: 0.75rem 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  line-height: 1.45;
}

.log-topline {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0.35rem;
}

.log-label {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  background: #f5ebd9;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.log-label.effect {
  background: #fff1df;
  border-color: #d8b98b;
}

.log-label.combat {
  background: #fde8e2;
  border-color: #d29a88;
}

.log-label.phase {
  background: #ece8fb;
  border-color: #b0a4d8;
}

.log-label.system {
  background: #eef3ff;
  border-color: #b5c3e4;
}

.log-body {
  color: var(--ink);
}

.target-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.choice-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-top: 0.75rem;
}

.choice-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 240, 0.98));
  padding: 0.7rem;
  box-shadow: 0 10px 24px rgba(70, 42, 16, 0.12);
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.choice-card:hover,
.choice-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 16px 30px rgba(70, 42, 16, 0.18);
  border-color: #d3a56d;
}

.choice-card .card-art {
  max-height: 220px;
}

.choice-card-life {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 240px;
}

.choice-card-head {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  z-index: 2;
}

.choice-card-title {
  margin-top: 0.25rem;
  font-weight: 700;
}

.choice-card-meta {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.choice-card-overlay {
  position: absolute;
  inset: 0;
  padding: 1rem 0.9rem 4.4rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(28, 22, 18, 0.24), rgba(21, 17, 14, 0.92));
  color: #fff8e8;
  opacity: 0;
  transition: opacity 140ms ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.choice-card:hover .choice-card-overlay,
.choice-card:focus-within .choice-card-overlay {
  opacity: 1;
}

.choice-card-overlay-title {
  font-weight: 700;
  font-size: 1rem;
}

.choice-card-overlay-meta,
.choice-card-overlay-stats {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: rgba(255, 248, 232, 0.88);
}

.choice-card-overlay-copy {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: #fff4d8;
}

.choice-card .actions {
  margin-top: 0.7rem;
  position: relative;
  z-index: 2;
}

.choice-sequence-summary {
  margin-top: 0.45rem;
}

.choice-sequence-label {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.choice-sequence-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.target-chip {
  padding: 0.45rem 0.6rem;
  color: var(--ink);
  background: #fff7ea;
}

.hint {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.control-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.board-action {
  color: var(--ink);
  background: #efe1c6;
}

.log-entry.effect {
  background: #fff7ea;
  border-color: #d8b98b;
}

.log-entry.combat {
  background: #fff4ef;
  border-color: #dfb09f;
}

.log-entry.phase {
  background: #f5f1ff;
  border-color: #cfc2ee;
}

.inspector-empty {
  color: var(--muted);
  line-height: 1.5;
}

.inspector-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.inspector-subtitle {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.inspector-copy {
  margin: 0.65rem 0 0;
  line-height: 1.45;
}

#controls-root,
#inspector-root {
  min-height: 80px;
}

#board-inspector-root,
#board-log-root {
  min-height: 0;
}

.debug-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

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

  .gameboard-shell {
    grid-template-columns: 1fr;
  }

  .gameboard-aux-rail,
  .gameboard-info-rail {
      order: -1;
  }

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

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

body:not(.app-mode-lobby) {
  height: 100svh;
  overflow: hidden;
}

body:not(.app-mode-lobby) .shell {
  height: 100svh;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.55rem 1rem;
}

body:not(.app-mode-lobby) .hero {
  flex: 0 0 auto;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  align-items: flex-start;
}

body:not(.app-mode-lobby) .hero-logo {
  width: clamp(30px, 4vw, 52px);
}

body:not(.app-mode-lobby) .layout {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: 1fr;
  gap: 0;
}

body:not(.app-mode-lobby) .board-panel {
  min-height: 0;
  padding: 0.2rem;
  overflow: hidden;
}

body:not(.app-mode-lobby) .side-panel {
  display: none !important;
}

body:not(.app-mode-lobby) .panel {
  min-height: 0;
  padding: 0.68rem 0.72rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body:not(.app-mode-lobby) .panel-header {
  margin-bottom: 0.55rem;
}

body:not(.app-mode-lobby) .panel-header h2 {
  font-size: 0.96rem;
}

body:not(.app-mode-lobby) .panel-header .eyebrow {
  font-size: 0.66rem;
}

body:not(.app-mode-lobby) .hero h1 {
  font-size: 1.05rem;
  line-height: 1;
}

body:not(.app-mode-lobby) .eyebrow {
  margin-bottom: 0.1rem;
  font-size: 0.68rem;
}

body:not(.app-mode-lobby) .subcopy {
  display: none;
}

body:not(.app-mode-lobby) .toolbar {
  gap: 0.45rem;
}

body:not(.app-mode-lobby) .multiplayer-bar {
  gap: 0.32rem;
}

body:not(.app-mode-lobby) .room-status,
body:not(.app-mode-lobby) .room-input,
body:not(.app-mode-lobby) .toolbar button {
  min-height: 34px;
  padding: 0.42rem 0.75rem;
  font-size: 0.84rem;
}

body:not(.app-mode-lobby) .status-banner {
  margin-bottom: 0.28rem;
  padding: 0.42rem 0.58rem;
  border-radius: 20px;
}

body:not(.app-mode-lobby) .status-topline {
  gap: 0.32rem;
  margin-bottom: 0.2rem;
}

body:not(.app-mode-lobby) .status-chip {
  padding: 0.14rem 0.46rem;
  font-size: 0.72rem;
}

body:not(.app-mode-lobby) .status-copy {
  font-size: 0.86rem;
  line-height: 1.3;
}

body:not(.app-mode-lobby) .status-subcopy {
  margin-top: 0.2rem;
  font-size: 0.76rem;
}

#board-fit-shell {
  width: 100%;
}

body:not(.app-mode-lobby) #board-fit-shell {
  height: 100%;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  padding-bottom: 0.15rem;
}

body:not(.app-mode-lobby) #board-root {
  width: fit-content;
  max-width: none;
}

body:not(.app-mode-lobby) .player-section + .player-section {
  margin-top: 0.2rem;
}

body:not(.app-mode-lobby) .gameboard-shell {
  grid-template-columns: 260px 680px 560px;
  gap: 0.8rem;
}

body:not(.app-mode-lobby) .gameboard-aux-rail,
body:not(.app-mode-lobby) .gameboard-info-rail {
  gap: 0.5rem;
  align-self: center;
  justify-self: start;
  width: auto;
}

body:not(.app-mode-lobby) .gameboard-main {
  width: 680px;
}

body:not(.app-mode-lobby) .board-embedded-panel {
  padding: 0.7rem 0.78rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  border-radius: 20px;
  box-shadow: 0 10px 22px rgba(23, 15, 9, 0.14);
}

body:not(.app-mode-lobby) .board-embedded-panel .panel-header {
  margin-bottom: 0.38rem;
}

body:not(.app-mode-lobby) #board-inspector-root,
body:not(.app-mode-lobby) #board-log-root {
  flex: 1 1 auto;
  min-height: 0;
}

body:not(.app-mode-lobby) .gameboard-rail-block .player-header h2 {
  font-size: 2.34rem;
}

body:not(.app-mode-lobby) .gameboard-rail-block .player-header .small-copy {
  font-size: 1.02rem;
}

body:not(.app-mode-lobby) .gameboard-rail-block .center-plaque-identity {
  padding: 0.82rem 1.55rem 0.88rem;
}

body:not(.app-mode-lobby) .gameboard-rail-block .stat-pill.center-plaque {
  min-width: 164px;
  padding: 0.42rem 1.04rem;
}

body:not(.app-mode-lobby) .gameboard-rail-block .rail-hand {
  gap: 0.16rem;
  padding-top: 0.12rem;
  padding-bottom: 0.1rem;
  scrollbar-width: thin;
}

body:not(.app-mode-lobby) .gameboard-rail-block .rail-hand .hand-card {
  flex: 0 0 158px;
  min-width: 158px;
  max-width: 158px;
  width: 158px;
}

body:not(.app-mode-lobby) .battle-divider-action {
  min-width: 194px;
  padding: 0.7rem 1.08rem;
  font-size: 1rem;
}

body:not(.app-mode-lobby) .battle-divider {
  gap: 0.34rem;
  margin: 0.04rem 0 0.1rem;
}

body:not(.app-mode-lobby) .player-identity {
  margin-bottom: 0.02rem;
}

body:not(.app-mode-lobby) .stat-row {
  margin-bottom: 0.02rem;
  gap: 0.22rem;
}

body:not(.app-mode-lobby) .gameboard-rail-block {
  justify-items: center;
}

body:not(.app-mode-lobby) .gameboard-rail-block .player-identity,
body:not(.app-mode-lobby) .gameboard-rail-block .stat-row,
body:not(.app-mode-lobby) .gameboard-rail-block .rail-hand {
  width: 100%;
}

body:not(.app-mode-lobby) .hand-row {
  gap: 0.18rem;
  padding: 0.02rem 0 0;
}

body:not(.app-mode-lobby) .playmat {
  padding: 0.28rem 0.34rem 0.28rem;
  min-height: 132px;
  margin-top: 0.04rem;
  border-radius: 24px;
}

body:not(.app-mode-lobby) .playmat-side {
  gap: 0.12rem;
}

body:not(.app-mode-lobby) .playmat-side-well {
  width: 100%;
}

body:not(.app-mode-lobby) .playmat .well-life,
body:not(.app-mode-lobby) .playmat .well-energy {
  width: 100%;
}

body:not(.app-mode-lobby) .playmat .value-well,
body:not(.app-mode-lobby) .playmat .pile-well {
  width: 100%;
  min-height: 0;
}

body:not(.app-mode-lobby) .playmat .value-well {
  min-height: 0;
}

body:not(.app-mode-lobby) .playmat .zone-row {
  gap: 0.06rem;
}

body:not(.app-mode-lobby) .playmat .slot {
  aspect-ratio: 3 / 2.78;
  min-width: 0;
  max-width: none;
  width: 100%;
}

body:not(.app-mode-lobby) .playmat .pile-label,
body:not(.app-mode-lobby) .playmat .value-label {
  font-size: 0.64rem;
}

body:not(.app-mode-lobby) .playmat .pile-count {
  font-size: 0.92rem;
}

body:not(.app-mode-lobby) .playmat .value-number {
  font-size: 1.04rem;
}

body:not(.app-mode-lobby) .hand-card {
  flex: 0 0 82px;
  min-width: 82px;
  max-width: 92px;
  box-shadow: 0 6px 14px rgba(20, 12, 8, 0.12);
}

body:not(.app-mode-lobby) .gameboard-rail-block .rail-hand::-webkit-scrollbar {
  height: 8px;
}

body:not(.app-mode-lobby) .gameboard-rail-block .rail-hand::-webkit-scrollbar-track {
  background: rgba(255, 244, 222, 0.08);
  border-radius: 999px;
}

body:not(.app-mode-lobby) .gameboard-rail-block .rail-hand::-webkit-scrollbar-thumb {
  background: rgba(211, 165, 109, 0.45);
  border-radius: 999px;
}

body:not(.app-mode-lobby) #board-inspector-root .inspector-art {
  max-width: 100%;
  width: 100%;
  margin-bottom: 0.55rem;
}

body:not(.app-mode-lobby) #board-log-root.log-list,
body:not(.app-mode-lobby) #board-log-root {
  max-height: 220px;
  overflow: auto;
}

body:not(.app-mode-lobby) #board-log-root.log-list {
  gap: 0.45rem;
}

body:not(.app-mode-lobby) .zone-hint {
  margin: 0 0 0.16rem;
  font-size: 0.68rem;
}

body:not(.app-mode-lobby) .player-self .hand-row {
  margin-top: 0;
}

body:not(.app-mode-lobby) .player-opponent .opponent-hand {
  margin-bottom: 0;
}

body:not(.app-mode-lobby) .player-card > .hand-row,
body:not(.app-mode-lobby) .player-card > .opponent-hand {
  display: none;
}

body:not(.app-mode-lobby) .log-list {
  min-height: 0;
}

body:not(.app-mode-lobby) #controls-root,
body:not(.app-mode-lobby) #inspector-root {
  min-height: 0;
  overflow: auto;
}

@media (orientation: landscape) and (max-height: 560px) and (display-mode: standalone),
       (orientation: landscape) and (max-height: 560px) and (display-mode: fullscreen) {
  .app-menu-wrap {
    display: block;
    flex: 0 0 auto;
  }

  .toolbar {
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  .multiplayer-bar {
    min-width: 0;
  }

  .header-utility-button,
  #room-code-input {
    display: none !important;
  }

  body.app-mode-lobby .hero {
    display: grid;
    grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
    align-items: center;
  }

  body.app-mode-lobby .hero-brand {
    min-width: 150px;
  }

  body.app-mode-lobby .multiplayer-bar {
    flex: 1 1 auto;
  }

  body:not(.app-mode-lobby) .hero {
    display: grid;
    grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
    align-items: center;
    flex-direction: initial;
  }

body:not(.app-mode-lobby) .hero-brand {
    min-width: 110px;
  }
}

body.app-mode-game {
  height: var(--app-viewport-height, 100dvh);
  overflow: hidden;
}

body.app-mode-game .shell {
  height: var(--app-viewport-height, 100dvh);
  max-width: 100vw;
  display: flex;
  flex-direction: column;
}

body.app-mode-game .layout {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: 1fr;
  gap: 0;
}

body.app-mode-game .board-panel {
  min-height: 0;
  overflow: hidden;
}

body.app-mode-game .side-panel {
  display: none !important;
}

body.app-mode-game #board-fit-shell {
  height: 100%;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
}

body.app-mode-game #board-root {
  width: fit-content;
  max-width: none;
}

@media (orientation: landscape) and (max-height: 620px) and (max-width: 980px) {
  body:not(.app-mode-lobby) {
    height: var(--app-viewport-height, 100svh);
  }

  body:not(.app-mode-lobby) .shell {
    height: var(--app-viewport-height, 100svh);
    padding: 0.28rem 0.3rem 0.36rem;
  }

  body:not(.app-mode-lobby) .hero {
    display: grid;
    grid-template-columns: minmax(96px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 0.28rem;
    margin-bottom: 0.14rem;
  }

  body:not(.app-mode-lobby) .hero-brand {
    min-width: 96px;
    gap: 0.34rem;
  }

  body:not(.app-mode-lobby) .hero-logo {
    width: 28px;
  }

  body:not(.app-mode-lobby) .hero h1 {
    font-size: 0.78rem;
    line-height: 1;
  }

  body:not(.app-mode-lobby) .toolbar {
    justify-content: flex-end;
    gap: 0.24rem;
  }

  body:not(.app-mode-lobby) .app-menu-button {
    width: 34px;
    height: 34px;
  }

  body:not(.app-mode-lobby) .board-panel {
    padding: 0.08rem;
    border-radius: 14px;
  }

  body:not(.app-mode-lobby) #board-fit-shell {
    padding-bottom: 0;
  }

  body:not(.app-mode-lobby) .gameboard-shell {
    grid-template-columns: 205px 590px 410px;
    gap: 0.42rem;
  }

  body:not(.app-mode-lobby) .gameboard-main {
    width: 590px;
  }

  body:not(.app-mode-lobby) .board-embedded-panel {
    padding: 0.42rem;
    border-radius: 13px;
  }

  body:not(.app-mode-lobby) .gameboard-rail-block .center-plaque-identity {
    padding: 0.46rem 0.76rem;
    border-radius: 13px;
  }

  body:not(.app-mode-lobby) .gameboard-rail-block .stat-pill.center-plaque {
    min-width: 112px;
    padding: 0.26rem 0.6rem;
  }

  body:not(.app-mode-lobby) .gameboard-rail-block .rail-hand .hand-card {
    flex-basis: 108px;
    min-width: 108px;
    max-width: 108px;
    width: 108px;
  }

  body:not(.app-mode-lobby) .battle-divider-action {
    min-width: 126px;
    padding: 0.42rem 0.66rem;
    font-size: 0.78rem;
  }

  body:not(.app-mode-lobby) .playmat {
    min-height: 112px;
    padding: 0.18rem;
    border-radius: 16px;
  }

  body:not(.app-mode-lobby) #board-log-root.log-list,
  body:not(.app-mode-lobby) #board-log-root {
    max-height: 138px;
  }
}

@media (orientation: landscape) and (max-height: 760px) {
  body.app-mode-game .shell {
    padding: 0.24rem 0.28rem 0.32rem;
  }

  body.app-mode-game .hero {
    display: grid;
    grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 0.26rem;
    margin-bottom: 0.12rem;
  }

  body.app-mode-game .hero-brand {
    min-width: 92px;
    gap: 0.32rem;
  }

  body.app-mode-game .hero-logo {
    width: 26px;
  }

  body.app-mode-game .hero h1 {
    font-size: 0.76rem;
    line-height: 1;
  }

  body.app-mode-game .toolbar {
    justify-content: flex-end;
    gap: 0.22rem;
  }

  body.app-mode-game .app-menu-wrap {
    display: block;
  }

  body.app-mode-game .header-utility-button,
  body.app-mode-game #room-code-input {
    display: none !important;
  }

  body.app-mode-game .app-menu-button {
    width: 32px;
    height: 32px;
  }

  body.app-mode-game .board-panel {
    padding: 0.06rem;
    border-radius: 13px;
  }

  body.app-mode-game .gameboard-shell {
    grid-template-columns: 205px 590px 410px;
    gap: 0.42rem;
  }

  body.app-mode-game .gameboard-main {
    width: 590px;
  }
}
