/* Card games — table, cards and chrome.
   Card artwork is inline SVG, so everything below tints geometry that already
   exists rather than shipping a second set of images. */

/* Full-height chain: the table claims whatever the window has left over after
   the header, nav, control bar and footer, and grows with the window.
   Scoped to .cards-page so the shared .Master layout is untouched elsewhere.
   min-height:0 on the flex children is what allows them to shrink rather than
   overflowing the viewport — without it a flex item refuses to go below its
   content size and the footer gets pushed off screen. */
/* main.css used to give body a 1px margin, which pushed a 100vh child 2px past
   the viewport and produced a permanent scrollbar. It is zero for every page
   now, so this margin:0 is belt and braces rather than a fix. */
.cards-page {
  margin: 0;
}

/* One line, not two. main.css gives every footer 3px 10px of padding and its
   children a margin; both are zeroed here so the strip costs one line of text
   and nothing else. Flex on the parent rather than display on the children, so
   the counter's `hidden` attribute still works — setting display on .page-hits
   itself would override it and leave a permanent "Visit —". */
.cards-page footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  padding: 2px 10px;
  margin: 0;
}

.build-tag,
.page-hits {
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: var(--footer-size);
  letter-spacing: 0.04em;
  opacity: 0.45;
  margin: 0;
}

.page-hits b { font-variant-numeric: tabular-nums; }

/* The separator belongs to the counter, not the build tag — when there is no
   count the element is gone and a trailing "·" would be left dangling. */
.page-hits::before { content: '· '; }

.cards-page .Master {
  min-height: 100vh;
  min-height: 100dvh;    /* accounts for mobile browser chrome */
  display: flex;
  flex-direction: column;
}

.cards-page .Master > section.games-shell {
  flex: 1;
  min-height: 0;
}

.games-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  /* No double-tap zoom anywhere in the game: a double tap on a card sends it
     home, and an iPhone would otherwise zoom instead. Pinch zoom still works.
     The table surface itself is touch-action: none; this covers the bar and
     the margins round the table, and any browser that honours only
     manipulation. */
  touch-action: manipulation;
}

/* ...and on the page round it too. An iPhone zooms on whatever is under the
   second tap, so a double tap that lands just off the game still zoomed the
   page. Pinch zoom is untouched. js/games/cards/table.js cancels the second
   tap on the table itself as well, for an iPhone that ignores this. */
html:has(body.cards-page) {
  touch-action: manipulation;
}

/* --------------------------------------------------- the line along the top

   What is on the table and the score, in one line over it: handheld mode
   (js/games/arcade/handheld.js). It took over from a bar of buttons, whose
   buttons went to the dock along the bottom and into Menu. Dark, in the card
   games' own colours rather than the site theme's: it sits on the frame round
   the felt. */

.cards-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 2px 8px;
  color: #e8e8ee;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color-scheme: dark;
}

.cards-top__deal {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  white-space: nowrap;
}

.cards-top__score {
  display: flex;
  gap: 16px;
  white-space: nowrap;
}

