:root {
  --ink: #182452;
  --blue: #2948cd;
  --blue-dark: #223bad;
  --paper: #f5f5ed;
  --ice: #e8ebf6;
  --yellow: #edeead;
  --coral: #f58b79;
  --muted: #6b7390;
  color-scheme: light;
  --table: var(--blue);
  --card-stock: var(--paper);
  --card-back: #2039a7;
  --back-edge: #d9dff9;
  --back-eyes: var(--back-edge);
  --on-accent: var(--ink);
  --on-primary: white;
  --active-seat: var(--paper);
  --control-line: #18245230;
  --control-hover: #ffffff70;
  --input-focus: #ffffff50;
  --popover: white;
  --result-row: #ffffff70;
  --winner-muted: #575f75;
  --log-text: #505b80;
  --error: #a72b36;
  --zero-ink: #9b4f3e;
  --zero-stock: #f8d4c9;
  --peek-own-ink: #486e65;
  --peek-alien-ink: #79627c;
  --role-base: white;
  --hero-back: var(--blue);
  --hero-edge: var(--paper);
  --deck-edge: #bac5f1;
  --deck-shadow: #1b3190;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  color: var(--ink);
  background: var(--ice);
  font-synthesis: none;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ice: #111829;
  --paper: #202c41;
  --ink: #f0f1e9;
  --muted: #a8b4ca;
  --blue: #b1bfff;
  --blue-dark: #c5cfff;
  --yellow: #e5dfa6;
  --coral: #f2a594;
  --table: #1b2947;
  --card-stock: #33435b;
  --card-back: #293f6c;
  --back-edge: #849bc5;
  --back-eyes: #c6d4ec;
  --on-accent: #1a2440;
  --on-primary: #172240;
  --active-seat: #d9e2f6;
  --control-line: #5e6c85;
  --control-hover: #2a3750;
  --input-focus: #1a253a;
  --popover: var(--paper);
  --result-row: var(--paper);
  --winner-muted: #49516a;
  --log-text: #c0cade;
  --error: #ffa99b;
  --zero-ink: #ffd1bf;
  --zero-stock: #644044;
  --peek-own-ink: #a0beb4;
  --peek-alien-ink: #c1adc5;
  --role-base: var(--paper);
  --hero-back: #324e85;
  --hero-edge: #728bb3;
  --deck-edge: #8093b6;
  --deck-shadow: #15233c;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  cursor: var(--local-arrow-cursor, default);
}
button,
input {
  font: inherit;
}
button, a[href], [role="button"] {
  cursor: var(--local-hand-cursor, pointer);
}
button:disabled {
  cursor: var(--local-arrow-cursor, default);
}
:is(input:not([type]), input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="number"], input[type="tel"], input[type="url"]), textarea, [contenteditable="true"] {
  cursor: text;
}
button {
  border: 0;
}
button,
input {
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 5px;
}
button {
  color: inherit;
}
input {
  min-width: 0;
}
button .icon {
  flex: none;
}
.icon {
  width: 22px;
  height: 22px;
  vertical-align: middle;
}
.cat {
  width: 100%;
  height: 100%;
}
button {
  transition:
    background 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}
