:root {
  --bg: #07090d;
  --bg-2: #0c1118;
  --surface: rgba(14, 19, 28, 0.84);
  --surface-2: rgba(20, 28, 40, 0.88);
  --surface-3: rgba(255, 255, 255, 0.055);
  --text: #eef5ff;
  --muted: #97a5b8;
  --line: rgba(157, 184, 220, 0.2);
  --line-strong: rgba(75, 211, 255, 0.38);
  --accent: #31d7ff;
  --accent-2: #37e89b;
  --gold: #ffbf45;
  --danger: #ff6b7d;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --white-gem: #f1eadb;
  --blue-gem: #55a7ff;
  --green-gem: #37e89b;
  --red-gem: #ff6b5d;
  --black-gem: #778494;
  --gold-gem: #ffbf45;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

html.game-active-root {
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(49, 215, 255, 0.16), transparent 30%),
    radial-gradient(circle at 78% 12%, rgba(55, 232, 155, 0.12), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-2) 48%, #07090d);
  font-family: Inter, "Noto Sans SC", "Noto Sans TC", "Noto Sans JP", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-break: auto;
  word-break: normal;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 78%);
}

.ambient-grid {
  position: fixed;
  inset: auto -20% -18% -20%;
  z-index: -1;
  height: 46vh;
  background:
    linear-gradient(90deg, transparent, rgba(49, 215, 255, 0.24), transparent),
    radial-gradient(ellipse at center, rgba(255, 191, 69, 0.12), transparent 64%);
  filter: blur(12px);
  opacity: 0.75;
  pointer-events: none;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(49, 215, 255, 0.11);
  transform: translateY(-1px);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  min-width: 0;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 760;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.button-link:hover {
  border-color: var(--accent);
  background: rgba(49, 215, 255, 0.11);
  transform: translateY(-1px);
}

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

button.primary {
  color: #061015;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 820;
}

a {
  color: inherit;
}

code {
  color: var(--accent);
  overflow-wrap: anywhere;
}

:lang(zh-Hans),
:lang(zh-Hant),
:lang(ja) {
  overflow-wrap: anywhere;
  word-break: normal;
}

.table-header {
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(180px, 1fr) minmax(0, auto);
  gap: 24px;
  align-items: center;
  padding: 18px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid rgba(174, 244, 255, 0.16);
  background:
    linear-gradient(120deg, rgba(174, 244, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(7, 16, 21, 0.94), rgba(10, 17, 24, 0.78));
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.back-link {
  color: #eef8f8;
  font-size: 1.02rem;
  font-weight: 820;
  text-decoration: none;
  text-shadow: 0 0 24px rgba(174, 244, 255, 0.22);
}

.back-link:focus-visible,
.button-link:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.header-actions,
.form-actions,
.action-buttons,
.quick-starts,
.bga-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.header-actions {
  align-items: center;
  justify-content: flex-end;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  white-space: nowrap;
}

.language-switch span {
  white-space: nowrap;
}

.language-switch select {
  width: auto;
  min-width: 116px;
  max-width: clamp(116px, 18vw, 168px);
  min-height: 38px;
  padding: 0 28px 0 10px;
  border-color: transparent;
  background-color: rgba(255, 255, 255, 0.02);
}

.eyebrow,
.label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: none;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
  word-break: normal;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.35rem, 5.6vw, 5.4rem);
  line-height: 0.92;
  letter-spacing: 0;
  white-space: nowrap;
}

.table-header h1 {
  color: #eef8f8;
  font-size: 2.1rem;
  font-weight: 780;
  text-shadow: 0 0 32px rgba(174, 244, 255, 0.18);
}

.table-header .eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.78rem;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.02rem;
}

h3 {
  margin: 0;
  font-size: 0.95rem;
}

main {
  width: min(1540px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

body.game-active main {
  width: min(1820px, calc(100% - 136px));
  padding-top: 12px;
  padding-bottom: 112px;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.compact {
  margin-bottom: 0;
}

.start-panel,
.status-bar,
.bank-panel,
.nobles-panel,
.market-panel,
.side-panel section,
.log-panel,
.active-hand-panel,
.step-panel,
.bga-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.start-panel {
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(520px, 0.72fr);
  gap: clamp(28px, 5vw, 74px);
  align-items: start;
  max-width: 1460px;
  margin: 6vh auto;
  padding: clamp(22px, 4vw, 42px);
}

.start-copy h2 {
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.98;
}

.start-workspace {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.start-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 5px;
  border: 1px solid rgba(174, 244, 255, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
}

.start-mode-tabs button {
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 820;
}

.start-mode-tabs button.active {
  color: #061015;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.start-form,
.name-fields,
.start-replay-panel {
  display: grid;
  gap: 14px;
}

.ruleset-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(174, 244, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(174, 244, 255, 0.045), transparent),
    rgba(255, 255, 255, 0.03);
}

.ruleset-panel h3 {
  color: #eef8f8;
  font-size: 0.86rem;
}

.module-toggle-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  gap: 8px;
  justify-content: end;
  align-items: center;
}

.module-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(49, 215, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 820;
}

.module-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.start-form label,
.start-replay-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 720;
  min-width: 0;
}

.start-form label > span,
.start-replay-panel label > span {
  min-width: 0;
}

.start-form .module-toggle {
  display: inline-flex;
  color: var(--text);
}

.start-replay-panel textarea {
  min-height: 260px;
  margin-top: 0;
}

.file-panel {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid rgba(49, 215, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(49, 215, 255, 0.07), transparent),
    rgba(255, 255, 255, 0.035);
}

.file-panel > span {
  color: #eef8f8;
  font-size: 0.78rem;
  font-weight: 820;
}

.file-panel p {
  margin: 0;
}

.file-panel.muted {
  margin: 0;
}

.player-setup-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(340px, 0.95fr);
  gap: 12px;
  align-items: end;
}

.ai-control {
  display: grid;
  grid-template-columns: minmax(140px, 0.78fr) minmax(174px, 1fr);
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.ai-toggle {
  display: inline-flex !important;
  justify-content: center;
  align-items: center;
  gap: 8px !important;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid rgba(255, 191, 69, 0.3);
  border-radius: 7px;
  color: #ffe1a6 !important;
  background:
    linear-gradient(135deg, rgba(255, 191, 69, 0.1), transparent),
    rgba(255, 255, 255, 0.045);
  white-space: nowrap;
}

.ai-toggle input {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--gold);
}

.ai-toggle span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-level {
  display: grid;
  gap: 6px;
  min-width: 0;
  opacity: 0.46;
  transition: opacity 160ms ease;
}

.ai-control.active .ai-level {
  opacity: 1;
}

.ai-control:has(input[name="playerAi"]:checked) .ai-level {
  opacity: 1;
}

.ai-level span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  white-space: nowrap;
}

.ai-level select {
  min-width: 0;
  min-height: 42px;
  padding-right: 28px;
  white-space: nowrap;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

select {
  color-scheme: dark;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.045)),
    #0c1118;
}

select option {
  color: var(--text);
  background: #0c1118;
}

select option:checked,
select option:hover {
  color: #061015;
  background: var(--accent);
}

select,
input {
  min-height: 42px;
  padding: 0 11px;
}

textarea {
  min-height: 220px;
  margin-top: 14px;
  padding: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
}

.game-panel {
  display: grid;
  gap: 12px;
  scroll-margin-top: 14px;
}

.table-top-panel {
  position: sticky;
  top: 0;
  z-index: 82;
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(49, 215, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(12, 17, 24, 0.97), rgba(10, 15, 21, 0.94)),
    var(--surface);
  box-shadow:
    0 0 0 1px rgba(49, 215, 255, 0.06),
    0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.table-top-sentinel {
  display: block;
  height: 0;
  pointer-events: none;
}

body:not(.game-active) .board-progress {
  display: none;
}

.board-progress {
  --progress: 0%;
  position: fixed;
  top: 50%;
  right: clamp(8px, 1.2vw, 18px);
  z-index: 70;
  display: grid;
  gap: 9px;
  padding: 11px 8px;
  border: 1px solid rgba(174, 244, 255, 0.18);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(13, 22, 31, 0.82), rgba(7, 10, 14, 0.72)),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  transform: translateY(-50%);
}

.board-progress::before,
.board-progress::after {
  content: "";
  position: absolute;
  left: 18px;
  width: 2px;
  border-radius: 999px;
  pointer-events: none;
}

.board-progress::before {
  top: 15px;
  bottom: 15px;
  background: rgba(174, 244, 255, 0.16);
}

.board-progress::after {
  top: 15px;
  bottom: 15px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2), var(--gold));
  box-shadow: 0 0 18px rgba(49, 215, 255, 0.44);
  transform: scaleY(var(--progress));
  transform-origin: top;
  transition: transform 120ms linear;
}

.board-progress a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  padding-left: 23px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
  text-decoration: none;
  white-space: nowrap;
}

.board-progress a::before {
  content: "";
  position: absolute;
  left: 5px;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(174, 244, 255, 0.42);
  border-radius: 999px;
  background: #101923;
  box-shadow: 0 0 0 3px rgba(7, 10, 14, 0.88);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.board-progress span {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 160ms ease, opacity 160ms ease;
}

.board-progress:hover span {
  max-width: 120px;
  opacity: 1;
}

.board-progress a.active {
  color: #eef8f8;
}

.board-progress a.active::before {
  border-color: rgba(255, 255, 255, 0.62);
  background: var(--accent);
  box-shadow:
    0 0 0 3px rgba(7, 10, 14, 0.88),
    0 0 18px rgba(49, 215, 255, 0.56);
}

.status-bar {
  position: static;
  z-index: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background:
    linear-gradient(180deg, rgba(12, 17, 24, 0.42), transparent);
}

.status-bar .label {
  margin-bottom: 4px;
  font-size: clamp(0.56rem, 0.52rem + 0.14vw, 0.68rem);
  line-height: 1.1;
  white-space: nowrap;
}

.status-bar,
.table-top-panel,
.ai-notice,
.market-panel,
.bank-panel,
.active-hand-panel,
.nobles-panel,
.players-panel,
.bga-panel {
  scroll-margin-top: 86px;
  scroll-snap-align: none;
}

.status-bar strong {
  color: #eef8f8;
  font-size: clamp(0.8rem, 0.74rem + 0.24vw, 0.98rem);
  font-weight: 820;
  line-height: 1.12;
  text-shadow: 0 0 24px rgba(174, 244, 255, 0.14);
}

.top-replay-controls {
  display: none;
  grid-column: 1 / -1;
  grid-template-columns: minmax(92px, 1fr) repeat(7, auto);
  gap: 7px;
  align-items: center;
  padding: 6px;
  border: 1px solid rgba(49, 215, 255, 0.18);
  border-radius: 8px;
  background: rgba(49, 215, 255, 0.055);
}

body.replay-mode .top-replay-controls {
  display: grid;
}

.top-replay-controls button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.66rem;
  white-space: nowrap;
}

.replay-jump {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  min-width: 0;
  padding: 2px 3px 2px 8px;
  border: 1px solid rgba(174, 244, 255, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(49, 215, 255, 0.035)),
    rgba(7, 12, 18, 0.5);
  font-size: 0.62rem;
  font-weight: 780;
  white-space: nowrap;
}

