/* Liar's Dice: the site's one stylesheet (the warm theme). url() references are
 * relative to web/src; web/build.py rewrites them to the hashed copies in assets/.
 * Font: Urbanist (github.com/coreyhu/Urbanist), SIL Open Font License 1.1, see
 * url("URBANIST-OFL.d8c6282d9c.txt"). */
@font-face {
  font-family: "Urbanist";
  src: url("urbanist-latin-wght-normal.7981ef90c2.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --page: #f2ebdf;
  --card: #faf6ef;
  --ink: #2a1f18;
  --ink-2: #6e5e50;          /* 5.2:1 on the page, 5.8:1 on cards */
  --line: #ddd0be;
  --terra: #b4583a;          /* large text and fills only (4.0:1 on the page) */
  --terra-dark: #9b4a30;     /* small terracotta text: 5.2:1 */
  --mat: #3b2b21;
  --mat-rim: #2c2018;
  --cream-on-mat: #f4ead9;
  --muted-on-mat: #b9a691;   /* 5.8:1 on the mat */
  --peach-on-mat: #f0b49a;   /* 7.5:1 on the mat */
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--page) url("speckle-light.9cb9045258.svg"); -webkit-text-size-adjust: 100%; }
body {
  font-family: "Urbanist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; display: flex; flex-direction: column; }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
/* No grey box on tap or click (D-198): no tap highlight anywhere, and the focus ring only for
   keyboard users (:focus-visible), a subtle on-theme ring. Grey hover backgrounds apply only
   with a real mouse (see the end of the file), so they never stick after a tap on a phone. */
html, body, a, button, input, label, summary, [role="button"], [tabindex] {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible { outline: 2px solid var(--terra-dark); outline-offset: 2px; }
/* Not controls: the game panel and the heading are focus targets for screen readers
   (tabindex="-1", focused by the script when the screen changes), never a ring. */
.panel:focus, h1:focus { outline: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---- header / footer --------------------------------------------------------- */
.site-head { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing: -.3px; white-space: nowrap; }
.logo-die { width: 28px; height: 28px; display: block; filter: drop-shadow(0 1px 1.5px rgba(42, 31, 24, .22)); }
.head-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  font-size: 16px; font-weight: 700; border: 1.5px solid var(--ink); white-space: nowrap;
}
.site-foot { margin-top: auto; padding-top: 28px; padding-bottom: 32px; font-size: 13px; color: var(--ink-2); }
.banner {
  margin: 4px 0 12px; padding: 12px 16px; border-radius: 16px; background: var(--card);
  border: 1.5px solid var(--terra); font-weight: 600;
}

/* ---- dice ---------------------------------------------------------------------- */
.die {
  display: inline-block; vertical-align: middle; flex: none; overflow: visible;
  width: var(--s, 48px); height: var(--s, 48px);
  filter: drop-shadow(var(--shadow, 0 1px 1.5px rgba(42, 31, 24, .22)));
}
.die.dim { opacity: .3; filter: none; }
.die.hit .body { stroke-opacity: .42; }
.hidden-die { display: inline-block; width: 12px; height: 12px; border-radius: 3.5px; background: var(--ink-2); opacity: .5; }

/* ---- buttons -------------------------------------------------------------------- */
.btn {
  min-height: 56px; padding: 0 30px; border-radius: 999px; font-size: 19px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: background-color .15s, box-shadow .15s, opacity .15s;
}
.btn.primary { background: var(--terra); color: #fff; box-shadow: 0 2px 0 var(--terra-dark); }
.btn.primary:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--terra-dark); }
.btn.outline { border: 1.5px solid var(--ink); }
/* Pressed (the Dashboard link, D-198): it reacts the moment it is touched, with no grey tap box.
   .pressed is set on touch by app.js, for browsers that show the pressed state late on touch. */
.btn.outline:active:not(:disabled), .btn.outline.pressed { transform: translateY(1px); background: rgba(42, 31, 24, .08); }
/* After the tap, while the dashboard opens: a small spinner and "Opening…", same width. */
.hero .cta #dashLink { min-width: 8.2em; }
#dashLink.opening { padding: 0 22px; color: var(--ink-2); border-color: var(--ink-2); }
#dashLink .spinner { width: 15px; height: 15px; }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn.primary:disabled { opacity: .55; }
.text-btn {
  min-height: 44px; padding: 0 6px; font-size: 16px; font-weight: 700; color: var(--ink-2);
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px;
  text-decoration-color: rgba(110, 94, 80, .45);
}

/* ---- landing -------------------------------------------------------------------- */
.hero {
  flex: 1; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center;
  padding-top: 40px; padding-bottom: 24px;
}
.eyebrow { font-size: 15px; font-weight: 700; color: var(--terra-dark); letter-spacing: .2px; }
.hero h1 { margin-top: 14px; font-size: clamp(52px, 7vw, 84px); line-height: .96; font-weight: 800; letter-spacing: -2px; }
.hero .lede { margin-top: 22px; font-size: 20px; line-height: 1.45; color: var(--ink-2); max-width: 30ch; }
.hero .cta { margin-top: 32px; display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; }
.hero .note { font-size: 15px; color: var(--ink-2); }
/* The loading line has its space from the start and keeps it when done (hidden, not removed):
   nothing below or beside it moves (owner, D-198). */
.loading { margin-top: 16px; min-height: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 15px; color: var(--ink-2); }
.loading.done { visibility: hidden; }
.hero .cta #playBtn { min-width: 8.2em; } /* "Loading…" and "Play": the same width */
.loading.error { color: var(--ink); font-weight: 600; }
.loading.error:not(.waiting) .spinner { display: none; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid rgba(155, 74, 48, .25); border-top-color: var(--terra-dark);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.land-error { margin-top: 14px; max-width: 44ch; font-size: 15px; font-weight: 600; color: var(--terra-dark); }

.mat {
  position: relative; aspect-ratio: 1; width: 100%; border-radius: 50%;
  background: var(--mat) url("speckle-dark.bae3f18af2.svg");
  box-shadow: inset 0 0 0 10px var(--mat-rim), inset 0 18px 40px rgba(0, 0, 0, .35), 0 24px 50px -20px rgba(59, 43, 33, .55);
}
.hero-art { display: flex; align-items: center; justify-content: center; min-width: 0; }
.hero .mat { max-width: 460px; }
.scatter .die { position: absolute; width: 17%; height: auto; aspect-ratio: 1; --shadow: 0 6px 6px rgba(0, 0, 0, .35); }
/* The dice cluster sits exactly in the table's middle (the box around the five rotated dice is
   centred on the table's centre, D-198). */
.scatter .d1 { left: 22.9%; top: 27.4%; transform: rotate(-14deg); }
.scatter .d2 { left: 44.9%; top: 18.4%; transform: rotate(9deg); }
.scatter .d3 { left: 60.9%; top: 41.4%; transform: rotate(-6deg); }
.scatter .d4 { left: 33.9%; top: 50.4%; transform: rotate(18deg); }
.scatter .d5 { left: 52.9%; top: 63.4%; transform: rotate(-22deg); }

.not-found { padding-top: 48px; }
.not-found h1 { font-size: clamp(40px, 6vw, 64px); font-weight: 800; letter-spacing: -1.5px; }
.not-found .lede { margin: 14px 0 28px; font-size: 20px; color: var(--ink-2); }

/* ---- the table ------------------------------------------------------------------ */
.game {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 48px;
  align-items: center; padding-top: 16px; padding-bottom: 24px;
}
.board {
  --pad-t: 34px; --pad-b: 34px;
  position: relative; padding: var(--pad-t) 0 var(--pad-b);
  width: min(100%, 560px, max(400px, calc(100vh - 180px)));
  container-type: inline-size;
}
.board-area { display: flex; align-items: center; justify-content: center; min-width: 0; }
.board .mat { width: 100%; }
.center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: var(--pad-t) 20% var(--pad-b);
  color: var(--cream-on-mat); pointer-events: none;
}
.center .who { font-size: 17px; color: var(--muted-on-mat); }
.center .bid { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.center .bid .q { font-size: clamp(56px, 18.5cqw, 104px); line-height: 1; font-weight: 800; letter-spacing: -2px; }
.center .bid .x { font-size: clamp(26px, 6cqw, 34px); color: var(--muted-on-mat); font-weight: 600; }
.center .bid .die { --s: clamp(52px, 15.7cqw, 88px); --shadow: 0 6px 8px rgba(0, 0, 0, .35); }
.center .sub { margin-top: 8px; font-size: 15px; color: var(--muted-on-mat); }
.center .pal { margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--peach-on-mat); }
.center .big-text { margin: 6px 0 4px; font-size: clamp(34px, 9cqw, 54px); line-height: 1.05; font-weight: 800; letter-spacing: -1px; }
.center .big-text.small { font-size: clamp(24px, 5.5cqw, 32px); }
.center .count { font-size: clamp(72px, 21cqw, 120px); line-height: 1; font-weight: 800; }
/* A reveal on the mat: the called bid, the count with a check (the bid was right) or a
   cross, and which dice counted, as dice. A Palifico round: a crossed-out wild one. */
.center .who-bid .bidx { font-size: 19px; color: var(--cream-on-mat); gap: 6px; }
.center .who-bid .bidx .x { color: var(--muted-on-mat); }
.center .who-bid .die { --s: 24px; --shadow: none; }
.center .result { display: flex; align-items: center; gap: clamp(8px, 3cqw, 14px); margin-top: 6px; }
.mark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: clamp(30px, 9cqw, 46px); height: clamp(30px, 9cqw, 46px); border-radius: 50%; }
.mark svg { display: block; width: 62%; height: 62%; }
.mark.ok { background: var(--cream-on-mat); color: var(--mat); }
.mark.bad { background: var(--terra); color: #fff; }
.center .counted { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 18px; font-weight: 800; color: var(--muted-on-mat); }
.center .counted .die { --s: 26px; --shadow: none; }
.center .sub { display: flex; align-items: center; gap: 7px; }
.hidden-die.light { background: var(--muted-on-mat); opacity: 1; }
.center .pal { display: inline-flex; align-items: center; gap: 7px; }
.nowild { position: relative; display: inline-flex; }
.nowild .die { --s: 18px; --shadow: none; }
.nowild::after {
  content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 2px; margin-top: -1px;
  border-radius: 2px; background: var(--peach-on-mat); transform: rotate(-45deg);
}

.seats { position: absolute; inset: 0; pointer-events: none; }
.seat {
  position: absolute; transform: translate(-50%, -50%); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 18px; padding: 10px 14px 9px; text-align: center;
  min-width: 112px; box-shadow: 0 6px 16px -8px rgba(59, 43, 33, .4);
}
.seat .name { font-size: 16px; font-weight: 800; white-space: nowrap; }
.seat-dice .count { display: flex; gap: 3px; justify-content: center; align-items: center; height: 14px; margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.seat .last { height: 24px; margin-top: 6px; display: flex; align-items: center; justify-content: center; }
.seat.acting { border-color: var(--terra); box-shadow: 0 0 0 1.5px var(--terra), 0 10px 22px -10px rgba(155, 74, 48, .6); }
.seat.out { opacity: .65; box-shadow: none; }
.seat.p-left { left: 6%; top: 50%; }
.seat.p-top { left: 50%; top: calc(var(--pad-t) + 20px); }
.seat.p-right { left: 94%; top: 50%; }

/* A bid as a chip: plain on the seat cards, dark for the bid on the table. */
.bidx { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.bidx .x { font-weight: 600; }
.bidx .die { --s: 18px; --shadow: 0 .5px 1px rgba(42, 31, 24, .3); }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 15px; font-weight: 700; color: var(--ink-2); }
.chip.cur { background: var(--ink); color: var(--cream-on-mat); }
.chip.cur .die { --shadow: none; }
.chip.call { color: var(--ink); font-weight: 800; }

/* Thinking dots under the card of the player to act. */
.dots {
  position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px 9px; border-radius: 999px; background: var(--terra);
  box-shadow: 0 2px 6px rgba(155, 74, 48, .35);
}
.dots i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: think 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes think { 0%, 60%, 100% { opacity: .4; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

/* Your place at the bottom of the mat. */
.me {
  position: absolute; left: 50%; top: calc(100% - var(--pad-b)); transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--card); border: 1.5px solid var(--line); font-size: 16px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 6px 16px -8px rgba(59, 43, 33, .4);
}
.me .chip { margin-right: -8px; }
.me.turn {
  background: var(--terra); border-color: var(--terra); color: #fff; padding: 0 22px;
  box-shadow: 0 0 0 4px rgba(180, 88, 58, .28), 0 10px 22px -10px rgba(155, 74, 48, .7);
}
.me.out { color: var(--ink-2); }

/* ---- the side column: your dice and the panel ------------------------------------- */
.side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.mine .label { display: flex; justify-content: space-between; font-size: 15px; color: var(--ink-2); font-weight: 600; }
.mine .dice {
  --d: min(64px, calc((100% - 32px) / 5));
  display: grid; grid-template-columns: repeat(5, var(--d)); justify-content: space-between; margin-top: 10px;
}
.mine .dice .die { width: 100%; height: auto; aspect-ratio: 1; --shadow: 0 4px 5px rgba(59, 43, 33, .25); }

.panel {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 24px; padding: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.panel.turn { border-color: var(--terra); box-shadow: 0 0 0 1.5px var(--terra); }
.panel .title { min-height: 20px; font-size: 15px; font-weight: 800; color: var(--ink-2); }
.panel.turn .title { color: var(--terra-dark); }
.faces { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.face { display: flex; flex-direction: column; align-items: center; gap: 5px; min-height: 44px; padding: 8px 0 6px; border-radius: 14px; }
.face .die { width: min(38px, calc(100% - 8px)); height: auto; aspect-ratio: 1; --shadow: 0 1px 2px rgba(42, 31, 24, .22); }
.face .min { height: 16px; font-size: 13px; line-height: 16px; font-weight: 700; color: var(--ink-2); }
.face.on { background: var(--page); box-shadow: inset 0 0 0 2px var(--ink); }
.face.on .min { color: var(--ink); }
.face:disabled { cursor: default; }
.face:disabled .die { opacity: .38; filter: none; }
.row { display: flex; gap: 10px; margin-top: 12px; }
.stepper {
  display: flex; align-items: center; justify-content: space-between; flex: none; width: 140px; height: 56px;
  padding: 0 5px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--page);
}
.step { width: 44px; height: 44px; border-radius: 22px; font-size: 24px; font-weight: 700; line-height: 1; }
.step:disabled { opacity: .3; cursor: default; }
.qty {
  width: 40px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent;
  text-align: center; font-size: 26px; font-weight: 800;
}
.qty:disabled { color: var(--ink-2); }
.bid-btn { flex: 1; min-width: 0; padding: 0 16px; }
.bid-btn .bidx { gap: 6px; }
.bid-btn .die { --s: 26px; --shadow: 0 1px 1.5px rgba(0, 0, 0, .25); }
.qty-note { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--terra-dark); }
.qty-note:empty { margin-top: 0; }
.calls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.calls.one { grid-template-columns: 1fr; }
.calls .btn { width: 100%; }

/* ---- reveal, out, game over ------------------------------------------------------- */
.verdict .head { font-size: 24px; line-height: 1.3; font-weight: 800; }
.verdict .more, .panel .more { margin-top: 6px; font-size: 16px; line-height: 1.4; font-weight: 600; color: var(--ink-2); }
.more b { color: var(--ink); font-weight: 800; }
.hands { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.hand { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.hand .who { width: 84px; flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: 16px; font-weight: 800; white-space: nowrap; }
.hand .who .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hand .who .chip { height: 22px; padding: 0 7px; font-size: 13px; }
.hand .who .chip .die { --s: 14px; }
.hand .who .chip.call { background: var(--terra); color: #fff; }
.hand .dice { display: flex; gap: 5px; flex: 1; min-width: 0; }
.hand .dice .die { --s: 30px; --shadow: 0 1px 1.5px rgba(42, 31, 24, .2); }
.hand .delta { font-size: 16px; font-weight: 800; color: var(--terra-dark); }
.hand .delta.gain { color: var(--ink); }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.buttons .btn { flex: 1 1 auto; padding: 0 22px; }
.buttons .btn.wide { flex-basis: 100%; }
.countdown { width: 100%; text-align: center; font-size: 14px; color: var(--ink-2); }
.ranking { list-style: none; margin-top: 14px; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 9px 2px; font-size: 17px; font-weight: 700; border-bottom: 1px solid var(--line); }
.ranking li:last-child { border-bottom: 0; }
.ranking .place { width: 38px; color: var(--ink-2); font-weight: 800; }
.ranking li.you .rname { color: var(--terra-dark); font-weight: 800; }
.quiet { display: flex; justify-content: center; margin-top: 6px; }
.panel .title.out { font-size: 22px; color: var(--ink); }
.icon-btn {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  border: 1.5px solid var(--line); color: var(--ink-2);
}

/* ---- the leave dialog -------------------------------------------------------------- */
.dialog {
  margin: auto; width: min(440px, calc(100vw - 32px)); padding: 24px; border-radius: 24px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  box-shadow: 0 30px 60px -24px rgba(42, 31, 24, .55);
}
.dialog::backdrop { background: rgba(42, 31, 24, .45); }
.dialog-title { font-size: 24px; font-weight: 800; }
.dialog-text { margin-top: 8px; font-size: 16px; line-height: 1.45; font-weight: 600; color: var(--ink-2); }
.dialog-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-buttons .btn { min-height: 48px; padding: 0 22px; font-size: 17px; }

/* ---- motion ------------------------------------------------------------------------ */
.anim .a-pop { animation: pop .32s cubic-bezier(.2, .8, .3, 1.25) both; }
.anim .a-swap { animation: swap .3s ease-out both; }
.anim .a-roll { animation: roll .45s cubic-bezier(.2, .8, .3, 1) both; }
.anim .mine .die:nth-child(2) { animation-delay: .04s; }
.anim .mine .die:nth-child(3) { animation-delay: .08s; }
.anim .mine .die:nth-child(4) { animation-delay: .12s; }
.anim .mine .die:nth-child(5) { animation-delay: .16s; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.anim .me.a-pop { animation-name: pop-me; }
@keyframes pop-me { from { transform: translate(-50%, -50%) scale(.85); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
@keyframes swap { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes roll { from { transform: translateY(-8px) rotate(-10deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ---- phone -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .wrap { padding: 0 18px; }
  .site-head { height: 60px; }
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 18px; padding-bottom: 8px; }
  .hero .mat { max-width: 300px; }
  .hero .lede { font-size: 18px; }
  .game { grid-template-columns: 1fr; gap: 14px; padding-top: 4px; padding-bottom: 16px; }
  .board { --pad-t: 46px; --pad-b: 22px; width: min(100%, 360px, max(260px, calc(100svh - 540px))); }
  .center { padding: calc(var(--pad-t) + 14%) 14% calc(var(--pad-b) + 14%); } /* centred on the mat */
  .seat { min-width: 92px; padding: 8px 10px 7px; border-radius: 16px; }
  .seat .name { font-size: 15px; }
  .seat.p-left { left: 13%; top: 32%; }
  .seat.p-top { top: calc(var(--pad-t) + 2px); }
  .seat.p-right { left: 87%; top: 32%; }
  .side { gap: 14px; }
  .mine .dice { --d: min(58px, calc((100% - 32px) / 5)); margin-top: 8px; }
  .site-foot { padding-top: 16px; padding-bottom: 24px; }
}
@media (max-width: 359px) {
  .wrap { padding: 0 14px; }
  .logo { font-size: 18px; gap: 8px; }
  .head-link { padding: 0 14px; }
  .panel { padding: 14px 12px; }
  .faces { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stepper { width: 124px; }
  .hand .who { width: 66px; }
  .hand .dice .die { --s: 25px; }
  .seat { min-width: 84px; }
}

.icon-btn:disabled { opacity: .3; cursor: default; }

/* ---- phones, portrait: every screen fits the display exactly --------------------------
   The page is exactly one screen tall, inside the notch and home-bar safe areas: the
   round table takes whatever height is left (a size container), the panel is compact,
   and "Your turn" lives on the table (the panel's title is dropped). */
@media (max-width: 600px) and (orientation: portrait) {
  .page { height: 100vh; height: 100dvh; min-height: 0; }
  .site-head { height: calc(52px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); flex: none; }
  .main { min-height: 0; }
  .site-foot { flex: none; padding-top: 8px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  body.playing .site-foot { display: none; }

  /* The landing (D-198): text, buttons and table as one composed block, centred in the screen,
     with no empty band between the buttons and the table. The table's box is reserved by CSS
     (its full size, shrinking only when the screen is too short), so nothing moves while the
     game loads. */
  /* From the top (owner, D-198): the space under the header about matches the space between
     the buttons and the table (both about 64 px on a 390 x 844 or 430 x 932 screen); what is
     left goes below the table. On a short screen the top space shrinks first (to 8 px), then
     the table. */
  .hero {
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 24px;
    min-height: 0;
    padding-top: clamp(8px, calc((100dvh - 654px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * .6), 50px);
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .hero-text { flex: none; }
  .hero-art {
    flex: 0 1 min(calc(100vw - 36px), 340px); min-height: 0; align-self: stretch; container-type: size;
  }
  .hero .mat { width: min(100cqw, 100cqh, 340px); max-width: none; }

  .game { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding-top: 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .board-area { flex: 1 1 0; min-height: 0; align-self: stretch; container-type: size; }
  .board { width: min(100cqw, 100cqh - var(--pad-t) - var(--pad-b), 380px); }
  .side { flex: none; gap: 10px; align-self: stretch; }
  .mine .dice { --d: min(54px, calc((100% - 32px) / 5)); margin-top: 0; }
  .panel { padding: 12px; border-radius: 22px; }
  .panel .title:not(.out) { display: none; }
  .faces { gap: 4px; margin-top: 0; }
  .face { padding: 5px 0 4px; gap: 4px; }
  .face .die { width: min(34px, calc(100% - 8px)); }
  .row { margin-top: 8px; }
  .calls { margin-top: 8px; }
  .btn { min-height: 50px; font-size: 18px; }
  .stepper { height: 50px; }
  .hands { margin-top: 0; gap: 8px; }
  .buttons { margin-top: 12px; }
  .icon-btn { width: 50px; height: 50px; }
  .ranking { margin-top: 0; }
  .ranking li { padding: 7px 2px; }
}

/* ---- opened from the home screen: a fixed app screen that never scrolls or bounces ---- */
html.app, html.app body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.app body { position: fixed; inset: 0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.app .page { height: 100%; min-height: 0; }
html, body { touch-action: manipulation; }

/* ---- hover, with a mouse only: on touch screens a hover state sticks after a tap and shows
   as a grey box (D-198) ------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  .text-btn:hover { color: var(--ink); }
  .icon-btn:hover { color: var(--ink); border-color: var(--ink); }
  .btn.primary:hover:not(:disabled) { background: #a9502f; }
  .head-link:hover { background: rgba(42, 31, 24, .06); }
  .btn.outline:hover:not(:disabled) { background: rgba(42, 31, 24, .05); }
  .face:hover:not(:disabled) { background: rgba(42, 31, 24, .05); }
  .step:hover:not(:disabled) { background: rgba(42, 31, 24, .07); }
  .face.on:hover { background: var(--page); box-shadow: inset 0 0 0 2px var(--ink); }
}