button:not(:disabled):active {
  transform: translateY(2px);
}
.primary,
.secondary {
  min-height: 58px;
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-size: 17px;
  font-weight: bold;
}
.primary {
  background: var(--blue);
  color: var(--on-primary);
}
.primary:not(:disabled):hover {
  background: var(--blue-dark);
}
.secondary {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--control-line);
}
.secondary:hover {
  background: var(--control-hover);
}
.primary:disabled {
  opacity: 0.35;
}
.eyes {
  display: block;
  width: 78%;
  height: 38%;
  margin: auto;
}
/* The menu is a single invitation, with the deck as its only illustration. */
.menu {
  max-width: 1180px;
  min-height: 100svh;
  margin: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 70px 60px;
  gap: 70px;
}
.menu-content {
  grid-column: 1;
  grid-row: 1;
  z-index: 1;
}
.menu h1 {
  font-family: "Arial Black", Gato, sans-serif;
  font-size: clamp(80px, 10.5vw, 148px);
  letter-spacing: -0.085em;
  margin: 0 0 48px;
  line-height: 0.9;
  position: relative;
}
.title-dot {
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--coral);
  margin-left: 12px;
}
.fields {
  display: grid;
  gap: 13px;
}
.fields input {
  background: transparent;
  border: 1.5px solid var(--control-line);
  border-radius: 14px;
  padding: 19px 22px;
  width: 100%;
  font-size: 20px;
  color: var(--ink);
  height: 64px;
}
.fields input::placeholder {
  color: var(--muted);
}
.fields input:focus {
  background: var(--input-focus);
  border-color: var(--blue);
}
.play {
  margin-top: 20px;
  width: 100%;
  justify-content: space-between;
  font-size: 23px;
  min-height: 67px;
}
.play .icon {
  width: 28px;
  height: 28px;
}
.error {
  min-height: 22px;
  color: var(--error);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 0;
}
.menu-art {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  height: 480px;
}
.orbit {
  position: absolute;
  width: 460px;
  height: 460px;
  border: 1px solid color-mix(in srgb, var(--blue) 16%, transparent);
  border-radius: 50%;
  top: 20px;
  left: -10px;
}
.orbit:after {
  content: "";
  position: absolute;
  inset: 35px;
  border: 1px solid color-mix(in srgb, var(--blue) 9%, transparent);
  border-radius: 50%;
}
.hero-card {
  width: 230px;
  height: 270px;
  position: absolute;
  border-radius: 26px;
  box-shadow:
    0 18px 0 -8px #18245215,
    0 25px 45px #18245218;
  display: grid;
  place-items: center;
}
.hero-back {
  left: 0;
  top: 95px;
  background: var(--hero-back);
  color: var(--yellow);
  transform: rotate(-21deg);
  border: 8px solid var(--hero-edge);
}
.hero-back:after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid #edeead55;
  border-radius: 15px;
}
.hero-number {
  right: 0;
  top: 45px;
  background: var(--card-stock);
  color: var(--peek-alien-ink);
  color: var(--blue);
  transform: rotate(16deg);
}
.hero-number span {
  font-size: 145px;
  font-weight: bold;
  letter-spacing: -0.1em;
  margin-left: -12px;
}
.hero-cat {
  left: 95px;
  top: 180px;
  background: var(--yellow);
  transform: rotate(-4deg);
  color: var(--on-accent);
  padding: 33px;
}
.spark {
  position: absolute;
  color: var(--blue);
  font-size: 43px;
}
.spark-one {
  top: 4px;
  left: 70px;
  transform: rotate(12deg);
}
.spark-two {
  bottom: -5px;
  right: 5px;
  font-size: 65px;
  color: var(--coral);
}
.topbar {
  height: 88px;
  max-width: 1480px;
  padding: 0 40px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.wordmark {
  font-family: "Arial Black", Gato, sans-serif;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -2px;
  display: flex;
  align-items: center;
  gap: 17px;
}
.wordmark-eyes {
  display: inline-flex;
  width: 44px;
  height: 26px;
  color: var(--blue);
}
.wordmark-eyes .eyes {
  width: 100%;
  height: 100%;
}
.room-link {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  font-weight: bold;
  font-size: 16px;
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid var(--control-line);
  border-radius: 12px;
}
.room-link:hover {
  background: var(--control-hover);
}
.lobby {
  max-width: 640px;
  margin: 35px auto 65px;
  padding: 0 24px;
}
.lobby-mark {
  width: 94px;
  height: 94px;
  margin: 0 auto 35px;
  color: var(--blue);
}
.player-list {
  display: grid;
  gap: 9px;
}
.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border-radius: 16px;
  min-height: 64px;
  padding: 8px 17px 8px 10px;
  box-shadow: 0 3px 0 #18245208;
}
.role {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--player) 11%, var(--role-base));
  color: var(--player);
}
.role .icon {
  width: 25px;
  height: 25px;
}
.player-name {
  flex: 1;
  text-align: left;
  background: transparent;
  font-size: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bot-level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--player);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.bot-level input {
  width: clamp(40px, 10vw, 85px);
  padding: 0;
  height: 32px;
  accent-color: var(--player);
  cursor: var(--local-hand-cursor, pointer);
}
.bot-level output { min-width: 4ch; text-align: right; }
@media (max-width: 420px) {
  .player-row:has(.bot-level) { gap: 4px; padding-right: 8px; }
  .player-row:has(.bot-level) .points { min-width: 25px; }
  .player-row:has(.bot-level) .remove-player { width: 30px; }
}
.remove-player {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
}
.remove-player .icon {
  width: 17px;
  height: 17px;
}
.remove-player:hover {
  background: var(--control-hover);
  color: var(--ink);
}
.points {
  font-weight: bold;
  font-size: 23px;
  min-width: 50px;
  text-align: right;
}
.points small {
  font-size: 14px;
  color: var(--muted);
  margin-left: 4px;
}
.lobby-actions {
  display: flex;
  gap: 14px;
  margin-top: 30px;
}
.lobby-actions > * {
  flex: 1;
}
.ranked-toggle {
  width: 100%;
  margin-top: 10px;
}
.ranked-toggle[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--blue);
}
.ranked-toggle small, .lobby-rating, .rating-status {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.lobby-rating {
  white-space: nowrap;
}
/* Real DOM cards: responsive, focusable and usable with either tap or drag. */
.game-layout {
  max-width: 1480px;
  margin: auto;
  padding: 0 28px 18px;
}
.table {
  --hand-region-margin: 8px;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  background: var(--table);
  border-radius: 44px;
  padding: 25px 32px 24px;
  --table-min-height: calc(100svh - 180px);
  --table-bottom: 24px;
  display: grid;
  grid-template-rows: minmax(min-content, 1fr) auto;
  gap: 20px;
  isolation: isolate;
  overflow: clip;
  grid-template-columns: minmax(0, 1fr);
  box-shadow:
    inset 0 0 0 1px #ffffff20,
    0 8px 0 #1824520c;
}
.table:before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid #ffffff12;
  border-radius: 36px;
  pointer-events: none;
  z-index: -1;
}
.court {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, min(40%, 360px)) minmax(0, 1fr);
  grid-template-areas: "left piles right";
  column-gap: clamp(8px, 2vw, 32px);
  row-gap: 24px;
  align-items: center;
  min-width: 0;
}
.court:has(.seat-top) {
  grid-template-areas: "left north right" "left piles right";
  grid-template-rows: auto minmax(min-content, 1fr);
  row-gap: 24px;
}
.game-layout[data-count="2"] .court {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "north" "piles";
}
.opponents { display: contents; }
.seat-bank {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  align-items: center;
  justify-content: space-evenly;
  gap: clamp(6px, 1.4vh, 16px);
}
.seat-bank:empty { display: none; }
/* From the local seat, turns travel up the left, across the top, then down the right. */
.seat-left { grid-area: left; flex-direction: column-reverse; }
.seat-right { grid-area: right; }
.seat-top { grid-area: north; min-width: 0; display: grid; justify-items: center; }
.hand {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 12px;
  --card-size: 64px;
  --card-gap: 6px;
  /* Reserve both seven-card rows before the opening deal. */
  --columns: 7;
  --row-width: calc(
    var(--columns) * (var(--card-size) + var(--card-gap)) - var(--card-gap)
  );
}
.opponent {
  width: 100%;
  max-width: 420px;
}
.nameplate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  max-width: 100%;
  font-size: 14px;
  padding: 0 13px;
  border-radius: 30px;
  height: 32px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px #ffffff26;
}
.nameplate > span:nth-child(2) {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-dot,
.player-name::before,
.result-name::before,
.log-row::before {
  width: var(--mark-size, 10px);
  height: var(--mark-size, 10px);
  background: var(--player);
  clip-path: var(--mark);
}
.player-name::before, .result-name::before {
  content: "";
  display: inline-block;
  margin-right: .5em;
  vertical-align: .03em;
}
.player-dot {
  flex: none;
}
.hand.active .nameplate {
  background: var(--active-seat);
  color: var(--on-accent);
  box-shadow: 0 0 0 4px #ffffff20;
}
.nameplate .icon {
  width: 15px;
  height: 15px;
}
.hand-cards {
  width: var(--row-width);
  max-width: 100%;
}
.card-row {
  display: flex;
  /* A row must not stretch a card beyond its own aspect ratio. */
  align-items: flex-start;
  justify-content: center;
  gap: var(--card-gap);
  margin: 0 auto 6px;
  min-height: 0;
}
.card {
  /* Resolve these lengths on the painted children, against this card's
     actual width after a crowded row has shrunk it. */
  --card-radius: 12cqw;
  --ring-width: 2cqw;
  --hover-extra: 2cqw;
  --hover-rim: calc(3cqw + var(--hover-extra));
  position: relative;
  flex: none;
  width: var(--card-size, 100px);
  aspect-ratio: 1/1.12;
  /* A container cannot query its own width. Round the transparent input box
     with percentages; the painted surface uses the exact width below. */
  border-radius: 12% / 10.714286%;
  background: transparent;
  color: var(--ink);
  padding: 0;
  display: block;
  container-type: inline-size;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: none;
}
.card:not(:disabled):not([aria-disabled="true"]):not(.peek-only) {
  touch-action: none;
}
.card:not(:disabled):active {
  transform: none;
}
.card[aria-disabled="true"] {
  cursor: var(--local-arrow-cursor, default);
}
.hand-cards .card {
  /* Reserve paint space for the outside ring without shifting the hand slots. */
  --face-inset: 1cqw;
}
.card-surface {
  --surface-radius: max(0px, calc(var(--card-radius) - var(--face-inset, 0px)));
  position: absolute;
  inset: var(--face-inset, 0px);
  display: grid;
  place-items: center;
  border-radius: var(--surface-radius);
  overflow: hidden;
  background: var(--card-stock);
  box-shadow:
    0 3cqw 0 #13256940,
    0 5cqw 10cqw #14276418;
  transform-origin: top left;
  pointer-events: none;
}
.card.back {
  --rim: 3cqw;
}
.card.face > .card-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: var(--rim-extra, 0px) solid var(--back-edge);
  pointer-events: none;
}
.card.back > .card-surface {
  background: var(--back-edge);
  padding: var(--rim);
  color: var(--back-eyes);
}
.card.back:not(.empty-pile) > .card-surface::before {
  /* The exposed surface is the whole rim. Hover only insets the blue fill. */
  --inset: calc(var(--rim) + var(--rim-extra, 0px));
  content: "";
  position: absolute;
  inset: var(--inset);
  background: var(--card-back);
  border-radius: max(0px, calc(var(--surface-radius) - var(--inset)));
}
.card-eyes {
  position: relative;
  display: block;
  width: 82%;
  height: 46%;
  /* Blink the HTML wrapper, keeping external SVG paints centred together. */
  transform-origin: 50% 50%;
}
.card-eyes > .eyes {
  width: 100%;
  height: 100%;
  margin: 0;
}
.peek-fill {
  position: absolute;
  --inset: calc(var(--rim) + var(--rim-extra, 0px));
  inset: var(--inset);
  border-radius: max(0px, calc(var(--surface-radius) - var(--inset)));
  background: var(--player);
  visibility: hidden;
}
.peek-eyes {
  position: absolute;
  inset: 0;
  visibility: hidden;
}
/* Match the approved eye centres at x=34.92/65.08 in the 20..80 logo viewBox. */
.peek-eyes > i {
  position: absolute;
  top: 50%;
  left: 24.866667%;
  transform: translate(-50%, -50%);
  width: 40%;
  aspect-ratio: 1;
  background: currentColor;
  clip-path: var(--mark);
}
.peek-eyes > i:nth-child(2) { left: 75.133333%; }
@media (prefers-reduced-motion: reduce) {
  .card.back[data-peek-start] .peek-fill,
  .card.back[data-peek-start] .peek-eyes {
    visibility: visible;
  }
  .card.back[data-peek-start] .card-eyes {
    color: var(--on-accent);
  }
  .card.back[data-peek-start] .card-eyes > .eyes {
    visibility: hidden;
  }
}

