:root {
  color-scheme: dark;
  --ink: #241714;
  --cream: #fff4d6;
  --paper: #f4e5bc;
  --paper-deep: #d9c28c;
  --gold: #f1c75b;
  --muted: #bcad91;
  --felt: #244d3a;
  --felt-dark: #153629;
  --wood: #4b2d20;
  --danger: #d6524c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #160f0c;
  color: var(--cream);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0%, #61432f 0, transparent 38%),
    linear-gradient(135deg, #211612, #100a08);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.button,
.eyebrow,
.phase-badge,
.card-kind,
.round-plaque,
.move-legend,
.action-caption,
.table-tool,
.avatar-name,
.life-pile > b,
.ledger-stats,
.result-score,
.result-place {
  font-family: "Courier New", ui-monospace, monospace;
  letter-spacing: 0.045em;
}

.button {
  appearance: none;
  min-height: 40px;
  padding: 9px 14px;
  color: var(--ink);
  border: 2px solid #17100d;
  border-radius: 3px;
  background: var(--paper);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  transition: transform 100ms ease, filter 100ms ease, box-shadow 100ms ease;
}

.button:hover:not(:disabled),
.button:focus-visible {
  filter: brightness(1.08);
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.35);
}

.button.primary {
  background: var(--gold);
}

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

.button.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.65rem;
}

.button:disabled {
  opacity: 0.45;
  filter: grayscale(0.8);
  box-shadow: none;
}

.eyebrow {
  color: #8b552f;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.phase-badge {
  display: inline-flex;
  padding: 6px 9px;
  color: var(--ink);
  border: 2px solid #1a100d;
  background: var(--gold);
  font-size: 0.68rem;
  font-weight: 900;
}

/* Lobby */
.setup-shell {
  min-height: 100dvh;
  overflow: auto;
}

.tabletop-lobby {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: center;
  padding: clamp(22px, 5vw, 70px);
  border: clamp(10px, 2vw, 24px) solid var(--wood);
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.07), transparent 48%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 34px),
    var(--felt-dark);
  box-shadow: inset 0 0 0 5px #160e0b, inset 0 0 70px rgba(0, 0, 0, 0.45);
}

.lobby-title h1 {
  margin: 18px 0 8px;
  color: var(--cream);
  font: 900 clamp(3.7rem, 9vw, 8.5rem)/0.78 "Courier New", monospace;
  letter-spacing: -0.09em;
  text-shadow: 8px 8px 0 rgba(0, 0, 0, 0.32);
}

.lobby-title p {
  max-width: 420px;
  color: #cbbfa8;
  font-size: 0.9rem;
}

.setup-card {
  padding: clamp(20px, 3vw, 34px);
  color: var(--ink);
  border: 5px solid #1b110e;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 10px 12px 0 rgba(0, 0, 0, 0.34);
}

.field {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  align-items: center;
  margin: 12px 0;
}

.field label {
  color: #654936;
  font: 900 0.68rem "Courier New", monospace;
  text-transform: uppercase;
}

.field input,
.field select,
#manual-copy {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  border: 2px solid #3d291f;
  outline: 0;
  background: #fff9e9;
}

.field input:focus,
.field select:focus,
#manual-copy:focus {
  border-color: #a87532;
  box-shadow: 0 0 0 3px rgba(241, 199, 91, 0.35);
}

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

.seed-field {
  grid-template-columns: auto 1fr auto;
}

.start-button {
  width: 100%;
  margin-top: 8px;
}

.fast-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 14px 0 8px;
  padding: 10px;
  color: #523a2d;
  border: 2px solid rgba(57, 38, 29, 0.22);
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
}

.fast-option input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: #9b682c;
}

.fast-option span,
.fast-option b,
.fast-option small {
  display: block;
}

.fast-option b {
  font: 900 0.7rem "Courier New", monospace;
  text-transform: uppercase;
}

.fast-option small {
  margin-top: 3px;
  color: #745845;
  font-size: 0.65rem;
  line-height: 1.35;
}

.resume-row,
.action-row,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* Fullscreen table */
.tabletop-shell {
  width: 100vw;
  height: 100dvh;
  padding: clamp(5px, 1.1vw, 14px);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 54px),
    var(--wood);
}

.tabletop-board {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: clamp(6px, 0.8vw, 11px) solid var(--player-accent, var(--gold));
  border-radius: clamp(8px, 1.4vw, 18px);
  background:
    radial-gradient(ellipse at 50% 28%, rgba(255, 255, 255, 0.085), transparent 55%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 35%),
    var(--felt);
  box-shadow:
    0 0 0 5px #170e0b,
    0 10px 28px rgba(0, 0, 0, 0.5),
    inset 0 0 0 4px rgba(0, 0, 0, 0.25),
    inset 0 0 90px rgba(0, 0, 0, 0.38),
    0 0 28px color-mix(in srgb, var(--player-accent), transparent 38%);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.tabletop-board.sprite-cursor-active,
.tabletop-board.sprite-cursor-active * {
  cursor: none !important;
}

.table-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 48px 48px;
}

.round-plaque {
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 30;
  padding: 7px 11px;
  color: var(--ink);
  border: 3px solid #160e0b;
  background: var(--paper);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.table-tools {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 40;
  display: flex;
  gap: 5px;
}

.table-tool {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--cream);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  background: rgba(15, 10, 8, 0.46);
  font-size: 1rem;
  font-weight: 900;
}