.replay-jump input {
  width: 48px;
  min-height: 24px;
  padding: 0 6px;
  border-color: transparent;
  border-radius: 999px;
  color: #eef8f8;
  background: rgba(255, 255, 255, 0.075);
  font-size: 0.68rem;
  font-weight: 850;
  text-align: center;
}

.replay-jump input:focus {
  border-color: rgba(49, 215, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(49, 215, 255, 0.1);
}

.replay-jump input::-webkit-outer-spin-button,
.replay-jump input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

#replay-jump {
  border-color: rgba(49, 215, 255, 0.32);
  color: #d7fbff;
  background: rgba(49, 215, 255, 0.08);
}

#replay-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message {
  min-height: 24px;
  margin: 0;
  color: var(--danger);
  font-weight: 760;
}

.message.ok {
  color: var(--accent-2);
}

.handoff-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 22px;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(49, 215, 255, 0.12), transparent 28%),
    rgba(5, 8, 12, 0.2);
}

.handoff-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: min(440px, calc(100vw - 32px));
  padding: 16px 18px;
  border: 1px solid rgba(49, 215, 255, 0.46);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(49, 215, 255, 0.14), rgba(55, 232, 155, 0.08)),
    rgba(8, 13, 19, 0.92);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 34px rgba(49, 215, 255, 0.22);
  backdrop-filter: blur(18px);
  pointer-events: auto;
}

.handoff-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.handoff-action {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  min-height: 0;
  margin-top: 9px;
}

.handoff-action:empty {
  display: none;
}

.handoff-action-label,
.handoff-action-title {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(174, 244, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.66rem;
  font-weight: 820;
}

.handoff-action-label {
  color: var(--accent);
}

.handoff-action .log-token,
.handoff-action .log-card-badge,
.handoff-action .log-source-chip,
.handoff-action .log-payment-route {
  min-height: 24px;
  font-size: 0.64rem;
}

.handoff-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(238, 248, 248, 0.16);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  border-radius: 50%;
  animation: handoff-spin 820ms linear infinite;
  box-shadow: 0 0 22px rgba(49, 215, 255, 0.22);
}

.handoff-countdown {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 191, 69, 0.46);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(255, 191, 69, 0.11);
  font-size: 1.05rem;
  font-weight: 860;
}

.handoff-side {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.handoff-continue {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-color: rgba(49, 215, 255, 0.52);
  color: #051018;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 0.72rem;
  font-weight: 880;
}

.handoff-continue-ring {
  position: relative;
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(#061015 calc(var(--handoff-progress, 0) * 1turn), rgba(6, 16, 24, 0.22) 0);
  color: #061015;
  font-size: 0.68rem;
  font-weight: 950;
}

.handoff-continue-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(221, 255, 248, 0.8);
}

.handoff-continue-ring span {
  position: relative;
  z-index: 1;
}

.handoff-continue:disabled {
  opacity: 0.58;
}

.handoff-overlay.ai-thinking .handoff-card {
  border-color: rgba(255, 191, 69, 0.48);
  background:
    linear-gradient(135deg, rgba(255, 191, 69, 0.15), rgba(49, 215, 255, 0.08)),
    rgba(8, 13, 19, 0.92);
}

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

.ai-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid rgba(255, 191, 69, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 191, 69, 0.1), rgba(49, 215, 255, 0.05)),
    var(--surface);
  box-shadow: var(--shadow);
}

.ai-notice h2 {
  margin: 0;
}

.step-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.38fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 16px;
  border-color: rgba(255, 191, 69, 0.46);
}

.payment-panel {
  border-color: rgba(49, 215, 255, 0.42);
}

.active-payment-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(49, 215, 255, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(49, 215, 255, 0.075), rgba(255, 191, 69, 0.035)),
    rgba(255, 255, 255, 0.035);
}

.active-payment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.active-payment-head h2 {
  color: #eef8f8;
  font-size: 0.9rem;
}

.active-payment-head p {
  margin: 0;
}

.payment-workspace {
  display: grid;
  grid-template-columns: minmax(126px, 176px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.active-payment-panel .payment-workspace {
  grid-template-columns: minmax(118px, 154px) minmax(0, 1fr);
  gap: 10px;
}

.payment-card .dev-card {
  min-height: 112px;
}

.payment-options {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.payment-row,
.payment-choice-board {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(174, 244, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(49, 215, 255, 0.075), transparent),
    rgba(255, 255, 255, 0.035);
}

.payment-choice-board {
  display: grid;
  gap: 9px;
}

.payment-choice-section {
  display: grid;
  gap: 5px;
}

.payment-needs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.payment-token-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(40px, 1fr));
  gap: 6px;
}

.payment-token-choice,
.payment-virtual-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 34px;
  padding: 4px 6px;
  border-color: rgba(174, 244, 255, 0.14);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.payment-token-choice.active,
.payment-virtual-choice.active {
  border-color: color-mix(in srgb, var(--gem, #31d7ff), white 10%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--gem, #31d7ff), transparent 65%);
}

.payment-token-dot {
  min-width: 25px;
  min-height: 25px;
  font-size: 0.6rem;
}

.payment-token-count {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 860;
}

.payment-virtual-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.payment-virtual-choice {
  min-height: 34px;
  border-color: rgba(255, 191, 69, 0.3);
}

.payment-hint {
  margin: 0;
  color: var(--accent-2);
  font-size: 0.7rem;
  font-weight: 780;
}

.payment-need {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.payment-need strong {
  display: block;
  color: #eef8f8;
  font-size: 0.78rem;
}

.payment-need span span,
.payment-need div span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
}

.payment-used {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 820;
  white-space: nowrap;
}

.payment-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  gap: 5px;
}

.payment-controls button {
  min-height: 28px;
  padding: 0 7px;
  color: #111820;
  font-size: 0.66rem;
  font-weight: 880;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--gem, #cbd5e1), white 18%), color-mix(in srgb, var(--gem, #cbd5e1), #0c1118 34%));
}

.payment-actions {
  grid-column: 1 / -1;
}

.payment-discard-row {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--gem), transparent 70%);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gem), transparent 88%), transparent),
    rgba(255, 255, 255, 0.035);
}

.payment-discard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  color: #eef8f8;
  font-size: 0.76rem;
  font-weight: 860;
}

.payment-discard-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -1px 0 0;
  color: rgba(237, 247, 255, 0.78);
  font-size: 0.66rem;
  line-height: 1.25;
}

.payment-discard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 138px));
  gap: 8px;
  justify-content: start;
  min-width: 0;
}

.orient-action-options {
  --orient-choice-card-width: clamp(118px, 7.2vw, 146px);
  --orient-choice-card-height: 126px;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--orient-choice-card-width));
  gap: 8px;
  align-items: start;
  justify-content: start;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 3px;
}

.orient-action-options.orient-action-options-direct {
  display: block;
  padding-bottom: 0;
}

.orient-direct-choice-note {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid rgba(255, 191, 69, 0.32);
  border-radius: 8px;
  color: #ffe6aa;
  background: rgba(255, 191, 69, 0.08);
  font-size: 0.74rem;
  font-weight: 780;
}

