/* The Table game: a full-screen neon street with the HUD over it, and real content below the fold.
   System fonts only: a condensed display face for Latin text and a bold kai/serif stack for 漢字. */
:root {
  --bg: #07060f;
  --ink: #f6eedc;
  --dim: #a99fb8;
  --pink: #ff3d8b;
  --cyan: #3cf2ff;
  --amber: #ffb43c;
  --jade: #3dffa8;
  --violet: #b46bff;
  --lat: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --han: "Kaiti TC", "STKaiti", "BiauKai", "DFKai-SB", "KaiTi", "Songti TC", "Noto Serif CJK TC", "PingFang HK", serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); -webkit-text-size-adjust: 100%; }
a { color: var(--cyan); }
.han { font-family: var(--han); font-weight: 700; }
button { font: inherit; color: inherit; }

/* ---- Neon tube buttons ---- */
.neon-btn {
  --c: var(--cyan);
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 46px; padding: .45em 1.1em;
  border: 3px double var(--c); border-radius: 14px;
  background: rgba(9, 6, 20, .62);
  color: #fff; text-decoration: none; cursor: pointer;
  font-family: var(--lat); font-stretch: condensed; font-weight: 600; font-size: 17px; letter-spacing: .06em; text-transform: uppercase;
  text-shadow: 0 0 6px var(--c), 0 0 14px var(--c);
  box-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent), inset 0 0 10px color-mix(in srgb, var(--c) 45%, transparent);
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.neon-btn:hover { background: rgba(20, 12, 40, .72); }
.neon-btn:active { transform: scale(.96); }
.neon-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.neon-btn.big { --c: var(--pink); font-size: 22px; min-height: 60px; padding: .5em 1.6em; border-radius: 18px; }
.neon-btn.ghost { --c: #c9bfe0; text-shadow: 0 0 6px color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 35%, transparent), inset 0 0 6px color-mix(in srgb, var(--c) 25%, transparent); }
.neon-btn.icon { width: 46px; padding: 0; font-size: 22px; }

/* ---- Stage ---- */
.stage {
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  position: relative; width: 100%; height: 100vh; height: 100svh; overflow: hidden; background: #05040b;
}
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; outline: none; }
.stage.seated #gl { touch-action: none; }
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.hud > * { pointer-events: none; }
.hud button, .hud a, .hud .menu, .hud .result, .hud .scrim { pointer-events: auto; }

