/* Daaluu — a card room in green felt: the table a lighter pool of the same cloth,
   solid seat colours, bone tiles, gold for what matters. */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  --bg-0: #0a2119;
  --bg-1: #0e2a20;
  --raise: #123326;
  --raise-2: #1a4130;
  --line: rgba(220, 240, 225, .09);
  --line-2: rgba(220, 240, 225, .17);
  --ink: #f4f1e8;
  --ink-2: #d3ddd1;
  --muted: #92aa99;
  --gold: #e8bf5a;
  --gold-2: #c99a3a;
  --gold-ink: #2a1d05;
  --gold-glow: rgba(0, 0, 0, .3);
  --red: #f08a7a;
  --red-fill: #b8392e;
  --green: #7fd6a0;
  --turn: #45e0c0;
  --stage: #1a5039;
  /* Felt grain, generated: no motif, so it tiles evenly at any size. */
  --felt: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='.33 .33 .33 0 0 .33 .33 .33 0 0 .33 .33 .33 0 0 0 0 0 0 .08'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --brass: rgba(232, 191, 90, .35);
  --btn-hi: #23804f;
  --btn-lo: #145637;
  --btn-edge: rgba(150, 225, 185, .5);
  --paper: #f6efe0;
  /* sits under labels laid straight on the felt */
  --on-felt: rgba(5, 20, 14, .4);
  /* алхан хээ: a key band, used as a mask so it takes any colour */
  --hee: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 6'%3E%3Cpath d='M0 5.5H12M9 5.5V.5H3v3h3.5' fill='none' stroke='%23000'/%3E%3C/svg%3E");

  /* The room is the same felt as the table, darker and vignetted. */
  --wood: radial-gradient(130% 90% at 50% 35%, transparent 40%, rgba(0, 0, 0, .5) 100%), var(--felt) 0 0 / 180px, #0c2a1d;

  /* Seat colours, filled solid: me teal, then ochre, violet, rose, blue. */
  --s0: #1fa48e;
  --s1: #b07a2c;
  --s2: #7a50b4;
  --s3: #b4506f;
  --s4: #2f5f90;

  --f-ui: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --f-display: "Alegreya", Georgia, "Times New Roman", serif;

  --pad-l: 24px;            /* GameTok keeps a ~24pt exit strip on the left edge */
  --tile-w: 34px;
  --hand-max: 48px;
  --play-w: clamp(38px, 10.8vw, 48px);
  --slot: 26px;
  --av: 52px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--ink);
  font: 500 15px/1.35 var(--f-ui);
  /* Alegreya defaults to old-style figures; scores need to line up. A feature
     setting, not font-variant: the font shorthand would reset that. */
  font-feature-settings: "lnum" 1;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}
img, svg { -webkit-user-drag: none; user-select: none; }
.table, .hand { touch-action: none; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
.selectable, .selectable * { -webkit-user-select: text; user-select: text; }
.ic { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -.14em; }

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
  background: var(--wood);
}
/* Wide frames (usions.com on desktop): keep the table phone-shaped and centred. */
.topbar, .table, .dock { width: 100%; max-width: 560px; margin-left: auto; margin-right: auto; }

/* ── top bar ─────────────────────────────────────────── */
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 6px var(--pad-l);
  min-height: 54px;
}
.janlii-badge {
  height: 36px;
  flex: 0 1 auto;
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.janlii-tile .t { width: 17px; }
.janlii-badge.pulse { animation: janlii 1.4s ease-out; }
@keyframes janlii { 0% { transform: scale(.6); opacity: 0; } 30% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.janlii-tile .t svg { filter: none; }
.janlii-text { display: flex; flex-direction: row; align-items: baseline; gap: 10px; line-height: 1.2; min-width: 0; }
.janlii-text small { color: var(--gold); font-size: 16px; font-weight: 700; }
.janlii-text b { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 6px; margin-left: auto; }
.icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .06);
  background: rgba(0, 0, 0, .28);
  display: grid; place-items: center;
  font-size: 19px;
  color: var(--ink-2);
  padding: 0;
  transition: background .15s, transform .1s;
}
.icon-btn:active { transform: scale(.94); background: rgba(0, 0, 0, .4); }

/* ── table ───────────────────────────────────────────── */
.table { position: relative; flex: 1; min-height: 0; max-height: 530px; z-index: 1; }
/* Generated felt stays decorative; seats and tiles remain live controls. */
.stage {
  position: absolute;
  left: 10px; right: 10px; top: 2%; bottom: 3%;
  /* A stadium: the same circular corner all round, so the ends read as arcs
     rather than a squashed ellipse. A darker rim band, then a gold stitch. */
  border-radius: min(150px, 40vw);
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(255, 255, 255, .06), transparent 72%), var(--felt) 0 0 / 180px, linear-gradient(#1b5639, #174c31);
  border: 0;
  box-shadow: inset 0 0 0 10px rgba(0, 0, 0, .16), inset 0 0 0 11px rgba(232, 191, 90, .22), inset 0 0 60px rgba(0, 0, 0, .3), 0 0 0 1px rgba(0, 0, 0, .35), 0 12px 40px rgba(0, 0, 0, .4);
  pointer-events: none;
}
.toono {
  position: absolute; left: 50%; top: 54%;
  width: 150%; height: auto; aspect-ratio: 1;
  max-width: none;
  transform: translate(-50%, -50%);
  overflow: visible;
}
.toono-ribs { stroke: rgba(242, 187, 85, .075); stroke-width: .5; fill: none; }
.toono-ring { fill: rgba(10, 12, 11, .28); stroke: rgba(242, 187, 85, .26); stroke-width: .7; }
.toono-ring.in { fill: none; stroke: rgba(242, 187, 85, .1); stroke-width: .5; }

