/* ── 108 · Мангар — Luxe Casino theme ─────────────────────
   Гүн фетр ногоон + бараан, алтан аксент, serif гарчиг
   (Noto Serif) + цэвэр sans (Noto Sans). Хөзрийн ранк Inter. */
:root {
  --bg-0: #06100b;
  --felt-hi: #1a6b46;
  --felt-mid: #0f4e32;
  --felt-lo: #082f1f;
  --felt-edge: #062316;
  --gold: #e8b54a;     /* туслах өнгө — алт (ногоон ширээн дээр) */
  --gold-hi: #f2cb6b;
  --gold-deep: #9a7426;
  --cream: #efe6d2;
  --on-gold: #2a1d05;
  --ink: #1a1409;
  --suit-red: #c8322a;
  --panel: rgba(8, 30, 21, .72);
  --panel-2: rgba(13, 42, 30, .9);
  --line: rgba(232, 181, 74, .3);
  --text: #f1e6cc;
  --text-dim: rgba(241, 230, 204, .62);
  --danger: #ff8a94;
  --good: #7fe3a6;
  --back-1: #155740;   /* card-back gradient (felt-toned) */
  --back-2: #0a2c1d;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* hidden атрибут нь ямар ч display дүрмээс дээгүүр байна */
[hidden] { display: none !important; }
/* Form controls-д body фонт өвлөгддөггүй — Ү/Ө зөв гарахын тулд заавал */
button, input, select, textarea { font-family: inherit; }

/* Тоглоом — native апп шиг: текст сонголтгүй, хуудас гүйлгэх/үсрэхгүй */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  min-height: calc(100vh / var(--z, 1));
  min-height: calc(100dvh / var(--z, 1));
  background: var(--felt-mid);
  font-family: "Noto Sans", system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Тоглоомын хайрцаг ── */
main#app {
  width: 100%;
  max-width: 460px;
  height: calc(100vh / var(--z, 1));
  height: calc(100dvh / var(--z, 1));
  position: relative;
  display: flex;
  flex-direction: column;
  /* Usion бүтэн дэлгэцээр нээгддэг: iPhone-ий камер болон доод "гэр" зураасаас зай авна,
     эс бөгөөс доод товч дарахад iPhone-ий гарах зангаа идэвхждэг. (Муушигтай ижил) */
  padding: calc(10px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  overflow: hidden;
}
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ── Дэлгэцийн буланд байрлах хөвөгч товчнууд ── */
/* Чат, онооны товч (Муушигийн загвар) — зөвхөн ширээн дээр */
.score-btn {
  position: fixed; top: calc(8px + env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); z-index: 70;
  width: 44px; height: 44px; border-radius: 50%; padding: 0; border: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: rgba(0,0,0,.3); color: var(--cream);
}
.score-btn:active { transform: scale(.94); background: rgba(0,0,0,.45); }
.score-btn svg { width: 20px; height: 20px; }
.chat-btn { right: max(8px, env(safe-area-inset-right)); }
body:not([data-screen="table"]) .score-btn { display: none; }

/* ── Хөзөр (цэвэр CSS, sprite биш) ── */
.card {
  position: relative;
  width: 54px; height: 76px;
  font-family: "Inter", system-ui, sans-serif;   /* ранк латин — Inter цэвэрхэн */
  font-size: 12px;                               /* суурь; хүүхдүүд em ашиглана */
  border-radius: 9px;
  background: linear-gradient(158deg, #ffffff 0%, var(--cream) 70%, #ece3cc 100%);
  color: var(--ink);
  box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.06);
  border: 1.5px solid transparent;
  overflow: hidden;
}
.card.red { color: var(--suit-red); }
.card .corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .82; font-weight: 800; }
.card .corner.tl { top: .35em; left: .42em; }
.card .corner.br { bottom: .35em; right: .42em; transform: rotate(180deg); }
.card .corner b { font-size: 1.18em; letter-spacing: -.5px; }
.card .pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.5em; opacity: .9; }
/* Ноёлогч (ул) хөзөр — алтан хүрээ */
.card.trump { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(241,230,204,.45), 0 3px 8px rgba(0,0,0,.45); }

/* Хөзрийн ар тал — алтан диагональ судалтай фетр */
.card-back, .mini-back {
  background:
    repeating-linear-gradient(45deg, rgba(241,230,204,.1) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(-45deg, rgba(241,230,204,.1) 0 1px, transparent 1px 9px),
    var(--back-2);
  border: 1px solid rgba(241,230,204,.45);
}
.card-back {
  position: relative;
  width: 54px; height: 76px; border-radius: 7px; flex: 0 0 auto;
  box-shadow: 0 2px 5px rgba(0,0,0,.28);
}
.card-back::before {
  content: ""; position: absolute; inset: 4px; border-radius: 3px;
  border: 1px solid rgba(241,230,204,.3); pointer-events: none;
}
.card-back::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 28%; aspect-ratio: 1;
  transform: translate(-50%,-50%) rotate(45deg);
  border: 1px solid rgba(241,230,204,.6); background: var(--back-2); pointer-events: none;
}
.mini-back {
  width: 17px; height: 24px; border-radius: 3px; flex: 0 0 auto;
  margin-left: -10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.pod-fan .mini-back:first-child { margin-left: 0; }

/* ── Ширээ ── */
#table { gap: 0; }
.felt-wrap { position: relative; width: 100%; flex: 1; min-height: 0; margin: 0 auto; }
.felt { position: absolute; inset: 0; }

/* Ул (козырь) өнгийн тэмдэг */
.tsuit { font-size: 1.25em; color: var(--text); vertical-align: -1px; }
.tsuit.r { color: var(--suit-red); }
/* Тоглох фазын тогтмол «Ул ♠» pill (turn-line-ийн жижиг хувилбар) */
/* Идэвхтэй өнгө — хүрээгүй, сангийн зүүн талд томоор (сангийн «Сан» шошготой ижил хэв) */
.trump-tag {
  position: absolute; left: max(4px, env(safe-area-inset-left)); top: 47%; z-index: 7;
  transform: translateY(-50%); width: 62px; text-align: center;
}
.trump-tag .tsuit { display: block; font-size: 46px; line-height: 1.05; vertical-align: 0; color: var(--ink); } /* хөзөр шиг: хар/улаан */
.trump-tag .tsuit.r { color: var(--suit-red); }
/* Тоглогчдын тавьсан мод — ширээний яг голд. Эхний ул мод байхгүй. */
.center-trump {
  position: absolute; left: 50%; top: 47%;
  transform: translate(-50%, -50%); z-index: 2; text-align: center;
}
.center-trump .flip { position: relative; width: 54px; height: 76px; margin: 0 auto; transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.2,.8,.2,1); }
.center-trump .flip.revealed { transform: rotateY(180deg); }
.center-trump .flip .card,
.center-trump .flip .card-back { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.center-trump .flip .fb-front { transform: rotateY(180deg); }
.center-trump .flip.revealed .fb-front { animation: trumpGlow 2.5s ease-in-out infinite; }
@keyframes trumpGlow {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 10px rgba(241,230,204,.4), 0 6px 16px rgba(0,0,0,.55); }
  50%      { box-shadow: 0 0 0 2px var(--gold), 0 0 20px rgba(241,230,204,.65), 0 6px 16px rgba(0,0,0,.55); }
}
@media (prefers-reduced-motion: reduce) {
  .center-trump .flip { transition: none; }
  .center-trump .flip.revealed .fb-front { animation: none; }
}