.card .rank {
  font-size: 61cqw;
  font-weight: bold;
  line-height: 1;
  letter-spacing: -0.07em;
  transform: translateX(-0.03em);
}
.card.rank-10 .rank {
  transform: translateX(var(--ten-ink-offset, -.085em));
}
.corner {
  position: absolute;
  left: max(8%, calc(var(--card-radius) * 0.5));
  top: max(6%, calc(var(--card-radius) * 0.4));
  font-size: 14cqw;
  line-height: 1.1;
  font-weight: bold;
}
.corner.bottom {
  left: auto;
  top: auto;
  right: max(8%, calc(var(--card-radius) * 0.5));
  bottom: max(6%, calc(var(--card-radius) * 0.4));
  transform: rotate(180deg);
}
.card .power, .hero-number .power {
  position: absolute;
  left: 50%;
  bottom: 7%;
  transform: translateX(-50%);
  width: auto;
  height: 16%;
}
.rank-11 > .card-surface {
  background: var(--yellow);
  padding: 14%;
  color: var(--on-accent);
}
.rank-0 > .card-surface {
  color: var(--zero-ink);
  background: var(--zero-stock);
}
.card .mouse {
  width: 75%;
  height: 75%;
}
.rank-9,
.rank-10 {
  color: var(--blue);
}
.rank-5,
.rank-6 {
  color: var(--peek-own-ink);
}
.rank-7,
.rank-8 {
  color: var(--peek-alien-ink);
}
.card:focus-visible {
  outline: none;
}
.card:focus-visible > .card-surface {
  outline: var(--ring-width) solid var(--coral);
  outline-offset: 0;
}
.card:is(.target, .selected) > .card-surface {
  outline: var(--ring-width) dashed var(--yellow);
}
.card.selected > .card-surface {
  outline-style: solid;
}
.card.back.peekable:not(.target, [data-moving="deal"], [data-carried]) > .card-surface::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  pointer-events: none;
  inset: auto calc(50% - 6px) 6px;
  height: 2px;
  border: 0;
  background: color-mix(in srgb, var(--back-eyes) 60%, var(--card-back));
}
.cursor-regions {
  position: fixed;
  inset: 0;
  pointer-events: none;
  /* Inside the table's stacking context: above its fill, below all cards. */
  z-index: -1;
}
.cursor-region {
  position: absolute;
  border: 1px solid #ffffff12;
  pointer-events: none;
}
.cursor-region.notched { border: 0; }
.cursor-region > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: #ffffff12;
  stroke-width: 1;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .table:not([data-dragging]) .card:not(:disabled, [aria-disabled="true"], [data-moving]):hover {
    --rim-extra: var(--hover-extra);
  }
}
.card[data-over] {
  --rim-extra: var(--hover-extra);
}
/* The drop highlight matches the complete thickened rim of a hovered back. */
.discard-card.face[data-over] > .card-surface::after {
  border-width: var(--hover-rim);
}
.card[data-moving] {
  z-index: 3;
}
.card[data-carried] {
  z-index: 10;
}
.card[data-carried] > .card-surface {
  will-change: transform;
  outline: none;
  box-shadow: 0 9cqw 16cqw #09132f50;
}
.seat-dock:has([data-carried]) {
  z-index: 11;
}
.seat-dock:has([data-moving="draw"]):not(:has([data-carried])) {
  z-index: 3;
}
.card[data-carried]:before {
  content: "";
  position: absolute;
  inset: var(--face-inset, 0px);
  border: 1cqw dashed #ffffff65;
  border-radius: max(0px, calc(var(--card-radius) - var(--face-inset, 0px)));
  pointer-events: none;
}
.card[data-carried]:after {
  display: none;
}