.payment-discard-card,
.orient-choice-card {
  min-width: 0;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--gem, #cbd5e1), transparent 62%);
  border-radius: 8px;
  color: #eef8f8;
  text-align: left;
  background:
    linear-gradient(140deg, color-mix(in srgb, var(--gem, #cbd5e1), transparent 84%), rgba(255, 255, 255, 0.035)),
    rgba(9, 14, 20, 0.88);
}

.payment-discard-card {
  position: relative;
  min-height: 74px;
  overflow: hidden;
  cursor: pointer;
  appearance: none;
}

.payment-discard-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: var(--gem, #cbd5e1);
}

.payment-discard-card.active,
.payment-discard-card:hover,
.payment-discard-card:focus-visible,
.orient-choice-card:hover,
.orient-choice-card:focus-visible {
  border-color: color-mix(in srgb, var(--gem, #31d7ff), white 10%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--gem, #31d7ff), transparent 64%);
}

.payment-discard-card.active::after {
  position: absolute;
  inset: 3px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 6px;
  content: "";
  pointer-events: none;
}

.payment-discard-card.priority {
  border-color: rgba(191, 82, 184, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 16px rgba(191, 82, 184, 0.18);
}

.payment-discard-card-face {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
}

.payment-discard-card-top,
.payment-discard-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.payment-discard-bonus,
.payment-discard-priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1;
}

.payment-discard-bonus {
  min-width: 28px;
  padding: 3px 5px;
  color: #111820;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--gem), white 34%), color-mix(in srgb, var(--gem), #0a1118 20%));
}

.payment-discard-bonus .gem-dot {
  width: 8px;
  height: 8px;
}

.payment-discard-card-points {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  color: #fff9d7;
  font-size: 0.68rem;
  font-weight: 940;
  background: rgba(255, 255, 255, 0.12);
}

.payment-discard-card-id {
  overflow: hidden;
  color: #f4fbff;
  font-size: 0.72rem;
  font-weight: 920;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-discard-card-meta {
  color: rgba(226, 238, 246, 0.66);
  font-size: 0.58rem;
  font-weight: 820;
}

.payment-discard-prestige {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.payment-discard-prestige > span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #fff4c2;
  box-shadow: 0 0 0 1px rgba(255, 244, 194, 0.22);
}

.payment-discard-priority-badge {
  justify-self: start;
  width: fit-content;
  padding: 2px 5px 2px 3px;
  color: #fce7fb;
  background: rgba(80, 18, 82, 0.64);
  border: 1px solid rgba(255, 215, 255, 0.24);
}

.payment-discard-wild {
  width: 1em;
  height: 1em;
  padding: 0;
  vertical-align: -0.08em;
}

.orient-action-panel {
  border-color: rgba(255, 191, 69, 0.42);
}

.orient-choice-card .dev-card {
  height: var(--orient-choice-card-height);
  min-height: 0;
  width: 100%;
  pointer-events: none;
}

.stronghold-action-panel {
  border-color: rgba(255, 107, 93, 0.42);
}

.stronghold-action-options {
  display: grid;
  gap: 10px;
}

.stronghold-choice-group {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.stronghold-choice-group-title {
  color: rgba(255, 235, 218, 0.76);
  font-size: 0.64rem;
  font-weight: 880;
}

.stronghold-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 152px));
  gap: 8px;
  align-items: start;
  justify-content: start;
  min-width: 0;
}

.stronghold-conquest-grid {
  grid-template-columns: repeat(auto-fill, minmax(138px, 164px));
}

.stronghold-choice,
.stronghold-skip {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 107, 93, 0.28);
  border-radius: 8px;
  text-align: left;
  background:
    linear-gradient(135deg, rgba(255, 107, 93, 0.1), rgba(49, 215, 255, 0.04)),
    rgba(9, 14, 20, 0.84);
}

.stronghold-conquest-choice {
  border-color: rgba(255, 191, 69, 0.4);
  background:
    linear-gradient(135deg, rgba(255, 191, 69, 0.14), rgba(255, 107, 93, 0.08)),
    rgba(9, 14, 20, 0.88);
}

.stronghold-conquest-choice:hover,
.stronghold-conquest-choice:focus-visible {
  border-color: rgba(255, 220, 126, 0.72);
  box-shadow: 0 0 24px rgba(255, 191, 69, 0.18);
}

.stronghold-choice-title {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  margin-bottom: 6px;
  padding: 0 7px;
  border: 1px solid rgba(255, 107, 93, 0.36);
  border-radius: 999px;
  color: #ffd5d1;
  font-size: 0.62rem;
  font-weight: 840;
}

.stronghold-choice .dev-card {
  pointer-events: none;
}

.stronghold-conquest-actions {
  display: flex;
  justify-content: flex-start;
  min-width: 0;
}

.stronghold-conquest-actions .stronghold-skip {
  min-width: min(170px, 100%);
  text-align: center;
}

.stronghold-selection-hint {
  min-height: 34px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 191, 69, 0.42);
  border-radius: 8px;
  color: #fff3c8;
  background:
    linear-gradient(135deg, rgba(255, 191, 69, 0.16), rgba(255, 107, 93, 0.08)),
    rgba(9, 14, 20, 0.86);
  font-size: 0.78rem;
  font-weight: 860;
}

.stronghold-skip {
  color: var(--muted);
  text-align: center;
}

.orient-choice-note {
  display: inline-flex;
  align-items: center;
  margin-top: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #081016;
  font-size: 0.68rem;
  font-weight: 900;
  background: color-mix(in srgb, var(--gem, #31d7ff), white 16%);
}

.market-empty-slot {
  display: grid;
  min-height: var(--market-row-height);
  height: var(--market-row-height);
  place-items: center;
  border: 1px dashed rgba(160, 177, 199, 0.28);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 820;
  background: rgba(255, 255, 255, 0.025);
}

.table-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: 12px;
  align-items: start;
  max-height: none;
  min-height: 0;
  overflow: visible;
  padding-right: 0;
  scroll-snap-align: none;
}

.table-main {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.market-panel {
  padding: 12px;
}

.market-panel {
  display: grid;
  gap: 10px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.market-subpanel {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(174, 244, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(174, 244, 255, 0.035), transparent),
    rgba(255, 255, 255, 0.026);
}

.market-subheading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
  margin-bottom: 8px;
}

.market-subheading h3 {
  color: #eef8f8;
  font-size: 0.86rem;
}

.table-bank-panel {
  display: grid;
  gap: 8px;
  position: static;
  z-index: auto;
  padding: 9px 12px 10px;
  border: 0;
  border-top: 1px solid rgba(49, 215, 255, 0.16);
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(49, 215, 255, 0.055), transparent),
    rgba(255, 255, 255, 0.018);
  box-shadow: none;
}

.bank-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.bank-summary::-webkit-details-marker {
  display: none;
}

.bank-toggle {
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(49, 215, 255, 0.24);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(49, 215, 255, 0.055);
  font-size: 0.68rem;
  font-weight: 820;
  white-space: nowrap;
}

.bank-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.bank-discard {
  grid-column: 1 / -1;
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(255, 191, 69, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 191, 69, 0.1), transparent),
    rgba(255, 255, 255, 0.04);
}

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

.bank-discard-head strong {
  color: #ffe1a6;
  font-size: 0.82rem;
}

.bank-discard .token-row {
  flex-wrap: wrap;
  gap: 7px;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: none;
  min-width: 0;
  overflow: visible;
}

.side-panel section {
  padding: 12px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.bank-tokens,
.token-row,
.bonus-row,
.cost-row,
.noble-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bank-tokens {
  min-height: 44px;
}

.token {
  display: inline-grid;
  min-width: 30px;
  min-height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #10141a;
  background: var(--gem);
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 850;
  box-shadow: 0 0 22px color-mix(in srgb, var(--gem), transparent 76%);
}

.token[data-color="black"],
.token-button[data-color="black"],
.cost-pill[data-color="black"],
.bonus-pill[data-color="black"],
.requirement-tile[data-color="black"] {
  color: #fff;
}

.stronghold-stack {
  position: absolute;
  top: 20px;
  right: 18px;
  left: auto;
  z-index: 9;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  transform: none;
}

.stronghold-token {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 19px;
  padding: 0 3px;
  border: 1px solid color-mix(in srgb, var(--gem), white 34%);
  border-radius: 5px 5px 3px 3px;
  color: #10141a;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--gem), white 28%) 0 18%, color-mix(in srgb, var(--gem), white 8%) 18% 56%, color-mix(in srgb, var(--gem), #101824 30%) 100%);
  box-shadow:
    0 0 0 2px rgba(7, 10, 14, 0.46),
    0 5px 13px color-mix(in srgb, var(--gem), transparent 66%);
}

.stronghold-token-symbol {
  display: inline-grid;
  place-items: center;
  min-width: 10px;
  height: 13px;
  font-size: 0.54rem;
  font-weight: 950;
  line-height: 1;
}

.stronghold-token-count {
  position: absolute;
  right: -6px;
  bottom: -5px;
  display: inline-grid;
  width: 13px;
  height: 13px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: #10141a;
  background: color-mix(in srgb, var(--gem), white 10%);
  box-shadow: 0 0 0 2px rgba(7, 10, 14, 0.62);
  font-size: 0.42rem;
  font-weight: 950;
  line-height: 1;
}

body.stronghold-selecting .dev-card[data-stronghold-target] {
  cursor: pointer;
}

body.orient-free-selecting .dev-card.orient-choice-target {
  cursor: pointer;
  border-color: rgba(255, 191, 69, 0.86);
  box-shadow:
    0 0 0 1px rgba(255, 191, 69, 0.44),
    0 0 28px rgba(255, 191, 69, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

body.orient-free-selecting .dev-card.orient-choice-target::after {
  position: absolute;
  inset: 4px;
  z-index: 2;
  border: 1px solid rgba(255, 235, 165, 0.62);
  border-radius: 6px;
  content: "";
  pointer-events: none;
}

body.orient-free-selecting .dev-card.orient-choice-target:hover {
  border-color: rgba(255, 220, 126, 0.96);
  box-shadow:
    0 0 0 1px rgba(255, 191, 69, 0.56),
    0 0 34px rgba(255, 191, 69, 0.32),
    0 20px 52px rgba(0, 0, 0, 0.34);
}

body.orient-free-selecting .dev-card.orient-choice-disabled {
  cursor: not-allowed;
  opacity: 0.68;
  filter: saturate(0.78);
}

body.orient-free-selecting .dev-card.orient-choice-disabled:hover {
  transform: none;
}

body.stronghold-selecting .dev-card[data-stronghold-target] {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 16px 38px rgba(0, 0, 0, 0.24);
}

body.stronghold-selecting .dev-card.stronghold-action-place,
body.stronghold-selecting .dev-card.stronghold-action-move-target {
  border-color: rgba(255, 191, 69, 0.82);
  box-shadow:
    0 0 0 1px rgba(255, 191, 69, 0.42),
    0 0 28px rgba(255, 191, 69, 0.24);
}

body.stronghold-selecting .dev-card.stronghold-action-source {
  border-color: rgba(49, 215, 255, 0.82);
  box-shadow:
    0 0 0 1px rgba(49, 215, 255, 0.38),
    0 0 26px rgba(49, 215, 255, 0.18);
}

body.stronghold-selecting .dev-card.stronghold-action-remove {
  border-color: rgba(255, 107, 93, 0.82);
  box-shadow:
    0 0 0 1px rgba(255, 107, 93, 0.4),
    0 0 26px rgba(255, 107, 93, 0.22);
}

body.stronghold-selecting .dev-card[data-stronghold-target]:hover,
.dev-card.stronghold-selected-source,
.dev-card.stronghold-conquest-target {
  border-color: rgba(255, 191, 69, 0.8);
  box-shadow:
    0 0 0 1px rgba(255, 191, 69, 0.4),
    0 0 30px rgba(255, 191, 69, 0.26);
}

.dev-card.stronghold-blocked {
  cursor: not-allowed;
}

.dev-card.stronghold-blocked:hover {
  border-color: color-mix(in srgb, var(--gem), transparent 42%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 16px 38px rgba(0, 0, 0, 0.24);
  transform: none;
}

.dev-card.stronghold-blocked:hover::before {
  opacity: 0;
  transform: translateX(-24%);
}

.stronghold-lock-text {
  display: inline-grid;
  flex: 0 0 auto;
  margin-left: 0;
  place-items: center;
  color: #fff4b8;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 191, 69, 0.5);
  vertical-align: -0.06em;
}

.stronghold-log-chip {
  color: #10141a;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--gem, #ffbf45), white 22%), color-mix(in srgb, var(--gem, #ffbf45), #101824 24%));
}

.token.mini {
  min-width: 20px;
  min-height: 20px;
  padding: 0 4px;
  font-size: 0.56rem;
}

.token-button {
  min-width: 36px;
  min-height: 36px;
  border-radius: 999px;
  color: #10141a;
  background: var(--gem);
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 0 24px color-mix(in srgb, var(--gem), transparent 74%);
}

.market {
  --market-card-width: clamp(118px, 7.2vw, 146px);
  --market-deck-width: clamp(102px, 6.2vw, 124px);
  --market-row-min: 126px;
  --market-row-height: var(--market-row-min);
  display: grid;
  gap: 8px;
}

.market-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  overflow: visible;
}

.market-page {
  display: grid;
  flex: 0 1 auto;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  align-content: start;
  grid-template-rows: repeat(3, var(--market-row-height));
}

.market-page-heading {
  display: none;
  align-items: center;
  min-height: 28px;
  color: var(--muted);
  font-size: 0.74rem;
}

.market-page-orient-panel .tier {
  grid-template-columns: max-content var(--market-deck-width);
  justify-content: end;
}

.market-page-orient-panel .card-grid {
  grid-template-columns: repeat(2, var(--market-card-width));
}

.market-page-orient-panel .deck-box {
  order: 2;
}

.market-page-orient-panel .card-grid {
  order: 1;
}

.market.market-orient-wrapped .market-page-orient-panel .tier {
  grid-template-columns: var(--market-deck-width) max-content;
  justify-content: start;
}

.market.market-orient-wrapped .market-page-orient-panel .deck-box {
  order: 1;
}

.market.market-orient-wrapped .market-page-orient-panel .card-grid {
  order: 2;
}

.market-tabs {
  display: none;
  position: relative;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  isolation: isolate;
  overflow: hidden;
  padding: 5px;
  border: 1px solid rgba(174, 244, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.032);
}

.market-tabs::before {
  position: absolute;
  z-index: 0;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc((100% - 16px) / 2);
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 28px rgba(49, 215, 255, 0.2);
  content: "";
  transform: translateX(0);
  transition: transform 260ms cubic-bezier(0.2, 0.82, 0.2, 1);
}

.market-tabs.market-page-orient::before,
.market-tabs:has(#market-tab-orient.active)::before {
  transform: translateX(calc(100% + 6px));
}

.market-tabs button {
  position: relative;
  z-index: 1;
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  font-size: 0.74rem;
  font-weight: 840;
  transition: color 180ms ease, opacity 180ms ease;
}

.market-tabs button.active {
  color: #061015;
  background: transparent;
}

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

.tier {
  display: grid;
  grid-template-columns: var(--market-deck-width) max-content;
  gap: 8px;
  align-items: stretch;
  min-height: var(--market-row-height);
  height: var(--market-row-height);
}

.deck-box {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: var(--market-row-height);
  height: var(--market-row-height);
  min-width: var(--market-deck-width);
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(49, 215, 255, 0.08), rgba(255, 255, 255, 0.035)),
    var(--surface-2);
}

.deck-box strong {
  font-size: 1.08rem;
}

.deck-box .muted {
  font-size: 0.76rem;
  line-height: 1.25;
}

.deck-box button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, var(--market-card-width));
  gap: 7px;
  align-items: stretch;
  grid-auto-rows: var(--market-row-height);
  min-height: var(--market-row-height);
  height: var(--market-row-height);
}

.card-grid,
.active-reserved {
  scrollbar-width: thin;
  scrollbar-color: rgba(49, 215, 255, 0.5) rgba(255, 255, 255, 0.08);
}

.card-grid::-webkit-scrollbar,
.active-reserved::-webkit-scrollbar {
  height: 7px;
}

.card-grid::-webkit-scrollbar-track,
.active-reserved::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.card-grid::-webkit-scrollbar-thumb,
.active-reserved::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.dev-card,
.noble-card,
.player-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.dev-card {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 4px;
  min-height: 104px;
  padding: 6px;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--gem), transparent 42%);
  border-top: 4px solid color-mix(in srgb, var(--gem), white 8%);
  background:
    radial-gradient(circle at 20% 13%, color-mix(in srgb, var(--gem), white 18%), transparent 28%),
    linear-gradient(145deg, color-mix(in srgb, var(--gem), #101824 52%), color-mix(in srgb, #0c1118, var(--gem) 22%));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 16px 38px rgba(0, 0, 0, 0.24);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.market .dev-card {
  min-height: 0;
  height: var(--market-row-height);
}

.dev-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(118deg, transparent 0 36%, rgba(255, 255, 255, 0.28) 44%, transparent 52%),
    linear-gradient(180deg, transparent 0 38%, rgba(0, 0, 0, 0.28));
  opacity: 0;
  transform: translateX(-24%);
  transition: opacity 160ms ease, transform 260ms ease;
}

.dev-card:hover {
  border-color: color-mix(in srgb, var(--gem), white 24%);
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.36),
    0 0 42px color-mix(in srgb, var(--gem), transparent 62%),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transform: translateY(-3px);
}