/* Газрын сан (6 мод) — козырийн хажууд, доош харсан */
.pool {
  position: absolute; left: calc(max(8px, env(safe-area-inset-left)) + 64px); top: 47%;
  transform: translateY(-50%); z-index: 2; text-align: center;
}
.pool .stack { position: relative; width: 58px; height: 50px; margin: 0 auto; }
.pool .stack .card-back { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 34px; height: 48px; border-radius: 5px; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.pool .cnt {
  font-family: "Noto Sans", sans-serif; font-size: 11px; font-weight: 800; color: var(--gold-hi);
  margin-top: 4px; font-variant-numeric: tabular-nums;
}

/* Нислэгийн анимэйшн (#fly) — сан↔тоглогч хооронд хөзөр нисгэнэ */
.deal { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.deal .card-back, .deal .card { position: absolute;
  transition: left .42s cubic-bezier(.2,.8,.2,1), top .42s cubic-bezier(.2,.8,.2,1), opacity .35s ease; }
.deal .card-back { transform: translate(-50%,-50%) scale(.78); }

/* ── Тоглогчид (ширээний эргэн тойронд) ── */
.pods { position: absolute; inset: 0; z-index: 4; }
.pod { position: absolute; transform: translate(-50%, -50%); width: 97px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pod.me { cursor: pointer; }
/* Ээлжтэй тоглогч — алтан хүрээ (ээлжийн мөрийн оронд) */
.pod.turn .ava { box-shadow: 0 0 0 3px var(--gold-hi), 0 0 16px rgba(244,227,161,.55); }
.pod.turn .pod-ava:has(.seat-timer) .ava { box-shadow: none; } /* хүний ээлжид цагийн цагираг л харагдана (давхар хүрээгүй) */
/* Аватарын суурь (pod, lobby, scoreboard хаана ч ажиллана) */
.ava { position: relative; border-radius: 50%; display: grid; place-items: center; font-family: "Noto Sans", sans-serif;
  font-weight: 700; color: var(--cream); overflow: hidden; flex: none; }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.pod-ava { position: relative; display: inline-flex; }
.voice-mark { position: absolute; left: -5px; bottom: -3px; z-index: 6; display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--good); color: #062b21; pointer-events: none; }
.voice-mark svg { width: 13px; height: 13px; }
.voice-mark svg path { transform-box: fill-box; transform-origin: center; }
.voice-mark[data-speaking="true"] svg { stroke-width: 3; }
.voice-mark[data-speaking="true"] path { animation: voiceWave .65s ease-in-out infinite; }
.voice-mark[data-speaking="true"] path:nth-child(2) { animation-delay: -.15s; }
.voice-mark[data-speaking="true"] path:nth-child(3) { animation-delay: -.3s; }
.voice-mark[data-speaking="true"] path:nth-child(4) { animation-delay: -.45s; }
@keyframes voiceWave { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .voice-mark[data-speaking="true"] path { animation: none; } }
.pod .ava { width: 46px; height: 46px; font-size: 18px; border: 0; box-shadow: none; }
.pod.folded { opacity: .5; }
.pod.off { opacity: .85; }
.pod.off .ava { filter: grayscale(1) brightness(.65); }
.pod.kicked { opacity: .35; filter: grayscale(1); }
.pod-fan { display: flex; justify-content: center; min-height: 32px; padding: 3px; }
.opp-name { display: flex; align-items: center; gap: 5px; max-width: 100%; font-size: 13px; font-weight: 600; line-height: 1.25; }
.pname { max-width: 88px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0,0,0,.85); }
.opp-score { font-family: "Noto Sans", sans-serif; font-size: 16px; font-weight: 700; color: var(--gold-hi);
  font-variant-numeric: tabular-nums; line-height: 1.2; }
.opp-action {
  position: absolute; left: 50%; top: -42px; z-index: 8;
  transform: translateX(-50%);
  max-width: 112px; padding: 7px 12px; border-radius: 14px;
  font-family: "Noto Sans", sans-serif; font-size: 12px; font-weight: 800;
  color: var(--ink); background: var(--cream);
  border: 1px solid var(--gold-deep);
  box-shadow: 0 4px 12px rgba(0,0,0,.38);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.opp-action::after {
  content: ""; position: absolute; left: 50%; bottom: -6px;
  transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--cream); border-bottom: 0;
}
.pod.top-seat .opp-action { top: calc(100% + 6px); }
.pod.top-seat .opp-action::after {
  top: -6px; bottom: auto;
  border-top: 0; border-bottom: 6px solid var(--cream);
}
.opp-action.pass, .opp-action.play, .opp-action.off { color: var(--ink); background: var(--cream); }

/* Салсан тэмдэг (аватарын зүүн дээд буланд) */
.pod .off-badge { position: absolute; top: -4px; left: -6px; width: 19px; height: 19px; border-radius: 50%; z-index: 4;
  background: var(--suit-red); color: var(--cream); font-size: 11px; font-weight: 900; display: grid; place-items: center;
  border: 1.5px solid var(--cream); box-shadow: 0 1px 5px rgba(0,0,0,.5); animation: offPulse 1.2s ease-in-out infinite; }
@keyframes offPulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.18); opacity: .7; } }
/* Гэр хожиход аватар богино хугацаанд гэрэлтэнэ */
.pod.won-trick .ava { animation: trickWin .9s ease-out; }
@keyframes trickWin { 0% { box-shadow: 0 0 0 0 rgba(241,230,204,.85), 0 3px 10px rgba(0,0,0,.55); }
  100% { box-shadow: 0 0 0 14px rgba(241,230,204,0), 0 3px 10px rgba(0,0,0,.55); } }
@media (prefers-reduced-motion: reduce) {
  .pod .off-badge { animation: none; }
  .pod.won-trick .ava { animation: none; }
}

/* Ээлжийн pie countdown — дүүрэн дугуй бага багаар хорогдоно */
.seat-timer { position: absolute; inset: -6px; z-index: 3; display: block; pointer-events: none; }
.seat-timer svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); } /* шүүлтүүргүй: 200мс тутам дахин зурагддаг */
.seat-timer .ring-bg { display: none; } /* цаг хорогдоход ул мөр үлдээхгүй */
.seat-timer .ring-fg {
  fill: none; stroke: var(--cream); stroke-width: 1.75; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 0;
  transition: stroke-dashoffset .22s linear, stroke .3s;
}
.seat-timer.warn .ring-fg { stroke: var(--suit-red); }
.pod-timer { width: auto; height: auto; }

/* ── Миний суудал: гарын фэн + удирдлага ── */
.hand-area { margin-top: 8px; flex: none; }
.hand { display: flex; justify-content: center; align-items: flex-end; height: 122px; padding: 40px 6px 0; }
.hand .card {
  width: 52px; height: 74px; font-size: 13px;
  flex: 0 0 auto;                 /* margin-left-ийг layoutHand() JS-ээр өгнө */
  position: relative; z-index: 1; /* сонгоогүй хөзөр урд */
  cursor: pointer;
  transition: transform .14s cubic-bezier(.2,.8,.2,1), box-shadow .14s, border-color .14s;
}
/* Сонгосон хөзөр фэний АРДААС дээш гарна (зөвхөн үзүүр нь харагдана) */
.hand .card.sel {
  transform: translateY(-34px);
  z-index: 0;
  border-color: var(--gold);
  box-shadow: 0 -3px 12px rgba(241,230,204,.55);
}
/* Хуультай, хуульгүй хөзөр харагдах байдлаар ижил; хуульгүй нь зөвхөн click авахгүй. */
.hand .card.illegal { opacity: 1; filter: none; cursor: default; pointer-events: none;
  border-color: transparent !important; box-shadow: none !important; }