.cards-top__score b { color: #f3c96b; }

/* The purse: a running total across every deal ever won, not a number about
   the game on the table. */
.cards-top__coins { opacity: 0.85; }

/* A phone has room for the deal and the score. Best and the coins are in My
   record and on the screen after a deal. */
@media (max-width: 560px) {
  .cards-top { font-size: 0.85rem; padding: 2px 10px; }
  .cards-top__best,
  .cards-top__coins { display: none; }
}

.deal-chip__suit { color: #f3c96b; }
.deal-chip__sep { opacity: 0.6; font-weight: 400; }

/* How hard the deal on the table is. A quiet pill rather than a colour scale:
   the bands are a ranking, not a warning, and five severity colours next to
   the gold suit would turn the line into a traffic light. */
.deal-chip__band {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: #4a3740;
  color: #f0dfe3;
}


/* ---------------------------------------------------- the dock, on the dark

   css/games/handheld.css draws the dock in the site's theme; on the card
   table it is the bar's old colours, gold where it is pointed at. */

.games-shell .hh-dock button {
  border-color: #4a4a55;
  background: #2a2a31;
  color: #f0f0f5;
}

.games-shell .hh-dock button:hover:not(:disabled) {
  border-color: #f3c96b;
  background: #35353e;
}

.games-shell .hh-dock button:disabled { color: #9a9aa6; }
.games-shell .hh-dock button:focus-visible { outline-color: #f3c96b; }


/* Feedback for the keyboard shortcuts, whose controls are not on the screen.
   Inside the viewport rather than the site's .toast-host, because full screen
   renders only .games-shell — anything appended outside it would be invisible
   exactly when the keys are the only way to act. */
.table-flash {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  padding: 7px 18px;
  border-radius: 999px;
  background: rgb(16 16 20 / 0.86);
  border: 1px solid #4a4a55;
  color: #f0f0f5;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}

.table-flash.is-on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .table-flash { transition: none; }
}


/* -------------------------------------------------------------- the shell

   In handheld mode the shell is the window, from the first frame (app view:
   css/games/handheld.css lays it out). Its look is the card table's own --
   near black round the felt -- written heavier than handheld.css's generic
   rule so it wins whichever stylesheet loads last. */

html body .Master > section.games-shell.is-focus {
  gap: 6px;
  background: #101014;
}

/* The table's minimum height is for a page, where it stops a short window
   squashing the table to a strip. When the shell IS the screen there is
   nothing to scroll to, and a phone held sideways has about 300px under the
   line along the top -- the minimum pushed the table off the screen. */
.games-shell:fullscreen .table-viewport,
.games-shell.is-focus .table-viewport {
  min-height: 0;
}

/* On a phone the table runs to the edges of the screen. Klondike held upright
   is drawn with its own one-pixel edge (rules/klondike.js), so a frame round
   it was 12px of card width -- the thing a phone has least of. The dock keeps
   a little room at its sides so its buttons are not on the glass edge. */
@media (max-width: 720px) {
  html body .Master > section.games-shell.is-focus {
    padding-left: 0;
    padding-right: 0;
  }

  .games-shell.is-focus .table-viewport { border-radius: 0; }
  .games-shell .hh-dock { padding: 0 6px; }
}

/* ------------------------------------------------------------------ table */

.table-viewport {
  position: relative;
  flex: 1;
  min-height: 360px;
  overflow: hidden;
  border-radius: 10px;
  background: #0c0c0f;
}

.table-surface {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 50% 50%;
  border-radius: 16px;
  background: var(--table-surface, #14523a);
  box-shadow:
    inset 0 0 140px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 26px 60px rgba(0, 0, 0, 0.55);
  touch-action: none;      /* pointer events drive dragging, not scrolling */
  user-select: none;
}

/* Two independent grain layers: the second one carries wood figure. */
.table-surface::before,
.table-surface::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.table-surface::before {
  background-image: var(--table-grain, none);
  background-size: var(--table-grain-size, 220px);
  opacity: var(--table-grain-opacity, 0.15);
  mix-blend-mode: var(--table-grain-blend, overlay);
}

.table-surface::after {
  background-image: var(--table-grain2, none);
  background-size: var(--table-grain2-size, auto);
  opacity: var(--table-grain2-opacity, 0);
  mix-blend-mode: var(--table-grain2-blend, normal);
}

.table-surface.is-dragging { cursor: grabbing; }

/* ------------------------------------------------------------- pile slots */

.pile-slot {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: calc(var(--card-w) * 0.056);
  border: 2px dashed var(--slot-stroke, rgba(255, 255, 255, 0.35));
  background: var(--slot-fill, rgba(0, 0, 0, 0.16));
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.pile-slot--foundation,
.pile-slot--cell { border-style: solid; }

.pile-slot--discard { opacity: 0.4; }

.card-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------------ cards */

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: calc(var(--card-w) * 0.056);
  /* Cards take pointer events only so the cursor can change. All hit testing
     is done by the surface in table coordinates, and these events bubble to
     it, so a card can never swallow a drag. */
  pointer-events: auto;
  transition: transform 0.19s cubic-bezier(0.2, 0.75, 0.3, 1);
  will-change: transform;
  perspective: 900px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.28);
}

.card.is-playable { cursor: grab; }

/* Pyramid marks a card rather than dragging it. The ring is drawn with
   box-shadow because .card's transform is written inline by the renderer —
   a CSS transform here would simply lose to it. */
.card.is-selected {
  box-shadow:
    0 0 0 3px #f3c96b,
    0 0 16px rgba(243, 201, 107, 0.7),
    0 8px 18px rgba(0, 0, 0, 0.45);
}

/* No transition while dragging — the card must sit exactly under the cursor. */
.card.is-dragging {
  cursor: grabbing;
  transition: none;
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.42),
    0 26px 48px rgba(0, 0, 0, 0.38);
}

.card__flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(180deg);
  transition: transform 0.34s cubic-bezier(0.4, 0.1, 0.3, 1);
}

.card.is-face-up .card__flip { transform: rotateY(0deg); }

.card__side {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: inherit;
}

.card__side--face { transform: rotateY(0deg); }
.card__side--back { transform: rotateY(180deg); }

.card-svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--card-w) * 0.056);
}