.dev-card:hover::before {
  opacity: 0.82;
  transform: translateX(20%);
}

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

.dev-card > .stronghold-stack {
  position: absolute;
  z-index: 9;
}

.dev-card h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.72rem;
  line-height: 1.16;
}

.card-title-main {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.card-title-line {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 3px;
  white-space: nowrap;
}

.card-tier-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title-marks {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
}

.wild-element-mark {
  display: inline-grid;
  width: 1em;
  height: 1em;
  place-items: center;
  color: currentColor;
  font-size: 0.9em;
  font-weight: 950;
  line-height: 1;
  text-shadow: inherit;
  vertical-align: -0.08em;
}

.wild-element-mark > span {
  display: none;
}

.card-color-mark {
  margin-left: 1px;
}

.dev-card[data-card-color="white"] {
  color: #16222b;
  text-shadow: none;
}

.dev-card[data-card-color="white"] .muted,
.dev-card[data-card-color="white"] .card-id,
.dev-card[data-card-color="white"] .card-affordability {
  color: rgba(22, 34, 43, 0.66);
}

.dev-card[data-card-color="white"] .card-affordability {
  color: #15212a;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), color-mix(in srgb, var(--gem), #d7eef8 66%));
}

.dev-card[data-card-color="white"] button {
  color: #16222b;
  background: rgba(255, 255, 255, 0.42);
}

.dev-card[data-card-color="wild"] {
  color: #f7fbff;
  border-color: rgba(255, 255, 255, 0.5);
  border-top-color: rgba(255, 255, 255, 0.7);
  background:
    radial-gradient(circle at 12% 12%, rgba(241, 234, 219, 0.72), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(85, 167, 255, 0.62), transparent 28%),
    radial-gradient(circle at 36% 92%, rgba(55, 232, 155, 0.56), transparent 30%),
    linear-gradient(135deg, rgba(255, 107, 93, 0.42), rgba(255, 191, 69, 0.32) 42%, rgba(19, 28, 40, 0.92));
}

.points {
  min-width: 19px;
  color: #fff7c8;
  font-weight: 950;
  font-size: 0.8rem;
  text-align: right;
  text-shadow: 0 0 18px color-mix(in srgb, var(--gem), transparent 52%);
}

.card-id {
  color: rgba(238, 245, 255, 0.66);
  font-size: 0.62rem;
}

.card-module-badge,
.orient-ability-chip {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  width: fit-content;
  max-width: 100%;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--gem), white 20%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  color: #eef8f8;
  font-size: 0.55rem;
  font-weight: 820;
  line-height: 1.1;
}

.card-module-badge {
  height: 19px;
  white-space: nowrap;
}

.orient-ability-chip {
  height: 19px;
  max-height: 19px;
  flex: 0 0 auto;
  align-self: flex-start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orient-discard-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 18px;
  padding: 2px 4px;
  border: 1px solid color-mix(in srgb, var(--gem), white 22%);
  border-radius: 999px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gem), transparent 72%), rgba(7, 10, 14, 0.44));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  line-height: 0;
  vertical-align: middle;
}

.orient-discard-icons {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  height: 14px;
  line-height: 0;
}

.orient-discard-dot {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  width: 12px;
  height: 12px;
  border: 1px solid color-mix(in srgb, var(--gem), white 38%);
  border-radius: 4px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--gem), white 34%), color-mix(in srgb, var(--gem), #0b1118 16%));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 0 10px color-mix(in srgb, var(--gem), transparent 62%);
}

.orient-discard-dot::before,
.orient-discard-dot::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: rgba(8, 15, 22, 0.88);
  content: "";
  transform-origin: center;
}

.orient-discard-dot::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.orient-discard-dot::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.orient-ability-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 4px;
  min-width: 0;
}

.dev-card[data-card-module="orient"] {
  min-height: 104px;
}

.market .dev-card[data-card-module="orient"] {
  gap: 3px;
  min-height: 0;
}

.market .dev-card[data-card-module="orient"] h3 {
  line-height: 1.08;
}

.market .dev-card[data-card-module="orient"] .card-module-badge {
  height: 17px;
  min-height: 17px;
  padding: 0 4px;
  font-size: 0.5rem;
  line-height: 1;
}

.market .dev-card[data-card-module="orient"] .cost-row {
  gap: 3px;
  row-gap: 2px;
}

.market .dev-card[data-card-module="orient"] .cost-pill {
  min-height: 16px;
  padding: 0 4px;
  gap: 3px;
  font-size: 0.58rem;
  line-height: 1;
}

.market .dev-card[data-card-module="orient"] .cost-pill .gem-dot {
  width: 8px;
  height: 8px;
}

.market .dev-card[data-card-module="orient"] .orient-ability-row {
  gap: 3px;
  row-gap: 2px;
}

.market .dev-card[data-card-module="orient"] .orient-ability-chip {
  height: 16px;
  max-height: 16px;
  align-self: flex-start;
  min-height: 16px;
  padding: 0 4px;
  font-size: 0.48rem;
  line-height: 1;
}

.dev-card[data-card-module="orient"] .card-actions {
  grid-template-columns: 1fr 1fr;
}

.card-affordability {
  position: absolute;
  right: 6px;
  bottom: 34px;
  left: 6px;
  z-index: 3;
  margin: 0;
  padding: 4px 7px;
  color: #eef8f8;
  border: 1px solid color-mix(in srgb, var(--gem), white 28%);
  border-radius: 999px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gem), white 14%), color-mix(in srgb, var(--gem), #0b121b 72%));
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--gem), transparent 72%),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-size: 0.62rem;
  font-weight: 760;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px) scale(0.98);
  transition: opacity 140ms ease, transform 140ms ease, filter 140ms ease;
}

.dev-card:hover .card-affordability,
.dev-card:focus-within .card-affordability {
  opacity: 1;
  filter: saturate(1.08);
  transform: translateY(0) scale(1);
}

body.turn-locked .dev-card:hover .card-affordability,
body.turn-locked .dev-card:focus-within .card-affordability {
  opacity: 0;
  filter: none;
  transform: translateY(5px) scale(0.98);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: auto;
}

.card-actions button {
  min-height: 26px;
  padding: 0 7px;
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-reserved .card-actions {
  grid-template-columns: 1fr;
}

.cost-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(7, 10, 14, 0.42);
  font-size: 0.66rem;
  font-weight: 860;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.bonus-pill {
  position: relative;
  display: inline-grid;
  grid-template-rows: auto 1fr;
  width: 30px;
  min-height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--gem), white 16%);
  border-top: 3px solid color-mix(in srgb, var(--gem), white 24%);
  border-radius: 6px;
  color: #10141a;
  background:
    radial-gradient(circle at 25% 16%, color-mix(in srgb, var(--gem), white 28%), transparent 36%),
    linear-gradient(155deg, color-mix(in srgb, var(--gem), white 8%), color-mix(in srgb, var(--gem), #0f1720 35%));
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 18px color-mix(in srgb, var(--gem), transparent 82%);
}

.bonus-pill[data-bonus-preview-toggle] {
  cursor: pointer;
}

body.orient-copy-selecting .bonus-pill.orient-copy-color {
  border-color: rgba(255, 191, 69, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 0 22px rgba(255, 191, 69, 0.2);
}

.bonus-pill.preview-open {
  z-index: 85;
  border-color: color-mix(in srgb, var(--gem), white 34%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 0 28px color-mix(in srgb, var(--gem), transparent 64%);
}

.bonus-preview {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 95;
  display: none;
  gap: 6px;
  width: max-content;
  min-width: 154px;
  max-width: min(280px, calc(100vw - 28px));
  padding: 9px;
  border: 1px solid color-mix(in srgb, var(--gem), white 20%);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gem), transparent 86%), transparent),
    rgba(8, 13, 19, 0.96);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.42),
    0 0 28px color-mix(in srgb, var(--gem), transparent 72%);
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 140ms ease, transform 140ms ease;
}

.bonus-pill[data-color="red"] .bonus-preview,
.bonus-pill[data-color="black"] .bonus-preview {
  right: 0;
  left: auto;
}

.bonus-preview-title {
  color: #eef8f8;
  font-size: 0.72rem;
  font-weight: 850;
}

.bonus-card-row {
  display: grid;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(174, 244, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

body.orient-copy-selecting .bonus-card-row.orient-copy-target {
  cursor: pointer;
  border-color: rgba(255, 191, 69, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 191, 69, 0.12), transparent),
    rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 18px rgba(255, 191, 69, 0.16);
}

body.orient-copy-selecting .bonus-card-row.orient-copy-target:hover {
  border-color: rgba(255, 224, 146, 0.92);
  box-shadow: 0 0 24px rgba(255, 191, 69, 0.26);
}

.bonus-card-main {
  display: grid;
  gap: 2px;
}

.bonus-card-row strong {
  font-size: 0.72rem;
}

.bonus-card-main span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 760;
}