@media (prefers-reduced-motion: reduce) { .hand .card { transition: none; } }

/* Муушигтай адил тогтмол нэг мөр: ээлж солигдоход доод хэсэг үсрэхгүй. */
.controls {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch;
  gap: 10px; margin-top: 10px; height: 56px; min-height: 56px;
}
/* ── Доод товч — тэнцүү 2 хавтгай тэгш өнцөгт ── */
.act-round, .act-main {
  height: 56px; border-radius: 14px; padding: 0 12px; cursor: pointer; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font: 800 16px/1 "Noto Sans", sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap;
  transition: transform .1s, background-color .15s, opacity .2s;
}
.act-round .ic, .act-main .ic { width: 20px; height: 20px; }
.act-round:not(:disabled):active, .act-main:not(:disabled):active { transform: scale(.97); }
.act-main .badge { min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; display: inline-grid; place-items: center; font-size: 14px; }
/* Зүүн: сан / өнжих / болих */
.act-round { background: var(--felt-lo); border: 1.5px solid var(--gold); color: var(--gold-hi); }
.act-round:disabled { opacity: .45; cursor: default; }
.act-round.debt { background: var(--suit-red); border-color: var(--suit-red); color: #fff; }
/* Баруун: «Тавих» */
.act-main { border: 1.5px solid var(--gold); background: var(--gold); color: var(--on-gold); }
.act-main:not(:disabled):active { background: var(--gold-deep); border-color: var(--gold-deep); }
.act-main .badge { background: var(--on-gold); color: var(--gold-hi); }
.act-main:disabled { background: rgba(232,181,74,.12); border-color: rgba(232,181,74,.3); color: rgba(242,203,107,.55); cursor: default; }
/* Ээлж биш — бүхэлдээ бүдэг */
.controls.idle > button { opacity: .3; }
@media (hover: hover) { .act-main:not(:disabled):hover { background: var(--gold-hi); } .act-round:not(:disabled):hover { background: #0d3a27; } }
.ctrl-btn {
  flex: 1 1 0;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 0;
  font-family: "Noto Sans", sans-serif;
  font-size: 14px; font-weight: 700; letter-spacing: .3px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, box-shadow .2s, filter .2s;
}
.ctrl-btn:active { transform: scale(.97); }
.ctrl-btn.primary {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  color: var(--on-gold); border-color: var(--gold-hi);
  box-shadow: 0 4px 14px rgba(241,230,204,.35);
}
.ctrl-btn:disabled { background: rgba(255,255,255,.06); color: rgba(243,234,210,.32); border-color: rgba(255,255,255,.08); box-shadow: none; cursor: default; }
.ctrl-btn.btn-ready-on { background: rgba(127,227,166,.2); color: var(--good); border-color: rgba(127,227,166,.45); box-shadow: none; }
/* Икон SVG — ГЛОБАЛ хэмжээ. SVG-д өргөн/өндөр өгөхгүй бол эцгийнхээ хэмжээгээр
   тэлдэг (жишээ нь .btn-confirm доторх play икон 177px болж дэлбэрдэг). */
.ic, .ic-sm { display: inline-block; vertical-align: -2px; flex: none; }
.ic { width: 18px; height: 18px; }
.ic-sm { width: 14px; height: 14px; }
@media (prefers-reduced-motion: reduce) { .ctrl-btn { transition: none; } }
.btn-confirm {
  width: 100%;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  color: var(--on-gold); border: 1px solid var(--gold-hi); border-radius: 13px;
  padding: 14px; font-size: 16px; font-weight: 800; letter-spacing: 1px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(241,230,204,.4);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-confirm:active { transform: scale(.98); }

/* ── Оверлей дэлгэцүүд ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(3, 10, 7, .68);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  backdrop-filter: blur(4px);
}
.overlay-card {
  position: relative;
  background:
    radial-gradient(140% 90% at 50% 0%, rgba(241,230,204,.12), rgba(0,0,0,0) 55%),
    linear-gradient(180deg, var(--felt-mid), var(--felt-lo));
  background-color: var(--felt-lo);
  border: 1px solid var(--gold-deep);
  border-radius: 20px;
  padding: 26px 22px;
  width: 100%; max-width: 380px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.6), inset 0 0 0 1px rgba(241,230,204,.18);
  max-height: 94vh; overflow-y: auto;
}
.setup-foot { font-size: 11px; color: var(--text-dim); margin-top: 14px; line-height: 1.5; }

/* Хүлээлгийн өрөө */
.lobby-title { font-family: "Noto Sans", sans-serif; font-size: 22px; font-weight: 800; color: var(--gold-hi); margin: 4px 0 2px; }
.lobby-count { display: inline-block; font-family: "Noto Sans", sans-serif; font-size: 12px; font-weight: 800;
  font-variant-numeric: tabular-nums; color: var(--gold-hi);
  background: rgba(0,0,0,.28); border: 1px solid var(--line); padding: 3px 12px; border-radius: 999px; }
.lobby-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; text-align: left; }
.lobby-row {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.06);
  border-radius: 11px; padding: 10px 13px;
  transition: border-color .2s, background .2s;
}
.lobby-row.me { border-color: var(--line); }
.lobby-row.ready { background: linear-gradient(90deg, rgba(127,227,166,.12), rgba(0,0,0,.28) 45%); }
.lobby-row.empty { background: transparent; border-style: dashed; border-color: var(--line); opacity: .5; }
.lobby-row .ava { width: 34px; height: 34px; font-size: 15px; border: 1.5px solid rgba(247,242,228,.22); }
.ava-empty { width: 34px; height: 34px; border-radius: 50%; border: 1.5px dashed var(--line); flex: none; }
.lobby-name { flex: 1 1 4.5em; min-width: 0; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-tag { flex: none; display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 800; color: var(--gold); letter-spacing: .5px; }
.you-tag { flex: none; font-size: 9px; font-weight: 800; color: var(--gold); letter-spacing: .5px; }
.lobby-badge { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; letter-spacing: .3px; flex: none;
  display: inline-flex; align-items: center; gap: 4px; }
.lobby-badge.ready { background: rgba(127,227,166,.18); color: var(--good); }
.lobby-badge.wait { background: rgba(255,255,255,.08); color: var(--text-dim); }
.lobby-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: waitPulse 1.4s ease-in-out infinite; }
@keyframes waitPulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lobby-badge .dot { animation: none; } }
.lobby-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }

/* Үр дүн / оноо */
.winner-emoji { width: 56px; height: 56px; margin: 0 auto; color: var(--gold-hi);
  filter: drop-shadow(0 4px 14px rgba(241,230,204,.4)); animation: trophyPop .5s cubic-bezier(.34,1.56,.64,1) both; }
.winner-emoji svg { width: 100%; height: 100%; }
@keyframes trophyPop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .winner-emoji { animation: none; } }
.winner-label { font-size: 13px; font-weight: 700; letter-spacing: 4px; color: var(--gold); margin-top: 6px; }
.winner-name { font-family: "Noto Sans", sans-serif; font-size: 28px; font-weight: 900; color: var(--gold-hi); margin: 4px 0 16px;
  display: flex; align-items: center; justify-content: center; gap: 10px; }