/* ----------------------------------------------------------- card artwork */

.card-paper {
  fill: #fdfbf6;
  stroke: rgba(0, 0, 0, 0.3);
  stroke-width: 1.4;
}

.card-ink {
  font-family: Georgia, 'Times New Roman', serif;
  stroke-linejoin: round;
}

.card-face-svg.is-black .card-ink { fill: #16161a; color: #16161a; stroke: #16161a; }
.card-face-svg.is-red   .card-ink { fill: #c1272d; color: #c1272d; stroke: #c1272d; }

.card-index {
  font-size: 46px;
  font-weight: 700;
  stroke: none;
  letter-spacing: -0.02em;
}

.court-letter {
  font-size: 64px;
  font-weight: 700;
  stroke: none;
}

/* A faint suit-tinted wash. Without it a court card reads lighter than a 7,
   which is backwards — courts should be the heaviest cards on the table. */
.court-panel {
  fill: currentColor;
  fill-opacity: 0.07;
  stroke: currentColor;
}

.court-rule { stroke: currentColor; }
.card-court line { stroke: currentColor; }
.card-ace circle { stroke: currentColor; }

/* ------------------------------------------------- rules / stats / theme */

/* A <dialog> opened with showModal(), so the focus trap, the Escape key and
   the backdrop are the browser's job rather than ours. */
.info-dialog {
  width: min(660px, calc(100vw - 32px));
  max-height: min(82vh, 780px);
  padding: 0;
  border: 1px solid #3d3d47;
  border-radius: 12px;
  background: #1c1c20;
  color: #e8e8ee;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  color-scheme: dark;              /* dark scrollbar in the scrolling body */
  overflow: hidden;                /* keeps the head's top rule inside the radius */
  animation: info-rise 0.22s cubic-bezier(0.2, 0.75, 0.3, 1);
}

/* Scoped to [open] so the UA's `dialog:not([open]) { display: none }` still
   applies — an unscoped display:flex here would leave the panel on screen. */
.info-dialog[open] {
  display: flex;
  flex-direction: column;
}

.info-dialog::backdrop {
  background: rgba(6, 6, 9, 0.62);
  backdrop-filter: blur(3px);
}

@keyframes info-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .info-dialog { animation: none; }
}

.info-dialog__head {
  position: relative;
  padding: 20px 56px 18px 26px;
  background: linear-gradient(160deg, #7B1828 0%, #4c0f19 78%);
  border-bottom: 1px solid #3d3d47;
}

.info-dialog__suits {
  display: block;
  font-size: 0.94rem;
  letter-spacing: 0.5em;
  color: #f3c96b;
  opacity: 0.72;
}

.info-dialog__head h2 {
  margin: 4px 0 0;
  font-size: 1.72rem;
  color: #fff;
}

.info-dialog__tagline {
  margin: 4px 0 0;
  font-size: 0.94rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.8);
}

.info-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  cursor: pointer;
}

