:root {
  color-scheme: dark;
  --bg: #07060b;
  --surface: #100d18;
  --surface-2: #181221;
  --surface-3: #24172f;
  --table: #2d1745;
  --table-deep: #1c102d;
  --ink: #faf8ff;
  --muted: #bcb1c8;
  --cyan: #62d9f4;
  --blue: #4289cf;
  --violet: #7548a8;
  --magenta: #d76bf2;
  --danger: #ff6f91;
  --line: rgba(177, 146, 198, 0.25);
  --line-strong: rgba(98, 217, 244, 0.6);
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  --hud-w: clamp(176px, 11vw, 220px);
  --gap: clamp(7px, 0.7vw, 12px);
  --hand-h: clamp(200px, 25vh, 244px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  filter: saturate(0.35);
  opacity: 0.46;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  color: var(--ink);
  background: rgba(8, 6, 13, 0.9);
}

input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: none;
  padding: 10px 12px;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

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

.app-shell {
  width: 100%;
  min-height: 100dvh;
}

.eyebrow,
label > span,
.hud-section-label {
  display: block;
  margin: 0;
  color: #c9b6f3;
  font-size: clamp(0.56rem, 0.62vw, 0.72rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-action,
.secondary-action,
.icon-button,
.danger-link,
.stepper,
.seat-chip button,
.drawer-tabs button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 850;
  transition: transform 140ms ease, border-color 140ms ease, filter 140ms ease;
}

.primary-action {
  border-color: rgba(114, 228, 255, 0.7);
  color: #07081a;
  background: var(--cyan);
  box-shadow: inset 0 -3px rgba(14, 87, 110, 0.3), 0 7px 16px rgba(20, 121, 153, 0.2);
}

.secondary-action,
.icon-button,
.stepper,
.seat-chip button,
.drawer-tabs button {
  background: #17121f;
}

.danger-link {
  border-color: rgba(220, 105, 255, 0.42);
  background: #371b3f;
}

.primary-action:not(:disabled):hover,
.secondary-action:not(:disabled):hover,
.icon-button:not(:disabled):hover,
.danger-link:not(:disabled):hover,
.stepper:not(:disabled):hover,
.seat-chip button:not(:disabled):hover,
.drawer-tabs button:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  filter: brightness(1.1);
}

.wide {
  width: 100%;
}

/* Lobby */

.lobby-screen {
  width: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(14px, 2vw, 28px);
  background-color: #09070e;
  background-image: radial-gradient(rgba(130, 82, 160, 0.13) 0.7px, transparent 0.8px);
  background-size: 10px 10px;
}

.studio-table {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(177, 146, 198, 0.3);
  border-radius: var(--radius);
  background-color: var(--table);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.035) 0.7px, transparent 0.8px),
    radial-gradient(rgba(0, 0, 0, 0.08) 0.7px, transparent 0.8px);
  background-position: 0 0, 4px 5px;
  background-size: 8px 8px, 11px 11px;
  box-shadow: inset 0 0 65px rgba(8, 2, 14, 0.46), var(--shadow);
}

.intro-table {
  width: min(1100px, 100%);
  min-height: min(620px, calc(100dvh - 32px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 410px);
  gap: clamp(24px, 5vw, 72px);
  align-items: end;
  padding: clamp(28px, 5vw, 68px);
}

.lobby-logo {
  width: min(680px, 100%);
  margin: 0 0 20px;
  line-height: 0;
}

.lobby-logo img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.intro-line {
  max-width: 590px;
  margin-bottom: 0;
  color: #e4e0ff;
  font-size: clamp(1rem, 1.7vw, 1.3rem);
}

.lobby-controls,
.host-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 11, 22, 0.9);
}

.lobby-controls label,
.host-panel label {
  display: grid;
  gap: 6px;
}

.lobby-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.lobby-leaderboard-button {
  width: 100%;
  min-height: 44px;
  border-color: rgba(98, 217, 244, 0.45);
  color: var(--cyan);
}

.lobby-leaderboard {
  grid-template-rows: auto minmax(0, 1fr);
}

.join-field {
  min-width: 0;
}

.deck-stack {
  position: absolute;
  right: 7%;
  top: 9%;
  width: 150px;
  height: 205px;
  pointer-events: none;
  opacity: 0.42;
}

.card-back {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 5.4%;
  background: var(--card-back-image, url("reference/card-back-prompt-BY4_HknG.png")) center / 100% 100% no-repeat;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.42);
}

.prompt-back { --card-back-image: url("reference/card-back-prompt-BY4_HknG.png"); }
.character-back { --card-back-image: url("reference/card-back-character-DxEdqJdy.png"); }
.genre-back { --card-back-image: url("reference/card-back-genre-CwqXN-0D.png"); }
.story-back { --card-back-image: url("reference/card-back-story-BQ1-HI4t.png"); }

.deck-stack .one {
  --card-back-image: url("reference/card-back-genre-CwqXN-0D.png");
  transform: rotate(-9deg) translate(-20px, 7px);
}

.deck-stack .two {
  --card-back-image: url("reference/card-back-character-DxEdqJdy.png");
  transform: rotate(5deg) translate(15px, 3px);
}

.deck-stack .three {
  --card-back-image: url("reference/card-back-story-BQ1-HI4t.png");
  transform: rotate(-1deg);
}

/* Game shell and HUD */