.table-tool:hover,
.table-tool:focus-visible {
  color: var(--ink);
  border-color: #19100d;
  background: var(--gold);
  outline: 0;
}

.table-tool.debug {
  color: #ffaaa2;
}

.table-action {
  position: absolute;
  inset: 57px 16px 145px;
  z-index: 5;
  overflow: auto;
  padding: 8px 8px 24px;
  scrollbar-color: color-mix(in srgb, var(--player-accent), #fff 20%) rgba(0, 0, 0, 0.18);
  scrollbar-width: thin;
}

.selection-handoff-shield {
  position: absolute;
  inset: 0;
  z-index: 140;
  background: rgba(15, 35, 27, 0.08);
  pointer-events: auto;
}

.selection-handoff-shield::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--player-accent);
  box-shadow: 0 0 9px var(--player-accent);
  transform-origin: left center;
  animation: handoff-countdown 1000ms linear forwards;
}

@keyframes handoff-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.action-caption {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin: 0 0 10px;
  color: var(--cream);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  text-transform: uppercase;
}

.action-caption b {
  color: var(--player-accent);
  font-size: 1rem;
}

.action-caption span {
  font-size: 0.67rem;
}

.action-caption .button {
  margin-left: auto;
}

/* Player pieces */
.table-avatars {
  position: static;
  pointer-events: none;
}

.player-avatar {
  position: absolute;
  width: 76px;
  height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0;
  color: var(--cream);
  border: 0;
  outline: 0;
  background: transparent;
  pointer-events: auto;
  z-index: 4;
  transform: translate(-50%, -50%);
  transition: left 45ms linear, top 45ms linear, filter 150ms ease, opacity 150ms ease, transform 150ms ease;
}

.player-avatar img {
  position: absolute;
  bottom: 16px;
  left: 50%;
  width: 72px;
  height: 94px;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: drop-shadow(4px 5px 0 rgba(0, 0, 0, 0.42));
  transform: translateX(-50%);
  user-select: none;
}

.player-avatar.active {
  z-index: 150;
  opacity: 1;
  pointer-events: none;
  filter: brightness(1.12);
  transform: translate(-50%, -82%);
}

.player-avatar.inactive {
  z-index: 4;
  opacity: 0.24;
  filter: grayscale(1) brightness(0.62);
  transform: translate(-50%, -50%) scale(0.7);
}

.player-avatar.inactive:hover,
.player-avatar.inactive:focus-visible {
  opacity: 0.58;
  outline: 0;
}

.player-avatar.active img {
  animation: avatar-bob 760ms steps(2, end) infinite;
  filter: drop-shadow(0 0 7px var(--avatar-accent)) drop-shadow(4px 5px 0 rgba(0, 0, 0, 0.42));
}

.player-avatar.dead {
  opacity: 0.2;
  filter: grayscale(0.85);
}

.avatar-name,
.avatar-role {
  position: relative;
  z-index: 2;
  max-width: 104px;
  white-space: nowrap;
}

.avatar-name {
  min-width: 62px;
  padding: 3px 5px;
  overflow: hidden;
  color: #180f0d;
  border: 2px solid #160e0b;
  background: var(--avatar-accent);
  font-size: 0.62rem;
  font-weight: 900;
  text-overflow: ellipsis;
}

.avatar-role {
  margin-top: 1px;
  color: #d5c7ae;
  font-size: 0.5rem;
}

@keyframes avatar-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}

.move-legend {
  position: absolute;
  right: 18px;
  bottom: 138px;
  z-index: 22;
  color: rgba(255, 246, 220, 0.58);
  font-size: 0.55rem;
  pointer-events: none;
}

/* Cards */
.card-grid,
.background-grid,
.career-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 12px;
}

.game-card {
  position: relative;
  min-width: 0;
  min-height: 290px;
  display: flex;
  flex-direction: column;
  padding: 11px;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  border: 3px solid #1b110e;
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.35), transparent 38%),
    var(--paper);
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.34);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.game-card:nth-child(3n + 1) { --tilt: -0.35deg; }
.game-card:nth-child(3n + 2) { --tilt: 0.28deg; }

.draft-card {
  appearance: none;
  cursor: pointer;
}

.draft-card:hover:not(:disabled),
.draft-card:focus-visible,
.draft-card.near-player {
  z-index: 6;
  outline: 0;
  filter: brightness(1.06);
  transform: translateY(-6px) rotate(0);
  box-shadow: 0 0 0 4px var(--player-accent), 8px 10px 0 rgba(0, 0, 0, 0.4);
}

.draft-card.near-player::after {
  content: "ENTER";
  position: absolute;
  top: 5px;
  right: 6px;
  padding: 3px 5px;
  color: #170f0c;
  border: 1px solid #170f0c;
  background: var(--player-accent);
  font: 900 0.52rem "Courier New", monospace;
}

.game-card.disabled,
.game-card:disabled {
  filter: none;
}

.game-card.disabled::before,
.game-card:disabled::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 7;
  background: rgba(31, 29, 27, 0.36);
  pointer-events: none;
}

.game-card.selected-card {
  opacity: 1;
}

.game-card.selected-card::before {
  background: rgba(31, 29, 27, 0.48);
}