.info-dialog__close:hover { background: rgba(0, 0, 0, 0.42); }

/* Tabs sit on the head's bottom edge and overlap its border, so the selected
   one reads as continuous with the body below it. */
.info-dialog__tabs {
  display: flex;
  gap: 4px;
  margin: 16px -26px -19px;
  padding: 0 26px;
}

.info-dialog__tab {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: rgba(0, 0, 0, 0.24);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.info-dialog__tab:hover { color: #fff; background: rgba(0, 0, 0, 0.36); }

.info-dialog__tab[aria-selected="true"] {
  background: #1c1c20;
  border-color: #3d3d47;
  color: #f3c96b;
}

/* flex + min-height:0 rather than subtracting a guessed header height — the
   header grows a line whenever a tagline wraps, and the guess would clip. */
.info-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px 26px 26px;
  overflow-y: auto;
  line-height: 1.55;
}

.info-dialog__highlight {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-left: 3px solid #f3c96b;
  border-radius: 0 6px 6px 0;
  background: #24242b;
  font-size: 1rem;
}

.info-dialog__highlight b {
  color: #f3c96b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
}

.info-dialog__section + .info-dialog__section { margin-top: 18px; }

.info-dialog__body h3 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #f3c96b;
}

.info-dialog__body ul {
  margin: 0;
  padding-left: 20px;
}

/* prettyForm.css strips list markers site-wide for its form layouts, so the
   bullets have to be asked for back here. */
.info-dialog__body li {
  margin-bottom: 6px;
  font-size: 0.95rem;
  list-style: disc;
}

/* Scoring reads as a table of figures, so give the numbers their own column. */
.info-dialog__scoring ul {
  list-style: none;
  padding-left: 0;
}

/* Spelled out in full rather than relying on source order, so this still wins
   if the bullet rule above ever moves. */
.info-dialog__body .info-dialog__scoring li {
  margin-bottom: 0;
  padding: 5px 0;
  border-bottom: 1px solid #2c2c34;
  font-variant-numeric: tabular-nums;
  list-style: none;
}

.info-dialog__body .info-dialog__scoring li:last-child { border-bottom: 0; }

.info-dialog__note {
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid #2c2c34;
  font-size: 0.88rem;
  font-style: italic;
  opacity: 0.72;
}

/* Sublines live in one wrapper so the block's spacing does not depend on how
   many of them there happen to be. */
.info-dialog__subs {
  margin: -8px 0 20px;
  font-size: 0.9rem;
  opacity: 0.8;
}

.info-dialog__subs p { margin: 0 0 4px; }
.info-dialog__subs p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ stats rows */

.info-dialog__body ul.deal-list {
  list-style: none;
  padding-left: 0;
}

.info-dialog__body .deal-list li {
  margin-bottom: 4px;
  list-style: none;
}

/* A row of the record is two controls side by side — play it again, and change
   what it counts as. The status has to be its own button, so it cannot live
   inside the one that replays the deal. */
.deal-row--markable {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.5em;
  gap: 6px;
}

/* ------------------------------------------------------------ deal groups */

.deal-group {
  margin-bottom: 4px;
  border: 1px solid #34343c;
  border-radius: 6px;
  background: #1e1e24;
}

.deal-group[open] { background: #202027; }

.deal-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.86rem;
  /* The default triangle is replaced by one that follows the open state below,
     so it can sit on the correct side and match the rest of the panel. */
  list-style: none;
}

.deal-group__head::-webkit-details-marker { display: none; }

