/* Who Am I? — бараан, minimal: нэг гол фонт, нимгэн зураас, өнгө зөвхөн 1P/2P дохионд. */

@font-face { font-family: 'Golos Text'; src: url(/fonts/golos-latin.woff2) format('woff2'); font-weight: 400 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Golos Text'; src: url(/fonts/golos-latin-ext.woff2) format('woff2'); font-weight: 400 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Golos Text'; src: url(/fonts/golos-cyrillic.woff2) format('woff2'); font-weight: 400 700; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; src: url(/fonts/golos-cyrillic-ext.woff2) format('woff2'); font-weight: 400 700; font-display: swap; unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
/* Fira Sans Extra Condensed — гарчиг, дугаар, нэр, тамга (кирилл Ө/Ү-тэй) */
@font-face { font-family: 'Fira Sans Extra Condensed'; src: url(/fonts/fira-xc-700-latin.woff2) format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Fira Sans Extra Condensed'; src: url(/fonts/fira-xc-700-latin-ext.woff2) format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fira Sans Extra Condensed'; src: url(/fonts/fira-xc-700-cyrillic.woff2) format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Fira Sans Extra Condensed'; src: url(/fonts/fira-xc-700-cyrillic-ext.woff2) format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }


:root {
  --bg: #0c0c10;             /* суурь */
  --surface: #14141a;        /* самбар, карт */
  --surface-2: #1b1b23;      /* оролт, товч */
  --line: #2a2a35;           /* нимгэн зураас */
  --line-2: #3a3a48;         /* hover зураас */
  --text: #ececf1;
  --text-2: #9b9bab;         /* хоёрдогч бичвэр (≈7:1 суурь дээр) */
  --p1: #e5545e;             /* 1P — намуухан улаан */
  --p2: #5b8def;             /* 2P — намуухан цэнхэр */
  --gold: #d9b45a;           /* тодорхойгүй / сонголт */
  --danger: #f08a91;
  --side: var(--line-2);     /* одоо үйлдэл хийх талын өнгө */
  --f-text: 'Golos Text', system-ui, sans-serif;
  --f-card: 'Fira Sans Extra Condensed', 'Golos Text', system-ui, sans-serif;
  --gap: clamp(16px, 2.4vw, 28px);
  --r: 10px;
  --r-lg: 14px;
  --ease-out: cubic-bezier(.25, 1, .5, 1);
  color-scheme: dark;
}
[data-side='p1'] { --side: var(--p1); }
[data-side='p2'] { --side: var(--p2); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh;
  font: 400 15px/1.55 var(--f-text); color: var(--text);
  background: var(--bg) radial-gradient(1200px 600px at 50% -10%, #17171f 0%, transparent 70%) no-repeat;
  caret-color: var(--text);
  scrollbar-color: var(--line-2) var(--bg);
  -webkit-font-smoothing: antialiased;
}
::selection { background: #3a3a48; color: #fff; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }

.page { max-width: 1280px; margin: 0 auto; padding: 0 var(--gap) 32px; display: flex; flex-direction: column; min-height: 100dvh; }

/* ---------- толгой ---------- */
.marquee {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  min-height: 64px; margin-bottom: 20px; border-bottom: 1px solid var(--line);
}
.logo { text-decoration: none; }
.logo-word { font: 700 17px/1 var(--f-text); letter-spacing: -0.01em; }
.facts { justify-self: end; grid-column: 3; font-size: 13px; color: var(--text-2); }
.plates { justify-self: center; display: flex; gap: 8px; min-width: 0; }
.plate {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 12px 4px 5px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--text-2);
  transition: border-color 200ms ease-out, color 200ms ease-out;
}
.plate-tag { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font: 700 10px var(--f-text); color: #0c0c10; }
.plate-p1 .plate-tag { background: var(--p1); }
.plate-p2 .plate-tag { background: var(--p2); }
.plate-name { font-weight: 600; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14ch; }
.plate-you { font-size: 12px; color: var(--text-2); }
.plate.is-active { border-color: var(--text-2); }
.room { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text-2); }
.room-code { font-weight: 700; letter-spacing: 0.12em; color: var(--text); font-variant-numeric: tabular-nums; }
.room-round { border-left: 1px solid var(--line); padding-left: 8px; }

/* ---------- ээлжийн мөр ---------- */
.turn {
  display: flex; align-items: center; gap: 12px; min-height: 44px;
  margin: 0 0 16px; padding: 6px 4px;
  font-weight: 600; font-size: 15px; color: var(--text-2);
}
.turn-mine, .turn-answer { color: var(--text); }
.turn-badge {
  flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--side) 16%, transparent); color: var(--text);
  font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
  animation: rise 200ms var(--ease-out) both;
}
.turn-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--side); }
.turn-hint { font-weight: 500; color: var(--text-2); }
.timer { margin-left: auto; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); }
.timer.is-low { border-color: var(--p1); color: var(--danger); }
@keyframes rise { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }
.banner-warn { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--r); border: 1px solid var(--gold); color: var(--gold); font-weight: 600; font-size: 14px; }