/* ten houses, between the two top seats */
.houses {
  position: absolute;
  left: 50%; top: 12%;
  transform: translate(-50%, -50%);
  z-index: 4;
}
.houses-strip {
  display: grid;
  grid-template-columns: repeat(5, var(--slot));
  gap: 5px;
}
.houses.four { left: 19%; }
.houses.four .houses-strip { grid-template-columns: repeat(4, var(--slot)); }
/* Three players: no top seats, so sixteen houses run in two rows across the top. */
.houses.three .houses-strip { grid-template-columns: repeat(8, var(--slot)); }
.houses-strip .slot {
  width: var(--slot); height: calc(var(--slot) * 1.25);
  padding: 0;
  border-radius: 5px;
  display: grid; place-items: center;
  font-size: calc(var(--slot) * .56); font-weight: 700;
  position: relative;
  /* a tile back in dark felt, cross-hatched */
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px), repeating-linear-gradient(-45deg, rgba(0, 0, 0, .12) 0 1px, transparent 1px 3px), linear-gradient(#123a2a, #0b281d);
  border: 1px solid rgba(0, 0, 0, .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 2px 4px rgba(0, 0, 0, .35);
  color: #fff;
  transition: transform .2s;
}
.houses-strip .slot .ic { font-size: calc(var(--slot) * .58); }
.houses-strip .slot::before { content: ""; position: absolute; inset: -4px; }
.houses-strip .slot .mono { font-size: calc(var(--slot) * .5); }
.houses-strip .slot.on {
  background: var(--seat);
  border-color: rgba(0, 0, 0, .3);
  animation: popIn .32s cubic-bezier(.3, 1.6, .5, 1);
}
.houses-strip .slot.on img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.houses-strip .slot.sel { transform: scale(1.18); box-shadow: 0 0 0 2px var(--gold); }
.banner-wrap { position: relative; }
.house-pop {
  position: absolute; left: 0; right: 0; bottom: 8px;
  min-height: 50px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .55);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 0 10px;
  border-radius: 10px;
  background: var(--raise-2);
  box-shadow: inset 3px 0 0 var(--gold), 0 14px 30px rgba(0, 0, 0, .55);
  color: var(--ink);
  white-space: nowrap;
  animation: fade .15s ease-out;
  z-index: 2;
}
.house-pop .tiles { display: flex; gap: 2px; }
.house-pop .t { width: 18px; }
.house-pop .txt { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.house-pop b { font-size: 12.5px; font-weight: 700; }
.house-pop small { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* seats */
.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 82px;
  z-index: 2;
}
.avatar {
  position: relative;
  width: var(--av); height: var(--av);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: calc(var(--av) * .46); font-weight: 700;
  color: #fff;
  background: var(--seat, var(--raise-2));
  border: 0;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 3px 8px rgba(0, 0, 0, .4);
  transition: box-shadow .25s;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
/* Profile photos fill their circle whatever their shape: a tall photo in a grid
   cell would otherwise stretch the row and spill out of the avatar. */
.avatar img, .mini-av img, .pav img, .slot img, .over-avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.mini-av { position: relative; overflow: hidden; }
.mono { font-family: var(--f-ui); font-weight: 700; color: #fff; line-height: 1; }
.avatar .cnt {
  display: none;
}
.avatar .botb {
  position: absolute; left: -6px; top: -5px;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--raise); color: var(--ink-2);
  border: 1px solid var(--line-2);
  font-size: 11px;
  z-index: 2;
}
.seat.turn .avatar, .me-seat.turn .avatar {
  /* only a glow: the face, a photo for most players, stays unframed */
  box-shadow: 0 0 0 2px var(--turn), 0 0 18px rgba(69, 224, 192, .55);
}
.avatar .star {
  position: absolute; right: -5px; top: -5px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--gold); color: var(--gold-ink);
  display: grid; place-items: center;
  font-size: 11px;
  border: 2px solid var(--bg-1);
  z-index: 2;
}
.seat .name {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 14.5px; font-weight: 500;
  color: var(--ink);
  max-width: 92px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.seat .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.seat .name .ic { font-size: 12px; color: var(--muted); }
.name .first { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.stats {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 0;
  font-size: 14px; font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stat { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); }
.stat { gap: 5px; }
.stat .ic { font-size: 15px; }
.stat.tea { font-size: 14px; }
.pips { display: inline-flex; align-items: center; gap: 3px; padding-left: 7px; border-left: 1px solid var(--line-2); color: var(--ink); }
.pips .ic { font-size: 13px; color: var(--ink-2); }
.pips b { font-size: 12.5px; margin-right: 2px; }
.pips i { width: 6px; height: 6px; border-radius: 50%; border: 1.3px solid rgba(255, 255, 255, .4); }
.pips i.on { background: var(--ink-2); border-color: var(--ink-2); }
.pips.safe i.on { background: var(--green); border-color: var(--green); }
.pips.safe b { color: var(--green); }
.stat.tea .ic { color: var(--gold); }
.stat.house .ic { color: var(--ink-2); }
.stat.debt, .stat.debt .ic { color: var(--red); }
.seat.away .avatar { filter: grayscale(1); opacity: .55; }
.seat .tag { font-size: 11px; font-weight: 700; color: var(--muted); }
.thinking {
  position: absolute; left: 50%; top: -8px;
  transform: translateX(-50%);
  display: flex; gap: 3px;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--seat);
}
.thinking i { width: 4px; height: 4px; border-radius: 50%; background: var(--bg-0); animation: blink 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
.gain {
  position: absolute; left: 50%; top: -12px;
  transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gold); color: var(--gold-ink);
  font-size: 12px; font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .4);
  animation: rise 1.2s ease-out both;
  white-space: nowrap;
  z-index: 3;
}
.bubble {
  position: absolute;
  top: -8px; left: 50%;
  transform: translate(-50%, -100%);
  max-width: 160px; width: max-content;
  padding: 7px 11px;
  border-radius: 12px 12px 12px 3px;
  background: var(--paper); color: #2a1d12;
  font-size: 12.5px; font-weight: 700;
  white-space: normal; text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
  animation: pop .18s ease-out;
  z-index: 8;
  pointer-events: none;
}
.me-seat .bubble { left: 24px; }
/* An emoji on its own is a reaction: big, no speech box. */
.bubble.emoji { padding: 2px 6px; background: none; box-shadow: none; font-size: 34px; line-height: 1.1; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
/* Table seats speak toward the middle of the table. */
.seat .bubble { top: 50%; bottom: auto; transform: translateY(-50%); width: max-content; max-width: 130px; animation: fade .18s ease-out; }
.seat.face-r .bubble { left: calc(100% + 8px); border-radius: 4px 14px 14px 14px; }
.seat.face-l .bubble { left: auto; right: calc(100% + 8px); border-radius: 14px 4px 14px 14px; }
/* Top seats speak downward, below their stats, clear of the house plate. */
.seat:has(.bubble) { z-index: 7; }
.bubble.still, .seat .bubble.still { animation: none; }
.seat.face-d .bubble { top: calc(100% + 52px); left: 50%; transform: translateX(-50%); border-radius: 4px 14px 14px 14px; }
.seat.face-d.dr .bubble { left: 30%; transform: none; }
.seat.face-d.dl .bubble { left: auto; right: 30%; transform: none; border-radius: 14px 4px 14px 14px; }

/* played tiles */
/* Its own layer over the felt. On iOS only the sliding-in tile got one, and
   the earlier plays of the trick were painted under the felt and vanished. */
.plays { position: absolute; inset: 0; z-index: 3; pointer-events: none; transform: translateZ(0); }
.play-slot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  padding: 6px;
  border-radius: 12px;
  z-index: 3;
  pointer-events: auto;
  will-change: transform, opacity;
  transition: opacity .3s, transform .38s cubic-bezier(.4, 0, .2, 1), background .2s, box-shadow .2s;
}
/* Each tile its own stacking slot: iOS dropped (and flickered) the second of
   two overlapped tiles when they shared the slot's filtered/animated layer. */
.play-slot { isolation: isolate; }
.play-slot .t { width: var(--play-w); position: relative; z-index: 1; }
.play-slot .t + .t { z-index: 2; }
.play-slot .t + .t + .t { z-index: 3; }
.play-slot .t + .t + .t + .t { z-index: 4; }
/* A pair overlaps square: every tile upright and on the same line. */
.play-slot .t + .t { margin-left: calc(var(--play-w) * -.45); }
/* Four tiles (the azi, or four Ёоз) tuck tighter so the slot still fits. */
.play-slot.quad .t + .t { margin-left: calc(var(--play-w) * -.62); }
.play-slot .crown {
  position: absolute;
  left: 50%; top: -22px;
  transform: translateX(-50%);
  display: grid; place-items: center;
  color: var(--gold);
  font-size: 30px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .5));
  z-index: 2;
}
.play-slot .suit-call {
  position: absolute;
  left: 50%; bottom: -17px;
  transform: translateX(-50%);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  white-space: nowrap;
}
.play-slot .suit-call.red { background: var(--red-fill); color: #fff; }
.play-slot .suit-call.white { background: var(--ink); color: var(--bg-0); }
/* Thrown tiles sit dimmed. A shade over them, not a CSS filter on the tiles:
   filtered overlapping tiles are what iOS fails to paint. */
.play-slot.thrown::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: calc(var(--play-w) * .14);
  background: rgba(8, 24, 16, .32);
  z-index: 5;
  pointer-events: none;
}
.plays.ghost .play-slot { opacity: .55; filter: saturate(.6); animation: fade .25s ease-out; }
.plays.ghost .crown { display: none; }
.plays.ghost .play-slot.best { box-shadow: inset 0 0 0 1.5px rgba(232, 191, 90, .5); }
.replay-tag {
  position: absolute; left: 50%; top: 54%;
  transform: translate(-50%, -50%);
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--raise-2); border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 12px; font-weight: 700;
  white-space: nowrap;
  z-index: 4;
  animation: fade .2s ease-out;
}
.play-slot.enter { animation: slideIn .26s cubic-bezier(.2, .9, .3, 1); }