.deal-group__head:hover { background: #2a2a33; }

.deal-group__range {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e8e8ee;
}

.deal-group__range::before {
  content: '▸ ';
  color: #8a8a99;
}

.deal-group[open] .deal-group__range::before { content: '▾ '; }

.deal-group__tally {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}

.deal-group .deal-list { padding: 0 8px 8px; }

/* Clickable rows put the grid on the button; the plain "other games" rows put
   it on the li itself. Same columns either way, so the two lists align. */
.deal-row__hit,
.deal-row--plain {
  display: grid;
  grid-template-columns: 7em 6em 1fr;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #24242b;
}

/* The badge took the middle column back, so the replay half is number + meta. */
.deal-row--markable .deal-row__hit { grid-template-columns: 7em 1fr; }

.deal-row__hit {
  width: 100%;
  font: inherit;
  text-align: left;
  border: 0;
  color: inherit;
  cursor: pointer;
}

.deal-row__hit:hover { background: #2e2e37; }

.deal-row__num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e8e8ee;
}

.deal-row__num--wide { grid-column: span 2; }

.deal-row__badge {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.5;
}

.deal-row.is-won .deal-row__badge { color: #f3c96b; opacity: 1; }
.deal-row.is-won .deal-row__num { color: #f3c96b; }

/* The status button. Same weight as the old badge so the list still scans as
   one column, but it is a control now and has to look like one. */
.deal-row__mark {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cfcfd8;
  background: #24242b;
  border: 1px solid #3a3a45;
  border-radius: 6px;
  padding: 7px 4px;
  cursor: pointer;
  opacity: 0.55;
}

.deal-row__mark:hover {
  background: #2e2e37;
  opacity: 1;
}

.deal-row.is-won .deal-row__mark {
  color: #f3c96b;
  border-color: #5d4d24;
  opacity: 1;
}

/* Won, but with the answer in hand. Deliberately not the gold of a clean win —
   the whole point of the mark is that the two do not look the same. */
.deal-row.is-aided .deal-row__mark {
  color: #9fc3e0;
  border-color: #2f4a5e;
  opacity: 1;
}

.deal-row.is-aided .deal-row__num { color: #9fc3e0; }

.deal-row__meta {
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

/* The way through to the solver. Styled as a button rather than a link so it
   does not pick up the site's blue underlined anchor inside a dark panel. */
.info-dialog__tool {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  background: #7B1828;
  border: 1px solid #9c2032;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.info-dialog__tool:hover {
  background: #94202f;
  color: #fff;
  text-decoration: none;
}

/* The Backup block's two actions reuse the maroon of the Lab link, but on real
   <button> elements -- which inherit neither the page font nor a pointer
   cursor the way an <a> does. */
button.info-dialog__tool {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.info-dialog__tool:disabled {
  background: #6b6062;
  border-color: #7d7274;
  cursor: default;
}

.info-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 10px;
}

/* ---------------------------------------------------------- theme picker */

/* A switch in the Settings tab. The whole row is a <label>, so the text is part
   of the hit target rather than a 13px checkbox being the only way in. */
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
}

.switch-row + .switch-row { border-top: 1px solid #2c2c34; }

.switch-row input {
  margin: 3px 0 0;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #7B1828;
  flex: none;
  cursor: pointer;
}

.switch-row__text { display: flex; flex-direction: column; gap: 2px; }

.switch-row__hint {
  font-size: 0.86rem;
  opacity: 0.7;
}

.picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.picker__option {
  display: flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 12px 6px 6px;
  border-radius: 8px;
  border: 1px solid #3d3d47;
  background: #24242b;
  color: #e8e8ee;
  cursor: pointer;
}

.picker__option:hover { background: #2e2e37; }

.picker__option[aria-pressed="true"] {
  border-color: #f3c96b;
  box-shadow: 0 0 0 1px #f3c96b;
}

.picker__swatch {
  width: 30px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.45);
  background-size: cover;
}

@media (max-width: 720px) {
  .table-viewport { min-height: 420px; }

  .info-dialog__head { padding: 16px 50px 14px 18px; }
  .info-dialog__head h2 { font-size: 1.4rem; }
  .info-dialog__body { padding: 18px 18px 22px; }
  .info-dialog__tabs { margin: 14px -18px -15px; padding: 0 18px; }
  .info-dialog__tab { padding: 7px 12px; letter-spacing: 0.04em; }

  .deal-row__hit,
  .deal-row--plain { grid-template-columns: 5.5em 4.5em 1fr; gap: 6px; }
  .deal-row--markable { grid-template-columns: minmax(0, 1fr) 4.6em; }
  .deal-row--markable .deal-row__hit { grid-template-columns: 5.5em 1fr; }
}


/* ======================================================================
   THE LADDER'S MAP, THE DEAL CARD, AND DEAL NUMBER

   Handheld screens (css/games/screens.css), filled by
   js/games/cards/ladderMap.js and main.js. In the site's theme like every
   screen, not the table's dark: they are pages about the deals, not part of
   the table. The difficulty words take the theme's status colours, so they
   are right in all eight themes.
   ====================================================================== */

.cl-sum {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  text-align: center;
}

.cl-sum b { font-size: 1.05rem; color: var(--accent); }
.cl-sum span { font-size: 0.85rem; color: var(--ink-muted); }

.cl-note {
  margin: 0;
  font-size: 0.85rem;
  text-align: center;
  color: var(--ink-muted);
}

.cl-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}

/* One deal: its number, what it is, and what you have done on it. The whole
   row is the button. */
.cl-deal {
  display: grid;
  grid-template-columns: 4.4em minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  width: 100%;
  min-height: 3.4rem;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0 !important;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.cl-deal:last-child { border-bottom: 0; }
.cl-deal:hover { background: var(--accent-soft); }

.cl-deal__number {
  grid-row: 1 / span 2;
  font-variant-numeric: tabular-nums;
}

.cl-deal .cl-band { grid-column: 2; justify-self: start; }

.cl-deal__line {
  grid-column: 2;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--ink-muted);
}

.cl-deal__mine {
  grid-column: 3;
  grid-row: 1 / span 2;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  color: var(--ink-faint);
}

.cl-deal.is-won .cl-deal__mine { color: var(--ok); }

/* Your place: lit, and the map opens on it. */
.cl-deal.is-next {
  background: var(--accent-soft);
  box-shadow: inset 4px 0 0 var(--accent);
}

.cl-deal.is-next .cl-deal__mine { color: var(--accent); }

/* The difficulty word. Easy is the theme's "good", the hard end its warning
   and danger, and a deal nobody can win is struck through rather than red --
   it is not a threat, it is a fact. */
.cl-band {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.cl-band--easy,
.cl-band--winnable { background: var(--ok-soft); color: var(--ok); }
.cl-band--normal   { background: var(--info-soft); color: var(--info); }
.cl-band--hard     { background: var(--warn-soft); color: var(--warn); }
.cl-band--advanced { background: var(--warn); color: var(--on-status); }
.cl-band--brutal   { background: var(--danger-soft); color: var(--danger); }
.cl-band--nearly   { background: var(--danger); color: var(--on-status); }

.cl-band--never {
  background: var(--surface-alt);
  color: var(--ink-faint);
  text-decoration: line-through;
}

.cl-band--unknown {
  border: 1px dashed var(--ink-faint);
  color: var(--ink-muted);
}

/* The deal card: one deal, said plainly before it is played. */
.cl-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 16px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
  text-align: center;
}

.cl-card__over {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.cl-card__deal { margin: 0; font-size: 1.8rem; color: var(--ink); }
.cl-card__line { margin: 0; color: var(--ink); }

.cl-card__bots,
.cl-card__mine { margin: 0; font-size: 0.9rem; color: var(--ink-muted); }

.cl-card__place {
  margin: 4px 0 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-alt);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.cl-card__play {
  width: 100%;
  padding: 12px;
  font-size: 1.05rem;
  border-radius: 12px !important;
}

/* Deal number: the box, big, and Play beside it. No spinner -- stepping by
   one is meaningless across a million deals. */
.cards-number {
  display: flex;
  gap: 8px;
  width: min(18rem, 100%);
}

.cards-number input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

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

.cards-number button {
  padding: 0 22px;
  font-size: 1.05rem;
  border-radius: 12px !important;
}