.winner-name .ava { width: 38px; height: 38px; font-size: 17px; border: 2px solid var(--gold); }
.winner-sub { font-family: "Noto Sans", sans-serif; font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: .5px; }
.scoreboard { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; text-align: left; }
.sb-row {
  display: flex; align-items: center; gap: 9px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.05);
  border-radius: 11px; padding: 10px 13px;
}
.sb-row.lead { background: linear-gradient(90deg, rgba(241,230,204,.22), rgba(241,230,204,.06)); border-color: var(--line); }
.sb-rank { font-size: 12px; font-weight: 700; color: var(--text-dim); width: 16px; text-align: center; flex: none; }
.sb-row.lead .sb-rank { color: var(--gold); }
.sb-row .ava { width: 32px; height: 32px; font-size: 14px; border: 1.5px solid rgba(247,242,228,.22); }
/* flex:1 биш — ингэснээр дараагийн ах дүү .you-tag нэрэндээ наалдаж, оноо руу түлхэгдэхгүй */
.sb-name { flex: 0 1 auto; min-width: 0; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-score { font-family: "Noto Sans", sans-serif; font-size: 17px; font-weight: 800; flex: none; width: 52px; margin-left: auto; text-align: right; color: var(--gold-hi);
  font-variant-numeric: tabular-nums; }
.rematch-status { min-height: 18px; font-size: 12px; color: var(--text-dim); margin: 6px 0 10px; line-height: 1.5; }

/* ── Toast ── */
.toast {
  position: fixed; top: 24%; left: 50%;
  transform: translate(-50%, -50%) scale(.8);
  background: var(--panel-2); border: 1px solid var(--gold-deep);
  border-radius: 14px; padding: 12px 26px; max-width: 90%;
  font-family: "Noto Sans", sans-serif; font-size: 16px; font-weight: 800; color: var(--gold-hi);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s, transform .25s, visibility 0s linear .25s; z-index: 60;
}
/* display:none → transition үхнэ. Тиймээс .show класс + visibility ашиглана. */
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1);
  transition: opacity .25s, transform .25s, visibility 0s; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } .toast.show { transition: none; } }


/* ── Мэдэгдлийн зөвшөөрөл ── */
.notif-ask { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: rgba(3,10,7,.68); backdrop-filter: blur(4px); padding: max(22px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); }
.na-card { animation: naPop .28s cubic-bezier(.34,1.56,.64,1) both; max-width: 340px; }
.na-ic { font-size: 38px; line-height: 1; margin-bottom: 10px; }
.na-title { font-family: "Noto Sans", sans-serif; font-size: 20px; font-weight: 800; color: var(--gold-hi); margin-bottom: 8px; }
.na-body { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin-bottom: 18px; }
.na-actions { display: flex; gap: 9px; }
@keyframes naPop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .na-card { animation: none; } }

/* ── Эможи / үг хэллэгийн сонгогч ── */
.emote-picker {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 460px; z-index: 60;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--felt-lo); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 32px rgba(0,0,0,.5), 0 0 0 100vmax rgba(0,0,0,.45); /* ард бүдгэрүүлэх; гадна дарвал хаагдана */
  animation: csUp .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes csUp { from { transform: translate(-50%, 24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .emote-picker { animation: none; } }
.emote-picker::before { content: ''; width: 36px; height: 4px; border-radius: 999px; background: rgba(247,242,228,.3); margin: 0 auto; }
.cs-head { display: flex; align-items: center; justify-content: space-between; }
.cs-head b { font: 700 18px/1.3 "Noto Sans", sans-serif; color: var(--text); }
.cs-close { width: 36px; height: 36px; margin-right: -6px; border: 0; border-radius: 50%; padding: 0; display: grid; place-items: center;
  background: rgba(247,242,228,.08); color: var(--text); cursor: pointer; position: relative; }
.cs-close::after { content: ''; position: absolute; inset: -4px; }
.cs-close svg { width: 18px; height: 18px; }
/* Мессежийн түүх */
.cs-log { display: flex; flex-direction: column; gap: 8px; max-height: 26vh; min-height: 64px; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px; border-radius: 16px; background: rgba(0,0,0,.22); }
.cs-empty { margin: auto; font-size: 13px; color: var(--text-dim); }
.cs-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 85%; }
.cs-msg .ava { width: 26px; height: 26px; font-size: 12px; }
.cs-msg.me { align-self: flex-end; }
.cs-bub { padding: 8px 12px; border-radius: 16px 16px 16px 4px; background: rgba(247,242,228,.1); color: var(--text);
  font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.cs-msg.me .cs-bub { border-radius: 16px 16px 4px 16px; background: var(--cream); color: var(--ink); }
.cs-name { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 2px; }
/* Хурдан хариу */
.cs-emojis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.cs-emoji { aspect-ratio: 1; width: 100%; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  font-size: 22px; line-height: 1; background: rgba(247,242,228,.07); transition: background-color .15s, transform .1s; }
.cs-emoji:active { transform: scale(.88); }
.cs-phrases { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.cs-phrases::-webkit-scrollbar { display: none; }
.cs-phrase { flex: none; min-height: 38px; padding: 0 16px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  font: 700 14px "Noto Sans", sans-serif; color: var(--text); background: transparent; border: 1.5px solid rgba(247,242,228,.4);
  transition: background-color .15s, transform .1s; }
.cs-phrase:active { transform: scale(.95); background: rgba(247,242,228,.12); }
@media (hover: hover) { .cs-emoji:hover, .cs-phrase:hover { background: rgba(247,242,228,.14); } }
/* Бичих мөр */
.cs-bar { display: flex; gap: 8px; align-items: center; }
.cs-input { flex: 1; min-width: 0; height: 48px; padding: 0 18px; border-radius: 999px; border: 1.5px solid rgba(247,242,228,.25);
  background: rgba(0,0,0,.25); color: var(--text); font: 500 16px "Noto Sans", sans-serif; outline: none; transition: border-color .15s; }
.cs-input::placeholder { color: var(--text-dim); }
.cs-input:focus { border-color: var(--text); }
.cs-send { width: 48px; height: 48px; flex: none; border: 0; border-radius: 50%; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--cream); color: var(--ink); transition: opacity .15s, transform .1s; }
.cs-send:disabled { opacity: .35; cursor: default; }
.cs-send:not(:disabled):active { transform: scale(.92); }
.cs-send svg { width: 20px; height: 20px; }

/* Pod дээр гарах эможи/үг хэллэгийн бөмбөлөг */
.emotes { position: absolute; inset: 0; z-index: 9; pointer-events: none; }
.emote-bubble {
  position: absolute; transform: translate(-50%,-50%) scale(.6); z-index: 9;
  max-width: 160px; text-align: center; white-space: normal; pointer-events: none; opacity: 0;
  padding: 7px 13px; border-radius: 14px;
  font-family: "Noto Sans", sans-serif; font-size: 14px; font-weight: 800;
  color: var(--ink); background: var(--cream);
  border: 1px solid var(--gold-deep);
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2,1.4,.5,1);
}
.emote-bubble.emoji-only { font-size: 32px; line-height: 1; padding: 0; background: none; border: none; box-shadow: none;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.5)); }
.emote-bubble.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.emote-bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--cream); border-bottom: none; }
.emote-bubble.emoji-only::after { display: none; }

/* ══════════════ 108 · Мангар — тоглоомын ӨВӨРМӨЦ элементүүд ══════════════
   Лавлагаанд (13-phi-ten) дүйцэлгүй хэсгүүд. Шинэ өнгө ЗОХИООГҮЙ —
   зөвхөн --gold / --cream / --ink / --panel* / --line / Noto Serif ашиглана. */

/* ── Хаягдлын овоо (#discard) — ширээний голд идэвхтэй хөзөр ── */
#discard .card { margin: 5px auto 0; position: relative; left: auto; top: auto; transform: none; }
#discard .card.just-landed { animation: landPop .32s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes landPop { from { transform: scale(.6); } to { transform: scale(1); } }

/* ── Сан (#drawPile) — татах боломжтой үед дарагдана (гэрэлтэхгүй) ── */
#drawPile.drawable { cursor: pointer; }