.card-watermark {
  position: absolute;
  top: 48%;
  right: -12px;
  left: -12px;
  z-index: 8;
  padding: 9px 16px;
  overflow: hidden;
  color: #180f0d;
  border: 3px solid #180f0d;
  background: color-mix(in srgb, var(--selected-accent, var(--gold)), #fff 18%);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.34);
  font: 900 clamp(1rem, 2vw, 1.45rem)/1 "Courier New", monospace;
  letter-spacing: 0.12em;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  transform: rotate(-9deg);
  pointer-events: none;
}

.card-prohibited {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 8;
  width: 74px;
  height: 74px;
  border: 9px solid #d83c35;
  border-radius: 50%;
  background: rgba(255, 243, 213, 0.68);
  box-shadow: 0 0 0 3px #f8e7bd, 4px 6px 0 rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%) rotate(-8deg);
  pointer-events: none;
}

.card-prohibited::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66px;
  height: 9px;
  border-radius: 8px;
  background: #d83c35;
  transform: translate(-50%, -50%) rotate(-45deg);
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #73533f;
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

.card-kind {
  color: #8b552f;
}

.card-icon {
  font-size: 1.5rem;
}

.card-art {
  height: 105px;
  display: grid;
  place-items: center;
  margin: 7px 0 5px;
  border: 2px solid rgba(36, 23, 20, 0.25);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(95, 72, 51, 0.07) 1px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(rgba(95, 72, 51, 0.07) 1px, transparent 1px) 0 0 / 12px 12px,
    #e7d3a2;
}

.card-art img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  user-select: none;
}

.game-card h3 {
  margin: 5px 0 4px;
  font: 900 clamp(0.9rem, 1.3vw, 1.15rem)/1 "Courier New", monospace;
  text-transform: uppercase;
}

.card-description {
  margin: 4px 0 8px;
  color: #583f32;
  font-size: 0.7rem;
  line-height: 1.35;
}

.requirement-box {
  margin: 3px 0;
  padding: 5px 6px;
  color: #5a4134;
  border-left: 3px solid #b98b47;
  background: rgba(255, 255, 255, 0.26);
  font-size: 0.62rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
}

.chip {
  padding: 2px 4px;
  color: #674b38;
  border: 1px solid rgba(38, 24, 19, 0.2);
  background: rgba(255, 255, 255, 0.28);
  font: 800 0.48rem "Courier New", monospace;
  text-transform: uppercase;
}

.card-pick {
  display: block;
  margin-top: 7px;
  padding: 5px;
  text-align: center;
  border: 2px solid #1c120f;
  font: 900 0.58rem "Courier New", monospace;
  text-transform: uppercase;
}

.card-pick {
  color: #160f0d;
  background: var(--gold);
}

.background-card {
  min-height: 440px;
  border-top: 9px solid var(--accent, var(--gold));
}

.background-art {
  height: 142px;
  display: grid;
  place-items: end center;
  margin: 3px 0 6px;
  overflow: hidden;
  border-bottom: 3px solid color-mix(in srgb, var(--accent), #1b110e 35%);
  background:
    radial-gradient(circle at 50% 75%, color-mix(in srgb, var(--accent), transparent 58%), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(58, 36, 27, 0.08));
}

.background-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: drop-shadow(4px 5px 0 rgba(0, 0, 0, 0.28));
  user-select: none;
}

.score-rule-list {
  margin: 7px 0 10px;
  padding-left: 17px;
  color: #594134;
  font-size: 0.67rem;
  line-height: 1.35;
}

.card-action {
  width: 100%;
  margin-top: auto;
}

.career-card {
  min-height: 275px;
}

.table-skip {
  margin-top: 12px;
}

/* Embedded table dashboard */
.table-dashboard {
  position: absolute;
  right: 12px;
  bottom: 10px;
  left: 12px;
  z-index: 24;
  min-height: 118px;
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(440px, 1.6fr);
  gap: 9px;
  padding: 9px;
  color: var(--cream);
  border: 3px solid #130c0a;
  border-top-color: var(--dashboard-accent);
  border-radius: 5px;
  background: rgba(17, 12, 10, 0.91);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.05), 0 -5px 18px rgba(0, 0, 0, 0.26);
}

.player-ledger {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) 1.7fr;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
}

.ledger-identity {
  min-width: 0;
}

.ledger-identity strong,
.ledger-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-identity strong {
  color: var(--dashboard-accent);
  font: 900 1rem "Courier New", monospace;
  text-transform: uppercase;
}

.ledger-identity span {
  margin-top: 4px;
  color: #baa98e;
  font-size: 0.6rem;
}

.ledger-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(36px, 1fr));
  gap: 4px;
}

.ledger-stats > span {
  min-width: 0;
  padding: 5px 3px;
  color: #eee1c8;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.66rem;
}

.ledger-stats b {
  margin-right: 4px;
  color: var(--dashboard-accent);
}

.ledger-stats .negative {
  color: #ff8f85;
}