.out .hand-cards {
  /* Quiet the ink without making physical cards see-through. */
  --back-edge: color-mix(in srgb, var(--muted) 55%, var(--table));
  --back-eyes: var(--muted);
}
.peek-progress {
  display: flex;
  gap: 4px;
}
.hand:not(:has(.card-row > .card:not([data-moving="deal"]))) .peek-progress {
  visibility: hidden;
}
.hand:has(.peek-progress) .card[data-moving] {
  pointer-events: none;
}
.hand:has(.peek-progress) .peekable[data-moving="shift"] > .card-surface {
  pointer-events: auto;
}
.peek-progress i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.5;
}
.peek-progress i.done {
  background: currentColor;
  opacity: 1;
}
.table-center {
  grid-area: piles;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 45px;
  position: relative;
  top: var(--stack-y, 0px);
  --card-size: 103px;
  padding: 5px 0 22px;
}
.deck-area,
.discard-area {
  position: relative;
}
.deck-card > .card-surface {
  box-shadow:
    2cqw 3cqw 0 var(--deck-edge),
    4cqw 6cqw 0 var(--deck-shadow);
}
.deck-dealer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--yellow);
}
.deck-dealer > svg {
  position: absolute;
  /* Match the deck's 3%-wide inset at its 1:1.12 aspect ratio. Keep the
     rig outside a containment layer so its paw can sit above the card. */
  inset: calc(3% / 1.12) 3%;
  width: 94%;
  height: calc(100% - 6% / 1.12);
  visibility: hidden;
  overflow: hidden;
  border-radius: calc(9% / .94) / calc(9% / 1.06);
}
.dealer-body {
  z-index: 2;
  background: var(--card-back);
}
.dealer-paw { z-index: 4; }
.dealer-turn { transform-origin: 50px 56px; }
.dealer-arm { transform-origin: 65px 66px; }

.deck-count {
  position: absolute;
  right: -20px;
  top: -15px;
  z-index: 5;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 13px;
  font-weight: bold;
  min-width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--on-accent);
}
.pile-caption {
  position: absolute;
  top: calc(100% + 20px);
  left: 0;
  right: 0;
  text-align: center;
  color: #d4dcff;
  font-size: 12px;
}
.empty-pile.back > .card-surface {
  background: transparent;
  border: var(--ring-width) dashed #ffffff55;
  box-shadow: none;
}
.empty-pile.back.target > .card-surface {
  border-color: transparent;
}
.empty-pile > .card-surface::after {
  content: "";
  position: absolute;
  inset: 3cqw;
  border-radius: max(0px, calc(var(--surface-radius) - 3cqw - var(--ring-width)));
  border: var(--ring-width) solid var(--pile-inner, transparent);
  pointer-events: none;
}
.empty-pile.target { --pile-ink: var(--yellow); }
@media (hover: hover) and (pointer: fine) {
  .table:not([data-dragging]) .discard-area:hover > .empty-pile { --pile-inner: var(--pile-ink, var(--back-edge)); }
}
.empty-pile:focus-visible, .empty-pile[data-over] { --pile-inner: var(--pile-ink, var(--back-edge)); }
.empty-pile[data-over] > .card-surface::after { border-width: var(--hover-rim); }
.empty-pile[data-over] > .card-surface {
  background: color-mix(in srgb, var(--yellow) 14%, transparent);
}
.discard-area { display: grid; }
.discard-area > .card { grid-area: 1 / 1; }
/* All pile layers paint in physical order, even when several are in flight. */
.discard-area:has([data-moving]) { z-index: 4; }
.discard-area > .card[data-moving] { z-index: auto; }
.pile-under, .pile-covered { pointer-events: none; }
.copied-card { left: max(4px, 5%); top: min(-3px, -4%); }
.held-area,
.turn-actions {
  grid-area: 1 / 1;
}
.seat-dock {
  position: relative;
  z-index: 1;
  grid-column: 3;
  justify-self: start;
  display: grid;
  align-items: center;
  justify-items: center;
  align-self: center;
  padding-top: 27px;
}