/* ── Хатан (Q) тавьсны дараа хүлээгдэж буй өнгө — #suitTag дотор ── */
#suitTag .pend { display: block; font-size: 15px; color: var(--gold-hi); font-weight: 900; font-variant-numeric: tabular-nums; }
#suitTag:has(.pend) { animation: pendPulse 1s ease-in-out infinite; }
@keyframes pendPulse { 50% { scale: 1.07; } } /* transform-ийг (translateY) дарахгүй */

/* Тойрог дуусах богино төлөв ч товчны мөрийн өндрийг өөрчлөхгүй. */
.control-status {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: center;
  min-width: 0; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Хатан тавихад гарах ӨНГӨ СОНГОГЧ — .overlay-card-ийн жижиг хувилбар ── */
.suit-picker {
  position: fixed; left: 50%; bottom: 28%; transform: translateX(-50%); z-index: 120;
  background: var(--panel-2); border: 1px solid var(--gold-deep); border-radius: 16px;
  padding: 13px 15px; box-shadow: 0 14px 44px rgba(0, 0, 0, .6);
}
.suit-picker .sp-title {
  font-family: "Noto Sans", sans-serif; font-size: 12.5px; font-weight: 800;
  color: var(--gold-hi); text-align: center; margin-bottom: 10px;
}
.suit-picker .sp-suits { display: flex; gap: 10px; }
/* Өнгө бүр = жижиг cream хөзөр (.card-ийн градиент/радиустай ижил гэр бүл) */
.suit-picker .sp-suit {
  width: 52px; height: 62px; border-radius: 9px; cursor: pointer;
  border: 1.5px solid transparent;
  background: linear-gradient(158deg, #fff 0%, var(--cream) 70%, #ece3cc 100%);
  color: var(--ink); font-size: 28px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.suit-picker .sp-suit.r { color: var(--suit-red); }
.suit-picker .sp-suit:active { transform: scale(.93); }

/* ── Зарлал (callout: "Мангар!", "108!") — лавлагааны .toast хэлээр ── */
/* Тусгай хөзрийн мэдээ — тоглогчийн дэргэд, хавтгай */
/* Муушигийн .opp-action шиг: цөцгий хайрцаг + сум (энгийн, цэвэр) */
.callout {
  position: absolute; z-index: 12; display: flex; align-items: center; gap: 4px;
  padding: 7px 12px; border-radius: 14px;
  font: 600 13px/1.35 "Noto Sans", sans-serif; color: var(--ink); background: var(--cream);
  border: 1px solid var(--gold-deep); box-shadow: 0 4px 12px rgba(0,0,0,.38);
  opacity: 0; white-space: nowrap; pointer-events: none;
  transform: translate(-50%, calc(-100% + 6px)); transition: opacity .2s, transform .25s ease;
}
.callout::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--cream); border-bottom: 0;
}
.callout.show { opacity: 1; transform: translate(-50%, -100%); }
.callout.below { transform: translate(-50%, -6px); }
.callout.below.show { transform: translate(-50%, 0); }
.callout.below::after { top: -6px; bottom: auto; border-top: 0; border-bottom: 6px solid var(--cream); }
.callout.debt { color: var(--suit-red); font-weight: 800; }
.callout .s { display: inline-grid; place-items: center; width: 20px; height: 20px; font: 400 21px/1 "Noto Sans", sans-serif; }
.callout .s[data-su="D"] { font-size: 24px; } /* ♦ бусдаасаа жижиг зурагддаг */
.callout .s.r { color: var(--suit-red); }


@media (prefers-reduced-motion: reduce) {
  #suitTag:has(.pend) { animation: none; }
  #discard .card.just-landed { animation: none; }
}

/* ===== Хүлээлгийн өрөө — Муушигийн загвар ===== */
.hall { align-items: center; justify-content: center; gap: 18px; padding: 16px; }
.logo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.logo-fan { position: relative; width: 112px; height: 92px; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 12px 30px rgba(244,227,161,.3)); }
.logo-fan .lc { position: absolute; left: 36px; top: 6px; width: 46px; height: 66px; border-radius: 7px; background: var(--cream); color: var(--ink);
  border: 1px solid var(--gold-hi); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: 800 19px/1 "Noto Serif", serif; transform-origin: 50% 120%; box-shadow: 0 4px 10px rgba(0,0,0,.35); }