/* ---------- товч ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 15px; line-height: 1.1; text-decoration: none; cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out, opacity 150ms ease-out;
}
.btn:hover:not(:disabled) { background: #23232d; border-color: #4a4a5a; }
.btn:active:not(:disabled) { background: #1f1f28; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--text); border-color: var(--text); color: #0c0c10; }
.btn-primary:hover:not(:disabled) { background: #ffffff; border-color: #ffffff; }
.btn-primary:active:not(:disabled) { background: #d6d6de; }
.btn-stamp { background: transparent; border-color: var(--line-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line); color: var(--text); }
/* таах: алт өнгө зөвхөн энд — эрсдэлтэй үйлдэл гэдгийг ялгана */
.btn-guess { background: transparent; border-color: color-mix(in srgb, var(--gold) 55%, transparent); color: var(--gold); }
.btn-guess:hover:not(:disabled) { background: color-mix(in srgb, var(--gold) 10%, transparent); border-color: var(--gold); }
.btn-guess-solid { background: var(--gold); border-color: var(--gold); color: #0c0c10; }
.btn-guess-solid:hover:not(:disabled) { background: color-mix(in srgb, var(--gold) 85%, #fff); border-color: color-mix(in srgb, var(--gold) 85%, #fff); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* хариултын товч: жижиг өнгөт цэгтэй хавтгай товч */
.answers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.arcade {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 10px;
  border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.arcade-cap { --c: var(--p1); width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.arcade-no .arcade-cap { --c: var(--p2); }
.arcade-unsure .arcade-cap { --c: var(--gold); }
.arcade-label { font-weight: 600; font-size: 15px; }
.arcade:hover:not(:disabled) { border-color: color-mix(in srgb, var(--c, var(--text-2)) 60%, var(--line-2)); background: #20202a; }
.arcade-yes:hover:not(:disabled) { border-color: var(--p1); }
.arcade-no:hover:not(:disabled) { border-color: var(--p2); }
.arcade-unsure:hover:not(:disabled) { border-color: var(--gold); }
.arcade:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- самбар ---------- */
.card, .dock { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card { padding: clamp(20px, 3vw, 28px); }
.survey { display: grid; gap: 18px; }
.card-title { font-weight: 700; font-size: 20px; line-height: 1.3; }
.field { display: grid; gap: 6px; }
.field-label { font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
#name, #share-link, .share-link {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--bg); font-size: 15px;
  transition: border-color 150ms ease-out;
}
#name:focus-visible, #share-link:focus-visible { outline: none; border-color: var(--text-2); }
#name::placeholder, textarea::placeholder, #join-code::placeholder { color: #6f6f80; }

/* ---------- нүүр ---------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: clamp(32px, 6vw, 96px); align-items: start; flex: 1; padding-top: clamp(16px, 6vh, 64px); }
.display { font-weight: 700; font-size: clamp(34px, 4.6vw, 52px); line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; max-width: 16ch; }
.lede { margin-top: 16px; font-size: 17px; max-width: 42ch; color: var(--text-2); }
.rules { margin: 32px 0 0; padding: 0; list-style: none; counter-reset: r; display: grid; gap: 12px; max-width: 46ch; color: var(--text-2); }
.rules li { counter-increment: r; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: baseline; }
.rules li::before { content: counter(r); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); font-size: 12px; font-weight: 600; color: var(--text); }

.menu { display: grid; gap: 10px; align-content: start; }
.menu-title { font-weight: 700; font-size: 18px; }
.menu .muted { margin-bottom: 6px; }
.menu-item {
  display: grid; gap: 2px; padding: 16px 18px; border-radius: var(--r-lg); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 150ms ease-out, background-color 150ms ease-out;
}
.menu-item:hover { border-color: var(--line-2); background: #17171e; }
.menu-primary { background: var(--text); border-color: var(--text); color: #0c0c10; }
.menu-primary:hover { background: #fff; border-color: #fff; }
.menu-label { font-weight: 700; font-size: 17px; }
.menu-sub { font-size: 13px; color: var(--text-2); }
.menu-primary .menu-sub { color: #4a4a58; }
button.menu-item { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.menu-primary { color: #0c0c10; }
button.menu-item:disabled { opacity: 0.6; cursor: progress; }
.menu-name { margin-bottom: 4px; }
.menu-name input, #home-name { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--bg); font-size: 15px; }
#home-name:focus-visible { outline: none; border-color: var(--text-2); }
.install { justify-self: start; }
.recent { margin-top: 18px; display: grid; gap: 4px; }
#recent { list-style: none; margin: 0; padding: 0; display: grid; }
#recent li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.result-dot { grid-row: span 2; width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); }
.result-dot.is-won { background: var(--gold); }
.recent-main { font-weight: 600; font-size: 14px; }
.recent-meta { font-size: 12px; color: var(--text-2); }

/* өрөө үүсгэх: сонголтууд */
.options { border: 0; margin: 0; padding: 0; min-width: 0; }
.options legend { margin-bottom: 8px; padding: 0; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg-item { position: relative; display: grid; place-items: center; min-height: 42px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-2); transition: border-color 150ms ease-out, color 150ms ease-out; }
.seg-item input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg-item:has(input:checked) { border-color: var(--text); color: var(--text); }
.seg-item:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.toggle { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.toggle input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--text); }
.toggle-text { display: grid; gap: 2px; }
.toggle-label { font-weight: 600; font-size: 15px; }

/* нээлттэй өрөөнүүд */
.rooms-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.room-row { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg); }
.room-host { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-info { grid-row: 2; font-size: 13px; color: var(--text-2); }
.join-room { grid-row: span 2; grid-column: 2; grid-row-start: 1; }
.empty { padding: 18px 0; }
.lobby-meta { margin-top: -10px; }

.menu-join { grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; }
.menu-join:hover { background: var(--surface); }
#join-code {
  min-width: 0; min-height: 42px; padding: 8px 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--bg);
  font-weight: 700; font-size: 17px; letter-spacing: 0.2em; text-transform: uppercase;
}
#join-code::placeholder { letter-spacing: 0.1em; font-weight: 500; font-size: 13px; }
#join-code:focus-visible { outline: none; border-color: var(--text-2); }
.back { justify-self: start; color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.back:hover { color: var(--text); }

.modes { border: 0; margin: 0; padding: 0; min-width: 0; }
.modes legend { margin-bottom: 10px; padding: 0; }
.modes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.mode {
  position: relative; display: grid; border-radius: var(--r); overflow: hidden;
  background: var(--bg); border: 1px solid var(--line); cursor: pointer;
  transition: border-color 150ms ease-out;
}
.mode input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.mode:hover { border-color: var(--line-2); }
.mode:has(input:checked) { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.mode:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.mode-art { display: grid; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.mode-multi .mode-art { grid-template-columns: 1fr 1fr; }
.mode-face { display: block; overflow: hidden; }
.mode-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; filter: saturate(0.85); }
.mode-title { padding: 7px 8px 0; font: 700 14px/1.15 var(--f-card); }
.mode-note { padding: 0 8px 8px; font-size: 12px; color: var(--text-2); }

.single { flex: 1; display: grid; place-items: start center; padding-top: 5vh; }
.single > * { width: min(520px, 100%); }
.single-wide > * { width: min(720px, 100%); }
.waiting { color: var(--text-2); font-weight: 500; }
.waiting::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 8px; vertical-align: middle; border-radius: 50%; background: var(--text-2); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.error { padding: 10px 12px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--p1) 60%, transparent); background: color-mix(in srgb, var(--p1) 8%, transparent); color: var(--danger); font-weight: 500; font-size: 14px; }
.error.is-empty { display: none; }

/* ---------- лобби ---------- */
.code-box { display: grid; justify-items: center; gap: 12px; padding: 20px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg); }
.code-big { font-weight: 700; font-size: clamp(34px, 8vw, 44px); line-height: 1; letter-spacing: 0.22em; padding-left: 0.22em; font-variant-numeric: tabular-nums; }
.share-link { min-height: 40px; font-size: 13px; color: var(--text-2); }
.seats { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.seat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); min-width: 0; }
.seat .plate-tag { grid-row: span 2; width: 30px; height: 30px; font-size: 11px; }
.seat-p1 .plate-tag { background: var(--p1); }
.seat-p2 .plate-tag { background: var(--p2); }
.seat.is-empty { border-style: dashed; }
.seat.is-empty .plate-tag { background: var(--surface-2); color: var(--text-2); }
.seat-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.is-empty .seat-name { font-weight: 400; font-size: 13px; color: var(--text-2); }
.seat-meta { font-size: 12px; color: var(--text-2); }
.seats-vs { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: lowercase; }
.btn-start { min-height: 48px; font-size: 17px; }

/* ---------- дүрийн самбар ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; flex: 1; }
.screen { padding: 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: inset 0 2px 0 -1px var(--side); transition: box-shadow 260ms ease-out; }
.ballot { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.entry {
  position: relative; display: grid; grid-template-rows: auto 1fr; padding: 0; margin: 0;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; text-align: left;
  background: var(--bg);
  transition: border-color 150ms ease-out, opacity 200ms ease-out;
}
.entry:hover:not(:disabled) { border-color: var(--line-2); }
.entry:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; z-index: 3; }
.entry:disabled { cursor: default; }
.entry-no { position: absolute; top: 5px; left: 5px; z-index: 1; padding: 0 5px; border-radius: 5px; background: rgb(12 12 16 / 0.72); color: var(--text-2); font: 700 11px/1.5 var(--f-card); letter-spacing: 0.03em; }
.portrait { display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--surface-2); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; display: block; transition: filter 200ms ease-out, opacity 200ms ease-out; }
.initials { display: grid; place-items: center; height: 100%; font-weight: 700; font-size: 20px; color: var(--text-2); }
.entry-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding: 6px 7px 7px; min-height: calc(2 * 1.15em + 13px); font: 700 14px/1.15 var(--f-card); }

/* хасагдсан: бүдгэрнэ, нэр зурагдана — буцааж болно */
.entry.is-down .portrait img { filter: grayscale(1); opacity: 0.25; }
.entry.is-down .entry-name { color: #6f6f80; text-decoration: line-through; text-decoration-thickness: 1px; }

.entry.is-marked { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); z-index: 2; }
.entry.is-mine .entry-no { background: var(--text); color: #0c0c10; }
.entry.is-theirs { border-color: var(--text-2); }
.screen.is-guessing { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: inset 0 2px 0 -1px var(--gold); }
.ballot.is-guessing .entry:not(.is-marked) { opacity: 0.5; }
.ballot.is-guessing .entry.is-marked { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.ballot.is-guessing .entry:not(.is-down):hover { opacity: 1; }
.hint { margin-top: 10px; font-size: 13px; color: var(--text-2); }

/* ---------- баруун багана ---------- */
.side { display: grid; gap: 18px; position: sticky; top: 16px; }
.dock { display: grid; gap: 16px; padding: 16px; }
.dock-main { display: grid; gap: 12px; min-width: 0; }
.act { display: grid; gap: 12px; }
.act-title { font-weight: 600; font-size: 15px; line-height: 1.35; }
.muted { color: var(--text-2); font-size: 13px; }
.warn { color: var(--danger); font-size: 13px; font-weight: 500; }

.secret { margin: 0; display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; }
.secret-portrait { display: block; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line-2); }
.secret-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; display: block; }
.secret figcaption { display: grid; gap: 1px; min-width: 0; }
.secret-name { font: 700 17px/1.2 var(--f-card); overflow-wrap: anywhere; }
.secret-label { font-size: 12px; color: var(--text-2); }

.postcard { display: grid; gap: 6px; }
#question {
  width: 100%; resize: none; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--bg); line-height: 1.5; font-size: 15px; min-height: calc(3em + 22px);
  transition: border-color 150ms ease-out;
}
#question:focus-visible { outline: none; border-color: var(--text-2); }
.count { justify-self: end; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.count.over { color: var(--danger); }
.incoming, .pending-q { font-weight: 500; font-size: 17px; line-height: 1.4; padding: 12px 14px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line-2); overflow-wrap: anywhere; }