.life-piles {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.life-pile {
  min-width: 0;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
}

.life-pile > b {
  display: block;
  margin-bottom: 5px;
  color: var(--dashboard-accent);
  font-size: 0.55rem;
}

.life-pile > div {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-content: flex-start;
  max-height: 72px;
}

.life-card-chip {
  position: relative;
  min-width: 0;
  max-width: 104px;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 5px 2px 2px;
  color: #eee1c8;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.54rem;
}

.life-card-chip > img {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
  image-rendering: pixelated;
}

.life-card-chip > span:not(.life-card-preview) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.life-card-chip:hover,
.life-card-chip:focus-visible {
  border-color: var(--dashboard-accent);
  outline: 0;
  background: rgba(255, 255, 255, 0.13);
}

.life-card-preview {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 100;
  width: 240px;
  display: none;
  padding: 9px;
  color: var(--ink);
  text-align: left;
  border: 3px solid #1b110e;
  background: var(--paper);
  box-shadow: 7px 8px 0 rgba(0, 0, 0, 0.38);
  transform: translateX(-50%);
  pointer-events: none;
}

.life-card-chip:hover .life-card-preview,
.life-card-chip:focus-visible .life-card-preview {
  display: block;
}

.life-card-preview .card-art {
  height: 92px;
  margin: 0 0 7px;
}

.life-card-preview strong,
.life-card-preview small,
.life-card-preview em {
  display: block;
}

.life-card-preview strong {
  font: 900 0.9rem "Courier New", monospace;
  text-transform: uppercase;
}

.life-card-preview small {
  margin: 3px 0 6px;
  color: #8b552f;
  font: 800 0.55rem "Courier New", monospace;
  text-transform: uppercase;
}

.life-card-preview em {
  color: #594134;
  font-size: 0.67rem;
  font-style: normal;
  line-height: 1.35;
}

.empty-pile {
  color: #786b58;
  font: 800 0.58rem "Courier New", monospace;
  text-transform: uppercase;
}

/* State boards */
.phase-card,
.test-rule-card {
  width: min(660px, calc(100% - 30px));
  min-height: 300px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
  margin: min(10vh, 80px) auto 0;
  padding: 36px;
  text-align: center;
  border: 4px dashed rgba(255, 255, 255, 0.24);
  background: rgba(12, 9, 7, 0.32);
}

.phase-card span,
.test-rule-card > span {
  color: var(--player-accent);
  font: 900 0.7rem "Courier New", monospace;
  letter-spacing: 0.14em;
}

.phase-card h1,
.test-rule-card h1 {
  margin: 0;
  color: var(--cream);
  font: 900 clamp(3rem, 9vw, 7rem)/0.8 "Courier New", monospace;
  letter-spacing: -0.08em;
  text-shadow: 7px 7px 0 rgba(0, 0, 0, 0.34);
  text-transform: uppercase;
}

.test-rule-card h1 {
  font-size: clamp(2.3rem, 7vw, 5.5rem);
}

.test-rule-card p {
  max-width: 490px;
  margin: 0;
  color: #d7ccb8;
  font-size: 0.9rem;
  line-height: 1.5;
}

.resolution-card,
.results-board {
  width: min(960px, 100%);
  margin: 0 auto;
}

.resolution-card {
  padding: 12px;
  border: 3px solid rgba(255, 255, 255, 0.13);
  background: rgba(14, 10, 8, 0.42);
}

.event-feed {
  max-height: min(44vh, 350px);
  overflow: auto;
  margin: 8px 0 12px;
}

.event-item {
  padding: 7px 4px;
  color: #d8cdb9;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  font-size: 0.72rem;
  line-height: 1.35;
}

.event-type {
  margin-right: 7px;
  color: var(--player-accent);
  font: 900 0.55rem "Courier New", monospace;
  text-transform: uppercase;
}

.dice-display {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}

.die {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--ink);
  border: 3px solid #17100d;
  border-radius: 6px;
  background: var(--cream);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.33);
  font: 900 1.35rem "Courier New", monospace;
}

.results-table {
  display: grid;
  gap: 8px;
}

.result-row {
  appearance: none;
  display: grid;
  grid-template-columns: 50px minmax(150px, 0.8fr) minmax(200px, 1.5fr) 70px;
  gap: 10px;
  align-items: center;
  padding: 11px;
  color: var(--ink);
  text-align: left;
  border: 3px solid #1b110e;
  background: var(--paper);
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.28);
}

.result-row:hover,
.result-row:focus-visible {
  outline: 3px solid var(--player-accent);
}

.result-row strong,
.result-row small {
  display: block;
}

.result-row small {
  margin-top: 3px;
  color: #755640;
  font-size: 0.6rem;
}

.result-place {
  font-size: 1.25rem;
  font-weight: 900;
}

.score-breakdown {
  color: #674c3b;
  font-size: 0.62rem;
  line-height: 1.35;
}

.result-score {
  text-align: right;
  font-size: 1.3rem;
  font-weight: 900;
}

/* Dialogs and feedback */
.game-dialog {
  width: min(540px, calc(100% - 30px));
  padding: 0;
  color: var(--ink);
  border: 4px solid #1c120f;
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 10px 12px 0 rgba(0, 0, 0, 0.4);
}

.game-dialog::backdrop {
  background: rgba(12, 8, 6, 0.8);
  backdrop-filter: blur(3px);
}

.dialog-body {
  padding: 22px;
}

.dialog-body h2 {
  margin: 8px 0 14px;
  font: 900 1.2rem "Courier New", monospace;
  text-transform: uppercase;
}

.dialog-art {
  height: 140px;
}

.target-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

#manual-copy {
  min-height: 300px;
  resize: vertical;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  max-width: 380px;
  padding: 11px 14px;
  color: var(--ink);
  border: 3px solid #18100d;
  background: var(--gold);
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.35);
  font: 900 0.7rem "Courier New", monospace;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.fatal-error {
  width: min(700px, calc(100% - 32px));
  margin: 60px auto;
  padding: 24px;
  color: var(--ink);
  border: 4px solid #1c120f;
  background: var(--paper);
}

@media (max-width: 900px) {
  .tabletop-lobby {
    grid-template-columns: 1fr;
  }

  .lobby-title h1 {
    font-size: clamp(3.2rem, 18vw, 6rem);
  }

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

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

  .life-card-chip {
    max-width: 78px;
  }
}