.logo-fan .lc i { font-style: normal; font-size: 18px; }
.logo-fan .lc.red { color: var(--suit-red); }
.logo-fan .lc:nth-child(1) { transform: translateX(-20px) rotate(-18deg); }
.logo-fan .lc:nth-child(3) { transform: translateX(20px) rotate(18deg); }
.logo b { font-family: "Noto Serif", serif; font-weight: 800; font-size: 28px; letter-spacing: -.01em; color: var(--text); }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .logo-fan { animation: none; } }
.seats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px 10px; width: 100%; max-width: 340px; }
#waiting:not(.room) .seats > .seat { grid-column: 1 / -1; }
.seat:nth-child(4) { grid-column: 2 / span 2; } /* доод 2 суудал голдоо */
.seat { grid-column: span 2; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seat .ava { width: 62px; height: 62px; font-size: 22px; color: #fff; box-shadow: 0 10px 22px rgba(0,0,0,.4); } /* хүрээгүй */
.seat.ready .ava { box-shadow: 0 0 0 3px var(--good), 0 10px 22px rgba(0,0,0,.4); }
.seat .nm { font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--text-dim); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.me .nm { color: var(--text); }
.seat .tick { position: absolute; top: 44px; right: calc(50% - 38px); width: 22px; height: 22px; border-radius: 50%; background: var(--good); color: #0b2a18;
  border: 3px solid var(--felt-lo); display: grid; place-items: center; transform: scale(0); transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.seat .tick svg { width: 11px; height: 11px; }
.seat.ready .tick { transform: scale(1); }
.seat .crown { position: absolute; z-index: 2; top: -13px; color: var(--gold-hi); }
.seat .x { position: absolute; top: -6px; right: calc(50% - 42px); width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); font-size: 12px; display: grid; place-items: center; z-index: 2; cursor: pointer; }
.seat .x::after { content: ''; position: absolute; inset: -9px; }
.seat.empty .ava { background: transparent; border: 2px dashed var(--line); box-shadow: none; }
.hall-hint { font-size: 14px; line-height: 1.4; color: var(--text-dim); text-align: center; min-height: 20px; font-weight: 500; }
.choice { display: grid; grid-template-columns: 1fr; gap: 12px; width: 100%; max-width: 360px; }
.tile { min-height: 56px; border-radius: 14px; padding: 14px 18px; border: 1px solid var(--gold-hi);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 16px/1.35 "Noto Sans", sans-serif; text-align: center; cursor: pointer;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: var(--on-gold); transition: transform .15s; }
.tile.alt { background: rgba(244,227,161,.08); color: var(--text); border-color: var(--line); }
.tile b { font: inherit; }
.tile .tile-ic { width: 24px; height: 24px; flex: none; display: grid; place-items: center; }
.tile .tile-ic svg { width: 24px; height: 24px; }
.tile:active { transform: scale(.98); }
.tile.tournament-entry { min-height: 96px; padding: 20px; justify-content: flex-start; gap: 14px; background: #080f20; border-color: #e8c57c; color: #fff2cd; text-align: left; }
.tournament-entry-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 5px; }
.tournament-entry-copy b { font: 800 21px/1.3 "Noto Serif", serif; }
.tournament-entry-copy small { color: #e8c57c; font-size: 12px; font-weight: 600; }
.tournament-entry-arrow { width: 20px; height: 20px; flex: none; color: #e8c57c; }
#chTournament .tile-ic { width: 40px; height: 40px; background: transparent; box-shadow: none; border: 0; color: #e8c57c; }
#chTournament .tile-ic svg { width: 30px; height: 30px; filter: none; }
.tile.tournament-entry:focus-visible { outline: 3px solid #fff2cd; outline-offset: 4px; }
@media (hover: hover) { .tile.tournament-entry:hover { background: #14233b; } }
.hall-bar { display: flex; gap: 10px; }
.hall-main { display: flex; gap: 10px; width: 100%; max-width: 360px; }
.hall-actions { display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; width: 100%; max-width: 360px; min-height: 192px; }
.room .hall-hint { max-width: 360px; font-size: 13px; line-height: 1.5; }
.room .hall-bar { width: 100%; max-width: 360px; }
.room .hall-bar .chip { flex: 1; min-height: 56px; }
.room #readyBtn, .room #startBtn { min-height: 56px; }
.room #readyBtn { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: var(--on-gold); border-color: var(--gold-hi); }
.room #readyBtn.btn-ready-on { background: transparent; color: var(--good); border-color: var(--good); box-shadow: none; }
@media (max-height: 680px) { .hall { gap: 12px; padding: 8px; } .hall .logo-fan { display: none; } }
/* ── Тэргүүлэгч ── */
.leaders-screen { padding: 14px 6px 0; gap: 16px; }
.leaders-head { display: flex; align-items: center; gap: 12px; flex: none; }
.leaders-head .chip { flex: none; padding: 0 14px; min-height: 44px; }
.leaders-head h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.leaders-cols { display: flex; justify-content: space-between; padding: 0 12px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.leaders-list { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 16px; margin-bottom: 0; }
.leaders-empty { padding: 24px 0; text-align: center; font-size: 14px; color: var(--text-dim); }

/* ── Online ширээ: буцах мөр + гарах баталгаажуулалт (Муушигтай ижил) ── */
.online-room-bar { position: relative; z-index: 51; display: flex; align-items: center; justify-content: flex-start; gap: 12px; flex: none;
  pointer-events: none; padding: 0 6px 8px; font-size: 13px; color: var(--text-dim); }
.online-room-bar button { pointer-events: auto; }
.online-room-bar .chip { min-height: 44px; padding: 0 16px; font-size: 14px; background: transparent; color: var(--cream); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.leave-dialog { position: fixed; inset: 0; margin: auto; width: calc(100% - 32px); max-width: 340px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--felt-lo); color: var(--cream); }
.leave-dialog::backdrop { background: rgba(3,10,7,.7); }
.leave-dialog h2 { font-size: 20px; line-height: 1.35; font-weight: 700; }
.leave-dialog p { margin: 12px 0 24px; font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.leave-actions { display: flex; gap: 12px; }
.leave-actions .ctrl-btn { flex: 1; }

/* ── Тойргийн дүн «108 хүртэлх зам» ── */
.round-sheet { position: fixed; inset: 0; z-index: 75; /* чат товчноос (70) дээр, toast-аас (120) доор */ display: grid; place-items: center; padding: 16px;
  background: rgba(3, 14, 9, .7); animation: rsFade .2s ease-out; }
.round-sheet[hidden] { display: none; }
@keyframes rsFade { from { opacity: 0; } }
.rs-card { width: min(360px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px 16px 14px; border-radius: 24px; background: var(--felt-lo);
  border: 1px solid rgba(239,230,210,.14); box-shadow: 0 24px 60px rgba(0,0,0,.6); animation: rsIn .35s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes rsIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
/* гарсан хүн */
.rs-hero { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 16px; }
.rs-hero .ava { width: 60px; height: 60px; font-size: 24px; box-shadow: 0 0 0 3px var(--gold), 0 8px 22px rgba(0,0,0,.45); }
.rs-hero b { margin-top: 6px; font-size: 19px; font-weight: 900; color: var(--cream); }
.rs-hero span:last-child { font-size: 13px; font-weight: 700; color: var(--gold-hi); }
.rs-crown { position: absolute; top: -16px; color: var(--gold); }
.rs-crown .ic-sm { width: 22px; height: 22px; }
/* мөр бүр */
.rs-list { display: flex; flex-direction: column; gap: 4px; }
.rs-row { display: grid; grid-template-columns: 32px 1fr 44px; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 12px; }
.rs-row.me { background: rgba(239,230,210,.06); }
.rs-row.dead { opacity: .55; }
.rs-row .ava { width: 32px; height: 32px; font-size: 13px; }
.rs-mid { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.rs-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.rs-name { flex: none; max-width: 40%; font-size: 14px; font-weight: 800; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-row.me .rs-name { color: var(--gold-hi); }
/* үлдсэн мод — жинхэнэ хөзөр шиг жижиг нүүр (тоо зүүн дээд, өнгө доод голд) */
.rs-cards { display: flex; }
.rs-cards .mc + .mc { margin-left: -5px; } /* бага зэрэг давхарлаж нэг мөрөнд */
.mc { position: relative; width: 26px; height: 36px; border-radius: 5px; background: #fbf6ea; color: var(--ink);
  box-shadow: 0 2px 4px rgba(0,0,0,.4); font-family: "Noto Sans", sans-serif; }
.mc b { position: absolute; left: 3px; top: 2px; font-size: 11px; font-weight: 800; line-height: 1; letter-spacing: -.5px; }
.mc i { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); font-style: normal; font-size: 17px; line-height: 1; }
.mc.r { color: var(--suit-red); }
.rs-line em { margin-left: auto; flex: none; font: 800 10px/1 "Noto Sans", sans-serif; font-style: normal; padding: 3px 6px; border-radius: 6px;
  background: rgba(239,230,210,.14); color: var(--cream); }
.rs-line em.out { background: var(--suit-red); color: #fff; }
/* 0 → 108 зам */
.rs-track { position: relative; height: 6px; border-radius: 3px; background: rgba(239,230,210,.1); overflow: hidden; }
.rs-base { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--gold); }
.rs-track.hot .rs-base { background: #f0a24a; }
.rs-add { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: #ff7a6e; transform-origin: left; }
.rs-add.minus { background: #7fd8a0; }
.rs-add.grow { animation: rsGrow .8s .25s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rsGrow { from { transform: scaleX(0); } }
.rs-pts { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.rs-total { font-size: 20px; font-weight: 900; line-height: 1; color: var(--cream); font-variant-numeric: tabular-nums; }
.rs-gain { font-size: 12px; font-weight: 800; line-height: 1; color: #ff8f84; font-variant-numeric: tabular-nums; }
.rs-gain.neg { color: #7fd8a0; }
.rs-gain:empty { display: none; }
.rs-next { display: flex; align-items: center; gap: 10px; margin: 16px 6px 0; }
.rs-bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(239,230,210,.12); overflow: hidden; }
.rs-bar i { display: block; height: 100%; border-radius: 3px; background: var(--gold); transform-origin: left; animation: rsBar 3s linear forwards; }
.rs-sec { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--gold); color: var(--gold-hi); font: 900 14px/1 "Noto Sans", sans-serif; font-variant-numeric: tabular-nums; }
@keyframes rsBar { to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .round-sheet, .rs-card, .rs-add.grow { animation: none; } }

/* ── Нүүр хуудасны icon: нэг ижил badge — бараан ногоон + алтан icon (ширээний өнгөтэй уялдана) ── */
.tile .tile-ic[class*="b-"] { width: 34px; height: 34px; border-radius: 11px; color: var(--gold-hi);
  background: linear-gradient(180deg, #1d6a45, #0b3a24); border: 1px solid rgba(242,203,107,.4);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.16), 0 3px 8px rgba(0,0,0,.28); }
.tile .tile-ic[class*="b-"] svg { width: 19px; height: 19px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.35)); }
.tile .tile-ic.b-play svg { margin-left: 2px; }

/* ── Дуут яриа (Муушигтай ижил) ── */
.voice-btn { right: calc(max(8px, env(safe-area-inset-right)) + 50px); overflow: visible; }
.voice-btn .mic-slash { stroke: currentColor; }
.voice-btn.on { background: #2f8f5b; color: #fff; }
.voice-btn.on .mic-slash { display: none; }
.voice-btn.busy { opacity: .6; }
.voice-count { position: absolute; top: -3px; right: -3px; min-width: 18px; padding: 1px 5px; border-radius: 9px;
  background: #f2c14e; color: #1b1b1b; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; pointer-events: none; }
body[data-screen="waiting"] .voice-btn { display: flex; right: max(8px, env(safe-area-inset-right)); }
/* нүүр хуудсан дээр (тоглоом сонгох) микрофон хэрэггүй */
body:has(#waiting:not([hidden]) #choice:not([hidden])) .voice-btn { display: none; }

/* Tournament surfaces match Muushig. */
.tournament-screen { width: 100%; padding: 8px 8px 0; }
.tournament-head { display: flex; align-items: center; gap: 18px; padding-bottom: 22px; flex: none; }
.tournament-head h1 { font: 700 23px "Noto Serif", serif; }
.tournament-head .chip { min-height: 44px; }
.tournament-head .chip, .tournament-actions .chip { background: transparent; color: var(--cream); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.tournament-scroll { min-height: 0; overflow: auto; padding: 0 2px 24px; scrollbar-width: thin; scrollbar-color: var(--gold-deep) transparent; }
.tournament-scroll h2 { font: 800 28px/1.25 "Noto Serif", serif; margin-bottom: 12px; }
.tournament-schedule { font-size: 14px; line-height: 1.6; }
.tournament-status { padding: 24px 0 16px; }
.tournament-status h3 { font-size: 18px; line-height: 1.5; margin-bottom: 8px; }
.tournament-status p { font-size: 14px; line-height: 1.7; color: var(--cream); }
.tournament-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.tournament-actions .ctrl-btn { width: 100%; min-height: 48px; }
.tournament-actions .chip { align-self: flex-start; min-height: 44px; }
.tournament-actions button:disabled { opacity: .55; cursor: wait; }
.tournament-actions button:focus-visible { outline: 2px solid var(--cream); outline-offset: 4px; }
.tournament-error { color: var(--danger); font-size: 14px; line-height: 1.6; margin-top: 12px; }
.tournament-stage { margin-top: 28px; }
.tournament-stage h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 17px; margin-bottom: 8px; }
.tournament-stage h3 span { font-size: 12px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.tournament-table { padding: 14px 8px; border-bottom: 1px solid var(--line); }
.tournament-table.yours { background: var(--panel-2); }
.tournament-table > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; }
.tournament-table strong { font-size: 14px; }
.tournament-table span { font-size: 12px; white-space: nowrap; }
.tournament-table p { font-size: 13px; line-height: 1.7; margin-top: 5px; overflow-wrap: anywhere; }
.tournament-winner { color: var(--good); font-weight: 600; }
.tournament-spectate { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 12px; padding: 12px 16px; background: var(--cream); color: var(--on-gold); border: 1px solid var(--cream); border-radius: 12px; font-weight: 700; box-shadow: 0 3px 8px rgba(0,0,0,.15); cursor: pointer; }
.tournament-spectate svg { width: 20px; height: 20px; flex: none; }
.tournament-spectate:hover { filter: brightness(1.05); }
.tournament-spectate:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }
.tournament-spectate:disabled { opacity: .55; cursor: wait; }
.tournament-entrants { list-style: none; padding: 0; margin: 0; }
.tournament-entrant { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.tournament-entrant.me { background: var(--panel-2); }
.tournament-entrant .ava { width: 36px; height: 36px; flex: none; font-size: 15px; }
.tournament-entrant-name { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.tournament-entrants-empty { padding: 12px 0; font-size: 14px; line-height: 1.6; color: var(--cream); }
.leader-player { min-width: 0; flex: 0 1 auto; }
.tournament-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 16px; margin-bottom: 20px; border-radius: 16px; background: #080f20; color: #fff2cd; }
.tournament-rules-summary { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: #080f20; color: #fff2cd; font-size: 13px; line-height: 1.65; }
.tournament-rules-summary p + p { margin-top: 4px; }
.tournament-rules-summary strong { color: #ffe29b; font-weight: 800; }
.tournament-banner-info { min-width: 0; }
.tournament-banner h2 { color: inherit; font-size: 23px; line-height: 1.3; margin: 8px 0; }
.tournament-banner .tournament-schedule { color: inherit; font-size: 12px; line-height: 1.5; margin: 0; }
.tournament-banner-time { flex: none; display: flex; align-items: flex-end; flex-direction: column; gap: 4px; text-align: right; }
.tournament-banner-time > span { font-size: 11px; line-height: 1.5; }
.tournament-banner-time strong { font-size: 25px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tournament-banner h2, .tournament-banner-time strong { color: #ffe29b; }
.tournament-daily-offer .leave-actions { flex-wrap: wrap; }
.tournament-daily-offer .leave-actions button { flex: 1 1 120px; }
.leader-player { min-width: 0; flex: 1; }
.leader-player .sb-name { display: block; }
.tournament-entrant.champion-row, .sb-row.champion-row { background: #080f20 url('/assets/champion-108-row.png') center / 100% 235%; color: #fff2cd; border-bottom: 0; border-radius: 10px; margin-bottom: 8px; min-height: 72px; padding-left: 16px; }
.champion-label { display: block; margin-top: 3px; font-size: 10px; font-weight: 800; line-height: 1.5; color: #ffe29b; }
.champion-row-stars { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px; margin-left: auto; max-width: 96px; flex-shrink: 0; color: #ffe29b; }
.champion-row-stars svg { width: 14px; height: 14px; flex: none; }
.tournament-entrant.champion-row { padding-right: 50px; }
.sb-row.champion-row { display: grid; grid-template-columns: 18px 32px minmax(0, 1fr) auto; gap: 3px 8px; padding-right: 46px; }
.sb-row.champion-row .sb-rank { grid-column: 1; grid-row: 1 / 3; }
.sb-row.champion-row .ava { grid-column: 2; grid-row: 1 / 3; }
.sb-row.champion-row .leader-player { grid-column: 3; grid-row: 1; }
.sb-row.champion-row .champion-label { white-space: nowrap; }
.sb-row.champion-row .champion-row-stars { grid-column: 3; grid-row: 2; margin-left: 0; justify-content: flex-start; }
.sb-row.champion-row .you-tag { grid-column: 3; grid-row: 2; justify-self: end; }
.sb-row.champion-row .sb-score { grid-column: 4; grid-row: 1 / 3; }
.sb-row.champion-row .sb-score { width: auto; min-width: 28px; font-variant-numeric: tabular-nums; }
.sb-row.champion-row .champion-row-stars { max-width: 48px; }
.sb-row.champion-row .sb-rank, .sb-row.champion-row .sb-score, .champion-row .you-tag { color: #ffe29b; }
.champions-description { margin: 8px 0 16px; color: var(--cream); font-size: 13px; line-height: 1.6; }
.tournament-views { display: flex; gap: 8px; margin-bottom: 22px; }
.tournament-views button { flex: 1; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--cream); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.tournament-views button[aria-pressed="true"] { background: var(--cream); border-color: var(--cream); color: #084c34; }
.tournament-views button:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }
.tournament-champions.tournament-stage { margin-top: 0; padding-top: 0; border-top: 0; }
.champions-list { display: grid; gap: 16px; list-style: none; padding: 0; margin: 0; }
.champion-profile { position: relative; display: flex; flex-direction: column; align-items: center; padding: 54px 28px 30px; min-height: 280px; border-radius: 16px; overflow: hidden; background: #080f20 url('/assets/champion-108-background.png') center / 100% 100%; color: #fff2cd; text-align: center; }
.champion-rank { position: absolute; top: 16px; left: 16px; padding: 3px 7px; border-radius: 6px; background: #080f20; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.champion-title { font: 800 15px/1.5 "Noto Serif", serif; color: #ffe29b; margin-bottom: 8px; }
.champion-profile .ava { width: 64px; height: 64px; flex: none; font-size: 26px; border: 2px solid #f2c14e; }
.champion-name { max-width: 100%; overflow-wrap: anywhere; font-size: 19px; line-height: 1.4; margin: 10px 0 6px; }
.champion-stars { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; color: #ffd363; }
.champion-stars svg { width: 19px; height: 19px; flex: none; }
.champion-wins { font-size: 13px; line-height: 1.6; margin-top: 6px; }
.tournament-notify-offer { position: absolute; z-index: 100; left: 16px; right: 16px; bottom: 24px; padding: 18px; border-radius: 16px; background: #122332; color: #e3ecf8; border: 1px solid #496078; box-shadow: 0 12px 36px rgba(0, 0, 0, .4); }
.tournament-notify-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.tournament-notify-heading svg { width: 30px; height: 30px; flex: none; color: #8bbdff; }
.tournament-notify-heading h3 { font-size: 18px; line-height: 1.4; color: #fff; }
.tournament-notify-offer p { font-size: 14px; line-height: 1.65; }
.tournament-notify-actions { display: flex; gap: 10px; margin-top: 16px; }
.tournament-notify-actions button { flex: 1; min-height: 46px; padding: 10px; border: 1px solid #496078; border-radius: 12px; background: #21394e; color: #e3ecf8; font-size: 15px; font-weight: 700; cursor: pointer; }
#tournamentNotifyEnable { background: #2c67bb; color: #fff; border-color: #2c67bb; }
.tournament-notify-actions button:disabled { opacity: .6; cursor: wait; }
@media (hover: hover) { #tournamentNotifyEnable:hover { background: #24579f; } #tournamentNotifyLater:hover { background: #2b4861; } }
.tournament-screen ::selection { color: var(--on-gold); background: var(--cream); }
@media (hover: hover) {
  .tournament-actions .chip:hover, .tournament-head .chip:hover { background: var(--panel-2); }
}

.tournament-table-wait { position: absolute; z-index: 3; left: 50%; top: 47%; transform: translate(-50%, -50%); width: 70%; text-align: center; pointer-events: none; }
.tournament-table-wait > span { display: block; font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--cream); }
.tournament-table-wait strong { display: block; margin: 10px 0; font-size: 52px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--cream); }
.tournament-table-wait small { display: block; font-size: 13px; line-height: 1.6; color: var(--cream); }
@media (max-height: 650px) {
  .tournament-table-wait > span { font-size: 14px; }
  .tournament-table-wait strong { margin: 6px 0; font-size: 40px; }
}

.table-viewers { position:fixed;z-index:70;top:calc(8px + env(safe-area-inset-top));right:calc(max(8px, env(safe-area-inset-right)) + 150px);height:44px;display:flex;align-items:center;gap:4px;color:var(--cream);font:600 12px/1.3 "Noto Sans",sans-serif;pointer-events:none; }
.table-viewers svg{width:17px;height:17px}.table-viewers.spectator{right:calc(max(8px, env(safe-area-inset-right)) + 50px)}
body[data-screen="table"] .online-room-bar{margin-top:0;gap:8px;padding-right:156px}
body[data-screen="table"] #onlineLeave{min-width:44px;padding:0}body[data-screen="table"] #onlineLeave span{display:none}.online-room-bar #onlineLeave{display:inline-flex;align-items:center;justify-content:center;gap:6px}.online-room-bar #onlineLeave svg{width:20px;height:20px;flex:none}
body[data-screen="table"] #tournamentReturn{padding:0 10px;font-size:12px;white-space:nowrap}body[data-screen="table"] .online-room-bar>span{display:none}
body[data-screen="table"] .voice-btn{right:calc(max(8px, env(safe-area-inset-right)) + 100px)}
body[data-screen="table"] .chat-btn{right:calc(max(8px, env(safe-area-inset-right)) + 50px)}
.score-history{max-height:80dvh;overflow:auto}.score-history table{width:100%;border-collapse:collapse;font-size:12px;margin:16px 0}.score-history th,.score-history td{padding:8px 4px;border-bottom:1px solid var(--line);text-align:center;max-width:70px;overflow-wrap:anywhere}.score-history td{font-variant-numeric:tabular-nums}.score-history button{margin-top:12px;width:100%}
.tournament-screen .chip{min-height:44px;padding:8px 14px;border:1px solid var(--line);border-radius:12px;background:transparent;color:var(--cream);cursor:pointer}
.tournament-screen .tournament-spectate{background:var(--cream);color:var(--on-gold);width:100%;font-weight:700}
body:has(#table.tournament-waiting:not([hidden])) #scoreBtn{display:none}
@media(max-width:360px){body[data-screen="table"] #tournamentReturn{padding:0 4px;font-size:11px}.table-viewers{right:calc(max(8px, env(safe-area-inset-right)) + 148px);font-size:11px;gap:3px}}

.tournament-result .winner-name{display:flex;align-items:center;justify-content:center;gap:12px}.tournament-result .winner-name .ava{width:56px;height:56px;font-size:22px;border:2px solid var(--cream)}
.tournament-result .winner-info{min-width:0;text-align:left}.winner-player-name{display:block;line-height:1.3;overflow-wrap:anywhere}.winner-sub{display:block;font-size:13px;line-height:1.4;color:var(--cream);margin-top:4px}
.result-summary{font-size:13px;line-height:1.5;color:var(--cream);margin-bottom:20px}.result-table-head{display:flex;justify-content:space-between;padding:0 12px;margin-bottom:10px;font-size:12px;color:var(--cream)}
#championShare{width:100%;margin-bottom:10px}#championShare:not([hidden]) + #rematchBtn{background:transparent;color:var(--cream);border:1px solid var(--line)}

.tournament-actions .primary,.tournament-result .btn-confirm{background:var(--cream);color:#0f3d2a;border:1px solid var(--cream);box-shadow:none;letter-spacing:normal;text-transform:none;font:700 15px/1.4 "Noto Sans",sans-serif}
.tournament-result{background:var(--felt-mid)}.tournament-result .overlay-card{background:transparent;border:0;border-radius:0;box-shadow:none;width:min(100%,420px);padding:24px 20px}
.tournament-result .winner-label{font-size:24px;font-weight:700;line-height:1.3;color:var(--cream);letter-spacing:normal;text-transform:none}
.tournament-result .sb-row.lead{background:var(--cream);color:#0f3d2a;border-color:var(--cream)}.tournament-result .sb-row.lead .sb-rank,.tournament-result .sb-row.lead .sb-score,.tournament-result .sb-row.lead .you-tag{color:#0f3d2a}

.tournament-result .rematch-status{color:var(--cream)}