.opp-left { font-size: 13px; color: var(--text-2); padding: 0 2px; }
.claim-wait { font-size: 12px; color: var(--text-2); }

.side-title { font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); padding: 0 2px 8px; border-bottom: 1px solid var(--line); }
.history { display: grid; gap: 8px; }
.log { list-style: none; margin: 0; padding: 0; display: grid; }
.log li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); align-items: center; }
.log .who { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.who-tag { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 700; font-size: 11px; color: #0c0c10; }
.who-tag.p1 { background: var(--p1); }
.who-tag.p2 { background: var(--p2); }
.log .q { overflow-wrap: anywhere; }
.log .q-guess { color: var(--text-2); font-style: italic; }
.stamp { justify-self: end; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text); }
.stamp::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.stamp-yes::before { background: var(--p1); }
.stamp-no::before { background: var(--p2); }
.stamp-unsure::before { background: var(--gold); }
.log li:last-child { animation: rise 220ms var(--ease-out) both; }

/* ---------- төгсгөл ---------- */
.over { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(28px, 5vw, 64px); align-items: start; flex: 1; padding-top: 8px; }
.verdict { display: grid; gap: 16px; justify-items: start; }
.verdict-title { font-weight: 700; font-size: clamp(34px, 5vw, 48px); line-height: 1.05; letter-spacing: -0.02em; }
.is-lost .verdict-title { color: var(--text-2); }
.verdict .lede { margin-top: 0; }
.reveal { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; width: 100%; max-width: 520px; margin-top: 8px; }
.reveal .secret { grid-template-columns: 1fr; padding: 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); animation: rise 320ms var(--ease-out) both; }
.reveal .side-p1 { box-shadow: inset 0 2px 0 -1px var(--p1); }
.reveal .side-p2 { box-shadow: inset 0 2px 0 -1px var(--p2); animation-delay: 80ms; }
.reveal .secret-portrait { border: 0; }
.reveal .secret-name { font-size: 20px; }
.vs-badge { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: lowercase; }