/* ── tiles ───────────────────────────────────────────── */
.t { display: block; aspect-ratio: 1 / 2; width: var(--tile-w); }
.t svg {
  width: 100%; height: 100%; display: block;
  /* a 1.5px ivory edge, then the shadow: reads as a thick bone tile */
  filter: drop-shadow(0 2px 0 #d6c7a6) drop-shadow(0 1px 0 #9c8a69) drop-shadow(0 6px 6px rgba(0, 0, 0, .45));
}

/* ── dock ────────────────────────────────────────────── */
.dock {
  position: relative;
  z-index: 3;
  padding: 10px 10px calc(10px + var(--safe-bottom)) var(--pad-l);
}
.hall-brand::after {
  content: "";
  position: absolute; left: 20px; right: 20px; top: 3px;
  height: 5px;
  background: var(--gold);
  opacity: .32;
  -webkit-mask: var(--hee) left center / auto 100% repeat-x;
  mask: var(--hee) left center / auto 100% repeat-x;
  pointer-events: none;
}
.banner {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  min-height: 46px;
  padding: 6px 8px 6px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .2);
  color: var(--ink-2);
  font-size: 13.5px; font-weight: 600; line-height: 1.25;
  overflow: hidden;
  transition: background .2s, border-color .2s, color .2s;
}
.banner .txt { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.banner .turn-heading { display: block; margin-bottom: 2px; color: var(--ink); font: 700 17px/1.15 var(--f-display); }
.banner.mine .txt { display: block; font-size: 13px; }
.banner.mine { min-height: 62px; }
.best-chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px 4px 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  font-size: 12px; color: var(--ink);
}
.best-chip .t { width: 12px; }
.best-chip .lab { display: flex; flex-direction: column; line-height: 1.1; }
.best-chip small { font-size: 11px; font-weight: 700; color: var(--muted); }
.best-chip b { font-size: 12.5px; }
.banner.mine .best-chip { background: rgba(0, 0, 0, .3); }
.best-chip .t svg { filter: none; }
.best-chip .t + .t { margin-left: -9px; }
.banner.flash { animation: flash .5s ease-out; }
.banner .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--seat, var(--muted)); }
.banner.wait .dot { animation: blink 1.2s ease-in-out infinite; }
.banner .bi { font-size: 16px; color: var(--gold); }
.banner.mine {
  background: rgba(214, 169, 90, .13);
  box-shadow: inset 3px 0 0 var(--gold);
  color: var(--ink-2);
}
.banner.built { box-shadow: inset 3px 0 0 var(--brass); color: var(--ink); }
.banner .timer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .06); }
.banner .timer i { display: block; height: 100%; background: var(--gold); transform-origin: left; }
.banner.urgent { background: rgba(165, 52, 43, .26); box-shadow: inset 3px 0 0 var(--red); color: #f6d3c8; }
.banner.urgent .timer i { background: var(--red); }
.banner.urgent .bi { color: var(--red); }
@keyframes flash { 0%, 100% { transform: none; } 20% { transform: translateX(-4px); } 60% { transform: translateX(3px); } }

.hand {
  --hw: 32px;
  margin-top: 4px;
  --hg: 4px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 20px 0 6px;
  min-height: calc(var(--hand-max) * 2 + 26px);
}
.hand .t {
  position: relative;
  width: var(--hw);
  margin-left: var(--hg);
  border: 0; padding: 0; background: none;
  transition: transform .16s cubic-bezier(.3, 1.4, .5, 1), opacity .14s, filter .14s;
  touch-action: manipulation;
}
.hand .t:first-child { margin-left: 0; }
.hand.two { flex-wrap: wrap; row-gap: 10px; margin-left: auto; margin-right: auto; }
.hand .t.dim { transform: translateY(4px); }
/* Not playable now: a navy veil over the face, edge and pips keep their colour. */
.hand .t.dim::before {
  content: "";
  position: absolute; inset: 1px 1px 2px;
  border-radius: 7px;
  background: rgba(12, 15, 13, .36);
  pointer-events: none;
}
.hand .t.sel { transform: translateY(-16px); z-index: 2; }
.hand .t:active { z-index: 3; }
.hand .t.sel svg { filter: drop-shadow(0 2px 0 #d6c7a6) drop-shadow(0 1px 0 #9c8a69) drop-shadow(0 10px 14px rgba(0, 0, 0, .55)); }
.hand .t.jan::after {
  content: "★";
  position: absolute; left: 50%; top: -9px;
  transform: translateX(-50%);
  min-width: 18px; height: 16px; padding: 0 4px;
  border-radius: 6px;
  display: grid; place-items: center;
  background: var(--gold); color: var(--gold-ink);
  font-size: 10px; line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  pointer-events: none;
  z-index: 2;
}
.hand.hidden-tiles .t { pointer-events: none; }
/* аргагүй арван мод: the hand sits the tent out, face up */
.hand.helpless .t { pointer-events: none; filter: brightness(.72) saturate(.7); }
.seat.helpless .avatar { opacity: .6; }
/* A sitting-out hand: one neat overlapped fan on a dark tray, hung under the
   seat out of the layout so the seat keeps its size and never covers a neighbour. */
.seat.helpless { z-index: 3; }
.open-hand {
  position: absolute;
  top: calc(100% + 3px); left: 50%;
  transform: translateX(-50%);
  display: flex; flex-wrap: nowrap;
  padding: 4px 6px 4px 5px;
  border: 0; border-radius: 9px;
  background: rgba(5, 18, 12, .55);
  box-shadow: inset 0 0 0 1px var(--line-2);
  z-index: 4;
  cursor: pointer;
}
.open-hand .t { width: 13px; flex: none; }
.open-hand .t + .t { margin-left: -5px; }
.open-hand .t svg { filter: drop-shadow(-1px 0 1px rgba(0, 0, 0, .35)); }
.open-hand:active { transform: translateX(-50%) scale(.96); }
/* Side seats hug the screen edge: hang the fan toward the table instead. */
.seat.face-r .open-hand { left: 0; transform: none; }
.seat.face-l .open-hand { left: auto; right: 0; transform: none; }
/* The two top seats: lean the fan in toward the table, clear of the side seat below. */
.seat.dr .open-hand { left: calc(50% - 2px); transform: none; }
.seat.dl .open-hand { left: auto; right: calc(50% - 2px); transform: none; }
.seat.face-r .open-hand:active, .seat.face-l .open-hand:active, .seat.dr .open-hand:active, .seat.dl .open-hand:active { transform: scale(.96); }

.hand-peek {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  max-width: calc(100% - 24px);
  padding: 10px 12px 12px;
  border-radius: 14px;
  background: rgba(6, 22, 15, .92);
  box-shadow: inset 0 0 0 1.5px var(--seat), 0 10px 26px rgba(0, 0, 0, .5);
  animation: fade .18s ease-out;
}
.hand-peek .hp-head { font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-align: center; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hand-peek .hp-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 290px; }
.hand-peek .t { width: 25px; flex: none; }

.dock-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; min-height: 52px; }
.dock-row:has(.suit-pick:not([hidden])) .me-seat .meta { display: none; }
.me-seat .avatar { flex: none; }
.me-seat { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.me-seat .avatar { --av: 42px; }
.me-seat .meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.me-seat .name { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.me-seat .stats { background: rgba(255, 255, 255, .05); }

.btn {
  height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  border: 0;
  background: rgba(255, 255, 255, .07);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  color: var(--ink);
  font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, opacity .15s, background .15s, box-shadow .15s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 rgba(0, 0, 0, .35); }
.btn.primary {
  background: linear-gradient(180deg, var(--btn-hi), var(--btn-lo));
  color: var(--paper);
  border-radius: 16px;
  font-family: var(--f-display);
  font-size: 19px;
  box-shadow: inset 0 0 0 2px var(--btn-edge), inset 0 2px 0 rgba(255, 255, 255, .12), 0 6px 14px rgba(0, 0, 0, .4);
}
.btn.primary:active:not(:disabled) { box-shadow: inset 0 0 0 2px var(--btn-edge), 0 2px 6px rgba(0, 0, 0, .4); }
.btn.primary:disabled { background: rgba(255, 255, 255, .05); color: var(--muted); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .08); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn.ghost:disabled { opacity: .4; }
.btn.soft { background: rgba(255, 255, 255, .06); }
.btn.big { height: 56px; width: 100%; }
.btn.play { min-width: 140px; padding: 0 26px; height: 56px; font-size: 24px; border-radius: 18px; }
.btn.wide { width: 100%; margin-top: 16px; height: 52px; }
.suit-pick { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .25); }
.suit {
  height: 44px; padding: 0 12px; border-radius: 10px;
  border: 0; background: transparent;
  font-weight: 700; font-size: 13px; color: var(--muted);
}
.suit.red.on { background: var(--red-fill); color: #fff; }
.suit.white.on { background: var(--ink); color: var(--bg-0); }

/* trick result (screen-reader copy of the banner) */
.trick-note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── sheets ──────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(3, 8, 6, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .2s ease-out; }
.sheet {
  position: fixed;
  z-index: 21;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 560px);
  max-height: 86%;
  overflow: auto;
  padding: 10px 20px calc(20px + var(--safe-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--raise);
  box-shadow: inset 0 1px 0 rgba(255, 228, 190, .07);
  box-shadow: 0 -24px 60px rgba(0, 0, 0, .6);
  animation: up .28s cubic-bezier(.2, .9, .3, 1);
}
.sheet.tall { max-height: 92%; }
.sheet-grip { width: 60px; height: 5px; background: var(--gold); opacity: .45; margin: 0 auto 16px; -webkit-mask: var(--hee) left center / auto 100% repeat-x; mask: var(--hee) left center / auto 100% repeat-x; }
.sheet h2 { margin: 0 0 6px; font: 700 24px/1.15 var(--f-display); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 10px; }
.sheet-head h2 { margin: 0; }
.muted { color: var(--muted); margin: 0 0 14px; font-size: 13.5px; font-weight: 600; }
.eyebrow { margin: 0 0 4px; color: var(--gold); font: italic 600 15px/1.2 var(--f-display); }

.name-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.name-opt {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 4px 10px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: rgba(0, 0, 0, .2);
  transition: border-color .15s, background .15s, transform .12s;
}
.name-opt:active { transform: scale(.96); }
.name-opt .t { width: 30px; }
.name-opt span { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.name-opt.on { border-color: var(--gold); background: rgba(214, 169, 90, .12); }
.name-opt.on span { color: var(--ink); }

.score-table { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.score-row {
  display: grid;
  grid-template-columns: 22px 34px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .18);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.score-row.me { background: rgba(255, 255, 255, .07); }
.score-row.win { background: rgba(214, 169, 90, .12); box-shadow: inset 3px 0 0 var(--gold); }
.score-row .place { color: var(--muted); font: 700 17px var(--f-display); text-align: center; }
.score-row.win .place { color: var(--gold); }
.score-row .mini-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 700; background: var(--seat, var(--raise-2)); overflow: hidden; }
.score-row .mini-av img { width: 100%; height: 100%; object-fit: cover; }
.score-row .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row .dl { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); min-width: 40px; justify-content: flex-end; }
.score-row .dl .ic { color: var(--muted); }
.score-row .delta { padding: 1px 6px; border-radius: 6px; font-size: 11.5px; background: rgba(255, 255, 255, .07); color: var(--muted); }
.score-row .dl.up .delta { background: rgba(61, 220, 151, .16); color: var(--green); }
.score-row .dl.down .delta { background: rgba(255, 98, 87, .16); color: var(--red); }
.score-row .tv { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; font-weight: 700; min-width: 52px; font-size: 15px; }
.score-row .tv .delta { margin-left: 4px; font-size: 12px; min-width: 28px; text-align: center; }
.score-row .tv .delta.up { background: rgba(61, 220, 151, .16); color: var(--green); }
.score-row .tv .delta.down { background: rgba(255, 98, 87, .16); color: var(--red); }
.score-table .foot { margin: 8px 2px 0; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.score-row .tv .ic { color: var(--gold); }
.score-row .tv.neg, .score-row .tv.neg .ic { color: var(--red); }
.score-head { display: grid; grid-template-columns: 22px 34px 1fr auto auto; gap: 10px; padding: 0 13px; font-size: 12px; font-weight: 600; color: var(--muted); }
.score-head span:nth-child(4) { min-width: 40px; text-align: right; }
.score-head span:nth-child(5) { min-width: 52px; text-align: right; padding-right: 36px; }

/* ── full screens: hall and result ───────────────────── */
.screen {
  position: fixed; inset: 0; z-index: 22;
  overflow: auto;
  background: var(--wood);
  animation: fade .22s ease-out;
}
.screen-inner {
  min-height: 100%;
  max-width: 460px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 18px) var(--pad-l);
}

/* menu: online or bots */
.menu-hero { display: flex; flex-direction: column; align-items: center; text-align: center; margin: auto 0 0; padding-top: 24px; }
.menu-logo { position: relative; width: 104px; height: 108px; margin-bottom: 18px; }
.menu-logo .t { position: absolute; top: 0; width: 52px; }
.menu-logo .t:first-child { left: 8px; transform: rotate(-14deg); }
.menu-logo .t:last-child { left: 40px; transform: rotate(12deg); }
.menu-hero .logo-word { font-size: 46px; }
.menu-tag { margin: 8px 0 0; color: var(--ink-2); font: italic 500 17px/1.3 var(--f-display); letter-spacing: .01em; max-width: 300px; text-wrap: balance; }
.menu-actions { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 340px; margin: 40px auto auto; padding-bottom: 12px; }
.menu-btn {
  position: relative;
  width: 100%; min-height: 80px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 0 18px;
  font: 800 23px/1.1 var(--f-display);
  letter-spacing: .01em;
  color: #eef4e8;
  background: #2b5a3c;
  border: 1px solid rgba(232, 191, 90, .35);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
  transition: transform .12s, filter .15s, opacity .15s;
}
.menu-btn.gold {
  color: #2a1606;
  background: linear-gradient(180deg, #f0cf72, #e0b34e);
  border-color: rgba(255, 236, 170, .55);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), 0 8px 20px rgba(0, 0, 0, .3);
}
.menu-btn:active:not(:disabled) { transform: translateY(2px) scale(.99); filter: brightness(.96); }
.menu-btn:disabled { opacity: .6; }
.menu-btn .mi {
  flex: none;
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid; place-items: center;
  color: #f0cf72;
  background: linear-gradient(180deg, #2b6b44, #164a2d);
  border: 1px solid rgba(232, 191, 90, .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 5px 12px rgba(0, 0, 0, .3);
}
.menu-btn .mi .ic { width: 24px; height: 24px; }
.menu-btn .ml { min-width: 0; }
.menu-btn.busy .mi .ic { animation: blink 1.2s infinite; }
.menu-note { margin: 4px 0 0; min-height: 1.3em; text-align: center; color: var(--muted); font-size: 13px; font-weight: 500; text-wrap: balance; }
@media (max-width: 360px) { .menu-btn { min-height: 72px; font-size: 21px; } .menu-btn .mi { width: 44px; height: 44px; } }

/* hall */
.hall-brand { position: relative; display: flex; align-items: center; gap: 14px; margin-bottom: 34px; padding-bottom: 22px; }
.hall-brand::after { top: auto; bottom: 0; left: 0; right: 0; }
.logo-mark { position: relative; width: 52px; height: 56px; flex: none; }
.logo-mark .t { position: absolute; top: 0; width: 26px; }
.logo-mark .t:first-child { left: 4px; transform: rotate(-14deg); }
.logo-mark .t:last-child { left: 20px; transform: rotate(12deg); }
.logo-word {
  margin: 0;
  font: 800 34px/1 var(--f-display);
  color: var(--ink);
}
.hall-brand .eyebrow { margin-bottom: 2px; }
.hall-table {
  position: relative;
  width: 100%; max-width: 360px;
  aspect-ratio: 1 / 1.06;
  margin: auto auto 0;
}
.hall-oval {
  position: absolute; left: 50%; top: 48%;
  width: 42%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .08), transparent 62%), var(--felt) 0 0 / 180px, linear-gradient(#1b5639, #174c31);
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), inset 0 0 30px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .4);
  display: grid; place-items: center;
}
.toono.mini { display: none; }
.toono.mini .toono-ring { fill: rgba(10, 12, 11, .45); }
.hall-count { position: relative; z-index: 1; }
.hall-count { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.hall-count b { font: 800 34px/1 var(--f-display); color: var(--ink); text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.hall-count small { font-size: 12px; font-weight: 700; color: var(--ink-2); max-width: 120px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.hall-list { list-style: none; padding: 0; margin: 0; position: absolute; inset: 0; }
.hall-list li {
  position: absolute;
  /* anchored on the avatar's centre, labels hang away from the table */
  translate: -50% -28px;
  width: 92px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
  animation: popIn .3s cubic-bezier(.3, 1.5, .5, 1);
}
.hall-list .mini-av {
  position: relative;
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--seat, var(--raise-2));
  border: 0;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 3px 8px rgba(0, 0, 0, .4);
  font-size: 24px; font-weight: 700;
}
.hall-list li.up { translate: -50% calc(-100% + 28px); }
.hall-list li.up .mini-av { order: 2; }
.hall-list .mini-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.hall-list .host {
  position: absolute; right: -6px; top: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold); color: var(--gold-ink);
  font-size: 13px;
  border: 2px solid var(--bg-0);
}
.hall-list .ok {
  position: absolute; right: -4px; bottom: -4px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green); color: #04261a;
  font-size: 13px;
  border: 2px solid var(--bg-0);
}
.hall-list .nm { font-size: 13px; font-weight: 700; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hall-list .rd { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.hall-list .rd.on { color: var(--green); }
.hall-list .rd.is-host { color: var(--gold); }
.hall-list li.empty .mini-av { padding: 0; background: rgba(0, 0, 0, .22); border: 1.5px solid rgba(214, 169, 90, .3); box-shadow: none; color: var(--gold); font-size: 22px; transition: transform .12s, background .15s; }
.hall-list li.empty .mini-av:active { transform: scale(.94); background: rgba(255, 255, 255, .08); }
.hall-list li.empty .nm { color: var(--ink-2); font-weight: 700; font-size: 12px; }
.hall-list li.empty .rd { font-weight: 700; }
.hall-note { color: var(--ink-2); font-size: 13.5px; font-weight: 700; text-align: center; text-wrap: balance; margin: 14px 0 auto; min-height: 1.3em; display: flex; align-items: baseline; justify-content: center; gap: 7px; }
.hall-note .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); transform: translateY(-1px); }
.hall-note.ok .dot { background: var(--green); }
.hall-note.wait .dot { background: var(--gold); animation: blink 1.2s infinite; }
.hall-actions { margin-top: 22px; padding-top: 0; display: flex; flex-direction: column; gap: 10px; }
.row-btns { display: flex; gap: 10px; margin-top: 16px; }
.row-btns .btn { flex: 1; }
.row-btns.small { margin-top: 0; align-items: center; }
.row-btns.small .btn { height: 44px; font-size: 14px; }
.row-btns.small .link-btn { flex: none; }
.link-btn { min-height: 44px; background: none; border: 0; color: var(--ink-2); font-weight: 700; font-size: 13.5px; padding: 10px 6px; text-decoration: underline; text-decoration-color: var(--brass); text-underline-offset: 3px; }

/* result */
.over-hero { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 8px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 22px 0 10px; width: 100%; border-bottom: 1px solid var(--line-2); }
.pod { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.pav {
  position: relative;
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 24px;
  background: var(--seat, var(--raise-2));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 4px 10px rgba(0, 0, 0, .45);
}
.pav img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.pod.p1 .pav { width: 84px; height: 84px; font-size: 36px; border: 3px solid var(--gold); box-shadow: 0 0 0 4px rgba(0, 0, 0, .35), 0 10px 24px rgba(0, 0, 0, .5); animation: popIn .45s cubic-bezier(.3, 1.6, .5, 1); }
.pav .crown { position: absolute; left: 50%; top: -24px; transform: translateX(-50%) rotate(-8deg); font-size: 28px; color: var(--gold); filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
.pn { font-size: 13px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.pt .ic { color: var(--gold); }
.step {
  width: 100%; display: grid; place-items: center;
  font: 700 22px var(--f-display); font-style: normal;
  color: var(--muted);
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  border: 1px solid var(--line-2); border-bottom: 0;
  height: 30px;
  margin-top: 4px;
}
.pod.p1 .step { height: 56px; color: var(--gold); background: linear-gradient(180deg, rgba(242, 187, 85, .22), rgba(242, 187, 85, .04)); border-color: rgba(242, 187, 85, .4); }
.pod.p2 .step { height: 40px; }
.over-avatar {
  position: relative;
  width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 44px; font-weight: 700;
  background: var(--seat, var(--raise-2));
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, .3), 0 10px 24px rgba(0, 0, 0, .5);
  margin-bottom: 16px;
  animation: popIn .45s cubic-bezier(.3, 1.6, .5, 1);
}
.over-avatar .mono { color: var(--seat, var(--gold)); }
.over-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.over-avatar .crown {
  position: absolute; left: 50%; top: -22px;
  transform: translateX(-50%) rotate(-8deg);
  font-size: 30px; color: var(--gold);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5));
}
.over-hero h2 { margin: 0 0 6px; font: 800 30px/1.1 var(--f-display); text-wrap: balance; }
.over-hero .muted { margin-bottom: 4px; color: var(--ink-2); }
.board { margin-top: 18px; }
.board-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font: 700 19px var(--f-display); color: var(--ink); }
.tabs { display: flex; gap: 3px; padding: 3px; border-radius: 11px; background: rgba(0, 0, 0, .28); }
.tab { height: 36px; padding: 0 12px; border-radius: 8px; border: 0; background: transparent; font: 700 12.5px var(--f-ui); color: var(--muted); letter-spacing: 0; text-transform: none; }
.tab.on { background: var(--ink); color: var(--bg-0); }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-height: 60px; }
.board-list li { display: flex; gap: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(0, 0, 0, .18); font-size: 13.5px; font-weight: 700; }
.board-list li.me { background: rgba(214, 169, 90, .12); box-shadow: inset 3px 0 0 var(--gold); }
.board-list li .r { width: 22px; color: var(--muted); font-weight: 700; }
.board-list li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list li.note { justify-content: center; color: var(--muted); background: none; }
.row-btns.sticky {
  position: sticky; bottom: 0; margin-top: auto;
  padding: 26px 0 calc(var(--safe-bottom) + 2px);
  background: linear-gradient(180deg, transparent, var(--bg-0) 24px);
}
.screen, .sheet { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }

.rules h3 { margin: 20px 0 4px; font: 700 18px var(--f-display); color: var(--gold); }
.rules p { margin: 0 0 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); line-height: 1.5; }
.rank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 12px 8px; margin: 10px 0; }
.rank-grid div { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; text-align: center; }
.rank-grid .t { width: 24px; margin-bottom: 2px; }
.rank-grid em { font-style: normal; font-weight: 600; color: var(--muted); }