.bonus-card-cost {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.bonus-card-cost .cost-pill {
  min-height: 17px;
  padding: 0 5px;
  font-size: 0.58rem;
}

.bonus-pill.preview-open .bonus-preview,
.bonus-pill:focus-within .bonus-preview {
  display: grid;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.bonus-pill[data-color="white"] {
  color: #16222b;
}

.bonus-label {
  color: currentColor;
  font-size: 0.5rem;
  font-weight: 850;
  opacity: 0.62;
}

.bonus-count {
  line-height: 1;
}

.bonus-extra-badge {
  position: absolute;
  right: -6px;
  bottom: -6px;
  z-index: 2;
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1.5px solid color-mix(in srgb, var(--gem), white 34%);
  border-radius: 999px;
  color: #10141a;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.72), transparent 38%),
    linear-gradient(145deg, color-mix(in srgb, var(--gem), white 18%), color-mix(in srgb, var(--gem), #0c1118 30%));
  box-shadow:
    0 0 0 2px rgba(7, 10, 14, 0.72),
    0 8px 18px color-mix(in srgb, var(--gem), transparent 72%);
  font-size: 0.54rem;
  font-weight: 980;
  letter-spacing: 0;
  line-height: 1;
}

.requirement-row {
  gap: 5px;
}

.requirement-tile {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--gem), white 20%);
  border-radius: 5px;
  color: #10141a;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--gem), white 18%), color-mix(in srgb, var(--gem), #0c1118 34%));
  font-size: 0.72rem;
  font-weight: 920;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 8px 18px color-mix(in srgb, var(--gem), transparent 82%);
}

.requirement-tile[data-color="white"] {
  color: #16222b;
}

.gem-dot {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: var(--gem);
  box-shadow: 0 0 16px color-mix(in srgb, var(--gem), transparent 58%);
}

.noble-card {
  width: 150px;
  display: grid;
  gap: 10px;
  padding: 12px;
  background:
    linear-gradient(145deg, rgba(255, 191, 69, 0.11), rgba(255, 255, 255, 0.035)),
    var(--surface-2);
}

#nobles {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 2px;
}

#nobles .noble-card {
  flex: 0 0 150px;
}

.noble-card strong {
  display: block;
  color: var(--gold);
}

.players {
  display: grid;
  gap: 10px;
}

.player-card {
  display: grid;
  gap: 7px;
  min-height: 286px;
  padding: 9px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.player-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(49, 215, 255, 0.25), 0 0 32px rgba(49, 215, 255, 0.1);
}

.player-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.score-line {
  color: var(--gold);
  font-weight: 850;
}

.ai-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 191, 69, 0.34);
  border-radius: 999px;
  color: #ffe1a6;
  background: rgba(255, 191, 69, 0.08);
  font-size: 0.72rem;
  font-weight: 780;
}

.player-ai-control {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(112px, 0.78fr);
  gap: 7px;
  align-items: end;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 191, 69, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.player-ai-control .ai-toggle {
  min-height: 34px;
  padding: 0 8px;
  font-size: 0.74rem;
}

.player-ai-control .ai-toggle input {
  flex-basis: 14px;
  width: 14px;
  height: 14px;
  min-height: 14px;
}

.player-ai-control .ai-level {
  gap: 4px;
  opacity: 0.52;
}

.player-ai-control.active .ai-level,
.player-ai-control:has(input[data-player-ai-toggle]:checked) .ai-level {
  opacity: 1;
}

.player-ai-control .ai-level span {
  font-size: 0.64rem;
}

.player-ai-control select {
  min-height: 34px;
  padding: 0 24px 0 8px;
  font-size: 0.74rem;
}

.player-resource-panel {
  display: grid;
  grid-template-columns: minmax(86px, max-content) repeat(6, 26px);
  justify-content: start;
  gap: 5px 3px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.player-resource-panel .label {
  margin: 0;
  white-space: nowrap;
}

.player-resource-panel .token-row,
.player-resource-panel .bonus-row {
  display: contents;
  flex-wrap: nowrap;
  min-width: max-content;
}

.player-resource-panel .token,
.player-resource-panel .bonus-pill {
  justify-self: center;
}

.player-resource-panel .token {
  min-width: 26px;
  min-height: 26px;
  padding: 0 4px;
  font-size: 0.6rem;
}

.token.token-compact {
  width: 26px;
  min-width: 26px;
  padding: 0;
  line-height: 1;
}

.player-resource-panel .bonus-pill {
  width: 26px;
  min-height: 32px;
  font-size: 0.61rem;
}

.player-resource-panel .bonus-label {
  font-size: 0.46rem;
}

.player-resource-panel .bonus-extra-badge {
  right: -7px;
  bottom: -6px;
  width: 18px;
  height: 18px;
  font-size: 0.52rem;
}

.player-resource-panel .orient-virtual-gold-row,
.player-resource-panel .stronghold-stock {
  grid-column: 2 / -1;
  justify-self: start;
}

.player-nobles-section {
  display: grid;
  gap: 5px;
  min-width: 0;
  min-height: 46px;
}

.player-noble-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  overflow: visible;
}

.player-noble-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 138px;
  min-height: 28px;
  padding: 3px 8px 3px 4px;
  border: 1px solid rgba(255, 191, 69, 0.44);
  border-radius: 999px;
  color: #ffe7b4;
  background:
    linear-gradient(135deg, rgba(255, 191, 69, 0.16), rgba(255, 255, 255, 0.035)),
    rgba(12, 17, 23, 0.9);
  font-size: 0.66rem;
  font-weight: 820;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.player-noble-points {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border-radius: 999px;
  color: #14100a;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.75), transparent 38%),
    linear-gradient(145deg, #ffd67b, #b9852e);
  font-size: 0.72rem;
  font-weight: 940;
}

.player-noble-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-noble-empty {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
}

.player-noble-preview {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 178;
  display: grid;
  gap: 7px;
  width: min(196px, calc(100vw - 30px));
  padding: 9px;
  border: 1px solid rgba(255, 191, 69, 0.48);
  border-top: 4px solid rgba(255, 214, 123, 0.72);
  border-radius: 8px;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 214, 123, 0.24), transparent 34%),
    linear-gradient(145deg, rgba(62, 45, 20, 0.96), rgba(11, 15, 21, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 18px 44px rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateY(4px) scale(0.98);
  transform-origin: bottom left;
  transition: opacity 130ms ease, transform 130ms ease;
}

.player-noble-badge.edge-right .player-noble-preview {
  right: 0;
  left: auto;
  transform-origin: bottom right;
}

.player-noble-badge:hover,
.player-noble-badge:focus-within,
.player-noble-badge.preview-open {
  z-index: 165;
  border-color: rgba(255, 224, 146, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 0 24px rgba(255, 191, 69, 0.18);
}

.player-noble-badge:hover .player-noble-preview,
.player-noble-badge:focus-within .player-noble-preview,
.player-noble-badge.preview-open .player-noble-preview {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.player-noble-preview-title {
  display: grid;
  gap: 1px;
}

.player-noble-preview-title strong {
  color: #fff1ca;
  font-size: 0.78rem;
  font-weight: 860;
}

.player-noble-preview-title span {
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 820;
}

.reserved-list,
.purchased-list {
  display: grid;
  gap: 8px;
}

.reserved-list {
  overflow: visible;
}

.reserve-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--gem), transparent 66%);
  border-radius: 999px;
  color: var(--muted);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gem), transparent 90%), transparent),
    rgba(255, 255, 255, 0.045);
  font-size: 0.76rem;
  font-weight: 780;
  overflow: visible;
}

.reserve-badge.face-up {
  color: #c8f8ff;
}

.reserve-badge.blind {
  color: #ffe1a6;
}

.reserve-slot {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--gem), white 20%);
  border-radius: 5px;
  color: #10141a;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--gem), white 18%), color-mix(in srgb, var(--gem), #0c1118 34%));
  font-size: 0.7rem;
  font-weight: 920;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 8px 18px color-mix(in srgb, var(--gem), transparent 82%);
}

.reserve-slot[data-color="white"] {
  color: #16222b;
}

.reserve-slot .wild-element-mark {
  width: 1em;
  height: 1em;
  padding: 0;
}

.reserve-preview {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 80;
  display: grid;
  gap: 6px;
  width: min(180px, calc(100vw - 32px));
  padding: 9px;
  border: 1px solid color-mix(in srgb, var(--gem), transparent 42%);
  border-top: 4px solid color-mix(in srgb, var(--gem), white 8%);
  border-radius: 8px;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 12%, color-mix(in srgb, var(--gem), white 18%), transparent 30%),
    linear-gradient(145deg, color-mix(in srgb, var(--gem), #101824 52%), color-mix(in srgb, #0c1118, var(--gem) 22%));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 18px 44px rgba(0, 0, 0, 0.34);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  transition: opacity 130ms ease, transform 130ms ease;
}

.reserve-badge:hover .reserve-preview,
.reserve-badge:focus-within .reserve-preview,
.reserve-badge.preview-open .reserve-preview {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.players-panel .reserve-preview {
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateY(4px) scale(0.98);
  transform-origin: bottom left;
}

.players-panel .reserve-badge:hover .reserve-preview,
.players-panel .reserve-badge:focus-within .reserve-preview,
.players-panel .reserve-badge.preview-open .reserve-preview {
  transform: translateY(0) scale(1);
}

.reserve-badge[data-reserve-preview-toggle]:focus-visible {
  outline: 2px solid rgba(49, 215, 255, 0.58);
  outline-offset: 3px;
}

.reserve-preview-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  color: #f6fbff;
  font-size: 0.78rem;
}

.reserve-preview-title span {
  color: #fff3bd;
  font-weight: 860;
  white-space: nowrap;
}

.reserve-preview .card-id {
  color: rgba(232, 239, 251, 0.7);
  font-size: 0.68rem;
  font-weight: 780;
}

.reserve-preview-cost {
  display: flex;
  flex-wrap: wrap;
  margin-top: 1px;
}

.active-hand-panel {
  position: fixed;
  right: 50%;
  bottom: 12px;
  z-index: 90;
  display: block;
  width: min(var(--table-dock-width, 1820px), calc(100vw - 28px));
  max-height: min(72vh, 520px);
  padding: 0;
  overflow: hidden;
  transform: translateX(50%) translateY(var(--hand-dock-y, 0));
  transition: transform 220ms ease, opacity 180ms ease;
}

body.hand-dock-retracting .active-hand-panel {
  --hand-dock-y: calc(100% + 22px);
  opacity: 0.72;
}

body.hand-dock-entering .active-hand-panel {
  animation: hand-dock-reenter 360ms cubic-bezier(0.18, 0.95, 0.24, 1.04);
}

@keyframes hand-dock-reenter {
  from {
    transform: translateX(50%) translateY(calc(100% + 22px));
    opacity: 0.72;
  }
  to {
    transform: translateX(50%) translateY(0);
    opacity: 1;
  }
}

.active-hand-panel[open] {
  overflow-y: auto;
}

.active-hand-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  background:
    linear-gradient(135deg, rgba(49, 215, 255, 0.13), rgba(255, 191, 69, 0.05)),
    rgba(12, 17, 24, 0.94);
}

.active-hand-summary::-webkit-details-marker {
  display: none;
}

.active-hand-summary strong {
  display: block;
  color: #eef8f8;
  font-size: 0.95rem;
}

#active-hand-meta {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.active-hand-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.active-hand-chip.token-count {
  color: var(--gold);
  border-color: rgba(255, 191, 69, 0.32);
  background: rgba(255, 191, 69, 0.08);
}