/* хурдан мессеж, түүх */
.dock-tools { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.emotes { display: flex; flex-wrap: wrap; gap: 6px; }
.emote { min-height: 32px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; transition: border-color 150ms ease-out, color 150ms ease-out; }
.emote:hover { border-color: var(--line-2); color: var(--text); }
.emote:active { background: var(--surface-2); }
.history-btn { display: none; justify-self: start; min-height: 36px; padding: 6px 10px; font-size: 13px; }
.toast-emote-p1::before { background: var(--p1); }
.toast-emote-p2::before { background: var(--p2); }
.sheet-backdrop { place-items: end center; padding: 0; }
.sheet { display: grid; gap: 12px; width: min(560px, 100%); max-height: 78dvh; overflow: auto; padding: 18px 18px max(18px, env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0; animation: sheet-in 240ms var(--ease-out) both; }
.sheet:focus { outline: none; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- мэдэгдэл ---------- */
#toasts { position: fixed; top: 14px; left: 50%; translate: -50% 0; z-index: 50; display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r);
  background: #1d1d26; border: 1px solid var(--line-2); color: var(--text); font-size: 14px; font-weight: 500;
  overflow-wrap: anywhere;
  animation: toast-in 220ms var(--ease-out) both;
}
.toast::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); }
.toast-ask::before, .toast-answer-yes::before { background: var(--p1); }
.toast-answer-no::before { background: var(--p2); }
.toast-answer-unsure::before, .toast-warn::before { background: var(--gold); }
.toast.is-leaving { opacity: 0; translate: 0 -6px; transition: opacity 220ms ease-out, translate 220ms ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- үр дүнгийн popup ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgb(6 6 9 / 0.72); animation: fade 200ms ease-out both; }
.modal {
  display: grid; justify-items: center; gap: 14px; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 26px clamp(18px, 4vw, 28px) 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2);
  text-align: center;
  animation: modal-in 260ms var(--ease-out) both;
}
.modal:focus { outline: none; }
.modal-kicker-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-2); }
.is-won .modal-kicker-dot { background: var(--gold); }
.modal .verdict-title { font-weight: 700; font-size: clamp(34px, 6vw, 48px); line-height: 1.05; letter-spacing: -0.02em; }
.is-lost .modal .verdict-title { color: var(--text); }
.modal .lede { margin: 0; font-size: 15px; }
.modal .reveal { margin: 4px 0 2px; max-width: none; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
/* асуултын popup */
.modal-q { gap: 16px; }
.modal-sub { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.modal-question { font-weight: 700; font-size: clamp(20px, 4.4vw, 34px); line-height: 1.3; overflow-wrap: anywhere; text-wrap: balance; }
.secret-q { grid-template-columns: 44px auto; justify-content: center; padding: 8px 14px 8px 8px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); text-align: left; }
.modal-q .answers { width: 100%; }
.modal-q .arcade { min-height: 56px; }

/* хариулт ирэхэд гарах түр карт — дарах үйлдлийг хаахгүй */
.flash-layer { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.flash {
  display: grid; justify-items: center; gap: 6px; min-width: min(320px, 100%); max-width: min(440px, 100%);
  padding: 22px 26px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); text-align: center;
  animation: modal-in 240ms var(--ease-out) both;
}
.flash.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity 240ms ease-out, transform 240ms ease-out; }
.flash-who { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.flash-answer { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; font-size: clamp(34px, 8vw, 48px); line-height: 1.05; }
.flash-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); }
.flash-yes .flash-dot { background: var(--p1); }
.flash-no .flash-dot { background: var(--p2); }
.flash-unsure .flash-dot { background: var(--gold); }
.flash-q { font-size: 15px; color: var(--text-2); overflow-wrap: anywhere; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.credit { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); }