/* tea timeline */
.timeline .tent { margin-bottom: 14px; }
.timeline h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: italic 600 15px var(--f-display); color: var(--gold); }
.timeline h3 .jan { display: inline-flex; }
.timeline h3 .jan .t { width: 13px; }
.moves { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.moves li {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 10px;
  background: rgba(0, 0, 0, .18);
}
.moves li.none { display: block; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.moves .who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.moves .who:last-child { flex-direction: row-reverse; text-align: right; }
.moves .who b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moves .who.me b { color: var(--gold); }
.moves .mini-av { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--seat, var(--raise-2)); overflow: hidden; }
.moves .mini-av img { width: 100%; height: 100%; object-fit: cover; }
.moves .amt { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; background: rgba(242, 187, 85, .14); color: var(--gold); font-weight: 700; font-size: 13px; }
.moves .amt .ic:last-child { margin-left: 2px; }
.moves .mid { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.moves .mid small { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.moves .repay .amt { background: rgba(127, 214, 160, .14); color: var(--green); }
.moves .repay .mid small { color: var(--green); }
/* Owed, not paid: no cup moved, so the chip is only an outline. */
.moves .debt .amt, .moves .owes .amt { background: none; box-shadow: inset 0 0 0 1.5px rgba(240, 138, 122, .55); color: var(--red); }
.moves .debt .mid small, .moves .owes .mid small { color: var(--red); }
.moves li.debts-head { display: block; padding: 8px 2px 0; background: none; font: 700 16px var(--f-display); color: var(--red); }
.moves.in-summary { margin-top: 10px; }
.emojis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 12px; }
.emojis button {
  aspect-ratio: 1; padding: 0; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .05);
  font-size: 26px; line-height: 1;
  transition: transform .1s, background .15s;
}
.emojis button:active { transform: scale(.9); background: rgba(255, 255, 255, .12); }
.phrases { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.phrases button { padding: 12px 8px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); font-size: 13.5px; font-weight: 700; }
.phrases button:active { background: rgba(255, 255, 255, .1); }
.chat-form { display: flex; gap: 8px; margin-top: 14px; }
.chat-form input {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px;
  border-radius: 14px; border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, .28); color: var(--ink);
  font: inherit; font-size: 16px;
  -webkit-user-select: text; user-select: text;
}
.chat-form input::placeholder { color: var(--muted); }

