/* Snooker Lounge */
:root {
  --bg: #040b10;
  --surface: #0a2030;
  --surface-2: #06161f;
  --well: #05101a;
  --text: #f1ece0;
  --muted: #a3b5c2;
  --faint: #7d90a2;
  --gold: #e6c477;
  --gold-2: #c9973a;
  --gold-ink: #2a1c05;
  --line: rgba(230, 204, 146, 0.26);
  --line-soft: rgba(230, 204, 146, 0.13);
  --red: #c4564d;
  --hud: rgba(6, 18, 28, 0.9);
  --hud-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --serif: "Playfair Display", "DM Serif Display", Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: #1d4459 var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(900px 520px at 10% 0%, rgba(214, 140, 60, 0.1), transparent 62%),
    radial-gradient(800px 640px at 96% 26%, rgba(22, 140, 196, 0.13), transparent 65%),
    linear-gradient(180deg, #05101a, #03070b 70%);
  background-attachment: fixed;
  line-height: 1.5;
  caret-color: var(--gold);
  -webkit-font-smoothing: antialiased;
}
body.playing { overflow: hidden; position: fixed; inset: 0; overscroll-behavior: none; }
[hidden] { display: none !important; }
::selection { background: rgba(230, 196, 119, 0.3); color: #fff; }
a { color: var(--gold); text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; text-align: center;
  font: 600 0.78em var(--sans); color: var(--text);
  background: #0c2a3c; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
}

/* ---------- shared pieces ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 800; font-size: 0.84rem; letter-spacing: 0.08em; text-transform: uppercase;
  transition: transform 0.16s var(--ease), filter 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.gold { color: var(--gold-ink); background: linear-gradient(180deg, #f6dc94, #dcae4c 55%, #c08f33); box-shadow: 0 8px 22px rgba(214, 160, 60, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn.gold:hover:not(:disabled) { filter: brightness(1.07); box-shadow: 0 10px 28px rgba(214, 160, 60, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn.big { min-height: 54px; font-size: 0.92rem; width: 100%; }
.btn.line { background: rgba(6, 20, 32, 0.84); border-color: var(--line); color: var(--text); }
.btn.line:hover:not(:disabled) { background: #0f3047; border-color: rgba(230, 204, 146, 0.45); }
.btn.ghost { background: none; color: var(--muted); min-height: 40px; }
.btn.ghost:hover { color: var(--text); }
.btn.red { background: #a8423c; border-color: #c96a60; color: #fff; }
.btn.red:hover { background: #b84d46; }

/* ---------- lobby ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1220px; margin: 0 auto; padding: calc(16px + var(--sat)) 20px 10px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); font: 700 1.22rem var(--serif); }
.top-link { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; color: var(--muted); padding: 10px 4px; transition: color 0.16s ease; }
.top-link:hover { color: var(--gold); }
.lobby-main { max-width: 1220px; margin: 0 auto; padding: 8px 20px 44px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.lobby-main > * { min-width: 0; }

/* the table itself is the picture; the words stand in the dark beside it */
.hero {
  --pad: clamp(28px, 4.2vw, 60px);
  --copy: 452px;                       /* how wide the words are set */
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; align-items: center;
  min-height: min(660px, calc(100dvh - 110px));
  padding: var(--pad);
  border-radius: 22px; border: 1px solid var(--line-soft);
  background: var(--surface-2);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}
.hero-art {
  position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%;
  object-fit: cover; object-position: 100% 50%;   /* what has to be cut comes off the dark side, never the table */
  animation: settle 1.6s var(--ease) both;
}
/* (the dark holds as far as the words reach, however wide the panel is, and gives way just past them: measured in
   parts of the panel it let the balls in the picture show beside the labels, and on a narrow window under them) */
.hero::before {
  --ends: calc(var(--pad) + var(--copy));
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(4, 11, 16, 0.97) 0, rgba(4, 11, 16, 0.9) calc(var(--ends) + 12px), rgba(4, 11, 16, 0.42) calc(var(--ends) + 60px), rgba(4, 11, 16, 0) calc(var(--ends) + 150px)),
    linear-gradient(0deg, rgba(4, 11, 16, 0.6), rgba(4, 11, 16, 0) 32%);
}
.hero-copy { width: min(var(--copy), 100%); }
.hero h1 { margin: 0; font: 800 clamp(2.2rem, 4.4vw, 3.5rem)/1.04 var(--serif); letter-spacing: -0.015em; text-wrap: balance; }
.lede { margin: 14px 0 0; max-width: 40ch; color: #c2d0db; font-size: 1.03rem; }
.setup { display: flex; flex-wrap: wrap; gap: 14px 16px; margin-top: 28px; }
.field { display: grid; gap: 7px; }
.field:first-child { flex: 1 1 170px; }
.field > span { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.field input, .join input {
  height: 46px; padding: 0 14px; width: 100%;
  background: rgba(5, 16, 26, 0.86); border: 1px solid var(--line-soft); border-radius: 12px; font-weight: 600; font-size: 1rem;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
.field input::placeholder, .join input::placeholder { color: var(--faint); }
.field input:hover, .join input:hover { border-color: var(--line); }
.field input:focus, .join input:focus { border-color: var(--gold); outline: none; background: var(--well); }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: rgba(5, 16, 26, 0.86); border: 1px solid var(--line-soft); border-radius: 12px; height: 46px; }
.seg button { min-width: 58px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 700; transition: color 0.16s ease, background-color 0.16s ease; }
.seg button:hover { color: var(--text); }
.seg button small { font-weight: 500; font-size: 0.72rem; opacity: 0.85; margin-left: 2px; }
.seg button[aria-checked="true"] { background: linear-gradient(180deg, #f1d588, #cfa043); color: var(--gold-ink); }

.play { display: grid; gap: 10px; margin-top: 22px; }
.join { display: flex; gap: 8px; }
.join input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.22em; text-align: center; font-weight: 800; }
.join input::placeholder { letter-spacing: 0.06em; font-weight: 500; text-transform: none; }
.join .btn { flex: none; min-width: 92px; }
.play-hint { margin: 0; color: var(--muted); font-size: 0.86rem; }
.alts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.alt {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 68px; padding: 12px 12px 12px 14px; text-align: left;
  color: var(--text); background: rgba(8, 26, 38, 0.78); border: 1px solid var(--line-soft); border-radius: 14px;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s var(--ease);
}
.alt > svg:first-child { color: var(--gold); }
.alt b { display: block; font: 700 1.06rem/1.2 var(--serif); }
.alt small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
.alt .chev { color: var(--faint); transition: transform 0.2s var(--ease), color 0.16s ease; }
.alt:hover { background: rgba(14, 44, 62, 0.9); border-color: var(--line); }
.alt:hover .chev { transform: translateX(3px); color: var(--gold); }
.alt:active { transform: scale(0.985); }
.lobby-msg { min-height: 1.4em; margin: 12px 0 0; color: #f3b9a8; font-size: 0.9rem; }
.lobby-msg:empty { min-height: 0; margin: 0; }
.facts { margin: 16px 0 0; color: var(--faint); font-size: 0.8rem; }

.about {
  padding: clamp(22px, 3.4vw, 42px);
  background: linear-gradient(180deg, rgba(10, 32, 48, 0.62), rgba(6, 20, 30, 0.62));
  border: 1px solid var(--line-soft); border-radius: 22px;
}
.about h2 { margin: 0 0 4px; font: 700 1.7rem var(--serif); }
.about h3 { margin: 22px 0 8px; font: 700 1.08rem var(--serif); color: var(--gold); }
.about .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 44px; }
.about ul { margin: 0; padding-left: 18px; color: #c9d5e0; }
.about li { margin: 7px 0; max-width: 62ch; }
.about li::marker { color: var(--gold-2); }
.about p { color: #c9d5e0; max-width: 70ch; margin: 6px 0 0; }
.about h1 { font: 800 2rem var(--serif); margin: 8px 0; }
.page { max-width: 760px; margin: 0 auto; padding: 30px 20px 60px; }
.page h2 { font-size: 1.2rem; margin-top: 26px; }

/* ---------- the guides: pages of text about the game and about snooker ----------
   Set like the lobby's own "How to play": the same panel, the same serif for what is said large. */
.top-guide { max-width: 880px; }
.top-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; margin-left: auto; }
.top-link[aria-current="page"] { color: var(--gold); }
.top-play { min-height: 40px; margin-left: 24px; padding: 0 24px; text-decoration: none; }
.guide { max-width: 880px; padding-top: 14px; }
.page.guide + .foot { max-width: 880px; }   /* under a guide, in line with it */
.guide .crumbs { margin: 0 0 16px; font-size: 0.78rem; color: var(--faint); }
.guide .crumbs a { color: var(--muted); text-decoration: none; }
.guide .crumbs a:hover { color: var(--gold); }
.guide h1 { margin: 0; font: 800 clamp(1.9rem, 4.6vw, 2.7rem)/1.08 var(--serif); letter-spacing: -0.012em; text-wrap: balance; }
.guide .lede { max-width: 64ch; margin: 14px 0 0; font-size: 1.05rem; }
.guide h2 { margin: 42px 0 0; font: 700 1.5rem/1.2 var(--serif); scroll-margin-top: 18px; text-wrap: balance; }
.guide h3 { margin: 26px 0 0; }
.guide p { margin: 10px 0 0; }
.guide ul, .guide ol { margin: 10px 0 0; padding-left: 20px; color: #c9d5e0; }
.guide li { max-width: 68ch; }
.guide ol li::marker { color: var(--gold); font-weight: 700; }
.guide strong { color: var(--text); }
/* the way back to the table, from the top of a guide and from its end */
.go { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 24px; }
.go .btn { text-decoration: none; }
.go span { color: var(--muted); font-size: 0.9rem; }
/* a table of figures. On a phone too narrow for it, it slides sideways on its own and the page does not */
.sheet { margin-top: 16px; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(5, 16, 26, 0.5); }
.sheet table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.sheet th, .sheet td { padding: 10px 16px; text-align: left; vertical-align: top; border-top: 1px solid var(--line-soft); color: #c9d5e0; }
.sheet thead th { border-top: 0; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.sheet tbody th { font-weight: 600; color: var(--text); }
.sheet tbody th:has(kbd), .sheet tbody th:has(.ball) { white-space: nowrap; }   /* keys pressed together stay together, and a ball stays with its name */
.sheet.slim { max-width: 480px; }   /* a few short figures: kept near each other, not strung across the page */
/* two tables that are read together: side by side, and on a phone one under the other */
.sheets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.sheet .n { text-align: right; font-variant-numeric: tabular-nums; }
.ball { display: inline-block; width: 0.84em; height: 0.84em; margin-right: 0.55em; border-radius: 50%; vertical-align: -0.07em; background: var(--c); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), inset -0.12em -0.14em 0.2em rgba(0, 0, 0, 0.42), inset 0.1em 0.1em 0.14em rgba(255, 255, 255, 0.3); }
/* the colours still to pot, in a row that ends on the black: each one potted leaves the row a ball shorter from the left */
.balls { display: inline-flex; justify-content: flex-end; gap: 0.2em; width: 6.04em; margin-right: 0.7em; vertical-align: -0.07em; }
.balls .ball { flex: none; margin: 0; vertical-align: 0; }
/* what this game does its own way, set apart from the general rule */
.note { margin-top: 20px; padding: 16px 20px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(230, 196, 119, 0.05); }
.note > b { display: block; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.note > :nth-child(2) { margin-top: 6px; }
.guide figure { margin: 18px 0 0; }
.guide figure img, .guide figure svg { display: block; width: 100%; height: auto; border-radius: 14px; }
.guide figure img { border: 1px solid var(--line-soft); }
.guide figcaption { max-width: 72ch; margin-top: 9px; font-size: 0.84rem; color: var(--muted); }
.pair { display: grid; grid-template-columns: minmax(0, 3.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
/* the table at the break-off is drawn twice: lying down for a wide screen, standing up for a phone */
.table-fig .tall { display: none; }
/* words of the game, each with what it means */
.terms { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 22px; margin: 14px 0 0; color: #c9d5e0; }
.terms dt { font-weight: 700; color: var(--text); }
.terms dd { margin: 0; max-width: 60ch; }
/* a question and its answer */
.qa { padding: 22px 0 24px; border-top: 1px solid var(--line-soft); }
.lede + .qa { margin-top: 30px; }
.qa h2 { margin: 0; font-size: 1.24rem; }
.qa + .go { margin-top: 0; padding-top: 24px; border-top: 1px solid var(--line-soft); }
/* the same, folded: the question shows, the answer opens under it */
.asks { margin-top: 12px; border-bottom: 1px solid var(--line-soft); }
.asks details { border-top: 1px solid var(--line-soft); }
.asks summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 2px; cursor: pointer; list-style: none; font-weight: 600; color: var(--text); }
.asks summary::-webkit-details-marker { display: none; }
.asks summary::after { content: ""; flex: none; width: 8px; height: 8px; margin: -4px 4px 0; border-right: 2px solid var(--gold-2); border-bottom: 2px solid var(--gold-2); transform: rotate(45deg); transition: transform 0.2s var(--ease); }
.asks details[open] summary::after { transform: translateY(4px) rotate(225deg); }
.asks summary:hover { color: var(--gold); }
.asks details p { margin: 0 2px 15px; }
/* where to read more: the guides, as a row of links */
.about .more { display: flex; flex-wrap: wrap; gap: 9px 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.about .more li { margin: 0; }
.more a { display: inline-block; padding: 8px 15px; border: 1px solid var(--line-soft); border-radius: 999px; background: rgba(5, 16, 26, 0.6); color: var(--text); font-size: 0.88rem; font-weight: 600; text-decoration: none; transition: border-color 0.16s ease, color 0.16s ease; }
.more a:hover { border-color: var(--line); color: var(--gold); }
/* the sums of a frame: figures in, where the frame stands out */
.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 16px; align-items: end; margin-top: 18px; }
.calc .field:first-child { flex: none; }
.field select {
  height: 46px; padding: 0 12px; width: 100%; font: 600 1rem var(--sans); color: var(--text);
  background: rgba(5, 16, 26, 0.86); border: 1px solid var(--line-soft); border-radius: 12px;
}
.field select:focus { border-color: var(--gold); outline: none; }
.field select:disabled { opacity: 0.45; }
.calc .tick { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; min-height: 30px; color: #c9d5e0; font-size: 0.92rem; cursor: pointer; }
.calc .tick input { flex: none; width: 20px; height: 20px; accent-color: var(--gold-2); }
.calc-out { margin-top: 16px; padding: 18px 20px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--well); }
.calc-out .fig { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; color: var(--muted); }
.calc-out .fig b { font: 800 2.3rem/1 var(--serif); color: var(--gold); font-variant-numeric: tabular-nums; }
.calc-out p { max-width: 62ch; }
@media (max-width: 760px) {
  .top-guide { flex-wrap: wrap; row-gap: 2px; }
  /* the guides in one row under the name; on the narrowest phones the row slides rather than breaks */
  .top-guide .top-nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; margin-left: 0; gap: 0 18px; overflow-x: auto; scrollbar-width: none; }
  .top-guide .top-nav::-webkit-scrollbar { display: none; }
  .top-guide .top-link { flex: none; }
  .top-guide .top-play { margin-left: auto; }
  .pair { grid-template-columns: 1fr; }
  .pair > :last-child { max-width: 220px; justify-self: center; }
  .sheets { grid-template-columns: minmax(0, 1fr); }
  .terms { grid-template-columns: 1fr; gap: 2px; }
  .terms dd { margin-bottom: 10px; }
  .sheet th, .sheet td { padding: 9px 12px; }
}
@media (max-width: 620px) {
  .table-fig .wide { display: none; }
  .table-fig .tall { display: block; max-width: 340px; margin-inline: auto; }
  /* on a phone the words of a guide have the whole width: the panel runs from edge to edge */
  .guide { padding-inline: 0; }
  .guide > .about { padding-inline: 20px; border-inline: 0; border-radius: 0; }
}

/* ---------- adverts: one shelf at the foot of the lobby ---------- */
.spots { position: relative; margin-top: 6px; }
.spots-tag, .spot-tag { font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.spots-tag { display: flex; align-items: center; gap: 18px; margin: 0 0 20px; }
.spots-tag::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-soft), transparent); }
/* The slots run from the left, and the blind one comes last: one network hands over a frame whether or not it
   has an advert for it, and nothing outside the frame can tell. Kept clear and bare, an empty frame shows as
   nothing but a little more room above the foot of the page. */
.spots-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 22px; }
.spot {
  width: 300px; max-width: 100%; border-radius: 12px; overflow: hidden;
  background: #0b2231; box-shadow: 0 0 0 1px var(--line-soft), 0 18px 40px -22px rgba(0, 0, 0, 0.9);
  animation: fade 0.5s ease both;
}
.spot[data-blind] { background: none; box-shadow: none; }
.spots.unlabelled .spots-tag { display: none; }   /* no label over what may be an empty frame */
.spots.unlabelled .spots-row { justify-content: center; }   /* alone, it has nothing to sit off centre beside */
.spot-body { display: grid; justify-items: center; }
.spot-body > * { max-width: 100%; }
/* An advert's frame sits on a line of text unless it is a block, which leaves a strip under it. And this page is
   dark where an advert's frame is not, so the browser paints the frame white before anything is drawn in it: an
   empty one would be a white box. Told that the frame is light, it leaves it clear. */
.spot iframe { display: block; color-scheme: light; }
/* Nothing has arrived yet. The slot keeps its width, so an ad has a real box to load into, but is folded
   away to no height, out of the page and out of sight. */
.spots.waiting, .spot.waiting { position: absolute; left: 0; top: 0; height: 0; visibility: hidden; pointer-events: none; animation: none; }
.spots.waiting { width: 300px; overflow: hidden; }
@media (max-width: 661px) {   /* one slot to a row: in the middle, and the label with it */
  .spots-tag::before { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-soft)); }
  .spots-tag::after { background: linear-gradient(270deg, transparent, var(--line-soft)); }
  .spots-row { justify-content: center; }
}
@media (max-width: 339px) { .spots { margin-inline: -10px; } }   /* room for a 300 wide advert on the narrowest phones */
/* The AdTogether card takes a white or a slate face from the visitor's system theme. This page is always dark. */
[data-ad-unit][data-served-ad-id] { background-color: #0b2231 !important; border-color: var(--line-soft) !important; }
[data-ad-unit][data-served-ad-id] h4 { color: var(--text) !important; }
[data-ad-unit][data-served-ad-id] p { color: var(--muted) !important; }
[data-ad-unit][data-served-ad-id] a > div:first-child { background-color: #071722 !important; }
/* on the shelf the slot is already its frame */
.spot [data-ad-unit] { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; transform: none !important; }
/* the foot of every page: whose it is on the left, where else to go on the right; on a narrow screen one under the other */
.foot { max-width: 1220px; margin: 0 auto; padding: 8px 20px calc(30px + var(--sab)); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 28px; color: var(--muted); font-size: 0.85rem; }
.foot p { margin: 0; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 0 22px; margin-block: -7px; }
.foot-nav a { padding-block: 7px; }   /* a finger's height to each, without moving the row */
.foot-nav [aria-current="page"] { color: var(--muted); text-decoration: none; }   /* the page one is on */
.page + .foot { max-width: 760px; }   /* under a page of text, in line with the text */

/* shown for a moment while the first table is built */
#curtain {
  position: fixed; inset: 0; z-index: 80; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: var(--bg); color: var(--muted); font-size: 0.9rem; font-weight: 600; letter-spacing: 0.04em;
}
#curtain p { margin: 0; }
.curtain-balls { display: flex; gap: 10px; }
.curtain-balls i { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #ff8d8d, #c8182a 55%, #6f0a14); animation: bob 0.9s ease-in-out infinite; }
.curtain-balls i:nth-child(2) { animation-delay: 0.12s; }
.curtain-balls i:nth-child(3) { animation-delay: 0.24s; background: radial-gradient(circle at 34% 30%, #ffffff, #f1ece0 55%, #a9a394); }

/* ---------- dialogs ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px;
  background: rgba(2, 5, 9, 0.72);
  -webkit-backdrop-filter: blur(7px) saturate(0.8); backdrop-filter: blur(7px) saturate(0.8);
  animation: fade 0.2s ease;
}
.dialog {
  width: min(420px, 100%); max-height: 100%; overflow: auto; padding: 28px 24px 22px; text-align: center;
  background: linear-gradient(180deg, #0e2d43, #06161f);
  border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: rise 0.34s var(--ease);
}
.dialog.wide { width: min(520px, 100%); display: grid; gap: 12px; justify-items: center; }
.dialog h2 { margin: 0 0 6px; font: 700 1.6rem/1.15 var(--serif); text-wrap: balance; }
.dialog p { margin: 0 0 14px; color: var(--muted); }
.dialog .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.dialog .row .btn { flex: 1; min-width: 130px; }
.code { margin: 6px 0 16px; font: 800 2.6rem var(--sans); letter-spacing: 0.3em; text-indent: 0.3em; color: var(--gold); padding: 12px; background: var(--well); border: 1px solid var(--line-soft); border-radius: 14px; user-select: all; -webkit-user-select: all; }
.wait { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 16px 0 6px !important; font-size: 0.9rem; }
.wait .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.final { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 12px 0 10px; font: 800 2.4rem var(--sans); font-variant-numeric: tabular-nums; }
.final small { display: block; margin-top: 2px; font: 600 0.72rem var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.final .dash { color: var(--line); font-weight: 400; }
.final .win { color: var(--gold); }

/* ---------- game ---------- */
#game {
  position: fixed; inset: 0; z-index: 20; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  background: #04060a;
}
#table { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
/* the room falls away into shadow at the edges of the screen, keeping the eye on the table */
#game::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 78% 72% at 50% 48%, transparent 60%, rgba(2, 7, 11, 0.46) 100%);
}

/* every control floats on the same dark slate, so the table stays the brightest thing on screen */
.chip, .score, .power, .spin, .elev, .fine, .keys, .say {
  background: var(--hud); border: 1px solid var(--line-soft); box-shadow: var(--hud-shadow);
}
.power-lbl, .spin-lbl, .elev-lbl, .fine-lbl, .keys em {
  font-size: 0.58rem; font-weight: 800; font-style: normal; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
/* what plays a shot stands back while the balls run, and while the turn is someone else's.
   (will-change: each is kept as a picture of its own, so that fading it is all the browser has to do at the instant
   a shot is struck. Left to itself it makes those pictures in that very frame, and coming from a table standing
   still it can miss the frame over it.) */
.power, .spin, .elev, .fine { transition: opacity 0.3s ease, border-color 0.2s ease; will-change: opacity; }
#game:not([data-state="aim"]) :is(.power, .spin, .elev, .fine) { opacity: 0.42; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 999px; color: var(--text);
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s var(--ease);
}
.chip:hover { background: #0f3044; border-color: var(--line); }
.chip:active { transform: scale(0.96); }
.chip.round { width: 40px; padding: 0; justify-content: center; }
.chip.danger { color: #f4b8ae; }
.chip.danger:hover { background: #7c2a27; border-color: #c9665c; color: #fff; }
.chip[aria-pressed="false"] .waves { display: none; }
.chip[aria-pressed="false"] { color: var(--faint); }
.hud-tl, .hud-tr { position: absolute; top: calc(10px + var(--sat)); display: flex; gap: 8px; z-index: 5; }
.hud-tl { left: calc(10px + var(--sal)); }
.hud-tr { right: calc(10px + var(--sar)); }

.score {
  position: absolute; top: calc(8px + var(--sat)); left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: stretch; gap: 0; height: 46px; max-width: calc(100% - 20px);
  border-radius: 14px; overflow: hidden;
}
.pl { display: flex; align-items: center; gap: 10px; padding: 0 16px; min-width: 0; position: relative; transition: background-color 0.35s ease; }
.pl .nm { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 0.35s ease; }
.pl .sc { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 1.4ch; text-align: center; }
.pl.active { background: linear-gradient(180deg, rgba(230, 196, 119, 0.2), rgba(230, 196, 119, 0.05)); }
.pl.active .nm { color: var(--gold); }
/* the line under whoever is at the table is drawn out from its middle as the turn passes */
.pl::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--gold); border-radius: 2px 2px 0 0; transform: scaleX(0); transition: transform 0.45s var(--ease); }
.pl.active::after { transform: scaleX(1); }
.mid { display: grid; align-content: center; justify-items: center; gap: 2px; padding: 0 16px; border-left: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); min-width: 98px; }
.on { display: flex; align-items: center; gap: 6px; }
.on .lbl, .brk { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.brk { font-variant-numeric: tabular-nums; transition: color 0.3s ease; }
.brk.live { color: var(--gold); }
.dots { display: flex; gap: 3px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.35), inset 2px 2px 2px rgba(255, 255, 255, 0.35); }
.dots.many i { width: 9px; height: 9px; }
/* (with any colour on, the one the cue is pointed at is the one being played at: the rest stand back) */
.dots.named i { opacity: 0.28; }
.dots.named i.at { opacity: 1; transform: scale(1.3); box-shadow: 0 0 0 1px var(--gold), inset -2px -2px 3px rgba(0, 0, 0, 0.35), inset 2px 2px 2px rgba(255, 255, 255, 0.35); }

/* ---------- the foot of the screen ---------- */
/* What turns the cue at one end, what the tip does at the other, and between them a place for what is said. The
   two ends are given equal room when there is room, which puts that place on the middle of the screen, under the
   score; when there is not, each end takes only what it needs. */
.deck {
  position: absolute; left: calc(10px + var(--sal)); right: calc(10px + var(--sar)); bottom: calc(10px + var(--sab)); z-index: 4;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; pointer-events: none;
}
.deck-side { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
.deck-end { justify-content: flex-end; }
.deck-side > * { pointer-events: auto; flex: none; }

/* One line of talk. It has a place kept for it that nothing else uses, so it never lies over the table. */
.status { min-width: 0; max-width: 520px; height: 58px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.say {
  margin: 0; max-width: 100%; padding: 7px 16px; border-radius: 17px;
  font-size: 0.82rem; font-weight: 600; line-height: 1.3; text-align: center; text-wrap: balance; color: var(--muted);
  opacity: 0; transform: translateY(6px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.32s var(--ease), color 0.2s ease, border-color 0.2s ease;
}
.say.show { opacity: 1; transform: none; }
.say.now { color: var(--text); border-color: var(--line); }
.say.good { border-color: rgba(230, 196, 119, 0.72); color: #fff3cf; }
.say.foul { border-color: #d0786c; color: #ffd9d2; }
.say small { font-size: inherit; opacity: 0.78; }
.say small::before { content: "·"; margin: 0 0.5em 0 0.25em; }

/* ---------- power: a cue on a rule, drawn back by its handle ---------- */
.power {
  position: absolute; right: calc(10px + var(--sar)); top: calc(64px + var(--sat)); bottom: calc(134px + var(--sab)); width: 58px; z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 8px;
  border-radius: 16px;
}
.power-pct { font-size: 0.76rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--faint); transition: color 0.2s ease; }
.power.set .power-pct { color: var(--gold); }
.power-track { position: relative; flex: 1; width: 100%; min-height: 60px; cursor: grab; touch-action: none; }
.power.pulling .power-track { cursor: grabbing; }
.power-well { position: absolute; inset: 0; overflow: hidden; }
/* the rule: a mark every tenth of the way down, longer at the top, the middle and the foot */
.power-well::before {
  content: ""; position: absolute; left: 7px; right: 7px; top: 8px; height: calc(100% - 29px); pointer-events: none;
  --tick: linear-gradient(rgba(230, 204, 146, 0.3) 0 1px, transparent 1px);
  background:
    var(--tick) left top / 10px calc((100% - 1px) / 2) repeat-y, var(--tick) right top / 10px calc((100% - 1px) / 2) repeat-y,
    var(--tick) left top / 5px calc((100% - 1px) / 10) repeat-y, var(--tick) right top / 5px calc((100% - 1px) / 10) repeat-y;
}
/* the slot the cue is drawn down */
.power-well::after {
  content: ""; position: absolute; left: 50%; top: 1px; bottom: 7px; width: 30px; margin-left: -15px; pointer-events: none;
  border-radius: 9px; background: rgba(1, 8, 13, 0.5); box-shadow: inset 0 0 0 1px rgba(230, 204, 146, 0.1), inset 0 2px 5px rgba(0, 0, 0, 0.5);
}
/* what the cue has been drawn back over is lit: cool where the shot is soft, through gold, to red at the foot.
   (The colours are laid down the whole rule and uncovered from the top, so the handle always sits on its own.) */
.power-fill {
  position: absolute; z-index: 1; left: 50%; top: 2px; bottom: 8px; width: 28px; margin-left: -14px; pointer-events: none;
  border-radius: 8px; clip-path: inset(0 0 100% 0);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2), transparent 38%, transparent 70%, rgba(0, 0, 0, 0.22)),
    linear-gradient(180deg, #2f9fb4 0%, #6fc49a 22%, #e8cf6a 46%, #f0a045 70%, #e4543c 100%);
}
.power-cue { position: absolute; z-index: 2; inset: 0; pointer-events: none; will-change: transform; }
.power.fired .power-cue, .power.fired .power-fill { transition: transform 0.14s cubic-bezier(0.5, 0, 0.9, 0.4), clip-path 0.14s cubic-bezier(0.5, 0, 0.9, 0.4); }
.power-cue i {
  position: absolute; left: 50%; top: 15px; width: 10px; height: 100%; margin-left: -5px; border-radius: 3px 3px 5px 5px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.26), transparent 32%, rgba(255, 255, 255, 0.3) 46%, transparent 62%, rgba(0, 0, 0, 0.32)),
    linear-gradient(180deg, #3f77b8 0 2%, #f3efe6 2% 5%, #e3c08a 5% 62%, #3a2114 62% 97%, #c49a52 97%);
  clip-path: polygon(22% 0, 78% 0, 100% 100%, 0 100%);
}
.power-cue b {
  position: absolute; left: 50%; top: 0; width: 38px; height: 16px; margin-left: -19px; border-radius: 8px;
  background: linear-gradient(180deg, #f8e2a2, #d9aa48 55%, #b98a30);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.65), inset 0 -1px 0 rgba(84, 56, 10, 0.5);
  transition: scale 0.16s var(--ease), filter 0.16s ease;
}
.power-cue b::before { content: ""; position: absolute; inset: 5px 12px; background: repeating-linear-gradient(90deg, rgba(64, 40, 6, 0.6) 0 1.5px, transparent 1.5px 4.2px); }
.power-track:hover .power-cue b { filter: brightness(1.08); }
.power.pulling .power-cue b { scale: 1.08; filter: brightness(1.12); }
/* until it has been pulled once, the handle stirs now and then to say that it can be */
#game[data-state="aim"] .power.fresh .power-cue b { animation: stir 2.6s var(--ease) 1.2s infinite; }
/* how hard, read off beside the handle where a thumb does not cover it */
.power-tip {
  position: absolute; right: calc(100% + 11px); top: 0; margin-top: -6px; min-width: 42px; padding: 4px 8px; border-radius: 9px; pointer-events: none;
  background: linear-gradient(180deg, #f6dc94, #d6a745); color: var(--gold-ink); text-align: center;
  font-size: 0.86rem; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: translateX(8px) scale(0.9); transform-origin: 100% 50%; transition: opacity 0.14s ease, transform 0.22s var(--ease);
}
.power-tip::after { content: ""; position: absolute; left: calc(100% - 1px); top: 50%; margin-top: -5px; border: 5px solid transparent; border-left-color: #e5c06c; }
.power.pulling .power-tip { opacity: 1; transform: none; }

/* ---------- cue angle: the butt of the cue lifted about the ball ---------- */
.elev { position: relative; width: 132px; padding: 7px 9px 6px; border-radius: 16px; }
.elev.raised { border-color: rgba(230, 196, 119, 0.62); }
.elev-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; height: 18px; }
.elev-val { font-size: 0.98rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); transition: color 0.2s ease; }
.elev.raised .elev-val { color: var(--gold); }
.elev-dial { display: block; width: 100%; height: auto; margin-top: 2px; touch-action: none; cursor: grab; overflow: visible; }
.elev.held .elev-dial { cursor: grabbing; }
.elev-bed { stroke: rgba(230, 204, 146, 0.26); stroke-width: 1; }
.elev-ticks { fill: none; stroke: rgba(230, 204, 146, 0.34); stroke-width: 2.6; stroke-dasharray: 0.7 9.3; stroke-dashoffset: -0.65; }
.elev-ticks.tall { stroke: rgba(230, 204, 146, 0.6); stroke-width: 5.6; stroke-dasharray: 0.9 29.1; stroke-dashoffset: -0.55; }
.elev-nums text { fill: var(--faint); font: 700 6.4px var(--sans); text-anchor: middle; dominant-baseline: central; }
.elev-arc { fill: none; stroke: rgba(230, 204, 146, 0.16); stroke-width: 3.4; stroke-linecap: round; }
.elev-fill { fill: none; stroke: var(--gold); stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 0 200; }
.elev-knob { fill: #0b2231; stroke: var(--gold); stroke-width: 2.2; transition: r 0.16s var(--ease), fill 0.16s ease; }
.elev-pip { fill: var(--gold); }
.elev-dial:hover .elev-knob { fill: #123a52; }
.elev.held .elev-knob { r: 6.6px; fill: #17475f; }
.elev-shade { fill: rgba(0, 0, 0, 0.45); }
.elev-mode {
  position: absolute; left: 9px; top: 29px; padding: 2px 7px; border-radius: 999px; pointer-events: none;
  font-size: 0.56rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-ink);
  background: linear-gradient(180deg, #f6dc94, #d6a745);
  opacity: 0; transform: translateY(3px) scale(0.92); transform-origin: 0 50%; transition: opacity 0.16s ease, transform 0.24s var(--ease);
}
.elev[data-mode="jump"] .elev-mode, .elev[data-mode="masse"] .elev-mode { opacity: 1; transform: none; }
.elev[data-mode="masse"] .elev-mode { background: linear-gradient(180deg, #f8c08c, #de8444); }

/* ---------- spin: where on the white the tip lands ---------- */
.spin { display: grid; justify-items: center; gap: 4px; padding: 6px 8px 8px; width: 106px; border-radius: 16px; }
.spin-lbl { transition: color 0.2s ease; }
.spin.set { border-color: rgba(230, 196, 119, 0.5); }
.spin.set .spin-lbl { color: var(--gold); }
.spin-ball {
  position: relative; width: 82px; height: 82px; border-radius: 50%; touch-action: none; cursor: pointer;
  background: radial-gradient(circle at 36% 30%, #ffffff, #ece7db 55%, #b9b3a4);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.5);
}
/* as far out as the tip can go and still bite, and the two lines that cross at centre ball */
.spin-ball::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 1px dashed rgba(30, 66, 88, 0.36); }
.spin-ball::after {
  content: ""; position: absolute; inset: 14px; border-radius: 50%; pointer-events: none;
  background:
    linear-gradient(rgba(30, 66, 88, 0.22), rgba(30, 66, 88, 0.22)) 50% 50% / 1px 100% no-repeat,
    linear-gradient(rgba(30, 66, 88, 0.22), rgba(30, 66, 88, 0.22)) 50% 50% / 100% 1px no-repeat;
}
.spin-ball i {
  position: absolute; left: 50%; top: 50%; z-index: 1; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #7fb0ff, #1b46c2); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.55);
  will-change: transform;
}

/* ---------- fine aim ---------- */
.fine { display: grid; grid-template-columns: auto auto; justify-items: center; gap: 5px 6px; padding: 6px; border-radius: 16px; }
.fine-lbl { grid-column: 1 / -1; line-height: 1.5; }
.fine button { width: 52px; height: 48px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--line-soft); background: #0c2a3c; color: var(--gold); touch-action: none; transition: background-color 0.12s ease, transform 0.12s ease, border-color 0.12s ease; }
.fine button:hover { background: #103449; border-color: var(--line); }
.fine button:active { background: #164a66; transform: scale(0.95); }

.keys { display: none; gap: 14px; padding: 9px 14px; border-radius: 14px; opacity: 0.82; transition: opacity 0.2s ease; }
.keys:hover { opacity: 1; }
.keys div { display: grid; justify-items: center; gap: 5px; }
.keys span { display: flex; gap: 3px; }
.keys kbd.wide { padding: 1px 10px; }

/* a mouse and room to spare: show the keyboard legend instead of the touch buttons */
@media (hover: hover) and (pointer: fine) and (min-width: 1100px) and (min-height: 560px) {
  .keys { display: flex; }
  .fine { display: none; }
}

/* ---------- short landscape screens (phones on their side) ----------
   Nothing fits under the table here: the controls stand in a column at each end of it, and what is said goes in
   the gap beside the score. */
@media (max-height: 480px) and (orientation: landscape) {
  .chip { height: 34px; padding: 0 11px; }
  .chip.round { width: 34px; }
  .chip.danger span, #btn-reset span { display: none; }
  .chip.danger, #btn-reset { width: 34px; padding: 0; justify-content: center; }
  .score { height: 38px; top: calc(6px + var(--sat)); }
  .pl { padding: 0 12px; gap: 8px; }
  .pl .nm { max-width: 8ch; }
  .pl .sc { font-size: 1.15rem; }
  .mid { padding: 0 12px; min-width: 90px; }
  .deck, .deck-side { display: contents; }
  .status {
    max-width: none;
    position: absolute; z-index: 6; top: calc(6px + var(--sat)); height: 38px; justify-content: flex-end;
    left: calc(94px + var(--sal)); right: calc(50% + var(--score-w, 240px) / 2 + 8px);
  }
  .say { padding: 4px 12px; border-radius: 13px; font-size: 0.72rem; line-height: 1.22; }
  .say small { display: none; }
  .power { top: calc(50px + var(--sat)); bottom: calc(98px + var(--sab)); width: 50px; padding: 8px 0 6px; }
  .power-cue b { width: 34px; margin-left: -17px; }
  .power-cue b::before { inset: 5px 10px; }
  .power-well::after { width: 26px; margin-left: -13px; }
  .power-fill { width: 24px; margin-left: -12px; }
  .spin { position: absolute; z-index: 4; right: calc(10px + var(--sar)); bottom: calc(10px + var(--sab)); width: 84px; padding: 4px 6px 6px; }
  .spin-ball { width: 64px; height: 64px; }
  .spin-ball::after { inset: 11px; }
  .spin-lbl { display: none; }
  .elev { position: absolute; z-index: 4; left: calc(10px + var(--sal)); top: calc(46px + var(--sat)); width: 90px; padding: 5px 6px 4px; border-radius: 14px; }
  .elev-lbl { display: none; }
  .elev-head { justify-content: flex-end; height: 15px; }
  .elev-val { font-size: 0.86rem; }
  .elev-dial { margin-top: 0; }
  .elev-mode { left: 6px; top: 5px; }
  .fine { position: absolute; z-index: 4; left: calc(10px + var(--sal)); top: calc(138px + var(--sat)); grid-template-columns: auto; gap: 5px; padding: 5px; }
  .fine-lbl { display: none; }
  .fine button { width: 44px; height: 46px; }
}

/* ---------- portrait phones ----------
   The table stands on end with a row of three under it: aim, cue angle, spin. What is said goes at the head of
   the screen, between the buttons. */
@media (orientation: portrait) {
  .chip.danger span, #btn-reset span { display: none; }
  .chip.danger, #btn-reset { width: 40px; padding: 0; justify-content: center; }
  .score { top: calc(58px + var(--sat)); width: calc(100% - 20px); }
  .score .pl { flex: 1; }
  .score #pl1 { justify-content: flex-end; }
  .deck, .deck-side { display: contents; }
  .status { position: absolute; z-index: 6; max-width: none; top: calc(10px + var(--sat)); height: 40px; left: calc(106px + var(--sal)); right: calc(106px + var(--sar)); }
  .say { padding: 4px 12px; border-radius: 13px; font-size: 0.72rem; line-height: 1.22; }
  .say small { display: none; }
  .power { top: calc(114px + var(--sat)); bottom: calc(130px + var(--sab)); width: 50px; right: calc(6px + var(--sar)); }
  .power-cue b { width: 34px; margin-left: -17px; }
  .power-cue b::before { inset: 5px 10px; }
  .power-well::after { width: 26px; margin-left: -13px; }
  .power-fill { width: 24px; margin-left: -12px; }
  .fine { position: absolute; z-index: 4; left: calc(10px + var(--sal)); bottom: calc(10px + var(--sab)); }
  .spin { position: absolute; z-index: 4; right: calc(6px + var(--sar)); bottom: calc(10px + var(--sab)); width: 98px; }
  .spin-ball { width: 76px; height: 76px; }
  .elev { position: absolute; z-index: 4; left: calc(142px + var(--sal)); right: calc(112px + var(--sar)); bottom: calc(10px + var(--sab)); width: auto; }
  .elev-dial { height: 80px; }
}
@media (orientation: portrait) and (max-width: 359px) {
  .fine button { width: 44px; }
  .spin { width: 88px; }
  .spin-ball { width: 66px; height: 66px; }
  .elev { left: calc(126px + var(--sal)); right: calc(102px + var(--sar)); padding-inline: 6px; }
  .elev-lbl { letter-spacing: 0.06em; }
  .status { left: calc(102px + var(--sal)); right: calc(102px + var(--sar)); }
}

/* ---------- coming to the table: it is lit, and the controls take their places round it ---------- */
#game.enter #table { animation: fade 0.6s ease both; }
#game.enter .score { animation: from-above 0.6s var(--ease) 0.1s both; }
#game.enter :is(.hud-tl, .hud-tr) { animation: fade 0.5s ease 0.2s both; }
#game.enter .power { animation: from-right 0.6s var(--ease) 0.18s both; }
#game.enter :is(.fine, .keys) { animation: from-below 0.6s var(--ease) 0.18s both; }
#game.enter .elev { animation: from-below 0.6s var(--ease) 0.24s both; }
#game.enter .spin { animation: from-below 0.6s var(--ease) 0.3s both; }

/* ---------- narrow screens: the picture sits above the words ---------- */
@media (max-width: 860px) {
  .hero { display: block; min-height: 0; padding: 0; }
  .hero-art {
    position: relative; inset: auto; z-index: 0; display: block; height: auto; aspect-ratio: 16 / 10;
    -webkit-mask-image: linear-gradient(#000 52%, transparent 98%); mask-image: linear-gradient(#000 52%, transparent 98%);
  }
  .hero::before { display: none; }
  .hero-copy { position: relative; width: auto; margin-top: -64px; padding: 0 20px 24px; }
  .about .cols { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .alts { grid-template-columns: 1fr; }
  .pl { padding: 0 9px; gap: 7px; }
  .mid { padding: 0 8px; min-width: 84px; }
  .pl .nm { max-width: 8ch; font-size: 0.72rem; }
  .code { font-size: 2.1rem; }
}

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes pulse { 50% { opacity: 0.3; transform: scale(0.7); } }
@keyframes settle { from { transform: scale(1.06); filter: brightness(0.7); } }
@keyframes bob { 50% { transform: translateY(-7px); } }
@keyframes from-above { from { opacity: 0; translate: 0 -16px; } }
@keyframes from-below { from { opacity: 0; translate: 0 18px; } }
@keyframes from-right { from { opacity: 0; translate: 18px 0; } }
@keyframes stir { 0%, 78%, 100% { translate: 0 0; } 86% { translate: 0 5px; } 93% { translate: 0 -1px; } }
@keyframes bump { 30% { scale: 1.32; color: var(--gold); } }
.sc.bump { animation: bump 0.5s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .modal, .dialog, .wait .dot, .hero-art, .curtain-balls i, .spot, .sc.bump { animation: none; }
  #game.enter *, #game[data-state="aim"] .power.fresh .power-cue b { animation: none !important; }
  .say, .btn, .alt, .chip, .power-tip, .elev-mode, .pl::after, .power.fired .power-cue, .power.fired .power-fill { transition: none; }
}