.active-hand-toggle {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(49, 215, 255, 0.28);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(49, 215, 255, 0.06);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.active-player-dock {
  display: grid;
  gap: 10px;
  align-items: start;
  padding: 0 12px 12px;
  background: rgba(12, 17, 24, 0.94);
}

.active-token-panel {
  display: grid;
  grid-template-columns: minmax(54px, max-content) repeat(6, 34px);
  justify-content: start;
  gap: 7px 6px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.active-token-panel .label {
  margin: 0;
  white-space: nowrap;
}

.active-token-panel .token-row,
.active-token-panel .bonus-row {
  display: contents;
}

.active-token-panel .token,
.active-token-panel .bonus-pill {
  justify-self: center;
}

.active-token-panel .token {
  min-width: 31px;
  min-height: 31px;
  padding: 0 5px;
  font-size: 0.66rem;
}

.active-token-panel .token.token-compact {
  width: 31px;
  min-width: 31px;
  padding: 0;
}

.active-token-panel .bonus-pill {
  width: 31px;
  min-height: 36px;
  font-size: 0.68rem;
}

.active-token-panel .bonus-extra-badge {
  right: -7px;
  bottom: -6px;
  width: 18px;
  height: 18px;
  font-size: 0.52rem;
}

.active-token-panel .token-row,
.active-token-panel .bonus-row {
  flex-wrap: nowrap;
  min-width: max-content;
}

.active-token-panel .orient-virtual-gold-row {
  grid-column: 2 / -1;
  justify-self: start;
}

.active-reserved {
  --active-reserved-card-height: 128px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 160px));
  gap: 10px 12px;
  align-items: start;
  justify-content: start;
  min-width: 0;
}

.active-reserved-item {
  display: grid;
  grid-template-rows: 24px var(--active-reserved-card-height);
  gap: 8px;
  width: min(160px, 100%);
}

.active-reserved .dev-card {
  block-size: var(--active-reserved-card-height);
  height: var(--active-reserved-card-height);
  min-height: var(--active-reserved-card-height);
  max-height: var(--active-reserved-card-height);
}

.active-reserved .dev-card h3 {
  line-height: 1.08;
}

.active-reserved .dev-card[data-card-module="orient"] {
  gap: 3px;
  block-size: var(--active-reserved-card-height);
  height: var(--active-reserved-card-height);
  min-height: var(--active-reserved-card-height);
  max-height: var(--active-reserved-card-height);
}

.active-reserved .dev-card[data-card-module="orient"] .card-module-badge {
  height: 17px;
  min-height: 17px;
  padding: 0 4px;
  font-size: 0.5rem;
  line-height: 1;
}

.active-reserved .dev-card[data-card-module="orient"] .cost-row {
  gap: 3px;
  row-gap: 2px;
}

.active-reserved .dev-card[data-card-module="orient"] .cost-pill {
  min-height: 16px;
  padding: 0 4px;
  gap: 3px;
  font-size: 0.58rem;
  line-height: 1;
}

.active-reserved .dev-card[data-card-module="orient"] .cost-pill .gem-dot {
  width: 8px;
  height: 8px;
}

.active-reserved .dev-card[data-card-module="orient"] .orient-ability-row {
  flex-wrap: nowrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 3px;
  row-gap: 2px;
  overflow: hidden;
}

.active-reserved .dev-card[data-card-module="orient"] .orient-ability-chip {
  flex: 0 0 auto;
  height: 16px;
  max-height: 16px;
  align-self: flex-start;
  max-width: calc(50% - 2px);
  min-height: 16px;
  padding: 0 4px;
  font-size: 0.48rem;
  line-height: 1;
  white-space: nowrap;
}

.reserve-origin {
  width: fit-content;
  max-width: none;
  height: 24px;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.76rem;
  font-weight: 780;
  white-space: nowrap;
}

.reserve-origin.face-up {
  color: var(--accent);
  border-color: rgba(49, 215, 255, 0.34);
}

.reserve-origin.blind {
  color: var(--gold);
  border-color: rgba(255, 191, 69, 0.38);
}

.reserved-card,
.purchased-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  border-left: 7px solid color-mix(in srgb, var(--gem), white 8%);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--gem), transparent 68%), transparent),
    rgba(255, 255, 255, 0.045);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.reserved-card:hover {
  border-color: color-mix(in srgb, var(--gem), white 18%);
  box-shadow: 0 0 28px color-mix(in srgb, var(--gem), transparent 72%);
  transform: translateY(-2px);
}

.purchased-summary {
  grid-template-columns: 1fr;
}

.orient-virtual-gold-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.orient-virtual-card {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 191, 69, 0.42);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(255, 191, 69, 0.22), rgba(255, 255, 255, 0.04)),
    rgba(8, 13, 19, 0.78);
}

.orient-virtual-card-face {
  display: grid;
  place-items: center;
  width: 20px;
  height: 24px;
  border-radius: 5px;
  color: #10141a;
  background:
    linear-gradient(135deg, #e6f3ff, #ffbf45 42%, #56e39f 72%, #67aefb);
  font-size: 0.68rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.orient-virtual-token-pair {
  display: inline-flex;
  gap: 2px;
}

.orient-virtual-token-pair span {
  width: 13px;
  height: 13px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(255, 191, 69, 0.48);
}

.orient-virtual-count {
  color: #ffecb5;
  font-size: 0.68rem;
  font-weight: 900;
}

.stronghold-stock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.stronghold-stock-token {
  display: inline-grid;
  width: 22px;
  height: 24px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--gem), white 24%);
  border-radius: 6px 6px 3px 3px;
  color: #10141a;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--gem), white 18%), color-mix(in srgb, var(--gem), #101824 34%));
  font-size: 0.58rem;
  font-weight: 900;
}

.stronghold-stock-count {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 860;
}

.log-panel {
  position: relative;
  z-index: 18;
  padding: 12px;
  overflow: visible;
}

.log-panel:has(.preview-open) {
  z-index: 130;
}

.players-panel {
  position: relative;
  z-index: 24;
  overflow: visible;
}

.players-panel:has(.reserve-badge:hover),
.players-panel:has(.reserve-badge:focus-within),
.players-panel:has(.reserve-badge.preview-open),
.players-panel:has(.player-noble-badge:hover),
.players-panel:has(.player-noble-badge:focus-within),
.players-panel:has(.player-noble-badge.preview-open) {
  z-index: 150;
}

.reserve-badge:hover,
.reserve-badge:focus-within,
.reserve-badge.preview-open {
  z-index: 160;
}

.reserve-badge .reserve-preview {
  z-index: 170;
}

.action-log {
  display: grid;
  gap: 8px;
  max-height: none;
  margin: 0;
  padding: 2px 2px 4px;
  overflow: visible;
  list-style: none;
}

.log-entry {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(174, 244, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(49, 215, 255, 0.045), transparent),
    rgba(255, 255, 255, 0.03);
}

.log-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.log-entry-title {
  color: #eef8f8;
  font-size: 0.78rem;
  font-weight: 860;
}

.log-entry-actor {
  color: rgba(232, 239, 251, 0.74);
  font-size: 0.68rem;
  font-weight: 760;
}

.log-entry-meta {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 760;
  white-space: nowrap;
}

.log-entry-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.log-card-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--gem), transparent 62%);
  border-radius: 999px;
  color: #c8f8ff;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gem), transparent 88%), transparent),
    rgba(255, 255, 255, 0.045);
  font-size: 0.72rem;
  font-weight: 800;
  overflow: visible;
}

.log-card-badge.preview-open {
  z-index: 140;
}

.log-card-badge .reserve-preview {
  z-index: 150;
}

.log-card-badge.blind {
  color: #ffe1a6;
}

.log-token-set {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.log-token {
  width: auto;
  height: 24px;
  min-width: 24px;
  padding: 0 7px;
  font-size: 0.66rem;
}

.log-source-chip,
.log-payment-route {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(174, 244, 255, 0.14);
  border-radius: 999px;
  color: rgba(232, 239, 251, 0.82);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gem, #31d7ff), transparent 92%), transparent),
    rgba(255, 255, 255, 0.04);
  font-size: 0.66rem;
  font-weight: 790;
}

.log-source-chip.gold {
  border-color: rgba(255, 191, 69, 0.3);
  color: #ffe1a6;
}

.log-card-badge:hover .reserve-preview,
.log-card-badge:focus-within .reserve-preview,
.log-card-badge.preview-open .reserve-preview {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.log-mode-toggle,
.log-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.log-controls {
  margin-top: 12px;
}

.log-controls button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.7rem;
}

.log-controls button.active {
  border-color: rgba(49, 215, 255, 0.48);
  color: #061015;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.log-panel summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.log-panel summary::-webkit-details-marker {
  display: none;
}

.log-panel summary span:first-child {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 820;
}

.log-panel .action-log {
  margin-top: 14px;
}

.flight-card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  display: grid;
  width: var(--w);
  height: var(--h);
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--gem), white 18%);
  border-top: 7px solid color-mix(in srgb, var(--gem), white 10%);
  border-radius: 8px;
  color: #fff;
  background:
    radial-gradient(circle at 24% 18%, color-mix(in srgb, var(--gem), white 20%), transparent 32%),
    linear-gradient(145deg, color-mix(in srgb, var(--gem), #101824 48%), rgba(9, 13, 19, 0.94));
  box-shadow:
    0 28px 74px rgba(0, 0, 0, 0.44),
    0 0 58px color-mix(in srgb, var(--gem), transparent 48%);
  overflow: hidden;
  padding: 0 6px;
  font-weight: 900;
  font-size: 0.78rem;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(calc(var(--from-x) - var(--w) / 2), calc(var(--from-y) - var(--h) / 2)) scale(0.82) rotate(-4deg);
  animation: cardFlight 1280ms cubic-bezier(.18,.78,.22,1) forwards;
}

.flight-card.stronghold-flight {
  border-top-width: 4px;
  border-radius: 7px;
  font-size: 0.68rem;
  letter-spacing: 0;
}

@keyframes cardFlight {
  0% {
    opacity: 0;
    transform: translate(calc(var(--from-x) - var(--w) / 2), calc(var(--from-y) - var(--h) / 2)) scale(0.72) rotate(-5deg);
  }
  14% {
    opacity: 1;
  }
  40% {
    opacity: 1;
    transform: translate(calc((var(--from-x) + var(--to-x)) / 2 - var(--w) / 2), calc((var(--from-y) + var(--to-y)) / 2 - var(--h) / 2 - 92px)) scale(1.12) rotate(6deg);
  }
  72% {
    opacity: 1;
    transform: translate(calc((var(--from-x) + var(--to-x)) / 2 - var(--w) / 2), calc((var(--from-y) + var(--to-y)) / 2 - var(--h) / 2 - 42px)) scale(1.04) rotate(-2deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--to-x) - var(--w) / 2), calc(var(--to-y) - var(--h) / 2)) scale(0.58) rotate(0deg);
  }
}

.help-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.bga-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.bga-panel .panel-heading {
  margin-bottom: 0;
}

.bga-panel > p.muted:not(.file-panel) {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(157, 184, 220, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(174, 244, 255, 0.045), transparent),
    rgba(255, 255, 255, 0.026);
}