.table-button {
  min-height: 42px;
  padding: 10px 20px;
  background: var(--yellow);
  color: var(--on-accent);
  border-radius: 12px;
  font-size: 13px;
  font-weight: bold;
}
.table-button:disabled {
  opacity: 0.45;
}
.self-zone {
  --dock: 76px;
  display: grid;
  grid-template-columns: minmax(var(--dock), 1fr) minmax(0, max-content) minmax(
      var(--dock),
      1fr
    );
  justify-content: center;
  align-items: start;
  gap: 18px;
}
.held-area {
  --card-size: var(--dock);
}
.self {
  grid-column: 2;
  --card-size: 84px;
  --card-gap: 9px;
  min-width: 0;
  width: var(--row-width);
  max-width: 100%;
}
.self .nameplate {
  font-size: 16px;
}
.retired-cats {
  position: absolute;
  left: 30px;
  bottom: 28px;
  display: flex;
  color: var(--yellow);
  opacity: 0.65;
}
.retired-cats > .cat {
  width: 25px;
  height: 25px;
  margin-right: 3px;
}
.other-hold {
  --card-size: 19px;
}

.game-footer {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 25px;
  padding: 24px 13px 0;
}
.counters {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 13px;
  padding-top: 4px;
}
.counters b {
  color: var(--ink);
  font-size: 18px;
  margin-left: 5px;
}
.action-log {
  width: 340px;
  height: 100px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--control-line) transparent;
  font-size: 12px;
  line-height: 1.8;
  padding: 0 10px;
  overscroll-behavior: contain;
}
.log-row {
  position: relative;
  padding: 2px 0 2px 15px;
  margin-bottom: 3px;
  color: var(--log-text);
}
.shared-cursors {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: clip;
}
.remote-cursor {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transition: transform 70ms linear, opacity 100ms ease;
  will-change: transform, opacity;
}
.remote-cursor.visible { opacity: 1; }
body:has(.table[data-dragging]), body:has(.table[data-dragging]) * {
  cursor: var(--local-hand-cursor, pointer);
}
.remote-cursor.jump { transition: opacity 100ms ease; }
.cursor-glyph {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--player);
}
/* Each bitmap already matches its physical screen pixels. Avoid smoothing it
   again when fractional display scaling rounds a CSS box by a fraction. */
.cursor-art { display: block; width: 100%; height: 100%; background: 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.remote-cursor .cursor-hand, .remote-cursor[data-form="hand"] .cursor-arrow { display: none; }
.remote-cursor[data-form="hand"] .cursor-hand { display: block; }
.log-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: .72em;
  --mark-size: 8px;
}
.log-card {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 22px;
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  font-weight: bold;
  vertical-align: middle;
  box-shadow: 0 1px 2px #18245220;
}
.log-card :is(.cat, .mouse) {
  width: 18px;
  height: 18px;
}