.game-screen {
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--hud-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: var(--gap);
  padding:
    max(var(--gap), env(safe-area-inset-top))
    max(var(--gap), env(safe-area-inset-right))
    max(var(--gap), env(safe-area-inset-bottom))
    max(var(--gap), env(safe-area-inset-left));
  overflow: hidden;
  background: #08070c;
}

.game-screen.build {
  grid-template-rows: minmax(0, 1fr) var(--hand-h);
}

.game-screen.build.spectating-build {
  grid-template-rows: minmax(0, 1fr) 54px;
}

.top-hud {
  grid-column: 1;
  grid-row: 1 / -1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px;
  overflow: hidden;
  border: 1px solid rgba(177, 146, 198, 0.28);
  border-radius: var(--radius);
  background: #100d17;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025), 0 12px 28px rgba(0, 0, 0, 0.3);
}

.hud-brand {
  min-height: 62px;
  display: grid;
  place-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(98, 217, 244, 0.5);
  border-radius: 6px;
  background: #3c1c5b;
  box-shadow: inset 0 -5px 0 rgba(15, 6, 26, 0.25);
}

.hud-brand img {
  display: block;
  width: 100%;
  max-height: 46px;
  object-fit: contain;
}

.hud-cluster,
.hud-actions {
  display: grid;
  gap: 5px;
}

.hud-pill,
.studio-badge,
.mobile-active-player {
  min-width: 0;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 3px;
  padding: 6px 8px;
  background: transparent;
  text-align: center;
}

.phase-pill {
  color: var(--cyan);
  border-left: 2px solid var(--cyan);
  background: rgba(98, 217, 244, 0.07);
}

.studio-badge {
  min-height: 66px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.studio-badge span,
.mobile-active-player span {
  color: #c8b2eb;
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

.studio-badge strong,
.mobile-active-player strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-active-player {
  display: none;
}

.hud-scores {
  min-height: 0;
  display: grid;
  gap: 4px;
  padding-top: 3px;
  overflow: hidden;
}

.hud-section-label {
  padding: 0 3px 2px;
}

.hud-score-row {
  min-width: 0;
  min-height: 31px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 4px 7px;
  border-left: 2px solid transparent;
  border-radius: 3px;
  background: rgba(29, 18, 36, 0.72);
}

.hud-score-row.studio {
  border-left-color: var(--cyan);
}

.hud-score-row span {
  overflow: hidden;
  color: #dcd8f5;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-score-row strong {
  color: var(--cyan);
  font-size: 1rem;
}

.hud-actions {
  margin-top: auto;
  grid-template-columns: 1fr;
}

.network-pill {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: #dcd8f5;
  background: #15101c;
  font-size: 0.66rem;
  font-weight: 800;
}

.network-pill > span {
  width: 7px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(114, 228, 255, 0.72);
}

.network-pill.reconnecting > span {
  background: #ffca63;
  box-shadow: 0 0 8px rgba(255, 202, 99, 0.7);
}

.card-table {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 100%;
  padding: clamp(18px, 1.65vw, 30px);
  border: clamp(7px, 0.65vw, 11px) solid #0d0a11;
  outline: 1px solid rgba(115, 82, 137, 0.7);
  outline-offset: -2px;
  box-shadow:
    inset 0 0 0 2px rgba(209, 178, 228, 0.12),
    inset 0 0 90px rgba(10, 3, 18, 0.5),
    0 14px 32px rgba(0, 0, 0, 0.45);
}

.card-table::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 5px;
  pointer-events: none;
  border: 1px solid rgba(225, 198, 239, 0.12);
  border-radius: 4px;
}

.waiting-layout,
.draw-layout,
.build-layout,
.pitching-layout,
.judging-layout,
.gameover-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  max-width: 1520px;
  margin-inline: auto;
}

/* Cards */

.game-card {
  position: relative;
  width: var(--card-width, 138px);
  aspect-ratio: 0.72;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  border: 0;
  border-radius: 5.4%;
  padding: 9% 9% 8%;
  color: #11131e;
  background: #fff var(--card-front-image) center / 100% 100% no-repeat;
  text-align: left;
  box-shadow: 0 8px 0 rgba(5, 2, 8, 0.34), 0 13px 22px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  transform-origin: center bottom;
  animation: card-deal 260ms cubic-bezier(0.2, 0.82, 0.2, 1.1) both;
  animation-delay: calc(var(--fan, 0) * 34ms);
}

.card-copy {
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-items: start;
  gap: clamp(5px, 0.45vw, 8px);
}

.game-card.genre {
  --card-front-image: url("reference/card-front-genre-B8iJdlem.png");
}

.game-card.character {
  --card-front-image: url("reference/card-front-character-DPnE9_8M.png");
}

.game-card.story {
  --card-front-image: url("reference/card-front-story-BUfIfINm.png");
}

.game-card.prompt {
  --card-front-image: url("reference/card-front-prompt-eC-G4BT8.png");
}

.game-card .card-type {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  justify-self: stretch;
  text-align: left;
  font-size: clamp(0.5rem, 0.52vw, 0.64rem);
  font-weight: 950;
  text-transform: uppercase;
}