/* Top bar */
.hud-top {
  position: absolute; top: calc(var(--safe-t) + 10px); left: 10px; right: 10px;
  display: flex; align-items: center; gap: 8px; transition: opacity .5s ease;
}
.hud-top .menu-btn { --c: var(--pink); flex: none; }
.me-plate, .status, .plate {
  display: inline-flex; align-items: center; gap: .45em; padding: 5px 11px 5px 9px; border-radius: 999px;
  background: rgba(8, 6, 18, .66); border: 1px solid rgba(255, 255, 255, .14);
  font-family: var(--lat); font-stretch: condensed; font-size: 15px; letter-spacing: .03em; white-space: nowrap;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.me-plate { --c: var(--cyan); border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.status { margin-left: auto; color: var(--dim); }
.status .han { color: var(--amber); font-size: 18px; text-shadow: 0 0 8px rgba(255, 180, 60, .7); }
.status .wl { color: var(--ink); }
.pw { color: var(--c, var(--cyan)); font-size: 19px; line-height: 1; text-shadow: 0 0 8px var(--c, var(--cyan)); }
.pn { color: var(--ink); font-weight: 600; }
.ps { color: var(--dim); font-variant-numeric: tabular-nums; }
.pd { font-size: 13px; color: #fff; background: #c8322b; border-radius: 5px; padding: 1px 4px; box-shadow: 0 0 8px rgba(255, 60, 60, .7); }
.turn { box-shadow: 0 0 0 1px var(--c, var(--cyan)), 0 0 14px color-mix(in srgb, var(--c, var(--cyan)) 70%, transparent); }

.plate.pulse { animation: platePulse .7s ease-out; }
@keyframes platePulse { 0% { box-shadow: 0 0 0 1px var(--c), 0 0 26px var(--c); background: color-mix(in srgb, var(--c) 30%, rgba(8, 6, 18, .7)); } 100% { box-shadow: none; } }
.plate { position: absolute; left: 0; top: 0; border-color: color-mix(in srgb, var(--c) 50%, transparent); transition: opacity .3s ease; font-size: 14px; padding: 3px 10px 3px 8px; }
.stage:not(.seated) .hud-top, .stage:not(.seated) .dock, .stage:not(.seated) .plate, .hud.titling .plate, .hud.titling .hud-top, .hud.titling .dock { opacity: 0 !important; }
/* The win is a cinematic: no chrome over the sign and the fan. */
.stage.winning .hud-top, .stage.winning .plate, .stage.winning .dock { opacity: 0 !important; pointer-events: none; transition: opacity .4s ease; }

/* Dock: caption, coach and actions stack just above the hand */
.dock {
  position: absolute; left: 0; right: 0; bottom: calc(100% - var(--hand-top, 85%) + 8px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 8px;
}
.caption {
  --c: var(--cyan);
  position: absolute; left: 0; top: 0; transform: translate(-999px, 0);
  display: inline-flex; align-items: center; gap: .5em; padding: 4px 12px 4px 5px; border-radius: 12px; white-space: nowrap;
  background: rgb(8, 6, 18); border: 1px solid var(--c);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 40%, transparent), inset 0 0 8px color-mix(in srgb, var(--c) 18%, transparent);
  font-family: var(--lat); font-stretch: condensed; font-size: 15px;
  opacity: 0; transition: opacity .2s ease;
}
/* a small pointer toward the player who said it */
.caption::before { content: ""; position: absolute; width: 9px; height: 9px; background: rgb(8, 6, 18); border: solid var(--c); border-width: 0; }
.caption[data-side="left"]::before { left: -5.5px; top: 50%; transform: translateY(-50%) rotate(45deg); border-left-width: 1px; border-bottom-width: 1px; }
.caption[data-side="right"]::before { right: -5.5px; top: 50%; transform: translateY(-50%) rotate(45deg); border-right-width: 1px; border-top-width: 1px; }
.caption[data-side="up"]::before { top: -5.5px; left: 50%; transform: translateX(-50%) rotate(45deg); border-left-width: 1px; border-top-width: 1px; }
.caption[data-side="down"]::before { bottom: -5.5px; left: 50%; transform: translateX(-50%) rotate(45deg); border-right-width: 1px; border-bottom-width: 1px; }
.caption.on { opacity: 1; }
.caption b { font-size: 23px; color: #fff; text-shadow: 0 0 10px var(--c); }
.caption .cap-t { width: 26px; height: 35px; }
.caption i { color: var(--amber); font-style: normal; }
.caption span { color: var(--dim); }
.coach {
  max-width: min(520px, 96vw); padding: 0 4px 0 0; border-radius: 12px;
  background: rgba(6, 5, 14, .74); border: 1px solid rgba(60, 242, 255, .5);
  box-shadow: 0 0 12px rgba(60, 242, 255, .2), inset 0 0 10px rgba(60, 242, 255, .1);
  display: none; align-items: center; gap: 2px;
}
.coach.on { display: flex; animation: rise .25s ease both; }
.coach .c-text {
  flex: 1 1 auto; min-width: 0; padding: 5px 4px 0 11px; margin-bottom: 5px; background: none; border: 0; cursor: pointer; text-align: left;
  font-size: 13.5px; line-height: 1.3; color: #fff;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  max-height: calc(2.6em + 5px);
}
.coach.open .c-text { display: block; -webkit-line-clamp: unset; max-height: none; }
.coach .tip { color: var(--amber); font-weight: 700; }
.coach .plan { display: none; color: var(--dim); font-size: 12.5px; margin-top: 3px; }
.coach.open .plan { display: block; }
.coach .waits { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; margin-left: 2px; }
.coach .waits { height: 1.2em; }
.coach .waits .mt { width: 13px; height: 17px; padding: 0; box-shadow: 0 1px 0 #0f6a4a, 0 0 7px rgba(61, 255, 168, .55); }
.coach .guide { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--cyan); border: 1px solid rgba(60, 242, 255, .5); font: 700 15px var(--lat); text-decoration: none; }
/* One compact row of controls directly above the hand; it scrolls sideways if a chow has many choices. */
.actions { display: none; flex-wrap: nowrap; justify-content: center; gap: 7px; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; }
.actions::-webkit-scrollbar { display: none; }
.actions.many { justify-content: flex-start; }
.actions.on { display: flex; }
.act { flex: none; flex-direction: column; gap: 0; min-width: 56px; min-height: 50px; padding: 3px 10px; line-height: 1.05; border-radius: 12px; }
.act .han { font-size: 23px; text-transform: none; letter-spacing: 0; }
.act .en { font-size: 11px; opacity: .92; }
.act.claim { --c: var(--amber); }
.act.win { --c: var(--pink); min-width: 74px; }
.act.win .han { font-size: 27px; }
.act.pass { --c: #b9b2cc; min-width: 58px; }
.act.pass .en { font-size: 15px; }
.act.discard { --c: var(--cyan); }
.act.advised { animation: breathe 1.6s ease-in-out infinite; }
.act .trip { display: inline-flex; gap: 1px; margin-bottom: 2px; }
.mt { display: inline-block; width: 22px; height: 29px; border-radius: 4px; background: linear-gradient(#fbf6ea, #ece2cc); box-shadow: 0 2px 0 #0f6a4a, 0 3px 6px rgba(0, 0, 0, .5); padding: 1px; vertical-align: middle; }
.mt svg { width: 100%; height: 100%; display: block; }
.act .mt { width: 15px; height: 20px; padding: 0; }
.act:has(.trip) { padding: 3px 6px; min-width: 0; }
.act:has(.trip) .en { font-size: 12px; }
.act .trip { margin-bottom: 1px; }

/* Call words: struck on over a player's side, in their colour */
.words { position: absolute; inset: 0; overflow: hidden; }
.word {
  position: absolute; transform: translate(-50%, -50%); text-align: center; color: #fff; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  animation: strike 1.9s ease both;
}
.word b { font-size: clamp(56px, 15vw, 96px); line-height: 1; color: #fff;
  text-shadow: 0 0 4px #fff, 0 0 12px var(--c), 0 0 28px var(--c), 0 0 60px var(--c); -webkit-text-stroke: 1px color-mix(in srgb, var(--c) 70%, #fff); }
.word span { font-family: var(--lat); font-stretch: condensed; font-size: 17px; letter-spacing: .08em; text-transform: uppercase; color: var(--c); text-shadow: 0 0 8px var(--c); background: rgba(5, 4, 12, .55); padding: 1px 8px; border-radius: 6px; }
.word.big { animation-duration: 2.1s; }
.word.big b { font-size: clamp(72px, 20vw, 130px); }

/* Toast */
.toast { position: absolute; left: 50%; top: calc(var(--safe-t) + 64px); transform: translate(-50%, -8px); opacity: 0; transition: opacity .25s, transform .25s;
  background: rgba(8, 6, 18, .9); border: 1px solid rgba(255, 180, 60, .6); color: var(--ink); padding: 8px 14px; border-radius: 12px; max-width: 92vw; font-size: 14px; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- Title ---- */
.title-screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 6vh) 16px calc(var(--safe-b) + 7vh); text-align: center; pointer-events: none;
}
.title-screen[hidden] { display: none; }
.title-screen .t-go, .title-screen .t-back { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; animation: rise 1s .1s ease both; }
.t-sign { flex: 1; }
.t-line {
  margin: 0; padding: 7px 16px; border-radius: 14px; font-size: clamp(15px, 4.2vw, 19px); color: #fff3dc;
  background: rgba(5, 3, 12, .8); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  box-shadow: 0 0 18px rgba(5, 3, 12, .7); text-shadow: 0 0 10px rgba(255, 180, 60, .55);
}
.t-link { font-size: 15px; color: #efe6fb; text-shadow: 0 1px 3px #000; text-underline-offset: 3px; padding: 8px 14px; border-radius: 12px; background: rgba(5, 3, 12, .5); }
.title-screen.returning { justify-content: flex-end; }
.t-wb { margin: 0; font-family: var(--lat); font-stretch: condensed; font-size: 22px; letter-spacing: .06em; color: #fff; text-shadow: 0 0 12px var(--amber), 0 1px 3px #000; }

.scroll-hint { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 10px); transform: translateX(-50%); z-index: 3; color: var(--dim); font-size: 13px; text-decoration: none; padding: 8px 12px; opacity: .8; }
.stage.seated .scroll-hint { display: none; }

/* ---- Result ---- */
.result {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 60%; overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 12px calc(var(--safe-b) + 14px);
  background: linear-gradient(rgba(7, 6, 15, 0), rgba(7, 6, 15, .9) 26px, rgba(7, 6, 15, .97));
  transform: translateY(30px); opacity: 0; transition: transform .45s cubic-bezier(.2, .9, .2, 1), opacity .35s ease;
  z-index: 4;
}
.result.in { transform: none; opacity: 1; }
.result[hidden] { display: none; }
.r-card { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.r-head { display: flex; align-items: center; gap: 12px; }
.r-how { flex: none; font-size: 54px; line-height: 1; color: #fff; text-shadow: 0 0 4px #fff, 0 0 16px var(--pink), 0 0 40px var(--pink); }
.r-who { flex: 1 1 auto; min-width: 0; font-family: var(--lat); font-stretch: condensed; font-size: clamp(20px, 6vw, 28px); white-space: nowrap; font-weight: 600; letter-spacing: .03em; display: flex; flex-direction: column; line-height: 1.05; }
.r-who small { font-size: 14px; color: var(--dim); font-weight: 400; margin-top: 4px; letter-spacing: .02em; white-space: normal; }
.r-faan { flex: none; display: flex; flex-direction: column; align-items: center; gap: 0; }
.r-faan .count { font-family: var(--lat); font-stretch: condensed; font-size: 76px; line-height: .85; font-weight: 700; color: #eafdff;
  text-shadow: 0 0 4px #fff, 0 0 16px var(--cyan), 0 0 40px var(--cyan); font-variant-numeric: tabular-nums; }
.r-faan > span { display: flex; flex-direction: column; align-items: center; font-family: var(--lat); font-stretch: condensed; font-size: 16px; letter-spacing: .24em; text-transform: uppercase; color: var(--cyan); }
.r-faan em { font-style: normal; color: var(--pink); text-shadow: 0 0 10px var(--pink); letter-spacing: 0; font-size: 22px; }
.result.big .r-faan .count, .result.limit .r-faan .count { font-size: 96px; color: #ffe8f2; text-shadow: 0 0 4px #fff, 0 0 18px var(--pink), 0 0 50px var(--pink), 0 0 90px rgba(255, 61, 139, .6); }
.result.limit .r-how { font-size: 72px; }
.r-faan .count.done { animation: settle .5s ease; }
.r-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.r-lines li { opacity: 0; transform: translateX(-10px); }
.r-lines li.on { animation: lineOn .5s ease both; }
.r-lines button {
  width: 100%; min-height: 44px; display: grid; grid-template-columns: auto auto 1fr auto; align-items: baseline; gap: 10px;
  padding: 6px 12px; border-radius: 12px; cursor: pointer; text-align: left;
  background: rgba(255, 180, 60, .06); border: 1px solid rgba(255, 180, 60, .45);
  box-shadow: inset 0 0 10px rgba(255, 180, 60, .12);
}
.r-lines b { font-size: 24px; color: #fff4dc; text-shadow: 0 0 10px var(--amber); }
.r-lines i { font-style: normal; color: var(--amber); font-size: 14px; }
.r-lines .en { color: var(--dim); font-size: 14px; }
.r-lines .f { font-family: var(--lat); font-stretch: condensed; font-size: 24px; font-weight: 700; color: var(--cyan); text-shadow: 0 0 8px var(--cyan); }
.r-tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.r-tiles .grp { display: inline-flex; gap: 1px; }
.r-pay { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.r-pay > div { display: flex; flex-direction: column; align-items: center; padding: 4px 4px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); background: rgba(8, 6, 18, .5); }
.r-pay .nm { font-size: 13px; color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.r-pay .d { font-family: var(--lat); font-stretch: condensed; font-size: 20px; font-weight: 700; }
.r-pay .d.up { color: var(--jade); text-shadow: 0 0 8px var(--jade); }
.r-pay .d.down { color: #ff7a8a; }
.r-pay .sc { font-size: 12px; color: var(--dim); }
.r-paid { display: block; padding: 10px 14px; border-radius: 12px; border: 1px dashed rgba(255, 180, 60, .5); color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1.4; background: rgba(255, 180, 60, .05); }
.r-paid b { color: var(--amber); }
.r-paid span { color: var(--cyan); white-space: nowrap; }
.r-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.r-btns .next { flex: 1 1 100%; }
.r-final { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.r-final li { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); font-family: var(--lat); font-stretch: condensed; font-size: 22px; }
.r-final .pl { color: var(--c); font-weight: 700; text-shadow: 0 0 8px var(--c); }
.r-final .sc { margin-left: auto; }

/* ---- Menu ---- */
.scrim { position: absolute; inset: 0; background: rgba(2, 1, 8, .5); z-index: 5; }
.scrim[hidden], .menu[hidden] { display: none; }
.menu {
  position: absolute; top: 0; left: 0; bottom: 0; width: min(380px, 90vw); overflow-y: auto; z-index: 6;
  padding: calc(var(--safe-t) + 14px) 16px calc(var(--safe-b) + 20px);
  background: rgba(9, 6, 20, .97); border-right: 3px double rgba(255, 61, 139, .8);
  box-shadow: 8px 0 30px rgba(255, 61, 139, .25);
  animation: slideIn .28s cubic-bezier(.2, .9, .2, 1) both;
}
.m-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.m-head b { font-size: 34px; color: #ffe3ef; text-shadow: 0 0 10px var(--pink), 0 0 24px var(--pink); }
.m-head span { font-family: var(--lat); font-stretch: condensed; letter-spacing: .2em; text-transform: uppercase; color: var(--cyan); text-shadow: 0 0 8px var(--cyan); }
.m-head .close { margin-left: auto; --c: #c9bfe0; }
.m-sec { padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.m-sec.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-sec h3, .m-tools h3 { margin: 0 0 6px; font-family: var(--lat); font-stretch: condensed; font-size: 14px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.m-sec h3 small { letter-spacing: .04em; text-transform: none; font-weight: 400; }
.seg-row { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-row button { flex: 1 1 auto; min-height: 44px; padding: 6px 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .04); cursor: pointer; font-size: 15px; }
.seg-row button[aria-pressed="true"] { border-color: var(--cyan); color: #fff; box-shadow: 0 0 10px rgba(60, 242, 255, .5), inset 0 0 8px rgba(60, 242, 255, .25); text-shadow: 0 0 8px var(--cyan); }
.m-sec .newgame { width: 100%; }
.m-tools { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; }
.m-tools a { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); min-height: 44px; }
.m-tools a:hover { background: rgba(60, 242, 255, .06); }
.m-tools a b { font-size: 16px; color: #fff; }
.m-tools a b .han { color: var(--amber); font-size: 15px; margin-left: 4px; }
.m-tools a > span { font-size: 13px; color: var(--dim); }
.m-tools a.game { margin-top: 6px; border: 1px dashed rgba(255, 180, 60, .45); }

/* ---- Landscape and desktop: HUD panels to the side ---- */
.hud.dock-side .dock { left: 16px; right: auto; width: calc(var(--hand-left) - 32px); max-width: 380px; bottom: calc(var(--safe-b) + 14px); align-items: stretch; padding: 0; }
.hud.dock-side .coach { text-align: left; align-items: flex-start; max-width: none; }
.hud.dock-side .actions { justify-content: flex-start; }
@media (min-aspect-ratio: 5/4) {
  .result { left: auto; top: 0; width: min(460px, 44vw); max-height: none; padding: calc(var(--safe-t) + 20px) 18px 20px;
    background: linear-gradient(90deg, rgba(7, 6, 15, 0), rgba(7, 6, 15, .92) 30px, rgba(7, 6, 15, .97)); transform: translateX(30px); }
  .result.in { transform: none; }
  .title-screen { padding-top: calc(var(--safe-t) + 5vh); }
  .coach { font-size: 16px; }
}

/* ---- Below the fold ---- */
.below { max-width: 760px; margin: 0 auto; padding: 48px 18px 60px; line-height: 1.6; font-size: 17px; }
.below h1 { font-family: var(--lat); font-stretch: condensed; font-size: clamp(30px, 6vw, 46px); line-height: 1.1; letter-spacing: .01em; margin: 0 0 .5em;
  color: #fff; text-shadow: 0 0 14px rgba(255, 61, 139, .55); }
.below h2 { font-family: var(--lat); font-stretch: condensed; font-size: 26px; letter-spacing: .06em; text-transform: uppercase; margin: 1.8em 0 .6em; color: var(--cyan); text-shadow: 0 0 10px rgba(60, 242, 255, .6); }
.below .promise { color: #e9e0f4; }
.below .han { color: var(--amber); }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tools a { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; text-decoration: none; color: var(--ink);
  border: 1px solid rgba(60, 242, 255, .35); background: rgba(60, 242, 255, .04); box-shadow: inset 0 0 14px rgba(60, 242, 255, .06); transition: box-shadow .2s, border-color .2s; }
.tools a:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(60, 242, 255, .35), inset 0 0 14px rgba(60, 242, 255, .1); }
.tools b { color: #fff; font-size: 18px; }
.tools span { color: var(--dim); font-size: 15px; line-height: 1.45; }
.faq details { border-bottom: 1px solid rgba(255, 255, 255, .1); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.game-card { margin-top: 2.4em; padding: 18px; border-radius: 16px; border: 3px double rgba(255, 180, 60, .6); box-shadow: 0 0 18px rgba(255, 180, 60, .2); }
.game-card h2 { margin-top: 0; color: var(--amber); text-shadow: 0 0 10px rgba(255, 180, 60, .6); }
.foot { margin-top: 3em; color: var(--dim); font-size: 14px; }
.foot a { color: var(--dim); }

/* ---- Fallback (no WebGL) ---- */
.gl-fallback { display: none; }
body.no-gl #gl, body.no-gl .hud { display: none; }
body.no-gl .stage { height: auto; min-height: 70svh; background: radial-gradient(ellipse at 50% 30%, #2a0f2c, #07060f 70%); }
body.no-gl .gl-fallback { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 70svh; padding: 30px 18px; text-align: center; }
.fb-sign { display: flex; flex-direction: column; align-items: center; }
.fb-sign .han { font-size: 110px; line-height: 1; color: #ffe3ef; text-shadow: 0 0 10px var(--pink), 0 0 30px var(--pink); }
.fb-sign b { font-family: var(--lat); font-stretch: condensed; letter-spacing: .3em; text-transform: uppercase; color: var(--cyan); text-shadow: 0 0 10px var(--cyan); }

/* ---- Capture mode ---- */
body.cinema .hud-top, body.cinema .plate, body.cinema .coach, body.cinema .caption, body.cinema .scroll-hint,
body.cinema .r-btns, body.cinema .r-paid, body.cinema .t-link, body.cinema .r-pay { display: none !important; }

/* ---- Motion ---- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent), inset 0 0 10px color-mix(in srgb, var(--c) 45%, transparent); }
  50% { box-shadow: 0 0 24px var(--c), inset 0 0 14px color-mix(in srgb, var(--c) 70%, transparent); } }
/* Tube ignition: a few uneven strikes, never faster than 3 per second, then steady. */
@keyframes igniteA { 0% { opacity: 0; } 20% { opacity: .55; } 38% { opacity: .1; } 62% { opacity: .85; } 78% { opacity: .35; } 100% { opacity: 1; } }
@keyframes igniteB { 0% { opacity: 0; } 30% { opacity: .4; } 52% { opacity: 0; } 70% { opacity: .9; } 84% { opacity: .5; } 100% { opacity: 1; } }
@keyframes hum { 0%, 91%, 100% { opacity: 1; } 93% { opacity: .55; } 96% { opacity: .95; } }
@keyframes strike {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.35); }
  8% { opacity: 1; transform: translate(-50%, -50%) scale(.96); }
  14% { opacity: .55; }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -54%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.98); }
}
@keyframes lineOn { 0% { opacity: 0; transform: translateX(-10px); } 40% { opacity: .5; } 55% { opacity: .2; } 100% { opacity: 1; transform: none; } }
@keyframes settle { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .word, .word.big { animation: fadeHold 2s ease both; }
  .act.advised { animation: none; box-shadow: 0 0 22px var(--c); }
  .r-lines li.on { animation: fadeIn .3s ease both; }
  .result { transition: opacity .3s ease; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeHold { 0% { opacity: 0; transform: translate(-50%, -50%); } 15%, 80% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -50%); } }

/* Street view / Table view switch: only while seated and playing. */
.g-viewbtn { position:absolute; right:max(10px,env(safe-area-inset-right)); top:calc(118px + env(safe-area-inset-top)); z-index:6; display:none; align-items:center; gap:6px;
  min-height:40px; padding:6px 12px; border-radius:999px; border:1px solid rgba(120,240,255,.55); background:rgba(6,8,16,.72); color:#dffaff; font:600 13px/1 "Avenir Next Condensed","DIN Condensed","Roboto Condensed","Arial Narrow",system-ui,sans-serif;
  letter-spacing:.06em; text-transform:uppercase; box-shadow:0 0 12px rgba(80,220,255,.35), inset 0 0 8px rgba(80,220,255,.18); cursor:pointer; -webkit-tap-highlight-color:transparent; }
.g-viewbtn .han { font-family:"Kaiti TC","Songti TC","Noto Serif CJK TC",serif; font-size:17px; text-transform:none; color:#7df3ff; text-shadow:0 0 8px rgba(80,220,255,.8); }
.stage.seated .g-viewbtn { display:inline-flex; }
.stage.winning .g-viewbtn, body.cinema .g-viewbtn, .menu-open .g-viewbtn { display:none !important; }
@media (min-width:900px) { .g-viewbtn { top:calc(44px + env(safe-area-inset-top)); } }

/* The view switch lives in the top bar: a small round control on phones, labelled on wide screens. */
.hud-top .g-viewbtn { position: static; flex: none; top: auto; right: auto; min-height: 40px; height: 40px; padding: 0 12px; }
@media (max-width: 600px) {
  .hud-top .g-viewbtn { padding: 0 10px 0 8px; gap: 4px; font-size: 12px; letter-spacing: .04em; }
  .hud-top .g-viewbtn .han { font-size: 18px; }
  .status { gap: .35em; padding: 5px 10px; }
  .status > span:nth-child(2) { display: none; }
  .hud-top { gap: 6px; }
}
@media (max-width: 370px) { .me-plate { padding: 5px 9px 5px 7px; } .me-plate .pn { display: none; } }
body.cinema .title-screen .go, body.cinema .t-link, body.cinema .g-viewbtn { display: none !important; }

/* The view control names the view you are in; tap for the next (Street, Table, Top). After moving freely it offers
   the way back to your preset. */
.g-viewbtn.free { border-color: rgba(255, 180, 60, .7); box-shadow: 0 0 12px rgba(255, 180, 60, .35); }
.g-viewbtn.free .han { color: var(--amber); text-shadow: 0 0 8px rgba(255, 180, 60, .8); }
/* Sit down tapped before the table finished warming up */
.title-screen .go.dealing { opacity: .85; animation: breathe 1.4s ease-in-out infinite; }

/* Until the first touch the street is silent (browsers allow no sound before it): a small hint on the title. */
.sound-hint { position: absolute; z-index: 6; top: calc(var(--safe-t) + 14px); right: 12px; display: none; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(60, 242, 255, .55); background: rgba(6, 5, 14, .66);
  color: #dffaff; font: 600 13px/1 var(--lat); letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
  box-shadow: 0 0 12px rgba(60, 242, 255, .3); text-shadow: 0 0 8px rgba(60, 242, 255, .7); -webkit-tap-highlight-color: transparent; }
.sound-hint.on { display: inline-flex; animation: rise .6s ease both; }