@media (max-width: 660px) {
  .tabletop-shell {
    padding: 0;
  }

  .tabletop-board {
    border-width: 5px;
    border-radius: 0;
  }

  .round-plaque {
    top: 7px;
    left: 7px;
    font-size: 0.59rem;
  }

  .table-tools {
    top: 6px;
    right: 6px;
  }

  .table-tool {
    width: 30px;
    height: 30px;
  }

  .table-action {
    inset: 45px 4px 172px;
  }

  .card-grid,
  .background-grid,
  .career-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 7px;
  }

  .game-card {
    min-height: 270px;
    padding: 8px;
  }

  .card-art {
    height: 82px;
  }

  .table-dashboard {
    right: 4px;
    bottom: 4px;
    left: 4px;
    min-height: 158px;
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 5px;
  }

  .player-ledger {
    grid-template-columns: minmax(90px, 0.7fr) 1.6fr;
    padding: 4px;
  }

  .life-piles {
    min-height: 65px;
  }

  .life-card-chip {
    width: 28px;
    max-width: 28px;
    padding: 2px;
  }

  .life-card-chip > span:not(.life-card-preview) {
    display: none;
  }

  .life-card-preview {
    width: 210px;
  }

  .player-avatar {
    width: 58px;
    height: 88px;
  }

  .player-avatar img {
    width: 56px;
    height: 72px;
  }

  .avatar-role,
  .move-legend {
    display: none;
  }

  .result-row {
    grid-template-columns: 38px 1fr 58px;
  }

  .score-breakdown {
    grid-column: 2 / -1;
  }

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

/* Mobile pass-and-play presentation */
.mobile-swipe-hint {
  display: none;
}

.life-card-chip {
  appearance: none;
  margin: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

html[data-layout="mobile"] body {
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

html[data-layout="mobile"] button,
html[data-layout="mobile"] [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

html[data-layout="mobile"] .setup-shell {
  min-height: 100dvh;
  overflow: auto;
  overscroll-behavior-y: contain;
}

html[data-layout="mobile"] .tabletop-lobby {
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: start;
  padding: calc(18px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  border-width: 8px;
}

html[data-layout="mobile"] .lobby-title h1 {
  margin-top: 14px;
  font-size: clamp(3.6rem, 20vw, 5.4rem);
}

html[data-layout="mobile"] .lobby-title p {
  margin-bottom: 0;
}

html[data-layout="mobile"] .setup-card {
  padding: 20px;
  border-width: 4px;
  box-shadow: 7px 8px 0 rgba(0, 0, 0, 0.34);
}

html[data-layout="mobile"] .player-name-grid {
  grid-template-columns: 1fr;
}

html[data-layout="mobile"] .field input,
html[data-layout="mobile"] .field select {
  min-height: 48px;
  font-size: 1rem;
}

html[data-layout="mobile"] .button {
  min-height: 46px;
}

html[data-layout="mobile"] .resume-row .button {
  flex: 1 1 132px;
}

.mobile-game {
  width: 100vw;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  color: var(--cream);
  border: 5px solid var(--player-accent, var(--gold));
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255, 255, 255, 0.09), transparent 50%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 35%),
    var(--felt);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.3), inset 0 0 70px rgba(0, 0, 0, 0.34);
  overscroll-behavior: none;
}

.mobile-topbar {
  position: relative;
  z-index: 40;
  min-height: calc(62px + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
  padding: calc(7px + env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 7px max(8px, env(safe-area-inset-left));
  border-bottom: 3px solid rgba(0, 0, 0, 0.62);
  background: rgba(17, 12, 10, 0.93);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}

.mobile-round {
  min-width: 0;
  padding: 6px 8px;
  color: var(--ink);
  border: 2px solid #160e0b;
  background: var(--paper);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.28);
  font: 900 0.62rem "Courier New", monospace;
  text-transform: uppercase;
}

.mobile-round span,
.mobile-round small,
.mobile-turn-identity b,
.mobile-turn-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-round small {
  margin-top: 2px;
  color: #795b46;
  font-size: 0.49rem;
}

.mobile-turn-identity {
  min-width: 0;
  display: flex;
  gap: 7px;
  align-items: center;
}

.mobile-turn-identity > img,
.mobile-seat-token {
  width: 40px;
  height: 42px;
  flex: 0 0 auto;
}

.mobile-turn-identity > img {
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.4));
}

.mobile-seat-token {
  display: grid;
  place-items: center;
  color: var(--ink);
  border: 2px solid #170e0b;
  background: var(--player-accent);
  font: 900 0.7rem "Courier New", monospace;
}

.mobile-turn-identity b {
  color: var(--player-accent);
  font: 900 0.78rem "Courier New", monospace;
  text-transform: uppercase;
}

.mobile-turn-identity small {
  margin-top: 2px;
  color: #b9ab91;
  font-size: 0.52rem;
}

.mobile-icon-button,
.mobile-sheet-close {
  appearance: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--cream);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.1rem;
  font-weight: 900;
}

.mobile-icon-button:active,
.mobile-sheet-close:active {
  color: var(--ink);
  background: var(--gold);
}