.game-card.genre .card-type { color: #a93e18; }
.game-card.character .card-type { color: #199900; }
.game-card.story .card-type { color: #703299; }
.game-card.prompt .card-type { color: #141414; }

.game-card strong {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  justify-self: stretch;
  text-align: left;
  display: block;
  overflow: hidden;
  font-size: clamp(0.76rem, 0.88vw, 1.08rem);
  line-height: 1.1;
  overflow-wrap: break-word;
  word-break: normal;
  max-height: calc(1.1em * 3);
}

.game-card p {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-width: 0;
  justify-self: stretch;
  text-align: left;
  margin: 0;
  align-self: center;
  overflow: hidden;
  font-size: clamp(0.62rem, 0.66vw, 0.78rem);
  line-height: 1.24;
  max-height: calc(1.24em * 4);
}

.game-card.prompt strong {
  font-size: clamp(0.7rem, 0.78vw, 0.94rem);
  max-height: calc(1.1em * 5);
}

.game-card.prompt p {
  max-height: calc(1.24em * 3);
}

.game-card em {
  position: relative;
  z-index: 1;
  align-self: end;
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  border-radius: 999px;
  padding: 4px 7px;
  color: white;
  background: rgba(7, 8, 30, 0.84);
  font-size: 0.56rem;
  font-style: normal;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-card.selectable:hover,
.game-card.selectable:focus-visible {
  transform: translateY(-7px) scale(1.025);
}

.game-card.selected {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
  transform: translateY(-8px);
  animation: card-deal 220ms ease both, selected-pulse 1.15s ease-in-out infinite;
}

.game-card.required {
  outline-color: var(--magenta);
  box-shadow: 0 0 0 2px rgba(208, 89, 255, 0.38), var(--card-shadow);
}

.game-card.mini {
  --card-width: 108px;
  padding: 8px;
}

.prompt-cards,
.submission-cards,
.mini-card-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 16px);
}

/* Waiting and draw */

.waiting-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(320px, 1.3fr) minmax(270px, 0.78fr);
  gap: clamp(18px, 2.2vw, 36px);
  align-items: center;
  padding: clamp(16px, 3vw, 46px);
}

.room-code-block h2 {
  margin: 8px 0;
  color: var(--cyan);
  font-size: clamp(4rem, 8vw, 7.5rem);
  line-height: 0.9;
}

.room-code-block p:last-child {
  color: var(--muted);
}

.seats-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
}

.seat-chip {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px;
  background: rgba(20, 13, 27, 0.78);
}

.seat-chip div {
  min-width: 0;
  display: grid;
}

.seat-chip span,
.seat-chip small {
  color: var(--muted);
  font-size: 0.7rem;
}

.seat-presence::before {
  content: "";
  width: 6px;
  height: 6px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
  background: #766f91;
}

.seat-presence.online::before {
  background: var(--cyan);
  box-shadow: 0 0 7px rgba(114, 228, 255, 0.7);
}

.seat-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.round-control {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: stretch;
}

.round-control > div {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px;
  background: #18111f;
}

.round-control span,
.round-control small,
.seat-limit {
  color: var(--muted);
  font-size: 0.68rem;
}

.round-control strong {
  color: var(--cyan);
  font-size: 1.45rem;
}

.notice-strip {
  border: 1px solid rgba(255, 111, 145, 0.5);
  border-radius: 6px;
  padding: 9px 10px;
  color: #ffd5df;
  background: rgba(93, 26, 56, 0.45);
  font-size: 0.78rem;
}

.network-room-copy {
  display: grid;
  justify-items: center;
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px;
  background: #18111f;
  text-align: center;
}

.network-room-copy span,
.network-room-copy small {
  color: var(--muted);
  font-size: 0.68rem;
}

.network-room-copy strong {
  color: var(--cyan);
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  letter-spacing: 0.12em;
}

.draw-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(180px, 22vw, 320px);
  gap: clamp(24px, 5vw, 80px);
  align-items: center;
  padding: clamp(26px, 6vw, 90px);
}

.prompt-zone h2 {
  max-width: 850px;
  margin: 8px 0 16px;
  font-size: clamp(2.4rem, 5vw, 5.8rem);
  line-height: 0.94;
}

.prompt-zone > p:last-child {
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.3vw, 1.15rem);
}

.prompt-deck-button {
  display: grid;
  place-items: center;
  gap: 18px;
  border: 1px solid rgba(220, 196, 235, 0.14);
  border-radius: 10px;
  padding: clamp(10px, 1.2vw, 18px);
  color: var(--ink);
  background: rgba(10, 5, 15, 0.24);
  box-shadow: inset 0 12px 28px rgba(0, 0, 0, 0.24);
}

.prompt-deck-button .card-back {
  position: relative;
  width: clamp(120px, 12vw, 175px);
  aspect-ratio: 0.72;
  inset: auto;
}

/* Build phase */

.build-layout {
  display: grid;
  max-width: 1320px;
  grid-template-columns: clamp(142px, 12vw, 184px) minmax(0, 1fr) clamp(132px, 12vw, 176px);
  gap: clamp(12px, 1.5vw, 24px);
  align-items: stretch;
}

.prompt-column {
  min-width: 0;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
  align-self: start;
  padding: 6px 0;
}

.prompt-column .game-card {
  --card-width: clamp(126px, 10vw, 160px);
}

.effect-log {
  width: 100%;
  display: grid;
  gap: 7px;
  border-left: 2px solid var(--magenta);
  padding: 5px 7px;
  color: #dcd8f5;
  font-size: clamp(0.64rem, 0.72vw, 0.8rem);
  background: transparent;
}

.pitch-assembly {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: clamp(10px, 1.2vw, 18px) 0;
}