.result-shade {
  position: fixed;
  inset: 0;
  background: #142354b8;
  backdrop-filter: blur(8px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 26px;
}
.results {
  background: var(--ice);
  border-radius: 28px;
  width: min(680px, 100%);
  padding: 28px 35px 35px;
  margin: auto;
  box-shadow: 0 30px 100px #12205250;
}
.result-cat {
  width: 58px;
  height: 58px;
  margin: auto;
  color: var(--blue);
}
.results h1 {
  text-align: center;
  font-size: 35px;
  letter-spacing: -2px;
  margin: 14px 0 25px;
}
.result-list {
  display: grid;
  gap: 6px;
}
.result-row {
  display: grid;
  grid-template-columns: 26px 1fr 95px 95px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--result-row);
  font-size: 20px;
}
.result-row.winner {
  background: var(--yellow);
  color: var(--on-accent);
  --muted: var(--winner-muted);
}
.result-name .result-accuracy {
  display: block;
  font-size: 11px;
  font-weight: normal;
  margin-top: 3px;
}
.analysis-toggle {
  margin-top: 14px;
}
.analysis-panel {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--result-row);
  font-size: 13px;
  line-height: 1.45;
}
.analysis-panel p {
  margin: 0 0 10px;
}
.analysis-panel p:last-child {
  margin-bottom: 0;
}
.analysis-panel ol {
  padding-left: 20px;
}
.analysis-panel li {
  margin: 10px 0;
}
.analysis-panel li small {
  display: block;
  font-size: 12px;
}
.analysis-status {
  font-size: 13px;
  margin: 14px 0 0;
}
.placing {
  font-size: 14px;
  color: var(--muted);
}
.result-name {
  font-weight: bold;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-name .icon {
  width: 16px;
  height: 16px;
  margin-left: 8px;
}
.result-name.is-ready {
  position: relative;
  padding-inline-end: 20px;
}
.ready-check {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
}
.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.result-actions .rematch-ready {
  grid-column: 1 / -1;
  grid-row: 1;
}
.rematch-ready {
  gap: .65em;
}
.rematch-ready small {
  font-variant-numeric: tabular-nums;
}
.rematch-ready[aria-pressed="true"] {
  background: var(--yellow);
  color: var(--on-accent);
}
.rematch-ready[aria-pressed="true"]:hover {
  background: var(--yellow);
}
.result-row small {
  font-size: 11px;
  color: var(--muted);
}

@media (min-width: 1000px) {
  .game-layout {
    max-width: 1760px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(180px, 18vw, 260px);
    grid-template-areas: "table activity" "counters activity";
    column-gap: 20px;
  }
  .game-layout > .table { grid-area: table; min-width: 0; }
  .game-footer { display: contents; }
  .counters { grid-area: counters; padding: 24px 13px 0; }
  .action-log {
    grid-area: activity;
    width: auto;
    height: auto;
    min-height: 0;
    max-height: calc(100svh - 112px);
    contain: size;
    align-self: stretch;
    position: sticky;
    top: 16px;
    padding: 12px 4px 12px 8px;
    font-size: 13px;
  }
  .game-layout[data-count="6"] .opponent,
  .game-layout[data-count="7"] .opponent {
    --card-size: 45px;
  }

}
@media (max-width: 999px) {
  .menu {
    padding: 45px;
    gap: 35px;
  }
  .menu-art {
    transform: scale(0.8);
    transform-origin: left center;
  }
  .menu h1 {
    font-size: 100px;
  }
  .table {
    --table-bottom: 22px;
    padding: 22px 24px;
  }
  .opponent { --card-size: clamp(36px, 5.6vw, 48px); }
  .game-layout[data-count="6"] .table,
  .game-layout[data-count="7"] .table {
    gap: 12px;
  }
  .card .rank {
    font-size: 61cqw;
  }
  .self {
    --card-size: 74px;
  }
  .table-center .rank {
    font-size: 61cqw;
  }
  .table-center {
    min-height: 175px;
  }
  .nameplate {
    font-size: 12px;
  }
}
@media (max-width: 1250px) {
  .court {
    grid-template-columns: minmax(0, 1fr) minmax(0, min(34%, 300px)) minmax(0, 1fr);
    column-gap: clamp(6px, 1.4vw, 24px);
  }
  .opponent { --card-gap: 3px; }
}
@media (max-width: 650px) {
  .menu {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 20px 30px 30px;
    justify-content: center;
    overflow: hidden;
  }
  .menu-art {
    width: 320px;
    height: 280px;
    transform: scale(0.67);
    transform-origin: center top;
    margin-bottom: -62px;
    flex: none;
  }
  .orbit {
    left: -53px;
    top: -15px;
  }
  .hero-back {
    left: -35px;
    top: 40px;
  }
  .hero-number {
    right: -35px;
    top: 5px;
  }
  .hero-cat {
    left: 45px;
    top: 110px;
  }
  .spark-one {
    top: -25px;
    left: 10px;
  }
  .spark-two {
    bottom: -100px;
    right: -40px;
  }
  .menu-content {
    width: 100%;
    max-width: 350px;
  }
  .menu h1 {
    font-size: 85px;
    text-align: center;
    margin: 0 0 30px;
  }
  .title-dot {
    width: 10px;
    height: 10px;
    margin-left: 10px;
  }
  .fields input {
    height: 58px;
    font-size: 18px;
  }
  .play {
    min-height: 59px;
    font-size: 20px;
  }
  .topbar {
    height: 72px;
    padding: 0 19px;
  }
  .wordmark {
    font-size: 26px;
  }
  .wordmark-eyes {
    width: 34px;
  }
  .room-link {
    font-size: 13px;
  }
  .lobby {
    margin: 24px auto;
    padding: 0 20px;
  }
  .lobby-mark {
    width: 80px;
    height: 80px;
    margin-bottom: 25px;
  }
  .primary,
  .secondary {
    padding: 13px 15px;
    font-size: 15px;
    gap: 10px;
    min-height: 52px;
  }
  .lobby-actions {
    gap: 10px;
  }
  .player-name {
    font-size: 18px;
  }
  .game-layout {
    padding: 0 10px 15px;
  }
  .table {
    border-radius: 25px;
    --hand-region-margin: 6px;
    padding: 18px 14px;
    gap: 17px;
    --table-min-height: calc(100svh - 155px);
    --table-bottom: 18px;
  }
  .table:before {
    inset: 4px;
    border-radius: 21px;
  }
  .opponent {
    --card-size: clamp(32px, 10vw, 43px);
    gap: 6px;
  }
  .game-layout[data-count="2"] .opponent { --card-size: 50px; }
  .court { column-gap: 6px; }
  .court:has(.seat-bank .hand) .table-center {
    --card-size: clamp(38px, 10vw, 65px);
    gap: clamp(10px, 2.2vw, 18px);
  }
  .court:has(.seat-bank .hand) .deck-count { right: 50%; transform: translateX(50%); }
  .hand {
    --card-gap: 4px;
  }
  .card-row {
    gap: var(--card-gap);
    margin-bottom: 4px;
  }
  .nameplate {
    font-size: 11px;
    padding: 0 8px;
    gap: 6px;
    height: 26px;
  }
  .nameplate > span:nth-child(2) {
    max-width: 100px;
  }
  .player-dot {
    --mark-size: 8px;
  }
  .table-center {
    --card-size: 76px;
    gap: 32px;
    min-height: 145px;
    padding-bottom: 25px;
  }
  .table-center .rank {
    font-size: 61cqw;
  }
  .deck-count {
    height: 25px;
    min-width: 25px;
    font-size: 11px;
    right: -15px;
    top: -12px;
  }
  .card .rank {
    font-size: 61cqw;
  }
  .self-zone {
    --dock: 54px;
    gap: 8px;
  }
  .held-card .rank {
    font-size: min(34px, 61cqw);
  }
  .self {
    --card-size: 65px;
    --card-gap: 6px;
  }
  .self .nameplate {
    font-size: 14px;
  }

  .table-button {
    padding: 7px 12px;
    min-height: 34px;
    font-size: 11px;
  }
  .retired-cats {
    left: 18px;
    bottom: 17px;
  }
  .retired-cats > .cat {
    width: 15px;
    height: 15px;
  }
  .game-footer {
    padding: 18px 8px 0;
    gap: 13px;
  }
  .counters {
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
    min-width: 62px;
  }
  .counters b {
    font-size: 15px;
  }
  .action-log {
    font-size: 11px;
    width: min(260px, 70vw);
    height: 85px;
    padding-right: 0;
  }
  .results {
    padding: 22px 16px;
    border-radius: 22px;
  }
  .result-shade {
    padding: 14px;
  }
  .results h1 {
    font-size: 29px;
  }
  .result-row {
    grid-template-columns: 19px 1fr 70px 70px;
    gap: 5px;
    font-size: 17px;
    padding: 10px 8px;
  }
  .result-name {
    font-size: 13px;
  }
  .result-name .icon {
    width: 13px;
    margin-left: 4px;
  }
  .result-row small {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
/* Keep text native and card numerals legible at every table size. */
:root {
  font-family: "Trebuchet MS", Verdana, sans-serif;
}
.table-center .card .rank {
  font-size: 61cqw;
}
.opponent .card .rank {
  font-size: min(36px, 61cqw);
}
.self .card .rank {
  font-size: min(50px, 61cqw);
}
/* Actual card width is planned for all fourteen cards from the first deal.
   Empty rows reserve exactly the same height as occupied rows. */
.game-layout .hand-cards .card, .hand-cards .card-row:empty::before {
  width: min(var(--card-size), calc((100% + var(--card-gap)) / var(--columns) - var(--card-gap)));
}
.hand-cards .card-row:empty::before {
  content: "";
  aspect-ratio: 1 / 1.12;
}
/* Screen size and seat count choose the plan; current hand lengths never do. */
@media (min-width: 651px) {
  .game-layout[data-count="7"] .opponent { --card-size: clamp(31px, 4.8svh, 45px); gap: 6px; }
  .game-layout[data-count="7"] .opponent .nameplate { height: 26px; }
  .game-layout[data-count="7"] .opponent .card-row { margin-bottom: 4px; }
}
@media (max-height: 800px) and (min-width: 651px) {
  .table {
    --table-min-height: min(630px, calc(100svh - 88px));
    --table-bottom: 14px;
    padding-block: 14px;
    gap: 12px;
  }
  .table-center { min-height: 130px; --card-size: 84px; }
  .self { --card-size: min(74px, 10svh); }
  .game-layout[data-count="5"] .opponent { --card-size: min(54px, 7svh); gap: 8px; }
}
@media (max-height: 760px) and (max-width: 650px) {
  body[data-screen="game"] .topbar { height: 48px; }
  .game-layout[data-count] .table {
    --table-min-height: min(580px, calc(100svh - 48px));
    --table-bottom: 10px;
    padding-block: 10px;
    gap: 10px;
  }
  .table-center { min-height: 102px; --card-size: 62px; }
  .pile-caption { top: calc(100% + 8px); }
  .self { --card-size: 54px; gap: 6px; }
  .game-layout .opponent { --card-size: clamp(27px, 5.4svh, 36px); gap: 4px; }
  .opponents .nameplate { height: 20px; }
  .opponents .card-row { margin-bottom: 2px; }
}

/* On short landscape tables, the side seats can use the space beside the local hand. */
@media (orientation: landscape) and (min-width: 540px) and (max-height: 700px) {
  body[data-screen="game"] .topbar { height: 48px; }
  .game-layout { padding-inline: 8px; }
  .game-layout[data-count] .table {
    --table-min-height: calc(100svh - 48px);
    --table-bottom: 8px;
    padding: 8px 10px;
    gap: 6px;
  }
  .table {
    grid-template-columns: minmax(0, 1fr) minmax(192px, 36%) minmax(0, 1fr);
    grid-template-rows: minmax(min-content, 1fr) auto;
    grid-template-areas: "left piles right" "left self right";
  }
  .table:has(.seat-top) {
    grid-template-rows: auto minmax(min-content, 1fr) auto;
    grid-template-areas: "left north right" "left piles right" "left self right";
  }
  .table .court { display: contents; }
  .table .self-zone { grid-area: self; }
  .game-layout .opponent { --card-size: clamp(28px, 7.3svh, 43px); --card-gap: 3px; gap: 2px; }
  .seat-bank { gap: 12px; }
  .opponents .card-row { min-height: 0; margin-bottom: 2px; }
  .table .nameplate { height: 20px; padding: 0 7px; font-size: 11px; }
  .court .table-center { --card-size: clamp(44px, 12svh, 76px); min-height: 0; gap: 18px; padding: 0 0 19px; }
  .pile-caption { top: calc(100% + 4px); }
  .self-zone { --dock: clamp(37px, 9svh, 64px); gap: 5px; }
  .self { --card-size: clamp(42px, 11svh, 74px); --card-gap: 4px; gap: 4px; }
  .self .card-row { margin-bottom: 3px; }
  .seat-dock { padding-top: 20px; }
  .table-button { padding-inline: 6px; font-size: 11px; }
}
@media (min-width: 540px) and (max-height: 420px) {
  .game-layout[data-count] .opponents .opponent { --card-size: clamp(25px, 7.3svh, 31px); }
  .court:has(.seat-bank .hand) .table-center { --card-size: clamp(44px, 12svh, 50px); }
  .opponents .card-row:last-child { margin-bottom: 0; }
}
/* Keep both sides available even when all seven seats hold fourteen cards. */
@media (max-width: 650px) {
  .court, .court:has(.seat-top) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "north north" "left right" "piles piles";
    grid-template-rows: auto auto minmax(min-content, 1fr);
    column-gap: 12px;
    row-gap: 12px;
  }
  .game-layout[data-count="2"] .court { grid-template-columns: minmax(0,1fr); grid-template-areas:"north" "piles"; }
  .seat-bank .hand { --card-gap: 3px; }
}
@media (max-width: 650px) and (orientation: portrait) {
  .game-layout:is([data-count="6"], [data-count="7"]) .opponent {
    --card-size: clamp(25px, 4svh, 30px);
    gap: 4px;
  }
  .game-layout:is([data-count="6"], [data-count="7"]) .opponent .nameplate { height: 22px; }
}
@media (max-width: 850px), (orientation: landscape) and (max-height: 700px) {
  .self-zone {
    grid-template-columns: minmax(0, 1fr);
    --dock: clamp(32px, 9svh, 44px);
  }
  .self-zone .self {
    grid-area: 1 / 1;
    justify-self: center;
  }
  .self-zone .self .nameplate {
    max-width: calc(100% - 2 * var(--dock));
    min-height: calc(var(--dock) * 1.12);
  }
  .self-zone .seat-dock {
    grid-area: 1 / 1;
    place-self: start end;
    padding: 0;
  }
}
@media (max-width: 650px) {
  .menu-art {
    margin-bottom: 0;
  }
}

/* Preferences remain reachable inside the results dialog and at the table. */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sound-toggle,
.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
}
.sound-toggle:hover,
.theme-toggle:hover {
  background: var(--control-hover);
}
.sound-toggle[aria-pressed="true"] {
  color: var(--muted);
}
.menu-preferences {
  position: absolute;
  top: 22px;
  right: 28px;
  z-index: 2;
}
@media (max-width: 650px) {
  .menu-preferences {
    top: 14px;
    right: 16px;
  }
  .header-controls {
    gap: 5px;
  }
}
.results {
  position: relative;
}
.results > .preferences {
  position: absolute;
  top: 14px;
  right: 14px;
}

.preferences {
  display: flex;
  align-items: center;
  gap: 2px;
}
.theme-toggle .sun,
:root[data-theme="dark"] .theme-toggle .moon {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .sun {
  display: block;
}
@media (max-width: 400px) {
  .topbar {
    gap: 6px;
    padding-inline: 10px;
  }
  .wordmark {
    gap: 5px;
  }
  .wordmark-eyes {
    display: none;
  }
  .header-controls,
  .header-controls .preferences {
    gap: 0;
  }
  .room-link {
    gap: 5px;
    padding-inline: 7px;
  }
}

/* Shared table dimensions follow the current responsive layout. */
.game-layout[data-count] > .table {
  min-height: var(--table-min-height);
  padding-bottom: var(--table-bottom);
}
.hints-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
}
.hints-toggle:hover { background: var(--control-hover); }
.hints-toggle[aria-pressed="true"] { color: var(--ink); background: var(--control-hover); }
@media (max-width: 400px) {
  .header-controls .preferences > button { width: 34px; height: 40px; padding: 7px; }
  .topbar .wordmark { font-size: 23px; }
}

@media (orientation: landscape) and (min-width: 540px) and (max-height: 700px) {
  .game-layout[data-count] .table { padding-top: 18px; padding-inline: 18px; --table-bottom: 18px; }
}
/* Short landscape keeps the edge breathing room without pushing the hand
   below the viewport; compact only the gaps between existing groups. */
@media (orientation: landscape) and (min-width: 540px) and (max-height: 420px) {
  .game-layout[data-count] .table { row-gap: 6px; column-gap: 0; }
  .self { gap: 1px; }
  .self .card-row:last-child { margin-bottom: 0; }
}
@media (orientation: landscape) and (min-width: 540px) and (max-height: 420px) {
  .seat-bank { gap: 6px; }
}

@media (orientation: landscape) and (min-width: 540px) and (max-height: 420px) {
  .deck-count { top: 0; right: -12px; height: 22px; min-width: 22px; font-size: 11px; }
}

.card-manual {
  width: min(440px, calc(100vw - 32px));
  max-height: min(720px, calc(100svh - 48px));
  margin: auto; padding: 0;
  border: 1px solid var(--control-line); border-radius: 20px;
  color: var(--ink); background: var(--popover);
  box-shadow: 0 20px 70px #0c153644;
  overflow: hidden;
}
.card-manual[open] { display: flex; flex-direction: column; }
.card-manual::backdrop { background: #0d163666; }
.manual-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 18px; border-bottom: 1px solid var(--control-line); }
.manual-header h2 { margin: 0; font-size: 18px; }
.manual-close { width: 34px; height: 34px; padding: 0; border-radius: 10px; font-size: 26px; color: var(--ink); background: transparent; }
.manual-close:hover { background: var(--control-hover); }
.manual-content { overflow-y: auto; overscroll-behavior: contain; padding: 0 18px; }
.manual-topic { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 14px; padding: 18px 0; }
.manual-topic + .manual-topic { border-top: 1px solid var(--control-line); }
.manual-topic h3 { margin: 0 0 8px; font-size: 14px; }
.manual-topic p { margin: 0; font-size: 13px; line-height: 1.5; }
.manual-topic p + p { margin-top: 8px; }
.manual-symbol { display: grid; justify-items: center; align-content: start; gap: 4px; padding-top: 2px; color: var(--ink); }
.manual-symbol b { font-size: 26px; line-height: 1; }
.manual-symbol > .cat, .manual-symbol > .mouse { width: 32px; height: 32px; }
.manual-symbol > .eyes { width: 32px; height: 18px; margin: 0; }
.manual-symbol > .power { position: static; width: auto; height: 18px; transform: none; }

/* While making room, input follows the painted card rather than its future slot. */
.card[data-moving="shift"]:not([data-carried]) { pointer-events: none; }
.card[data-moving="shift"]:not([data-carried]) > .card-surface { pointer-events: auto; }