.mobile-stage {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 12px 24px;
  scrollbar-color: color-mix(in srgb, var(--player-accent), #fff 20%) rgba(0, 0, 0, 0.18);
  scrollbar-width: thin;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-stage .action-caption {
  position: sticky;
  top: -12px;
  z-index: 18;
  min-height: 46px;
  margin: 0 -4px 3px;
  padding: 10px 4px 7px;
  background: linear-gradient(var(--felt) 68%, transparent);
}

.mobile-stage .action-caption b {
  font-size: 1.05rem;
}

.mobile-stage .action-caption span {
  font-size: 0.64rem;
}

.mobile-stage .mobile-swipe-hint {
  display: block;
  margin: 0 0 6px;
  color: rgba(255, 244, 214, 0.66);
  font: 900 0.52rem "Courier New", monospace;
  letter-spacing: 0.08em;
  text-align: center;
}

.mobile-stage .card-grid,
.mobile-stage .background-grid,
.mobile-stage .career-grid {
  width: auto;
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: min(84vw, 380px);
  gap: 12px;
  align-items: stretch;
  margin: 0 -12px;
  padding: 5px 8vw 18px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-padding-inline: 8vw;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-stage .card-grid::-webkit-scrollbar,
.mobile-stage .background-grid::-webkit-scrollbar,
.mobile-stage .career-grid::-webkit-scrollbar {
  display: none;
}

.mobile-stage .game-card {
  width: 100%;
  min-height: clamp(450px, calc(100dvh - 190px), 620px);
  padding: 14px;
  border-width: 3px;
  border-radius: 8px;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.34);
  transform: none;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.mobile-stage .game-card h3 {
  font-size: clamp(1rem, 4.6vw, 1.25rem);
  line-height: 1.05;
}

.mobile-stage .card-description {
  font-size: 0.8rem;
  line-height: 1.42;
}

.mobile-stage .card-art {
  height: clamp(150px, 25dvh, 220px);
  margin-top: 9px;
}

.mobile-stage .background-card {
  min-height: clamp(480px, calc(100dvh - 190px), 650px);
}

.mobile-stage .background-art {
  height: clamp(170px, 28dvh, 245px);
}

.mobile-stage .score-rule-list {
  font-size: 0.75rem;
  line-height: 1.42;
}

.mobile-stage .requirement-box {
  padding: 7px 8px;
  font-size: 0.7rem;
  line-height: 1.35;
}

.mobile-stage .chip {
  padding: 3px 5px;
  font-size: 0.54rem;
}

.mobile-stage .draft-card:hover:not(:disabled),
.mobile-stage .draft-card:focus-visible,
.mobile-stage .draft-card.near-player {
  filter: none;
  transform: none;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.34);
}

.mobile-stage .draft-card.near-player::after,
.mobile-stage .card-pick {
  display: none;
}

.mobile-draft-card {
  appearance: none;
}

.mobile-take-button {
  width: 100%;
  min-height: 50px !important;
  margin-top: auto;
}

.mobile-card-state {
  position: relative;
  z-index: 9;
  margin: 9px 0;
  padding: 8px;
  color: #8b211e;
  border: 2px solid #a6352f;
  background: rgba(255, 244, 214, 0.88);
  font: 900 0.62rem/1.35 "Courier New", monospace;
  text-transform: uppercase;
}

.mobile-stage .card-watermark {
  font-size: 1.05rem;
}

.mobile-stage .table-skip {
  position: sticky;
  bottom: 0;
  z-index: 16;
  width: 100%;
  min-height: 50px;
  margin-top: 8px;
}

.mobile-stage .phase-card,
.mobile-stage .test-rule-card {
  width: 100%;
  min-height: calc(100% - 18px);
  margin: 8px auto 0;
  padding: 26px 18px;
}

.mobile-stage .phase-card h1,
.mobile-stage .test-rule-card h1 {
  font-size: clamp(2.8rem, 16vw, 5rem);
}

.mobile-stage .test-rule-card p {
  font-size: 0.86rem;
}

.mobile-stage .resolution-card,
.mobile-stage .results-board {
  width: 100%;
}

.mobile-stage .resolution-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.mobile-stage .event-feed {
  max-height: none;
  flex: 1 1 auto;
}

.mobile-stage .event-item {
  padding: 10px 4px;
  font-size: 0.78rem;
}

.mobile-stage .resolution-card > .button {
  position: sticky;
  bottom: 0;
  width: 100%;
  min-height: 50px;
}

.mobile-stage .result-row {
  grid-template-columns: 42px minmax(0, 1fr) 58px;
  gap: 8px;
  min-height: 78px;
  padding: 10px;
}

.mobile-stage .score-breakdown {
  grid-column: 2 / -1;
}

.mobile-stage .result-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.mobile-bottom-bar {
  position: relative;
  z-index: 45;
  padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  border-top: 3px solid var(--player-accent);
  background: rgba(17, 12, 10, 0.95);
  box-shadow: 0 -5px 18px rgba(0, 0, 0, 0.27);
}

.mobile-player-summary {
  appearance: none;
  width: 100%;
  min-height: 50px;
  display: grid;
  grid-template-columns: minmax(72px, 1.2fr) repeat(3, minmax(48px, 0.72fr)) auto;
  gap: 5px;
  align-items: center;
  padding: 5px 7px;
  color: var(--cream);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.mobile-summary-name,
.mobile-summary-label,
.mobile-featured-stat {
  font-family: "Courier New", monospace;
  font-weight: 900;
}

.mobile-summary-name {
  overflow: hidden;
  color: var(--player-accent);
  font-size: 0.72rem;
  text-align: left;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.mobile-featured-stat {
  padding: 5px 2px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.66rem;
}

.mobile-featured-stat b {
  margin-right: 3px;
  color: var(--player-accent);
}

.mobile-featured-stat.negative {
  color: #ff9188;
}

.mobile-summary-label {
  color: #c5b79d;
  font-size: 0.48rem;
}

.mobile-sheet-backdrop {
  appearance: none;
  position: fixed;
  inset: 0;
  z-index: 180;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(8, 5, 4, 0.76);
  backdrop-filter: blur(2px);
}

.mobile-sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 190;
  max-height: min(86dvh, 760px);
  padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  color: var(--ink);
  border: 4px solid #1c120f;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--paper);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.5);
  overscroll-behavior-y: contain;
}

.mobile-sheet-handle {
  width: 48px;
  height: 5px;
  margin: 0 auto 10px;
  border-radius: 4px;
  background: rgba(36, 23, 20, 0.28);
}

.mobile-sheet-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.mobile-sheet-heading h2,
.mobile-life-section h3 {
  font-family: "Courier New", monospace;
  font-weight: 900;
  text-transform: uppercase;
}

.mobile-sheet-heading h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
  line-height: 1;
}

.mobile-sheet-heading p {
  margin: 5px 0 0;
  color: #6d513e;
  font-size: 0.68rem;
}

.mobile-sheet-close {
  flex: 0 0 auto;
  color: var(--ink);
  border-color: rgba(36, 23, 20, 0.24);
  background: rgba(255, 255, 255, 0.3);
  font-size: 1.5rem;
}

.mobile-player-tabs {
  display: flex;
  gap: 6px;
  margin: 15px -2px 10px;
  padding: 2px 2px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mobile-player-tabs::-webkit-scrollbar {
  display: none;
}

.mobile-player-tabs button {
  appearance: none;
  min-width: 82px;
  min-height: 44px;
  padding: 7px;
  color: var(--ink);
  border: 2px solid rgba(36, 23, 20, 0.28);
  border-top: 6px solid var(--tab-accent);
  background: rgba(255, 255, 255, 0.28);
  font: 900 0.62rem "Courier New", monospace;
  text-transform: uppercase;
}

.mobile-player-tabs button.active {
  outline: 3px solid var(--tab-accent);
  background: #fff8e5;
}

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

.mobile-stat-grid > div {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(36, 23, 20, 0.2);
  background: rgba(255, 255, 255, 0.25);
}

.mobile-stat-grid span,
.mobile-stat-grid b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-stat-grid span {
  color: #745743;
  font: 900 0.5rem "Courier New", monospace;
  text-transform: uppercase;
}

.mobile-stat-grid b {
  margin-top: 4px;
  font: 900 0.78rem "Courier New", monospace;
}

.mobile-stat-grid .negative b {
  color: #b32622;
}

.mobile-life-section {
  margin-top: 14px;
}

.mobile-life-section h3 {
  margin: 0 0 6px;
  color: #684c38;
  font-size: 0.66rem;
}

.mobile-life-section h3 span {
  color: #986b31;
}

.mobile-life-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mobile-life-list .life-card-chip {
  width: 100%;
  max-width: none;
  height: 54px;
  padding: 4px;
  color: var(--ink);
  border: 2px solid rgba(36, 23, 20, 0.22);
  background: rgba(255, 255, 255, 0.28);
  font: 900 0.58rem "Courier New", monospace;
}

.mobile-life-list .life-card-chip > img {
  width: 42px;
  height: 42px;
}

.mobile-life-list .life-card-preview {
  display: none !important;
}

.mobile-card-sheet .mobile-detail-art {
  height: clamp(190px, 34dvh, 300px);
  margin: 16px 0 12px;
}

.mobile-card-description {
  color: #543d30;
  font-size: 0.88rem;
  line-height: 1.5;
}

.mobile-menu-actions {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.mobile-handoff {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: calc(22px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--handoff-accent), transparent 64%), transparent 45%),
    linear-gradient(145deg, #173a2c, #0d2119);
}

.mobile-handoff-card {
  width: min(100%, 430px);
  display: grid;
  place-items: center;
  padding: 26px 20px;
  color: var(--cream);
  text-align: center;
  border: 4px solid var(--handoff-accent);
  border-radius: 12px;
  background: rgba(16, 11, 9, 0.76);
  box-shadow: 9px 11px 0 rgba(0, 0, 0, 0.34), 0 0 34px color-mix(in srgb, var(--handoff-accent), transparent 55%);
}

.mobile-handoff-card > img,
.mobile-handoff-token {
  width: 148px;
  height: 172px;
  margin: 10px 0 4px;
}

.mobile-handoff-card > img {
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: drop-shadow(5px 6px 0 rgba(0, 0, 0, 0.4));
}

.mobile-handoff-token {
  display: grid;
  place-items: center;
  color: var(--ink);
  border: 4px solid #160e0b;
  background: var(--handoff-accent);
  font: 900 2rem "Courier New", monospace;
}

.mobile-handoff-card p {
  margin: 4px 0 0;
  color: #c7bca7;
  font: 900 0.62rem "Courier New", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mobile-handoff-card h1 {
  margin: 4px 0 9px;
  color: var(--handoff-accent);
  font: 900 clamp(2.2rem, 12vw, 4rem)/0.9 "Courier New", monospace;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.mobile-handoff-card small {
  max-width: 300px;
  color: #cfc3ad;
  font-size: 0.76rem;
  line-height: 1.45;
}

.mobile-handoff-card .button {
  width: 100%;
  min-height: 52px;
  margin-top: 20px;
}

html[data-layout="mobile"] .game-dialog {
  width: 100%;
  max-width: none;
  max-height: 88dvh;
  margin: auto 0 0;
  overflow-y: auto;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 18px 18px 0 0;
}

html[data-layout="mobile"] .dialog-body {
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}

html[data-layout="mobile"] .target-list .button {
  min-height: 50px;
}

html[data-layout="mobile"] .toast {
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  bottom: auto;
  left: 12px;
  max-width: none;
}

@media (max-height: 520px) and (orientation: landscape) {
  html[data-layout="mobile"] .mobile-topbar {
    min-height: calc(51px + env(safe-area-inset-top));
    grid-template-columns: 118px minmax(0, 1fr) 44px;
    padding-top: calc(4px + env(safe-area-inset-top));
    padding-bottom: 4px;
  }

  html[data-layout="mobile"] .mobile-turn-identity > img,
  html[data-layout="mobile"] .mobile-seat-token {
    width: 34px;
    height: 34px;
  }

  html[data-layout="mobile"] .mobile-icon-button {
    width: 42px;
    height: 42px;
  }

  html[data-layout="mobile"] .mobile-stage {
    padding-top: 6px;
    padding-bottom: 10px;
  }

  html[data-layout="mobile"] .mobile-stage .action-caption {
    top: -6px;
    min-height: 38px;
    padding-top: 6px;
  }

  html[data-layout="mobile"] .mobile-stage .card-grid,
  html[data-layout="mobile"] .mobile-stage .background-grid,
  html[data-layout="mobile"] .mobile-stage .career-grid {
    grid-auto-columns: min(76vw, 620px);
    padding-right: 12vw;
    padding-left: 12vw;
    scroll-padding-inline: 12vw;
  }

  html[data-layout="mobile"] .mobile-stage .game-card {
    min-height: 250px;
    display: grid;
    grid-template-columns: minmax(130px, 36%) minmax(0, 1fr);
    grid-auto-rows: min-content;
    column-gap: 14px;
    align-content: start;
  }

  html[data-layout="mobile"] .mobile-stage .game-card > .card-topline {
    grid-column: 1 / -1;
  }

  html[data-layout="mobile"] .mobile-stage .game-card > .card-art,
  html[data-layout="mobile"] .mobile-stage .game-card > .background-art {
    grid-column: 1;
    grid-row: 2 / span 7;
    width: 100%;
    height: 180px;
  }

  html[data-layout="mobile"] .mobile-stage .game-card > h3,
  html[data-layout="mobile"] .mobile-stage .game-card > .card-description,
  html[data-layout="mobile"] .mobile-stage .game-card > .requirement-box,
  html[data-layout="mobile"] .mobile-stage .game-card > .score-rule-list,
  html[data-layout="mobile"] .mobile-stage .game-card > .tag-row,
  html[data-layout="mobile"] .mobile-stage .game-card > .mobile-card-state,
  html[data-layout="mobile"] .mobile-stage .game-card > .card-action,
  html[data-layout="mobile"] .mobile-stage .game-card > .mobile-take-button {
    grid-column: 2;
    margin-right: 0;
    margin-left: 0;
  }

  html[data-layout="mobile"] .mobile-stage .game-card > h3 {
    margin-top: 8px;
  }

  html[data-layout="mobile"] .mobile-stage .game-card > .score-rule-list {
    padding-left: 18px;
  }

  html[data-layout="mobile"] .mobile-stage .game-card > .mobile-take-button,
  html[data-layout="mobile"] .mobile-stage .game-card > .card-action {
    align-self: end;
  }

  html[data-layout="mobile"] .mobile-bottom-bar {
    padding-top: 4px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
  }

  html[data-layout="mobile"] .mobile-player-summary {
    min-height: 43px;
  }

  html[data-layout="mobile"] .mobile-stage .phase-card,
  html[data-layout="mobile"] .mobile-stage .test-rule-card {
    min-height: 210px;
    margin-top: 0;
    padding: 18px;
  }

  html[data-layout="mobile"] .mobile-stage .phase-card h1,
  html[data-layout="mobile"] .mobile-stage .test-rule-card h1 {
    font-size: clamp(2.4rem, 10vw, 4.4rem);
  }

  html[data-layout="mobile"] .mobile-handoff-card {
    max-width: 620px;
    grid-template-columns: 130px minmax(0, 1fr);
    column-gap: 18px;
    padding: 14px 18px;
    text-align: left;
  }

  html[data-layout="mobile"] .mobile-handoff-card > .eyebrow,
  html[data-layout="mobile"] .mobile-handoff-card > img,
  html[data-layout="mobile"] .mobile-handoff-card > .mobile-handoff-token {
    grid-column: 1;
  }

  html[data-layout="mobile"] .mobile-handoff-card > img,
  html[data-layout="mobile"] .mobile-handoff-card > .mobile-handoff-token {
    grid-row: 2 / span 5;
    width: 118px;
    height: 135px;
    margin: 0;
  }

  html[data-layout="mobile"] .mobile-handoff-card > p,
  html[data-layout="mobile"] .mobile-handoff-card > h1,
  html[data-layout="mobile"] .mobile-handoff-card > small,
  html[data-layout="mobile"] .mobile-handoff-card > .button {
    grid-column: 2;
    justify-self: stretch;
  }

  html[data-layout="mobile"] .mobile-handoff-card > .button {
    margin-top: 10px;
  }
}

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