.assembly-header {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 2px;
}

.assembly-header strong {
  overflow: hidden;
  font-size: clamp(1rem, 1.4vw, 1.45rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assembly-slots {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 1.6vw, 24px);
  overflow: hidden;
}

.assembly-slots .game-card,
.ghost-card {
  width: clamp(106px, 9vw, 176px);
  aspect-ratio: 0.72;
}

.ghost-card {
  display: grid;
  place-items: center;
  border: 1px solid rgba(225, 204, 238, 0.28);
  border-radius: 8px;
  color: #c4b4ce;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.submission-meter {
  min-width: 0;
  align-self: start;
  display: grid;
  gap: 8px;
  align-self: start;
  padding: 7px 0;
}

.submission-meter h2 {
  margin: 0;
  color: var(--cyan);
  font-size: clamp(2.1rem, 3.5vw, 3.8rem);
  line-height: 0.9;
}

.pitch-lock-list {
  display: grid;
  gap: 3px;
}

.lock-row {
  min-width: 0;
  min-height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid rgba(220, 196, 235, 0.16);
  border-radius: 0;
  padding: 5px 1px;
  background: transparent;
}

.lock-row.done {
  border-color: rgba(114, 228, 255, 0.68);
  animation: lock-flash 420ms ease both;
}

.lock-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lock-row strong {
  color: var(--cyan);
  font-size: 0.76rem;
}

.hand-rail {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  gap: 7px;
  padding: 9px 11px;
  overflow: hidden;
  border: 0;
  border-top: 4px solid #0a080d;
  border-radius: 0 0 var(--radius) var(--radius);
  background: #100d17;
  box-shadow: inset 0 1px 0 rgba(223, 197, 239, 0.12), 0 12px 28px rgba(0, 0, 0, 0.32);
}

.hand-toolbar {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(130px, 15vw, 210px) minmax(180px, 1fr) clamp(130px, 16vw, 220px);
  gap: 8px;
  width: min(1320px, 100%);
  margin-inline: auto;
}

.builder-status {
  min-width: 0;
  display: grid;
  align-content: center;
  border: 0;
  border-left: 2px solid var(--magenta);
  border-radius: 0;
  padding: 5px 10px;
  background: transparent;
}

.builder-status span {
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 900;
  text-transform: uppercase;
}

.builder-status strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pitch-notes,
.lock-button {
  height: 100%;
  min-height: 0;
}

.hand-groups {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 18px);
  overflow: hidden;
  width: min(1320px, 100%);
  margin-inline: auto;
}

.hand-group {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 15px minmax(0, 1fr);
}

.hand-group h3 {
  margin: 0;
  color: #d8badf;
  font-size: 0.62rem;
  text-transform: uppercase;
}

.card-fan {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: clamp(3px, 0.55vw, 9px);
  overflow: hidden;
  padding: 5px 3px 2px;
}

.hand-rail .game-card {
  width: min(30%, 122px);
  max-height: 100%;
  padding: 7px;
  gap: 3px;
}

.hand-rail .game-card strong {
  font-size: clamp(0.58rem, 0.7vw, 0.82rem);
}

.hand-rail .game-card p {
  font-size: clamp(0.5rem, 0.56vw, 0.66rem);
  -webkit-line-clamp: 2;
}

.hand-rail .game-card em {
  display: none;
}

.hand-rail .game-card.required em {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: 6px;
  display: block;
  width: max-content;
  max-width: calc(100% - 12px);
  color: #120819;
  background: var(--magenta);
}

.spectator-hand {
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: 6px 12px;
  border-top-width: 2px;
  text-align: center;
}

.spectator-hand > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spectator-hand .eyebrow {
  padding-right: 10px;
  border-right: 1px solid var(--line);
}

/* Pitching */

.pitching-layout {
  display: grid;
}

.active-pitch {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 1.3vw, 18px);
  padding: clamp(6px, 0.8vw, 12px) clamp(8px, 1vw, 16px);
}