.toast {
  position: fixed; z-index: 30;
  left: 50%; top: calc(var(--safe-top) + 14px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(420px, calc(100% - 48px));
  min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  text-wrap: balance;
  padding: 8px 16px;
  border-radius: 14px;
  background: var(--raise-2);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 13.5px; font-weight: 700;
  text-align: center;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .5);
  animation: pop .2s ease-out;
  pointer-events: none;
}
.toast.pot { transform: translate(-50%, -50%); border-color: rgba(242, 187, 85, .45); animation: popC .2s ease-out; }
@keyframes popC { from { opacity: 0; transform: translate(-50%, -50%) scale(.9); } }
.conn {
  position: fixed; z-index: 31;
  left: 0; right: 0; top: 0;
  padding: calc(var(--safe-top) + 6px) 12px 6px;
  background: var(--gold-2); color: var(--gold-ink);
  font-size: 13px; font-weight: 700; text-align: center;
}

@keyframes up { from { transform: translate(-50%, 40px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -90%) scale(.9); } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translate(-50%, -50%) translate(var(--dx, 0), var(--dy, 0)) scale(.8); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.7); } 25% { opacity: 1; transform: translate(-50%, -60%) scale(1.05); } 100% { opacity: 1; transform: translate(-50%, -70%) scale(1); } }
@keyframes blink { 50% { opacity: .3; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 400px) {
  .best-chip small { display: none; }
  .best-chip { padding: 4px 8px 4px 5px; }
}
@media (hover: hover) and (min-width: 600px) {
  :root { --pad-l: 10px; }
  .hand .t:not(.dim):hover { transform: translateY(-5px); }
  .hand .t.sel:hover { transform: translateY(-16px); }
}
@media (min-width: 520px) {
  :root { --play-w: 48px; --slot: 28px; --av: 56px; }
  .seat { width: 100px; }
  .seat .name { max-width: 100px; }
}
@media (max-height: 740px) {
  :root { --hand-max: 40px; --play-w: 36px; --slot: 22px; --av: 44px; }
  .topbar { min-height: 48px; padding-top: 6px; padding-bottom: 4px; }
  .houses-strip { gap: 4px; }
  .seat { gap: 2px; }
  .seat .name { font-size: 13px; }
  .houses { padding: 4px; }
  .hand { padding-top: 16px; min-height: calc(var(--hand-max) * 2 + 20px); }
  .banner { min-height: 42px; padding: 4px 8px 4px 11px; font-size: 12.5px; }
  .dock { padding-top: 8px; }
  .dock-row { min-height: 46px; margin-top: 4px; }
  .btn.play { height: 46px; }
  .me-seat .avatar { --av: 38px; }
  .banner.mine { min-height: 54px; }
}

/* Native table voice: one tap to join, portraits pulse only while speaking. */
.voice-toggle {
  position: fixed; top: calc(var(--safe-top) + 10px);
  right: calc(max(10px, var(--safe-right)) + 126px); z-index: 95;
  background: var(--raise-2); color: var(--ink); overflow: visible;
}
.voice-toggle[hidden] { display: none; }
.voice-slot { display: block; width: 44px; height: 44px; flex: 0 0 44px; }
.voice-slot[hidden] { display: none; }
.voice-toggle svg { width: 21px; height: 21px; }
.voice-toggle.on { background: #24774c; color: #fff; }
.voice-toggle.on .voice-slash { display: none; }
.voice-toggle.busy { opacity: .65; }
.voice-count { position: absolute; top: -4px; right: -4px; min-width: 16px; padding: 0 3px;
  border-radius: 10px; background: var(--gold); color: var(--gold-ink); font-size: 10px; line-height: 16px; }
[data-voice-id].is-speaking {
  outline: 2px solid #7bedac; outline-offset: 2px;
  animation: voice-profile-pulse .85s ease-in-out infinite;
}
@keyframes voice-profile-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(87,227,151,.12), 0 0 8px rgba(87,227,151,.25); }
  50% { box-shadow: 0 0 0 6px rgba(87,227,151,.04), 0 0 14px rgba(87,227,151,.5); }
}
@media (prefers-reduced-motion: reduce) {
  [data-voice-id].is-speaking { animation: none; box-shadow: 0 0 8px rgba(87,227,151,.3); }
}