.bga-actions {
  margin-top: 0;
  min-width: 0;
}

.bga-actions button {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.bga-actions .button-link {
  flex: 0 1 auto;
  white-space: nowrap;
  overflow-wrap: normal;
  font-size: clamp(0.66rem, 2.7vw, 0.86rem);
}

.bga-capture-panel {
  display: grid;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(49, 215, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(49, 215, 255, 0.055), transparent),
    rgba(255, 255, 255, 0.03);
}

.bga-capture-panel h3 {
  margin: 0 0 4px;
  color: #eef8f8;
  font-size: 0.92rem;
}

.bga-table-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
}

.bga-table-field input {
  max-width: 320px;
}

@media (max-width: 1180px) {
  .start-panel {
    grid-template-columns: 1fr;
    max-width: 760px;
  }

  .table-layout {
    grid-template-columns: 1fr;
  }

  .table-main {
    order: 2;
  }

  .side-panel {
    display: contents;
    position: static;
  }

  .players-panel {
    order: 1;
  }

  .log-panel,
  .help-panel {
    order: 3;
  }

  .players {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .card-grid {
    grid-template-columns: repeat(4, minmax(100px, 1fr));
  }

  .market-tabs {
    display: grid;
  }

  .market-stack {
    display: grid;
    grid-template-columns: 100% 100%;
    overflow: hidden;
    transition: transform 230ms cubic-bezier(0.2, 0.82, 0.2, 1);
  }

  .market.market-page-base .market-stack {
    transform: translateX(0);
  }

  .market.market-page-orient .market-stack {
    transform: translateX(-100%);
  }

  .market-page-heading {
    display: flex;
  }

  .market-page-base-panel,
  .market-page-orient-panel {
    display: grid;
    grid-row: 1;
    opacity: 1;
    transform: translateX(0);
  }

  .market-page-base-panel {
    grid-column: 1;
  }

  .market-page-orient-panel {
    grid-column: 2;
  }

  .market-page-orient-panel .tier {
    grid-template-columns: minmax(0, 1fr);
  }

  .market-page-orient-panel .deck-box {
    order: 1;
  }

  .market-page-orient-panel .card-grid {
    order: 2;
  }

  .market-page-orient-panel .card-grid {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }

  .card-actions button[data-short-label] {
    font-size: 0;
  }

  .card-actions button[data-short-label]::after {
    content: attr(data-short-label);
    font-size: 0.64rem;
  }

  .active-reserved {
    grid-template-columns: repeat(auto-fit, minmax(112px, 160px));
  }
}

@media (max-width: 760px) {
  html.game-active-root {
    scroll-padding-top: 12px;
  }

  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  :lang(zh-Hans),
  :lang(zh-Hant),
  :lang(ja) {
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .table-header,
  .start-panel,
  .status-bar,
  .active-player-dock,
  .ai-notice,
  .step-panel {
    grid-template-columns: 1fr;
  }

  body.game-active main {
    width: min(100% - 12px, 760px);
    padding-top: 8px;
    padding-bottom: 108px;
  }

  main {
    width: min(100% - 12px, 760px);
  }

  .start-panel,
  .start-copy,
  .start-form,
  .game-panel,
  .table-layout,
  .table-main,
  .market-panel,
  .table-top-panel,
  .players-panel {
    min-width: 0;
    max-width: 100%;
  }

  button,
  select,
  input,
  textarea {
    min-width: 0;
    max-width: 100%;
  }

  .status-bar {
    grid-template-columns: minmax(70px, 1.25fr) minmax(44px, 0.58fr) minmax(44px, 0.58fr) minmax(58px, auto);
    gap: 6px;
    padding: 6px;
  }

  .status-state {
    display: none;
  }

  .status-bar .label {
    display: block;
    overflow: hidden;
    margin-bottom: 1px;
    font-size: 0.5rem;
    letter-spacing: 0;
    opacity: 0.82;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-bar strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    font-size: clamp(0.66rem, 2.8vw, 0.82rem);
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-replay-controls {
    grid-template-columns: minmax(0, 1fr) repeat(4, auto);
    gap: 4px;
    padding: 4px;
  }

  .top-replay-controls button {
    min-height: 27px;
    padding: 0 5px;
    font-size: clamp(0.52rem, 2.35vw, 0.62rem);
  }

  .replay-jump {
    grid-column: span 2;
    gap: 4px;
    justify-content: space-between;
    padding-left: 7px;
    font-size: clamp(0.5rem, 2.25vw, 0.58rem);
  }

  .replay-jump input {
    width: 44px;
    min-height: 27px;
    padding: 0 4px;
    font-size: clamp(0.52rem, 2.35vw, 0.62rem);
  }

  #replay-status {
    font-size: clamp(0.54rem, 2.35vw, 0.66rem);
  }

  .table-top-panel {
    position: relative;
    top: auto;
    left: auto;
    z-index: 94;
    width: 100%;
    max-height: min(42vh, 300px);
    overflow-x: hidden;
    overflow-y: auto;
    transform: none;
    box-shadow:
      0 0 0 1px rgba(49, 215, 255, 0.08),
      0 18px 46px rgba(0, 0, 0, 0.48);
  }

  .table-top-panel.mobile-top-stuck {
    position: fixed;
    top: max(6px, env(safe-area-inset-top));
    left: 50%;
    width: min(100vw - 12px, 760px);
    transform: translateX(-50%);
  }

  .step-panel {
    position: relative;
    z-index: 1;
    margin-top: 2px;
  }

  .table-bank-panel {
    padding: 6px;
  }

  .bank-body {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 7px;
  }

  .bank-discard {
    gap: 7px;
    padding: 8px;
  }

  .bank-discard-head {
    display: grid;
    gap: 2px;
  }

  .bank-discard .token-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 1px;
  }

  .bank-tokens {
    min-height: 34px;
  }

  .bank-summary h3 {
    font-size: 0.78rem;
  }

  .bank-summary .compact {
    font-size: 0.62rem;
    line-height: 1.18;
  }

  .bank-toggle {
    min-height: 26px;
    padding: 4px 8px;
    font-size: 0.62rem;
  }

  .table-layout {
    gap: 10px;
  }

  .board-progress {
    top: auto;
    right: auto;
    bottom: 78px;
    left: 50%;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    width: min(420px, calc(100vw - 28px));
    padding: 8px 10px;
    border-radius: 999px;
    transform: translateX(-50%);
  }

  .board-progress::before,
  .board-progress::after {
    top: 17px;
    left: 16px;
    right: 16px;
    width: auto;
    height: 2px;
  }

  .board-progress::after {
    bottom: auto;
    transform: scaleX(var(--progress));
    transform-origin: left;
  }

  .board-progress a {
    justify-content: center;
    min-height: 18px;
    padding-left: 0;
  }

  .board-progress a::before {
    position: static;
    display: block;
  }

  .board-progress span {
    display: none;
  }

  .table-header {
    gap: 14px;
  }

  .table-header h1 {
    white-space: normal;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .language-switch {
    width: 100%;
    justify-content: space-between;
  }

  .language-switch select {
    flex: 0 1 168px;
    max-width: min(52vw, 168px);
  }

  .header-actions button,
  .form-actions button,
  .quick-starts button,
  .action-buttons button,
  .bga-actions button,
  .bga-actions .button-link {
    flex: 1 1 130px;
  }

  .bga-actions .button-link {
    flex: 0 1 max-content;
    padding: 0 clamp(5px, 2vw, 8px);
    font-size: clamp(0.58rem, 2.55vw, 0.7rem);
    letter-spacing: 0;
  }

  .panel-heading {
    display: grid;
  }

  .ruleset-panel {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .module-toggle-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .module-toggle {
    justify-content: center;
    min-width: 0;
  }

  .market-tabs button {
    min-height: 30px;
    font-size: 0.66rem;
  }

  .market-subheading {
    display: grid;
  }

  .market-panel {
    padding: 8px;
  }

  .market {
    padding-bottom: calc(126px + env(safe-area-inset-bottom, 0px));
  }

  .market-subpanel {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 8px;
  }

  .market-stack {
    display: grid;
    grid-template-columns: 100% 100%;
    overflow: hidden;
    transition: transform 230ms cubic-bezier(0.2, 0.82, 0.2, 1);
  }

  .market-page {
    transition: transform 220ms ease, opacity 180ms ease;
  }

  .market-page-heading {
    display: flex;
  }

  .market-page-base-panel,
  .market-page-orient-panel {
    grid-template-columns: 1fr;
  }

  .market.market-page-base .market-stack {
    transform: translateX(0);
  }

  .market.market-page-orient .market-stack {
    transform: translateX(-100%);
  }

  .market-page-base-panel,
  .market-page-orient-panel {
    display: grid;
    grid-row: 1;
    opacity: 1;
    transform: translateX(0);
  }

  .market-page-base-panel {
    grid-column: 1;
  }

  .market-page-orient-panel {
    grid-column: 2;
  }

  .market-page-orient-panel .tier {
    grid-template-columns: minmax(0, 1fr);
  }

  .market-page-orient-panel .deck-box {
    order: 1;
  }

  .market-page-orient-panel .card-grid {
    order: 2;
  }

  .market-page-orient-panel .card-grid {
    grid-template-columns: none;
  }

  .payment-workspace,
  .payment-row,
  .payment-choice-board {
    grid-template-columns: 1fr;
  }

  .orient-action-options {
    --orient-choice-card-height: 96px;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(84px, calc((100vw - 54px) / 4));
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
  }

  .orient-choice-card {
    scroll-snap-align: start;
  }

  .payment-token-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .active-hand-panel {
    bottom: 8px;
    width: min(100vw - 12px, 760px);
    max-height: min(72vh, 560px);
  }

  .active-hand-summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #active-hand-meta {
    justify-content: flex-end;
  }

  .active-hand-chip {
    min-height: 24px;
    padding: 3px 6px;
    font-size: 0.64rem;
  }

  .active-hand-toggle {
    display: none;
  }

  .payment-card .dev-card {
    max-width: 180px;
  }

  .tier {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .deck-box {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    min-height: 42px;
    height: auto;
    max-height: 48px;
    padding: 6px;
  }

  .deck-box .label,
  .deck-box .muted {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .deck-box strong {
    font-size: 0.95rem;
  }

  .deck-box .muted {
    font-size: 0.66rem;
  }

  .deck-box button {
    justify-self: end;
    min-height: 28px;
    padding: 0 7px;
    font-size: 0;
  }

  .deck-box button[data-short-label]::after {
    content: attr(data-short-label);
    font-size: 0.62rem;
  }

  .card-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(84px, calc((100vw - 54px) / 4));
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
  }

  .dev-card {
    min-height: 96px;
    padding: 5px;
    scroll-snap-align: start;
  }

  .dev-card[data-card-module="orient"] {
    min-height: 98px;
  }

  .dev-card h3 {
    gap: 4px;
    font-size: 0.62rem;
  }

  .card-title-line {
    gap: 2px;
  }

  .card-title-marks {
    gap: 1px;
  }

  .stronghold-lock-text {
    font-size: 0.56rem;
  }

  .points {
    min-width: 14px;
    font-size: 0.68rem;
  }

  .card-id {
    font-size: 0.52rem;
  }

  .card-module-badge,
  .orient-ability-chip,
  .orient-slot-chip {
    min-height: 16px;
    padding: 0 4px;
    font-size: 0.5rem;
  }

  .market .dev-card[data-card-module="orient"] .orient-ability-row {
    flex-wrap: nowrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 2px;
    overflow: hidden;
    min-height: 14px;
    max-height: 14px;
  }

  .market .dev-card[data-card-module="orient"] .orient-ability-chip {
    flex: 0 0 auto;
    height: 14px;
    max-height: 14px;
    align-self: flex-start;
    max-width: calc(50% - 1px);
    min-height: 14px;
    padding: 0 2px;
    font-size: 0.39rem;
    letter-spacing: 0;
    line-height: 1;
    white-space: nowrap;
  }

  .market .dev-card[data-card-module="orient"] {
    gap: 2px;
    padding: 4px;
  }

  .market .dev-card[data-card-module="orient"] h3 {
    gap: 3px;
    font-size: 0.58rem;
    line-height: 1.04;
  }

  .market .dev-card[data-card-module="orient"] .card-module-badge {
    height: 14px;
    min-height: 14px;
    padding: 0 3px;
    font-size: 0.43rem;
  }

  .cost-row {
    gap: 3px;
  }

  .market .dev-card[data-card-module="orient"] .cost-row {
    gap: 2px;
    row-gap: 1px;
  }

  .cost-pill {
    min-height: 16px;
    padding: 0 4px;
    gap: 3px;
    font-size: 0.56rem;
  }

  .cost-pill .gem-dot {
    width: 7px;
    height: 7px;
  }

  .market .dev-card[data-card-module="orient"] .cost-pill {
    min-height: 14px;
    padding: 0 2px;
    gap: 2px;
    font-size: 0.49rem;
  }

  .market .dev-card[data-card-module="orient"] .cost-pill .gem-dot {
    width: 6px;
    height: 6px;
  }

  .market .dev-card[data-card-module="orient"] .card-actions {
    gap: 3px;
  }

  .card-affordability {
    right: 5px;
    bottom: 31px;
    left: 5px;
    padding: 3px 5px;
    font-size: 0.54rem;
  }

  .card-actions {
    gap: 4px;
  }

  .card-actions button {
    min-height: 24px;
    padding: 0 3px;
  }

  .market .dev-card[data-card-module="orient"] .card-actions button {
    min-height: 22px;
    padding: 0 2px;
    font-size: 0.58rem;
  }

  .market .dev-card[data-card-module="orient"] .card-actions button[data-short-label] {
    font-size: 0;
  }

  .market .dev-card[data-card-module="orient"] .card-actions button[data-short-label]::after {
    font-size: 0.58rem;
  }

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

  .ai-control {
    grid-template-columns: 1fr;
  }

  .player-ai-control {
    grid-template-columns: minmax(0, 1fr) minmax(120px, 0.78fr);
  }

  .noble-row,
  #nobles {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .noble-card {
    flex: 0 0 116px;
    width: 116px;
    gap: 6px;
    padding: 8px;
    scroll-snap-align: start;
  }

  #nobles .noble-card {
    flex-basis: 116px;
  }

  .noble-card strong {
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .noble-card .requirement-row {
    flex-wrap: nowrap;
    gap: 4px;
  }

  .noble-card .requirement-tile {
    width: 22px;
    height: 22px;
    font-size: 0.62rem;
  }

  .players {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(318px, 94vw);
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    overscroll-behavior-block: none;
    touch-action: pan-x;
    padding-bottom: 4px;
  }

  .player-card {
    gap: 6px;
    min-height: 306px;
    align-self: start;
    padding: 8px;
  }

  .player-top {
    align-items: center;
    gap: 6px;
  }

  .player-top h3,
  .score-line {
    overflow: hidden;
    font-size: 0.76rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .player-resource-panel {
    grid-template-columns: minmax(60px, 72px) repeat(6, 30px);
    gap: 4px 3px;
    padding: 6px;
  }

  .player-resource-panel .label {
    overflow: hidden;
    font-size: 0.58rem;
    text-overflow: ellipsis;
  }

  .player-resource-panel .token {
    width: 30px;
    min-width: 30px;
    min-height: 26px;
    padding: 0 2px;
    font-size: 0.58rem;
  }

  .player-resource-panel .bonus-pill {
    width: 30px;
    min-height: 32px;
    font-size: 0.6rem;
  }

  .player-resource-panel .bonus-label {
    font-size: 0.42rem;
  }

  .player-nobles-section {
    min-height: 42px;
  }

  .player-noble-badge {
    max-width: 132px;
    min-height: 26px;
    padding-right: 7px;
    font-size: 0.6rem;
  }

  .player-noble-points {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    font-size: 0.66rem;
  }

  .player-noble-preview {
    width: min(180px, calc(100vw - 28px));
  }

  .player-card .reserved-list {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    padding-bottom: 3px;
    white-space: nowrap;
  }

  .player-card .reserve-badge {
    flex: 0 0 auto;
    max-width: 78vw;
  }

  .active-reserved {
    --active-reserved-card-height: 126px;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(126px, 48vw);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .active-reserved-item {
    grid-template-rows: 24px var(--active-reserved-card-height);
    width: 100%;
  }

  .active-reserved .dev-card {
    block-size: var(--active-reserved-card-height);
    height: var(--active-reserved-card-height);
    min-height: var(--active-reserved-card-height);
    max-height: var(--active-reserved-card-height);
    padding: 5px;
  }

  .active-reserved .dev-card[data-card-module="orient"] {
    gap: 2px;
    block-size: var(--active-reserved-card-height);
    height: var(--active-reserved-card-height);
    min-height: var(--active-reserved-card-height);
    max-height: var(--active-reserved-card-height);
  }

  .active-reserved .dev-card[data-card-module="orient"] h3 {
    gap: 3px;
    font-size: 0.6rem;
    line-height: 1.04;
  }

  .active-reserved .dev-card[data-card-module="orient"] .card-module-badge {
    height: 15px;
    min-height: 15px;
    padding: 0 3px;
    font-size: 0.45rem;
  }

  .active-reserved .dev-card[data-card-module="orient"] .cost-row {
    gap: 2px;
    row-gap: 1px;
  }

  .active-reserved .dev-card[data-card-module="orient"] .cost-pill {
    min-height: 14px;
    padding: 0 3px;
    gap: 2px;
    font-size: 0.5rem;
  }

  .active-reserved .dev-card[data-card-module="orient"] .cost-pill .gem-dot {
    width: 6px;
    height: 6px;
  }

  .active-reserved .dev-card[data-card-module="orient"] .orient-ability-row {
    align-items: flex-start;
    align-content: flex-start;
    gap: 2px;
    min-height: 14px;
    max-height: 14px;
  }

  .active-reserved .dev-card[data-card-module="orient"] .orient-ability-chip {
    height: 14px;
    max-height: 14px;
    align-self: flex-start;
    min-height: 14px;
    padding: 0 2px;
    font-size: 0.4rem;
  }

  .active-reserved .dev-card[data-card-module="orient"] .card-actions button {
    min-height: 23px;
    padding: 0 3px;
  }
}

@media (hover: none), (pointer: coarse), (max-width: 760px) {
  .dev-card:hover {
    border-color: color-mix(in srgb, var(--gem), transparent 42%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      0 16px 38px rgba(0, 0, 0, 0.24);
    transform: none;
  }

  .dev-card:hover::before {
    opacity: 0;
    transform: translateX(-24%);
  }

  .dev-card:hover .card-affordability,
  .dev-card:focus-within .card-affordability {
    opacity: 0;
    filter: none;
    transform: translateY(5px) scale(0.98);
  }

  .reserve-badge:hover .reserve-preview,
  .reserve-badge:focus-within .reserve-preview,
  .log-card-badge:hover .reserve-preview,
  .log-card-badge:focus-within .reserve-preview {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  .reserve-badge.preview-open .reserve-preview,
  .log-card-badge.preview-open .reserve-preview {
    position: fixed;
    top: 50%;
    bottom: auto;
    right: auto;
    left: 50%;
    z-index: 220;
    box-sizing: border-box;
    width: min(292px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
    transform-origin: center;
    white-space: normal;
  }

  .reserve-badge.preview-open .reserve-preview-title,
  .log-card-badge.preview-open .reserve-preview-title {
    align-items: flex-start;
    font-size: clamp(0.72rem, 3.3vw, 0.84rem);
    line-height: 1.16;
  }

  .reserve-badge.preview-open .reserve-preview-title strong,
  .log-card-badge.preview-open .reserve-preview-title strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .reserve-badge.preview-open .reserve-preview-title span,
  .log-card-badge.preview-open .reserve-preview-title span {
    font-size: clamp(0.64rem, 3vw, 0.76rem);
  }

  .reserve-badge.preview-open .reserve-preview-cost,
  .log-card-badge.preview-open .reserve-preview-cost {
    flex-wrap: wrap;
    gap: 4px;
  }

  .reserve-badge.preview-open .reserve-preview .requirement-tile,
  .log-card-badge.preview-open .reserve-preview .requirement-tile {
    width: 23px;
    height: 23px;
    font-size: 0.66rem;
  }
}

@media (max-width: 480px) {
  .tier {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .deck-box {
    padding: 6px;
  }

  .card-grid {
    grid-auto-columns: minmax(78px, calc((100vw - 50px) / 4));
  }

  .dev-card {
    min-height: 92px;
  }

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

  .payment-controls {
    grid-template-columns: repeat(2, minmax(76px, 1fr));
  }
}

@media (max-width: 1180px) {
  .market.market-has-orient {
    --market-slide-x: 0%;
    --market-drag-x: 0px;
    overflow: hidden;
  }

  .market.market-page-base {
    --market-slide-x: 0%;
  }

  .market.market-page-orient {
    --market-slide-x: -100%;
  }

  .market.market-has-orient .market-stack {
    display: grid;
    grid-template-columns: 100% 100%;
    gap: 0;
    overflow: visible;
    touch-action: pan-y;
    transform: translate3d(calc(var(--market-slide-x, 0%) + var(--market-drag-x, 0px)), 0, 0);
    transition: transform 280ms cubic-bezier(0.2, 0.82, 0.2, 1);
    will-change: transform;
  }

  .market.market-dragging .market-stack {
    transition: none;
  }

  .market.market-has-orient .market-page-base-panel,
  .market.market-has-orient .market-page-orient-panel {
    display: grid;
    grid-row: 1;
    width: 100%;
    min-width: 0;
  }

  .market.market-has-orient .market-page-base-panel {
    grid-column: 1;
  }

  .market.market-has-orient .market-page-orient-panel {
    grid-column: 2;
  }

  .market.market-page-base .market-page-orient-panel,
  .market.market-page-orient .market-page-base-panel {
    pointer-events: none;
  }

  .market-page {
    grid-template-rows: none;
  }

  .market > .tier,
  .market-page .tier,
  .market-page-orient-panel .tier {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    height: auto;
  }

  .market > .tier .deck-box,
  .market-page .deck-box {
    order: 1;
    min-height: 42px;
    height: auto;
    max-height: 48px;
  }

  .market > .tier .card-grid,
  .market-page .card-grid {
    order: 2;
    min-height: 0;
    height: auto;
  }
}

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