.pitch-title-row {
  min-width: 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.pitch-title-row h2 {
  max-width: 70vw;
  margin: 5px 0 0;
  overflow: hidden;
  font-size: clamp(2.35rem, 4.3vw, 5.1rem);
  line-height: 0.88;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-dial {
  --timer-color: var(--cyan);
  flex: 0 0 auto;
  width: clamp(92px, 8.5vw, 138px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #07101e;
  background:
    conic-gradient(var(--timer-color) var(--timer-angle), rgba(131, 119, 212, 0.2) 0),
    #261733;
  box-shadow: inset 0 0 0 10px rgba(9, 5, 13, 0.78), 0 8px 0 rgba(0, 0, 0, 0.3);
}

.timer-dial span {
  font-size: clamp(2rem, 3vw, 3.3rem);
  font-weight: 950;
  line-height: 0.8;
}

.timer-dial small {
  color: #07101e;
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}

.timer-dial.urgent {
  --timer-color: #ffca63;
  animation: timer-urgent 850ms ease-in-out infinite;
}

.timer-dial.critical {
  --timer-color: var(--danger);
  animation: timer-critical 460ms ease-in-out infinite;
}

.pitch-body {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(180px, 16vw, 250px);
  gap: clamp(16px, 2vw, 30px);
  align-items: center;
}

.pitch-card-stage {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 0;
  padding: clamp(8px, 1vw, 16px);
}

.pitch-card-stage .game-card {
  --card-width: clamp(132px, 11vw, 206px);
}

.pitch-assignment {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
  align-self: center;
  padding: 8px 0 8px clamp(10px, 1.2vw, 18px);
  border: 0;
  border-left: 1px solid rgba(220, 196, 235, 0.2);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pitch-assignment .game-card {
  --card-width: clamp(140px, 10vw, 190px);
}

.notes-strip {
  width: min(760px, 100%);
  margin: 7px 0 0;
  border-left: 3px solid var(--magenta);
  padding: 8px 11px;
  color: #e1dcf8;
  background: transparent;
  font-size: 0.8rem;
}

.pitch-actions {
  width: min(590px, 100%);
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(100px, 0.55fr) minmax(130px, 0.74fr);
  gap: 9px;
  justify-self: end;
}

.pitch-actions button {
  min-height: 46px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Judging */

.judging-layout {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(8px, 1vw, 14px);
}

.judging-header h2 {
  margin: 5px 0 0;
  overflow: hidden;
  font-size: clamp(1.65rem, 3vw, 3.5rem);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.judging-header h2 strong {
  color: var(--cyan);
}

.judge-tabs {
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.judge-tabs button {
  min-width: 110px;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(18, 11, 25, 0.68);
}

.judge-tabs button.active {
  border-color: var(--cyan);
  background: #352044;
  box-shadow: inset 0 -3px rgba(6, 3, 10, 0.24);
}

.judge-tabs span {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.judge-tabs strong {
  color: var(--cyan);
}

.judge-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: stretch;
}

.judge-nav {
  align-self: center;
  width: 46px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #1d1426;
  color: var(--cyan);
  font-size: 2.2rem;
  line-height: 1;
}

.judge-option {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: clamp(8px, 1vw, 16px);
  background: transparent;
  animation: panel-enter 220ms ease both;
}

.judge-option-header {
  min-width: 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.judge-option h3 {
  margin: 3px 0 0;
  overflow: hidden;
  font-size: clamp(1.45rem, 2.2vw, 2.7rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.judge-prompt .game-card {
  --card-width: clamp(108px, 8vw, 142px);
}

.judge-option .submission-cards {
  min-height: 0;
  align-self: center;
}

.judge-option .submission-cards .game-card {
  --card-width: clamp(126px, 10.5vw, 190px);
}

.judge-option > .primary-action {
  width: min(430px, 100%);
  min-height: 48px;
  justify-self: center;
}

/* Game over */

.gameover-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(330px, 1.3fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(14px, 2vw, 28px);
  padding: clamp(12px, 2vw, 28px);
}

.winner-moment {
  align-self: center;
}

.winner-moment h2 {
  margin: 4px 0 10px;
  color: var(--cyan);
  font-size: clamp(3rem, 7vw, 7rem);
  line-height: 0.88;
}

.standings-list {
  min-height: 0;
  display: grid;
  align-content: center;
  gap: 7px;
}

.standing-row,
.score-row,
.local-user-row {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #18111f;
}

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

.standing-row em,
.score-row em {
  color: var(--cyan);
  font-style: normal;
}

.won-prompts {
  grid-column: 1 / -1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  overflow: auto;
}

.won-prompts section {
  min-width: 0;
}

.won-prompts h3 {
  margin: 0 0 6px;
  font-size: 0.85rem;
}

.gameover-layout > .primary-action {
  grid-column: 1 / -1;
  width: min(420px, 100%);
  justify-self: center;
}

/* Prompt effect resolution */

.effect-resolution-scrim {
  position: fixed;
  z-index: 45;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 42px);
  background: rgba(5, 3, 8, 0.88);
}

.effect-resolution {
  width: min(920px, 100%);
  max-height: min(700px, 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(16px, 2vw, 28px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: clamp(20px, 2.6vw, 36px);
  background-color: #21122f;
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 0.7px, transparent 0.8px);
  background-size: 8px 8px;
  box-shadow: 0 24px 70px rgba(1, 2, 14, 0.58);
  animation: panel-enter 220ms ease both;
}

.effect-resolution-header,
.effect-resolution-footer {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.effect-resolution-header h2 {
  max-width: 720px;
  margin: 5px 0 0;
  font-size: clamp(1.8rem, 3.4vw, 3.4rem);
  line-height: 0.96;
}

.effect-resolution-header > span {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--cyan);
  background: #18111f;
  font-size: 0.72rem;
  font-weight: 850;
}

.effect-resolution-body {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(190px, 26vw, 280px);
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
}

.effect-source {
  min-width: 0;
  display: grid;
  gap: 10px;
  border-left: 3px solid var(--magenta);
  padding: 10px 0 10px 16px;
}

.effect-source > strong {
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  line-height: 1.05;
}

.effect-source > p:not(.eyebrow) {
  margin: 0;
  color: #ddd9f4;
  font-size: clamp(0.86rem, 1.1vw, 1rem);
  line-height: 1.35;
}

.effect-source small {
  color: var(--cyan);
  font-weight: 800;
}

.effect-draw-stage {
  display: grid;
  place-items: center;
}

.effect-deck-button {
  display: grid;
  justify-items: center;
  gap: 14px;
  border: 1px solid rgba(220, 196, 235, 0.14);
  border-radius: 10px;
  padding: clamp(10px, 1.2vw, 18px);
  color: var(--ink);
  background: rgba(10, 5, 15, 0.24);
  box-shadow: inset 0 12px 28px rgba(0, 0, 0, 0.24);
}

.effect-deck-button .card-back {
  position: relative;
  inset: auto;
  width: clamp(125px, 14vw, 170px);
  aspect-ratio: 0.72;
  transition: transform 160ms ease, filter 160ms ease;
}

.effect-deck-button:hover .card-back,
.effect-deck-button:focus-visible .card-back {
  transform: translateY(-8px) rotate(2deg);
  filter: brightness(1.16);
}

.effect-resolution .game-card {
  --card-width: clamp(135px, 15vw, 180px);
}

.effect-resolution-footer {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.effect-resolution-footer p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #ddd9f4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.effect-resolution-footer .primary-action {
  flex: 0 0 min(230px, 38%);
}

/* Drawer */

.drawer-scrim {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  justify-content: end;
  background: rgba(2, 3, 15, 0.7);
}

.side-drawer {
  width: min(440px, 94vw);
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  padding: 18px;
  background: #0d1129;
  box-shadow: -18px 0 44px rgba(1, 2, 14, 0.45);
  animation: drawer-enter 180ms ease both;
}

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

.drawer-header h2 {
  margin: 4px 0 0;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.drawer-tabs button.active {
  border-color: var(--cyan);
  color: var(--cyan);
}

.drawer-footer {
  display: grid;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.drawer-footer .danger-link {
  min-height: 44px;
}

.drawer-list,
.rules-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 0;
  overflow: auto;
}

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

.score-row div,
.local-user-row div {
  min-width: 0;
  display: grid;
}

.score-row small,
.local-user-row small {
  color: var(--muted);
}

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

.user-stat-line {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: end;
  gap: 5px;
}

.user-stat-line span {
  border-radius: 999px;
  padding: 3px 6px;
  color: var(--cyan);
  background: #2a1936;
  font-size: 0.64rem;
}

.database-status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #18111f;
}

.database-status small {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric-tile {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #18111f;
}

.metric-tile span {
  color: var(--muted);
  font-size: 0.68rem;
}

.metric-tile strong {
  color: var(--cyan);
  font-size: 1.55rem;
}

.rules-list {
  padding-left: 24px;
}

.rules-list li {
  padding: 5px 0;
  color: #ddd9f4;
  line-height: 1.35;
}

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

/* Portrait guard */

.portrait-guard {
  display: none;
}

@media (orientation: portrait) and (max-width: 820px) {
  .portrait-guard.is-gameplay {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 26px;
    background: #0a0710;
  }

  .rotate-card {
    width: min(340px, 100%);
    text-align: center;
  }

  .rotate-card h1 {
    margin: 16px 0 8px;
    font-size: 2.4rem;
  }

  .rotate-card p {
    color: var(--muted);
  }

  .rotate-icon {
    width: 88px;
    height: 54px;
    margin: 0 auto;
    border: 4px solid var(--cyan);
    border-radius: 11px;
    animation: rotate-device 1.8s ease-in-out infinite;
  }
}

/* Landscape mobile */

@media (max-width: 980px) and (orientation: landscape), (min-width: 981px) and (max-height: 620px) and (orientation: landscape) {
  :root {
    --gap: 6px;
    --hand-h: clamp(160px, 42vh, 210px);
  }

  .lobby-screen {
    padding: 8px;
  }

  .intro-table {
    width: min(940px, 100%);
    min-height: calc(100dvh - 16px);
    grid-template-columns: minmax(0, 0.9fr) minmax(340px, 1.1fr);
    gap: 26px;
    padding: clamp(22px, 4vw, 40px);
  }

  .lobby-logo {
    width: min(520px, 100%);
    margin-bottom: 14px;
  }

  .deck-stack {
    display: none;
  }

  .game-screen,
  .game-screen.build {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 52px minmax(0, 1fr);
    padding: 6px;
  }

  .game-screen.build {
    grid-template-rows: 52px minmax(0, 1fr) var(--hand-h);
  }

  .game-screen.build.spectating-build {
    grid-template-rows: 52px minmax(0, 1fr) 48px;
  }

  .top-hud {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: 108px auto auto minmax(120px, 1fr) 124px;
    align-items: stretch;
    gap: 6px;
    padding: 4px;
  }

  .hud-brand {
    min-height: 0;
    padding: 5px 8px;
  }

  .hud-brand img {
    max-height: 32px;
  }

  .hud-cluster {
    display: contents;
  }

  .hud-pill,
  .studio-badge,
  .mobile-active-player {
    min-height: 0;
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  .mobile-active-player {
    display: grid;
    place-items: center;
    border: 0;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.025);
  }

  .studio-badge {
    display: none;
  }

  .studio-badge span,
  .mobile-active-player span {
    font-size: 0.56rem;
  }

  .studio-badge strong,
  .mobile-active-player strong {
    font-size: 0.78rem;
  }

  .hud-scores {
    display: none;
  }

  .network-pill {
    display: none;
  }

  .hud-actions {
    display: flex;
    gap: 4px;
    margin: 0;
  }

  .hud-actions button {
    min-height: 42px;
    min-width: 58px;
    padding: 0 6px;
    font-size: 0.68rem;
  }

  .hud-actions .leaderboard-button {
    font-size: 0.6rem;
  }

  .card-table {
    grid-column: 1;
    grid-row: 2;
    padding: 8px 10px;
  }

  .game-screen.build .card-table {
    grid-row: 2;
  }

  .hand-rail {
    grid-column: 1;
    grid-row: 3;
    grid-template-rows: 44px minmax(0, 1fr);
    gap: 5px;
    padding: 7px 9px;
  }

  .hand-toolbar {
    grid-template-columns: minmax(96px, 0.18fr) minmax(0, 1fr) minmax(112px, 0.2fr);
    gap: 7px;
  }

  .builder-status {
    padding: 3px 7px;
  }

  .builder-status span {
    display: none;
  }

  .builder-status strong,
  .pitch-notes,
  .lock-button {
    font-size: 0.72rem;
  }

  .pitch-notes {
    padding: 5px 7px;
  }

  .hand-groups {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 0;
    overflow: visible;
    padding: 3px 0 0;
  }

  .hand-group {
    display: contents;
  }

  .hand-group h3 {
    display: none;
  }

  .card-fan {
    display: contents;
  }

  .hand-rail .game-card {
    width: clamp(72px, 9.2vw, 86px);
    margin-left: -6px;
    padding: 6px;
    gap: 2px;
    border-radius: 6px;
  }

  .hand-rail .game-card .card-type {
    font-size: 0.52rem;
  }

  .hand-rail .game-card strong {
    font-size: clamp(0.6rem, 1vw, 0.72rem);
    max-height: calc(1.1em * 2);
  }

  .hand-rail .game-card p {
    display: block;
    font-size: clamp(0.52rem, 0.78vw, 0.6rem);
    line-height: 1.1;
    max-height: calc(1.1em * 2);
  }

  .waiting-layout {
    grid-template-columns: 0.65fr 1.25fr 0.9fr;
    gap: 10px;
    padding: 8px;
  }

  .room-code-block h2 {
    font-size: 3rem;
  }

  .seats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .seat-chip {
    padding: 6px;
  }

  .seat-chip button {
    display: none;
  }

  .host-panel {
    gap: 5px;
    padding: 8px;
  }

  .host-panel input,
  .host-panel button {
    min-height: 44px;
    font-size: 0.72rem;
  }

  .round-control {
    grid-template-columns: 44px 1fr 44px;
    gap: 5px;
  }

  .draw-layout {
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 20px;
    padding: 14px 28px;
  }

  .prompt-zone h2 {
    font-size: clamp(1.8rem, 5vw, 3.2rem);
  }

  .prompt-deck-button .card-back {
    width: 92px;
  }

  .build-layout {
    grid-template-columns: 116px minmax(0, 1fr) 118px;
    gap: 8px;
  }

  .prompt-column {
    gap: 5px;
    padding: 5px;
  }

  .prompt-column .game-card {
    --card-width: 100px;
    padding: 6px;
  }

  .effect-log {
    display: none;
  }

  .pitch-assembly {
    gap: 5px;
    padding: 4px 6px;
  }

  .assembly-header strong {
    font-size: 0.76rem;
  }

  .assembly-slots {
    gap: 6px;
  }

  .assembly-slots .game-card,
  .ghost-card {
    width: clamp(72px, 10.5vw, 98px);
  }

  .ghost-card {
    font-size: 0.48rem;
  }

  .submission-meter {
    gap: 5px;
    padding: 5px 0 5px 7px;
  }

  .submission-meter h2 {
    font-size: 1.65rem;
  }

  .pitch-lock-list {
    gap: 3px;
  }

  .lock-row {
    min-height: 28px;
    padding: 4px 6px;
    font-size: 0.58rem;
  }

  .active-pitch {
    gap: 7px;
    padding: 3px 5px;
  }

  .pitch-title-row h2 {
    margin-top: 2px;
    font-size: clamp(1.55rem, 4vw, 2.45rem);
  }

  .timer-dial {
    width: clamp(58px, 7.5vw, 74px);
    box-shadow: inset 0 0 0 6px rgba(9, 5, 13, 0.78), 0 4px 0 rgba(0, 0, 0, 0.3);
  }

  .timer-dial span {
    font-size: 1.35rem;
  }

  .timer-dial small {
    font-size: 0.44rem;
  }

  .pitch-body {
    grid-template-columns: minmax(0, 1fr) 124px;
    gap: 8px;
  }

  .pitch-card-stage .game-card {
    --card-width: clamp(82px, 11vw, 112px);
    padding: 6px;
  }

  .pitch-card-stage .game-card strong,
  .judge-option .game-card strong {
    font-size: clamp(0.56rem, 1.1vw, 0.72rem);
    max-height: calc(1.1em * 2);
  }

  .pitch-card-stage .game-card p,
  .judge-option .game-card p {
    display: block;
    font-size: clamp(0.46rem, 0.74vw, 0.56rem);
    line-height: 1.08;
    max-height: calc(1.08em * 2);
  }

  .pitch-assignment {
    gap: 4px;
    padding: 6px;
  }

  .pitch-assignment .game-card {
    --card-width: clamp(92px, 12vw, 112px);
    padding: 5px;
  }

  .pitch-assignment .game-card p {
    display: block;
    font-size: clamp(0.48rem, 0.76vw, 0.58rem);
    line-height: 1.1;
    max-height: calc(1.1em * 2);
  }

  .pitch-assignment .game-card em {
    display: none;
  }

  .pitch-actions {
    width: min(470px, 68%);
    grid-template-columns: 1fr 0.52fr 0.72fr;
    gap: 5px;
  }

  .pitch-actions button,
  .judge-option > .primary-action {
    min-height: 44px;
    padding: 0 8px;
    font-size: 0.7rem;
  }

  .judging-layout {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
  }

  .judging-header h2 {
    font-size: clamp(1.1rem, 3vw, 1.65rem);
  }

  .judge-tabs {
    display: none;
  }

  .judge-tabs button {
    min-width: 0;
    min-height: 44px;
    flex: 1 1 0;
    padding: 3px 6px;
    font-size: 0.62rem;
  }

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

  .judge-nav {
    width: 44px;
    min-height: 44px;
    font-size: 1.7rem;
  }

  .judge-option {
    gap: 6px;
    padding: 7px 9px;
  }

  .judge-option h3 {
    font-size: 1.2rem;
  }

  .judge-option .submission-cards .game-card {
    --card-width: clamp(72px, 8.8vw, 94px);
    padding: 6px;
  }

  .judge-prompt .game-card {
    --card-width: 92px;
    padding: 5px;
  }

  .judge-prompt .game-card p {
    display: block;
    font-size: 0.46rem;
    line-height: 1.06;
    max-height: calc(1.06em * 2);
  }

  .judge-prompt .game-card em {
    display: none;
  }

  .gameover-layout {
    grid-template-columns: 0.7fr 1.3fr;
    gap: 8px;
    padding: 7px;
  }

  .winner-moment h2 {
    font-size: clamp(2rem, 6vw, 3.8rem);
  }

  .standing-row {
    padding: 6px 8px;
    font-size: 0.7rem;
  }

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

  .side-drawer {
    width: min(500px, 60vw);
    padding: 12px;
  }

  .drawer-tabs {
    gap: 8px;
  }

  .drawer-tabs button,
  .drawer-header button {
    min-height: 44px;
    font-size: 0.72rem;
  }

  .spectator-hand {
    padding: 5px 10px;
  }

  .spectator-hand > div {
    gap: 8px;
  }

  .effect-resolution-scrim {
    padding: 8px;
  }

  .effect-resolution {
    width: min(820px, 100%);
    height: 100%;
    gap: 8px;
    padding: 10px 14px;
  }

  .effect-resolution-header h2 {
    margin-top: 2px;
    font-size: clamp(1.2rem, 3.4vw, 1.8rem);
  }

  .effect-resolution-header > span {
    padding: 4px 7px;
    font-size: 0.58rem;
  }

  .effect-resolution-body {
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 16px;
  }

  .effect-source {
    gap: 5px;
    padding: 5px 0 5px 10px;
  }

  .effect-source > strong {
    font-size: clamp(0.92rem, 2.3vw, 1.25rem);
  }

  .effect-source > p:not(.eyebrow),
  .effect-source small {
    font-size: 0.66rem;
  }

  .effect-deck-button {
    gap: 6px;
    font-size: 0.68rem;
  }

  .effect-deck-button .card-back {
    width: 82px;
  }

  .effect-resolution .game-card {
    --card-width: 90px;
    padding: 6px;
  }

  .effect-resolution .game-card strong {
    font-size: 0.64rem;
  }

  .effect-resolution .game-card p {
    font-size: 0.5rem;
    -webkit-line-clamp: 2;
  }

  .effect-resolution-footer {
    padding-top: 7px;
  }

  .effect-resolution-footer p {
    font-size: 0.64rem;
  }

  .effect-resolution-footer .primary-action {
    min-height: 40px;
    font-size: 0.66rem;
  }
}

@media (max-width: 760px) {
  .intro-table {
    grid-template-columns: 1fr;
    align-items: center;
  }

  .deck-stack {
    display: none;
  }
}

/* Extra-short phone landscapes need a height-led table card size. */
@media (max-height: 430px) and (orientation: landscape) {
  .assembly-slots .game-card,
  .ghost-card {
    width: clamp(66px, 8.5vw, 74px);
  }
}

/* Motion */

@keyframes card-deal {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes selected-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.13); }
}

@keyframes lock-flash {
  0% { transform: scale(0.97); }
  55% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@keyframes panel-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drawer-enter {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes timer-urgent {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

@keyframes timer-critical {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.055); filter: brightness(1.18); }
}

@keyframes rotate-device {
  0%, 25% { transform: rotate(90deg); }
  65%, 100% { transform: rotate(0); }
}

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

/* Desktop card contract: keep every text layer on the real card width. */
@media (min-width: 981px) and (min-height: 621px) {
  .game-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .game-card > .card-copy,
  .game-card > .card-type,
  .game-card > strong,
  .game-card > p {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
    justify-self: stretch !important;
    align-self: stretch !important;
  }

  .game-card > .card-copy {
    position: absolute !important;
    z-index: 2 !important;
    top: 11% !important;
    right: 10% !important;
    bottom: 10% !important;
    left: 10% !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    flex: none !important;
    text-align: left !important;
  }

  .game-card > .card-copy > .card-type,
  .game-card > .card-copy > strong,
  .game-card > .card-copy > p {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    align-self: auto !important;
  }

  .game-card > .card-copy > strong,
  .game-card > strong {
    overflow: visible !important;
    max-height: none !important;
    margin-top: 8px !important;
  }

  .game-card > .card-copy > p,
  .game-card > p {
    overflow: visible !important;
    max-height: none !important;
    margin-top: 12px !important;
  }

  .game-card > em {
    position: relative !important;
    z-index: 3 !important;
    margin-top: auto !important;
  }
}