/* ── tournament ──────────────────────────────────────── */
.menu-btn .ml { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; }
.menu-btn .ms { font: 600 13px/1.2 var(--f-ui); letter-spacing: 0; color: rgba(238, 244, 232, .72); }
.menu-btn.tour { background: linear-gradient(180deg, #5a3a17, #42290f); }
.menu-btn.tour .ms:empty { display: none; }

.screen.tour .screen-inner { gap: 0; }
.tour-top { display: flex; align-items: center; gap: 12px; }
.tour-head { flex: 1; min-width: 0; }
.tour-head .logo-word { font-size: 32px; }
.tour-pill { flex: none; padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .08); color: var(--ink-2); white-space: nowrap; }
.tour-pill.st-registered, .tour-pill.st-waiting, .tour-pill.st-playing { background: rgba(127, 214, 160, .16); color: var(--green); }
.tour-pill.st-qualified, .tour-pill.st-champion { background: var(--gold); color: var(--gold-ink); }
.tour-pill.st-eliminated, .tour-pill.st-cancelled { background: rgba(240, 138, 122, .14); color: var(--red); }
.tour-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 16px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.tour-meta b { font: 800 20px/1 var(--f-display); color: var(--gold); font-variant-numeric: tabular-nums; }
.tour-note { margin: 14px 0 0; font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--ink-2); text-wrap: pretty; }
.tour-acts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.tour-acts:empty { display: none; }
.tour-champ { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: rgba(232, 191, 90, .12); box-shadow: inset 3px 0 0 var(--gold); }
.tour-champ-cup { font-size: 30px; }
.tour-champ-label { font-size: 12px; font-weight: 700; color: var(--gold); }
.tour-champ-name { font: 800 20px/1.15 var(--f-display); }
.tour-prize { margin: 16px 0; }
.tour-prize .tour-section { color: var(--gold); }
.tour-banner-img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--brass); }
.tour-prize .btn { width: 100%; margin-top: 12px; }
.tour-prize-hint { margin: 8px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.tour-prize-hint:empty { display: none; }
.tour-body { margin-top: 10px; }
.tour-section { margin: 20px 2px 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.tour-stage-head { display: flex; justify-content: space-between; }
.tour-stage-count { text-transform: none; letter-spacing: 0; font-weight: 600; }
.tour-empty { margin: 6px 2px; font-size: 13.5px; color: var(--muted); }
.tour-row, .tour-seat { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px; border-radius: 10px; }
.tour-row.me { background: rgba(255, 255, 255, .06); }
.tour-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour-tag { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--gold); color: var(--gold-ink); }
.tour-tag.dim { background: rgba(255, 255, 255, .08); color: var(--muted); }
.screen.tour .mini-av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; font-size: 14px; font-weight: 700; background: var(--raise-2); color: var(--ink); }
.screen.tour .mini-av img { width: 100%; height: 100%; object-fit: cover; }
.screen.tour .mini-av.sm { width: 26px; height: 26px; font-size: 12px; }
.screen.tour .mini-av.lg { width: 44px; height: 44px; font-size: 18px; }
.tour-table { margin-bottom: 10px; padding: 8px 4px 6px; border-radius: 14px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); }
.tour-table.mine { border-color: rgba(232, 191, 90, .55); }
.tour-table.done { opacity: .78; }
.tour-table-head { display: flex; align-items: center; gap: 8px; padding: 2px 10px 6px; }
.tour-table-no { flex: 1; font: 700 16px/1.2 var(--f-display); }
.tour-live { font-size: 11.5px; font-weight: 700; color: var(--turn); }
.tour-seat { min-height: 34px; }
.tour-seat.won .tour-name { color: var(--gold); }
.tour-seat.lost { opacity: .5; }
.tour-win { color: var(--gold); font-weight: 800; }
.tour-score { font-size: 13px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tour-score.out { color: var(--red); }
.tour-rules { margin-top: 22px; padding: 14px 16px; border-radius: 14px; background: rgba(0, 0, 0, .18); }
.tour-rules h3 { margin: 0 0 8px; font: 700 17px var(--f-display); color: var(--gold); }
.tour-rules ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.hall-list li.away .mini-av { opacity: .45; filter: grayscale(.6); }
.sheet.tour-invite { z-index: 31; text-align: center; box-shadow: 0 0 0 100vmax rgba(3, 8, 6, .62), 0 -24px 60px rgba(0, 0, 0, .6); }
.tour-invite-cup { margin: 0; font-size: 44px; line-height: 1; }
.tour-invite h2 { margin-top: 8px; }
.tour-invite-rule { margin: 0 0 16px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.tour-invite-acts { display: flex; flex-direction: column; gap: 10px; }

/* Tournament reminder card (the daaluu server pushes it 3 minutes before the start) */
.tour-remind { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--brass); background: rgba(0, 0, 0, .25); }
.tour-remind[hidden] { display: none; }
.tour-remind.offer { border-color: var(--gold); background: linear-gradient(180deg, rgba(232, 191, 90, .16), rgba(232, 191, 90, .05)); padding: 12px 14px; }
.tour-remind-ico { font-size: 18px; }
.tour-remind-text { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.tour-remind.offer .tour-remind-text { font-weight: 700; }
.tour-remind.blocked .tour-remind-text { color: #ff9a8a; }
.tour-remind-actions { display: flex; gap: 8px; width: 100%; }
.tour-remind-actions .tour-remind-btn { flex: 1; }
.tour-remind-btn { min-height: 36px; padding: 0 14px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 800;
  color: var(--ink); background: rgba(255, 255, 255, .06); border: 1px solid var(--brass); }
.tour-remind-btn.primary { color: var(--gold-ink); background: linear-gradient(180deg, var(--gold), var(--gold-2)); border-color: var(--gold); }
.tour-remind-btn:disabled { opacity: .6; cursor: default; }