@media (min-width: 1100px) {
  .page-game .ballot { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .page-game .entry-name { font-size: 13px; }
}

/* ---------- утас ---------- */
@media (max-width: 860px) {
  .home, .over { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .seats { grid-template-columns: 1fr; }
  .seats-vs { justify-self: center; }
  .ballot { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .screen { padding: 6px; }
  .page-game { padding-bottom: 250px; }
  .page-game .dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    grid-template-columns: 44px 1fr; align-items: start; gap: 12px;
    max-height: 60dvh; overflow: auto; border-radius: 16px 16px 0 0; border-width: 1px 0 0;
    padding: 12px max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    background: #111117;
  }
  .page-game .dock .secret { grid-template-columns: 1fr; }
  .page-game .dock .secret figcaption { display: none; }
  .marquee { grid-template-columns: auto auto; min-height: 56px; padding: 10px 0; row-gap: 10px; }
  .marquee .facts { display: none; }
  .marquee .plates { grid-row: 2; grid-column: 1 / -1; justify-self: stretch; display: grid; grid-template-columns: 1fr 1fr; }
  .plate-name { max-width: none; }
  .room-label { display: none; }
  .turn { position: sticky; top: 0; z-index: 5; background: var(--bg); margin-left: calc(-1 * var(--gap)); margin-right: calc(-1 * var(--gap)); padding: 8px var(--gap); }
  .turn-hint { display: none; }
  #question { min-height: calc(1.5em + 22px); }
  .history-btn { display: inline-flex; }
  .side > .history { display: none; }
  .dock-tools { padding-top: 10px; }
  .emote { min-height: 30px; padding: 3px 9px; flex: none; }
  .emotes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: calc(-1 * max(14px, env(safe-area-inset-right))); padding-right: 14px; }
  .emotes::-webkit-scrollbar { display: none; }
  .dock-tools { grid-template-columns: 1fr; }
  #toasts { top: 8px; }
  .modal .reveal { gap: 8px; }
  .modal .reveal .secret { padding: 6px; }
  .modal .reveal .secret-name { font-size: 17px; }
  .modal-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 480px) {
  .modes-grid { grid-template-columns: repeat(3, 1fr); }
  .entry-name { font-size: 12px; padding: 5px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
