:root {
  --felt-1: #15703f;
  --felt-2: #0b3d26;
  --ink: #f6f3ea;
  --muted: rgba(246, 243, 234, 0.66);
  --line: rgba(255, 255, 255, 0.14);
  --panel: rgba(0, 0, 0, 0.24);
  --gold: #f4c24f;
  --gold-ink: #231c07;
  --red: #e5484d;
  --green: #2fb36d;
  --card: #fffdf6;
  --card-red: #d42a2f;
  --card-black: #1b1b1f;
  --cw: min(16.5vw, 70px);
  --ch: calc(var(--cw) * 1.42);
  --tw: min(14vw, 58px);
  --th: calc(var(--tw) * 1.42);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --app-height: var(--tg-viewport-stable-height, 100dvh);
  --app-bg: #0d0a26;
  --violet: #8b5cf6;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--felt-2);
  color: var(--ink);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  background: radial-gradient(120% 90% at 50% 35%, var(--felt-1) 0%, var(--felt-2) 75%) fixed;
}

/* Home, o'yin tanlash va boshqa «ilova» ekranlari — binafsha fon; lobbi va stol — yashil movut */
html:not([data-screen="lobby"]):not([data-screen="table"]) { background: var(--app-bg); }
html:not([data-screen="lobby"]):not([data-screen="table"]) body {
  background:
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='860' viewBox='0 0 400 860'><g fill='%238b5cf6' fill-opacity='0.17' font-family='Arial, sans-serif'><text x='14' y='150' font-size='46' transform='rotate(-18 14 150)'>%E2%99%A0</text><text x='338' y='64' font-size='36' transform='rotate(16 338 64)'>%E2%99%A5</text><text x='350' y='470' font-size='54' transform='rotate(12 350 470)'>%E2%99%A3</text><text x='4' y='620' font-size='40' transform='rotate(-10 4 620)'>%E2%99%A6</text><text x='300' y='830' font-size='44' transform='rotate(-14 300 830)'>%E2%99%A0</text></g></svg>") top center / 100% auto no-repeat,
    radial-gradient(75% 45% at 100% 0%, rgba(124, 77, 255, 0.42), transparent 70%),
    radial-gradient(85% 50% at 0% 100%, rgba(53, 103, 232, 0.32), transparent 70%),
    radial-gradient(60% 35% at 0% 32%, rgba(176, 64, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #140d33 0%, var(--app-bg) 70%);
  background-attachment: fixed;
}

button { font: inherit; color: inherit; }
h1, h2 { margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

.screen {
  min-height: var(--app-height);
  padding: 16px 16px calc(16px + var(--safe-bottom));
  max-width: 560px;
  margin: 0 auto;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.13);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: var(--gold); color: var(--gold-ink); }
.btn.success { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.link { background: none; min-height: 36px; font-weight: 500; color: var(--muted); }
.btn.big { min-height: 52px; font-size: 16px; }
.btn.icon { min-width: 40px; min-height: 40px; padding: 6px 10px; border-radius: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin: 12px 0;
}
.label { font-weight: 600; }

.seg { display: inline-flex; background: rgba(0, 0, 0, 0.28); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button {
  border: 0;
  background: none;
  padding: 7px 11px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.seg button.on { background: var(--gold); color: var(--gold-ink); }
.seg button:disabled { cursor: default; }
.seg.readonly button:not(.on) { opacity: 0.5; }

/* ---------------------------------------------------------------- loading */

#loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.logo { font-size: 40px; line-height: 1; }
.logo.big { font-size: 64px; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2); border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------- home */

.home-hero { text-align: center; padding: 18px 0 6px; }
.home-hero h1 { font-size: 30px; margin-top: 6px; }
.home-top { display: flex; align-items: center; gap: 14px; padding: 6px 0 2px; }
.home-top .avatar {
  --size: 58px;
  flex: none;
  box-shadow: 0 0 0 3px var(--app-bg), 0 0 0 5px var(--violet), 0 0 24px 4px rgba(139, 92, 246, 0.55);
}
.hello { font-size: 22px; font-weight: 800; line-height: 1.25; }
.home-section { margin-top: 20px; }
.home-section > h2 { margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.home-section > h2.home-h {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  font-size: 19px; font-weight: 800; color: var(--ink);
}
.home-h-icon { font-size: 19px; filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.8)); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%; /* aniq kenglik — aspect-ratio grid ustunini kengaytirmasin */
  min-width: 0;
  aspect-ratio: 5 / 4; /* rasmlar 800×640 — kesilmasin */
  min-height: 140px;
  padding: 12px;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--accent) 80%, #fff 8%);
  border-radius: 20px;
  background: var(--accent);
  background: radial-gradient(120% 95% at 70% 5%,
    color-mix(in srgb, var(--accent) 80%, #fff 6%) 0%,
    color-mix(in srgb, var(--accent) 38%, var(--app-bg)) 58%,
    var(--app-bg) 100%);
  box-shadow: 0 12px 28px -16px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.08s ease;
}
/* Matn rasm ustida ham o'qilsin — pastki qism qoraytiriladi */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, transparent 30%, rgba(10, 8, 30, 0.55) 58%, rgba(10, 8, 30, 0.92) 100%);
}
button.tile:active { transform: scale(0.97); }
.tile-art { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.tile-emoji {
  position: absolute; top: 8px; left: 50%; z-index: -2;
  transform: translateX(-50%);
  font-size: 42px; line-height: 1;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}
.tile-body { display: flex; flex-direction: column; }
.tile-name { font-size: 19px; font-weight: 800; line-height: 1.15; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55); }
.tile-text {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.84);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tile-meta { display: flex; align-items: center; gap: 5px; margin-top: 6px; padding-right: 34px; font-size: 13px; font-weight: 600; }
.tile-meta i { font-style: normal; }
.tile-go {
  position: absolute; right: 10px; bottom: 10px;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(10, 8, 30, 0.6);
}
.tile-go::before {
  content: "";
  width: 7px; height: 7px;
  border-top: 2px solid #fff; border-right: 2px solid #fff;
  transform: translateX(-1px) rotate(45deg);
}
.tile-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: var(--gold); color: var(--gold-ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.tile.soon { filter: saturate(0.55); }
.tile.soon .tile-badge { background: rgba(255, 255, 255, 0.2); color: var(--ink); }
.tile.soon .tile-go { display: none; }
.tile.more { cursor: default; }
.tile.more .tile-emoji { filter: drop-shadow(0 0 18px rgba(167, 120, 255, 0.9)); }

/* «Qimor emas» eslatmasi va «Guruhga qo'shish» */
.fair {
  display: flex; align-items: center; gap: 12px;
  width: 100%; margin-top: 22px; padding: 12px 12px 12px 14px;
  text-align: left; cursor: pointer;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(20, 14, 50, 0.92), rgba(42, 24, 86, 0.78));
}
.fair-icon { flex: none; padding-right: 12px; font-size: 26px; border-right: 1px solid rgba(255, 255, 255, 0.15); }
.fair-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.3; }
.fair-text b { font-size: 13px; }
.fair-text span { color: var(--muted); }
.fair-pill {
  flex: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 700;
  background: linear-gradient(135deg, #8b5cf6, #5b2fd6);
  box-shadow: 0 4px 14px -4px #7c4dff;
}
.cta-group {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 58px; margin: 14px 0 10px; padding: 0 22px;
  cursor: pointer;
  font-size: 17px;
  border: 1.5px solid rgba(139, 92, 246, 0.6);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(53, 103, 232, 0.28), rgba(124, 77, 255, 0.38));
  box-shadow: 0 0 26px -8px rgba(124, 77, 255, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.cta-group b { flex: 1; text-align: center; }
.cta-arrow { font-size: 20px; }
.fair:active, .cta-group:active { transform: scale(0.98); }

/* ⚡ bonuslar */
.home-hello { flex: 1; min-width: 0; }
.bolt-pill {
  flex: none;
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 40px; padding: 0 14px;
  cursor: pointer;
  font-size: 15px;
  border: 1.5px solid rgba(244, 194, 79, 0.65);
  border-radius: 999px;
  background: rgba(244, 194, 79, 0.14);
  box-shadow: 0 0 18px -6px var(--gold);
}
.bolt-pill:active { transform: scale(0.96); }
.bolt-btn { position: relative; border-color: rgba(244, 194, 79, 0.65); }
.bolt-btn i {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; padding: 0 4px;
  font-size: 10px; font-style: normal; font-weight: 800; line-height: 16px;
  border-radius: 999px;
  background: var(--gold); color: var(--gold-ink);
}
.bolt-head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 12px; }
.bolt-big { font-size: 34px; font-weight: 800; color: var(--gold); }
.bolt-gift { font-size: 46px; line-height: 1.1; }
.bolt-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.bolt-pack { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0; }
.bolt-pack > span { display: flex; flex-direction: column; min-width: 0; }
.bolt-pack-n { flex: none; color: var(--gold); }
.bolt-pack + .bolt-pack { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.bolt-kinds { margin: 0 0 12px; padding: 0; list-style: none; font-size: 14px; line-height: 1.7; }
.bolt-invite h2 { margin-bottom: 6px; }
.bolt-invite .btn { width: 100%; margin-top: 6px; }
.bolt-opt-icon { flex: none; font-size: 24px; line-height: 1.2; }
.bolt-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0; }
.bolt-hand .card { margin: 0; cursor: pointer; }
.bonus-rules { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

.resume {
  display: flex; align-items: center; gap: 12px;
  width: 100%; margin-bottom: 8px; padding: 10px 12px;
  text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel);
}
.resume:active { transform: scale(0.98); }
.resume-icon { font-size: 28px; line-height: 1; }
.resume-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.resume-body b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-go { font-size: 24px; line-height: 1; color: var(--gold); }

/* ------------------------------------------------------------- game pick */

.pick-back { margin-bottom: 10px; }
.pick-hero {
  padding: 24px 16px 20px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  background: linear-gradient(170deg, color-mix(in srgb, var(--accent) 66%, transparent), rgba(0, 0, 0, 0.24));
}
.pick-icon { font-size: 62px; line-height: 1.1; }
.pick-hero.has-art { padding-top: 0; overflow: hidden; }
.pick-art { display: block; width: calc(100% + 32px); margin: 0 -16px 14px; aspect-ratio: 16 / 9; object-fit: cover; }
.pick-hero h1 { font-size: 28px; margin-top: 6px; }
.pick-hero p { margin: 4px 0 0; color: var(--muted); }
.pick-about { margin: 14px 2px 0; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.facts > div {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 10px 4px;
  text-align: center;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel);
}
.facts b { font-size: 15px; line-height: 1.2; }
.facts span { font-size: 12px; color: var(--muted); }
.mode-list { display: flex; flex-direction: column; gap: 8px; }
.mode-opt {
  display: flex; align-items: flex-start; gap: 10px;
  width: 100%; padding: 11px 12px;
  text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px;
  background: none;
}
.mode-opt b { display: block; }
.mode-opt.on { border-color: var(--gold); background: rgba(244, 194, 79, 0.1); }
.mode-dot { flex: none; width: 18px; height: 18px; margin-top: 2px; border: 2px solid var(--muted); border-radius: 50%; }
.mode-opt.on .mode-dot { border-color: var(--gold); background: var(--gold); box-shadow: inset 0 0 0 3px var(--felt-2); }

/* ------------------------------------------------------------------ lobby */

#lobby { position: relative; z-index: 0; }
/* Fon: tanlangan stol rangi, mast belgilari, oltin chiziqlar va chetdagi kartalar */
#lobby::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  background:
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='150' viewBox='0 0 120 150'><g transform='rotate(16 60 75)' font-family='Arial, sans-serif' fill='%231b1b1f'><rect x='22' y='18' width='76' height='108' rx='9' fill='%23fffdf6' stroke='%23d9b25a' stroke-opacity='0.55' stroke-width='1.5'/><text x='31' y='44' font-size='21' font-weight='700'>A</text><text x='31' y='62' font-size='16'>%E2%99%A0</text><text x='47' y='112' font-size='48'>%E2%99%A0</text></g></svg>") right -22px top 54px / 72px auto no-repeat,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='150' viewBox='0 0 120 150'><g transform='rotate(-14 60 75)' font-family='Arial, sans-serif' fill='%23d42a2f'><rect x='22' y='18' width='76' height='108' rx='9' fill='%23fffdf6' stroke='%23d9b25a' stroke-opacity='0.55' stroke-width='1.5'/><text x='31' y='44' font-size='21' font-weight='700'>A</text><text x='31' y='62' font-size='16'>%E2%99%A5</text><text x='47' y='112' font-size='48'>%E2%99%A5</text></g></svg>") left -26px bottom -8px / 72px auto no-repeat,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 375 812' preserveAspectRatio='none'><g fill='none' stroke='%23e6c063' stroke-width='1.6' stroke-opacity='0.55' stroke-linecap='round'><path d='M255 -8 C 318 26 362 74 386 134'/><path d='M-8 500 C 26 548 66 582 118 604'/><path d='M384 602 C 350 652 306 692 252 720'/><path d='M-8 700 C 38 736 78 776 96 822'/><path d='M384 744 C 352 768 318 792 296 822'/></g></svg>") center / 100% 100% no-repeat,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='375' height='812' viewBox='0 0 375 812'><g fill='%23000' fill-opacity='0.17' font-family='Arial, sans-serif'><text x='214' y='92' font-size='64'>%E2%99%A3</text><text x='262' y='150' font-size='44'>%E2%99%A0</text><text x='8' y='330' font-size='46'>%E2%99%A3</text><text x='330' y='300' font-size='42'>%E2%99%A3</text><text x='284' y='520' font-size='64'>%E2%99%A0</text><text x='8' y='652' font-size='44'>%E2%99%A3</text><text x='190' y='768' font-size='44'>%E2%99%A5</text><text x='100' y='782' font-size='40'>%E2%99%A3</text></g></svg>") center top / 100% auto no-repeat,
    radial-gradient(90% 62% at 50% 40%, var(--cloth-1) 0%, var(--cloth-2) 48%, var(--cloth-3) 82%, var(--cloth-4) 100%);
}
.lobby-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.lobby-gap { flex: 1; }
#lobby .lobby-bar .btn.icon { background: rgba(var(--felt-ink), 0.72); border: 1px solid rgba(217, 178, 90, 0.42); border-radius: 14px; }
#lobby .lobby-bar .chip { min-height: 40px; padding: 0 14px; background: rgba(var(--felt-ink), 0.72); border-color: rgba(217, 178, 90, 0.42); }
.lobby-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.lobby-art {
  flex: none;
  display: grid; place-items: center;
  width: 66px; height: 66px;
  overflow: hidden;
  font-size: 36px;
  border: 1.5px solid rgba(244, 194, 79, 0.75);
  border-radius: 18px;
  background: rgba(var(--felt-ink), 0.7);
  box-shadow: 0 0 20px rgba(244, 194, 79, 0.32);
}
.lobby-art img { width: 100%; height: 100%; object-fit: cover; object-position: 78% 72%; }
.lobby-title { min-width: 0; }
.lobby-title h1 { font-size: 26px; font-weight: 800; line-height: 1.15; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); }
.lobby-title .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Rejim va o'rinlar — bitta pill ichida */
.lobby-opt {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0; padding: 4px 4px 4px 16px;
  border: 1px solid rgba(217, 178, 90, 0.32);
  border-radius: 999px;
  background: rgba(var(--felt-ink), 0.82);
}
.lobby-opt .label { flex: none; min-width: 58px; }
.lobby-opt .seg { flex: 1; min-width: 0; padding: 0; background: none; }
.lobby-opt .seg button { flex: 1; min-width: 0; min-height: 38px; padding: 6px 4px; border-radius: 999px; }
#lobby .seg button.on {
  background: linear-gradient(180deg, #ffd873, #f0b32e);
  color: var(--gold-ink);
  box-shadow: 0 2px 10px -2px rgba(244, 194, 79, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.lobby-info { display: flex; align-items: flex-start; gap: 8px; margin: 10px 6px; font-size: 13px; line-height: 1.35; color: rgba(255, 255, 255, 0.78); }
.lobby-info i {
  flex: none;
  display: grid; place-items: center;
  width: 18px; height: 18px; margin-top: 1px;
  font-size: 12px; font-weight: 800; font-style: normal;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
}

#lobby .panel {
  border-color: rgba(217, 178, 90, 0.26);
  border-radius: 20px;
  background: rgba(var(--felt-ink), 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.seats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 8px; padding-top: 10px; }
.seat { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.seat .nm { font-size: 13px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.empty .avatar { background: none; border: 2px dashed rgba(255, 255, 255, 0.4); color: rgba(255, 255, 255, 0.85); }
.seat.empty .nm { color: var(--muted); font-weight: 500; }
.seat-avatar { position: relative; }
.seat .seat-ring { background: rgba(255, 255, 255, 0.2); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35); }
.seat .seat-ring.host {
  background: linear-gradient(150deg, #ffeab0 0%, #d9a93f 55%, #8a6519 100%);
  box-shadow: 0 0 16px rgba(244, 194, 79, 0.5);
}
.seat-crown { position: absolute; left: 50%; top: -14px; z-index: 1; font-size: 17px; line-height: 1; transform: translateX(-50%); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }

/* Tugmalar */
#lobby .btn.success { background: linear-gradient(180deg, #2fae5f, #17803f); border: 1px solid rgba(255, 255, 255, 0.22); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3); }
#lobby .btn.primary.big {
  min-height: 58px;
  font-size: 17px; font-weight: 800;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffd873 0%, #f5bd38 55%, #e09a18 100%);
  box-shadow: 0 10px 24px -10px rgba(244, 194, 79, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.lobby-start { gap: 12px; }
.play-dot { position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%; background: rgba(35, 28, 7, 0.88); }
.play-dot::after {
  content: "";
  position: absolute; left: 11px; top: 8px;
  border-left: 11px solid #ffd873;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}
#lobby-expiry { margin: 0; }
#lobby-expiry.urgent { color: #ff8a8d; font-weight: 700; }

/* ----------------------------------------------------------------- avatar */

.avatar {
  --size: 52px;
  position: relative;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  display: grid; place-items: center;
  background: hsl(var(--h, 200) 45% 42%);
  font-weight: 700; font-size: calc(var(--size) * 0.36);
  flex: none;
  transition: box-shadow 0.15s ease, opacity 0.2s ease;
}
.avatar > span { pointer-events: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.small { --size: 30px; }
.avatar.offline { opacity: 0.45; }
.avatar .vstate {
  position: absolute; right: -3px; bottom: -3px;
  width: 20px; height: 20px; border-radius: 50%;
  display: none; place-items: center;
  font-size: 11px; font-style: normal;
  background: var(--felt-2); border: 1px solid var(--line);
}
.avatar.small .vstate { width: 16px; height: 16px; font-size: 9px; right: -4px; bottom: -4px; }
.avatar.in-voice .vstate { display: grid; }
.avatar.in-voice .vstate::before { content: "🎙"; }
.avatar.in-voice.muted .vstate::before { content: "🔇"; }
.avatar.no-link { box-shadow: 0 0 0 3px #f59e0b; }
.avatar.no-link .vstate { display: grid; }
.avatar.in-voice.no-link .vstate::before, .avatar.no-link .vstate::before { content: "⚠️"; }
.avatar.speaking { box-shadow: 0 0 0 3px var(--green), 0 0 16px 2px rgba(47, 179, 109, 0.7); }

/* ------------------------------------------------------------------ table */

#table {
  height: var(--app-height);
  min-height: 0;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.topbar { display: flex; align-items: center; gap: 8px; }
.topbar .info { flex: 1; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip .red { color: #ff6b6f; }
.voice-mini { display: flex; gap: 6px; }

.timer { position: relative; height: 18px; border-radius: 9px; background: rgba(0, 0, 0, 0.3); overflow: hidden; flex: none; }
.timer-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(244, 194, 79, 0.55); transition: width 0.25s linear; }
.timer-fill.low { background: rgba(229, 72, 77, 0.75); }
.timer span { position: relative; display: block; text-align: center; font-size: 11px; font-weight: 700; line-height: 18px; }

.opponents {
  display: flex; justify-content: center; gap: 6px;
  overflow-x: auto; scrollbar-width: none; flex: none; padding: 4px 2px 2px;
}
.opponents::-webkit-scrollbar { display: none; }
.opp {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 72px; flex: none; padding: 6px 2px; border-radius: 14px;
  border: 1px solid transparent;
}
.opp .avatar { --size: 44px; }
.opp.acting { border-color: var(--gold); background: rgba(244, 194, 79, 0.1); }
.opp-name { font-size: 12px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-cards { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.opp-badge { font-size: 11px; color: var(--muted); min-height: 15px; white-space: nowrap; }
.opp.defender .opp-badge { color: #9fd8ff; }
.opp.attacker .opp-badge { color: #ffc2a8; }
.mini-backs { display: inline-flex; }
.mini-backs i {
  width: 9px; height: 13px; border-radius: 2px;
  background: repeating-linear-gradient(45deg, #b8323a 0 2px, #7e1d24 2px 4px);
  border: 1px solid rgba(255, 255, 255, 0.7);
}
.mini-backs i + i { margin-left: -5px; }

.board {
  position: relative;
  flex: 1;
  min-height: 150px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.board .empty-note { color: var(--muted); font-size: 14px; }

.pairs {
  display: grid;
  grid-template-columns: repeat(3, calc(var(--tw) + 18px));
  gap: 10px 8px;
  justify-content: center;
  padding: 10px calc(var(--tw) * 0.9);
}
.pairs.n1 { grid-template-columns: calc(var(--tw) + 18px); }
.pairs.n2, .pairs.n4 { grid-template-columns: repeat(2, calc(var(--tw) + 18px)); }
.pair { position: relative; width: calc(var(--tw) + 18px); height: calc(var(--th) + 18px); }
.pair .card { position: absolute; top: 0; left: 0; width: var(--tw); height: var(--th); }
.pair .card.def { top: 16px; left: 16px; transform: rotate(8deg); }
.pair.target .card.atk { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(244, 194, 79, 0.8); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: translateY(-3px); } }

.deck, .discard {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.deck { left: 6px; }
.discard { right: 6px; }
.deck-stack { position: relative; width: calc(var(--tw) * 0.9); height: calc(var(--th) * 0.9); }
.deck-stack .card { position: absolute; width: calc(var(--tw) * 0.9); height: calc(var(--th) * 0.9); }
.deck-stack .trump-under { transform: rotate(90deg) translateY(-38%); left: 0; top: 0; }
.deck-stack .back { left: 0; top: 0; }
.count {
  font-size: 12px; font-weight: 700;
  background: rgba(0, 0, 0, 0.35); padding: 1px 8px; border-radius: 999px;
}
.deck-empty {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; border: 2px solid var(--gold);
  font-size: 24px; background: rgba(0, 0, 0, 0.2);
}
.deck-empty .red { color: #ff6b6f; }
.discard .card { width: calc(var(--tw) * 0.8); height: calc(var(--th) * 0.8); transform: rotate(-12deg); }

/* ------------------------------------------------------------------ kozel */

.kz-plays { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 8px 6px 8px calc(var(--tw) + 14px); max-height: 100%; overflow-y: auto; }
.kz-play { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 12px; border: 1px solid transparent; }
.kz-play.lead { border-color: var(--gold); background: rgba(244, 194, 79, 0.12); }
.kz-who { width: 70px; flex: none; text-align: right; font-size: 11px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; }
.kz-who span { color: var(--muted); font-weight: 600; }
.kz-cards { display: flex; gap: 4px; }
.kz-cards .card { --w: calc(var(--tw) * 0.78); width: calc(var(--tw) * 0.78); height: calc(var(--th) * 0.78); cursor: default; }
.kz-cards .card.own-cover { opacity: 0.55; }
/* Bura natijasida: Bura/Moskva kartalari */
.bura-combo { justify-content: center; margin: 4px 0 12px; }
.kz-hand .card[data-pts]::before {
  content: attr(data-pts); position: absolute; left: 4px; bottom: 3px;
  font-size: 10px; font-weight: 800; color: #6b5a1e; background: rgba(244, 194, 79, 0.35);
  border-radius: 6px; padding: 0 4px; line-height: 14px;
}
.kz-count { align-self: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.sheet hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.hint { text-align: center; font-size: 14px; font-weight: 600; min-height: 20px; padding: 0 6px; }
.hint.mine { color: var(--gold); }

.actions { display: flex; gap: 8px; justify-content: center; min-height: 44px; flex: none; }
.actions .btn { min-width: 120px; }

.me-row { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; flex: none; }
.me-row .badge { color: var(--muted); }

/* ------------------------------------------------------------------- hand */

.hand {
  --step: 4px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 22px 8px 4px;
  min-height: calc(var(--ch) + 28px);
  flex: none;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
}
.hand::-webkit-scrollbar { display: none; }
.hand.scroll { justify-content: flex-start; }
.hand .card { width: var(--cw); height: var(--ch); flex: none; transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease; }
.hand .card + .card { margin-left: var(--step); }
.hand .card.selected { transform: translateY(-18px); box-shadow: 0 0 0 3px var(--gold), 0 8px 18px rgba(0, 0, 0, 0.45); z-index: 2; }
.hand .card.dim { opacity: 0.5; filter: saturate(0.6); }
.hand .card.playable { box-shadow: 0 0 0 2px rgba(244, 194, 79, 0.85), 0 4px 10px rgba(0, 0, 0, 0.35); }
.hand .card.shake { animation: shake 0.35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ------------------------------------------------------------------- card */

.card {
  position: relative;
  width: var(--cw); height: var(--ch);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 0, 0, 0.18);
  cursor: pointer;
  overflow: hidden;
}
.card.red { color: var(--card-red); }
.card.black { color: var(--card-black); }
.card .c-rank { position: absolute; top: 3px; left: 5px; font-weight: 800; font-size: calc(var(--w, 70px) * 0.3); line-height: 1; letter-spacing: -1px; }
.card .c-suit { position: absolute; top: calc(var(--w, 70px) * 0.32); left: 5px; font-size: calc(var(--w, 70px) * 0.24); line-height: 1; }
.card .c-pip { position: absolute; right: 6%; bottom: 4%; font-size: calc(var(--w, 70px) * 0.55); line-height: 1; }
.hand .card { --w: var(--cw); }
.pair .card { --w: var(--tw); }
.deck .card, .discard .card { --w: calc(var(--tw) * 0.85); }
.card.is-trump::after {
  content: ""; position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 4px, transparent 4px 8px),
    linear-gradient(135deg, #b8323a, #7e1d24);
  border: 3px solid #fff;
}
.card.back > * { display: none; }
.card.fresh { animation: fly-in 0.28s ease-out; }
.pair .card.def.fresh { animation: fly-in-def 0.28s ease-out; }
@keyframes fly-in { from { transform: translateY(40px) scale(0.85); opacity: 0; } }
@keyframes fly-in-def { from { transform: translateY(40px) rotate(8deg) scale(0.85); opacity: 0; } to { transform: rotate(8deg); } }

html:is([data-screen="table"], [data-screen="lobby"])[data-felt="blue"] :is(.sheet, .react-pop) { background: #0c2347; }
html:is([data-screen="table"], [data-screen="lobby"])[data-felt="red"] :is(.sheet, .react-pop) { background: #3a0f18; }
html:is([data-screen="table"], [data-screen="lobby"])[data-felt="purple"] :is(.sheet, .react-pop) { background: #1f1445; }
.menu-style { margin-bottom: 12px; }
.felt-swatches { display: flex; gap: 8px; }
.felt-swatch {
  width: 36px; height: 36px;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--swatch) 75%, #fff), var(--swatch));
}
.felt-swatch.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(244, 194, 79, 0.6); }

/* ------------------------------------------- yangi stol (kartali o'yinlar) */

#table.felt-table, #lobby {
  --rail: #d9b25a;
  --cloth-1: #1c8a4c;
  --cloth-2: #116a39;
  --cloth-3: #0a4526;
  --cloth-4: #06311b;
  --felt-ink: 5, 22, 13;
}
#table.felt-table {
  --tw: min(14.4vw, 60px);
  --th: calc(var(--tw) * 1.42);
  position: relative;
  gap: 4px;
  overflow: hidden;
  background:
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='375' height='812' viewBox='0 0 375 812'><g fill='%23000' fill-opacity='0.2' font-family='Arial, sans-serif'><text x='22' y='128' font-size='44' transform='rotate(-14 22 128)'>%E2%99%A3</text><text x='92' y='205' font-size='70' transform='rotate(-10 92 205)'>%E2%99%A0</text><text x='296' y='130' font-size='58' transform='rotate(12 296 130)'>%E2%99%A0</text><text x='250' y='270' font-size='46' transform='rotate(-6 250 270)'>%E2%99%A5</text><text x='32' y='380' font-size='58' transform='rotate(8 32 380)'>%E2%99%A3</text><text x='310' y='392' font-size='52' transform='rotate(10 310 392)'>%E2%99%A6</text><text x='120' y='520' font-size='48' transform='rotate(-8 120 520)'>%E2%99%A0</text><text x='214' y='548' font-size='54' transform='rotate(8 214 548)'>%E2%99%A5</text></g></svg>") center top / 100% auto no-repeat,
    radial-gradient(90% 62% at 50% 42%, var(--cloth-1) 0%, var(--cloth-2) 48%, var(--cloth-3) 82%, var(--cloth-4) 100%);
}
#table.felt-table[data-felt="blue"], #lobby[data-felt="blue"] { --cloth-1: #2268c0; --cloth-2: #154f96; --cloth-3: #0c3266; --cloth-4: #071d3f; --felt-ink: 6, 16, 36; }
#table.felt-table[data-felt="red"], #lobby[data-felt="red"] { --cloth-1: #ad2f3c; --cloth-2: #84202c; --cloth-3: #56141f; --cloth-4: #340c15; --felt-ink: 30, 8, 12; }
#table.felt-table[data-felt="purple"], #lobby[data-felt="purple"] { --cloth-1: #6340b4; --cloth-2: #49308f; --cloth-3: #2d1b5e; --cloth-4: #1a0f3a; --felt-ink: 16, 10, 38; }
.felt-table .topbar .btn.icon {
  background: rgba(var(--felt-ink), 0.72);
  border: 1px solid rgba(217, 178, 90, 0.42);
  border-radius: 14px;
}
.felt-table .topbar { gap: 6px; }
.felt-table .topbar .btn.icon { min-width: 36px; min-height: 36px; padding: 4px 6px; }
.felt-table .topbar .voice-mini { gap: 4px; }
.felt-table .topbar .info { flex-wrap: nowrap; gap: 4px; min-width: 0; }
.felt-table .topbar .chip { padding: 3px 8px; font-size: 12px; background: rgba(var(--felt-ink), 0.72); border-color: rgba(217, 178, 90, 0.42); }

.stage { position: relative; flex: 1; min-height: 0; }
.rail {
  position: absolute; left: -9%; right: -9%; top: 5%; bottom: 1%;
  pointer-events: none;
  border: 2px solid var(--rail);
  border-radius: 50% / 34%;
  box-shadow:
    0 0 14px rgba(244, 194, 79, 0.28),
    inset 0 0 0 7px rgba(var(--felt-ink), 0.32),
    inset 0 0 0 8px rgba(217, 178, 90, 0.2),
    inset 0 0 46px rgba(0, 0, 0, 0.22);
}

/* o'rinlar */
.seat-top { position: relative; isolation: isolate; }
.seat-ring {
  position: relative;
  padding: 2px;
  border-radius: 50%;
  background: linear-gradient(150deg, #ffeab0 0%, #c99a3c 55%, #7a5716 100%);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
.seat-fan { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: -1; }
.seat-fan i {
  position: absolute; left: -11px; top: -35px;
  width: 22px; height: 32px;
  border: 1.5px solid #fff;
  border-radius: 4px;
  background: repeating-linear-gradient(45deg, #c23a42 0 2px, #8a2129 2px 4px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transform-origin: 50% 118%;
  transform: rotate(var(--a));
}
.seat-name {
  position: relative; z-index: 1;
  max-width: 88px;
  margin-top: -5px;
  padding: 1px 8px;
  overflow: hidden;
  font-size: 11.5px; font-weight: 700; line-height: 1.35;
  text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid rgba(217, 178, 90, 0.5);
  border-radius: 999px;
  background: rgba(var(--felt-ink), 0.92);
}
.seat-count {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 2px; padding: 0 7px;
  font-size: 11.5px; font-weight: 800; line-height: 17px;
  border-radius: 999px;
  background: rgba(var(--felt-ink), 0.62);
}
.seat-count i { width: 8px; height: 11px; border-radius: 2px; background: #fffdf6; box-shadow: 1px -1px 0 rgba(255, 253, 246, 0.45); }
.felt-table .opp-badge { min-height: 0; margin-top: 1px; font-size: 10.5px; line-height: 1.2; color: #e8f3ea; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.felt-table .opp {
  position: absolute; left: var(--x); top: var(--y); z-index: 3;
  width: 74px; padding: 0; gap: 0;
  transform: translateX(-50%);
  background: none; border: 0;
}
.felt-table .opp .avatar { --size: 48px; }
.felt-table .acting .seat-ring {
  background: linear-gradient(150deg, #fff3c9 0%, #f4c24f 60%, #c8912a 100%);
  box-shadow: 0 0 0 2px rgba(244, 194, 79, 0.42), 0 0 20px 4px rgba(244, 194, 79, 0.75);
}
.felt-table .opp.acting::before, .me-seat.acting::before {
  content: "▼";
  position: absolute; left: 50%; top: -13px; z-index: 2;
  font-size: 11px; line-height: 1; color: var(--gold);
  transform: translateX(-50%);
  animation: seat-bob 1s ease-in-out infinite;
}
@keyframes seat-bob { 50% { margin-top: -3px; } }

/* stol o'rtasi */
.felt-table .board {
  position: absolute; left: 0; right: 0; top: 19%; bottom: 20%; z-index: 2;
  flex: none; min-height: 0;
  background: none; border: 0; border-radius: 0;
  pointer-events: none;
}
.felt-table .board > * { pointer-events: auto; }
.table-ring {
  position: absolute; left: 50%; top: 50%;
  width: min(66%, 270px); height: min(84%, 210px);
  border: 2px solid rgba(244, 194, 79, 0.75);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--felt-ink), 0.5), rgba(var(--felt-ink), 0.2) 70%, transparent);
  box-shadow: 0 0 22px rgba(244, 194, 79, 0.38), inset 0 0 20px rgba(244, 194, 79, 0.2), 0 0 0 7px rgba(var(--felt-ink), 0.2);
  transform: translate(-50%, -50%);
  pointer-events: none !important;
}
.felt-table .pairs { position: relative; padding: 0; gap: 8px 6px; }
.felt-table .pairs.n1, .felt-table .pairs.n2, .felt-table .pairs.n3 { --tw: min(16vw, 68px); --th: calc(var(--tw) * 1.42); }
.felt-table .pairs.n5, .felt-table .pairs.n6 { --tw: min(13vw, 54px); --th: calc(var(--tw) * 1.42); gap: 5px 4px; }
.felt-table .board .empty-note { position: relative; color: rgba(255, 255, 255, 0.6); }

/* koloda va chiqqan kartalar */
.felt-table .deck, .felt-table .discard { top: 66%; z-index: 2; --tw: min(11.5vw, 46px); --th: calc(var(--tw) * 1.42); }
.felt-table .deck { left: 3px; }
.felt-table .discard { right: 3px; }
.felt-table .deck .card, .felt-table .discard .card { --w: var(--tw); }
.felt-table .discard .card { width: var(--tw); height: var(--th); }

/* pastki qator: men, ko'rsatma, tugmalar */
.stage-foot {
  position: absolute; left: 0; right: 0; bottom: 2px; z-index: 4;
  display: flex; align-items: flex-end; gap: 6px;
}
.me-seat { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; width: 70px; }
.me-seat .avatar { --size: 46px; }
.felt-table .hint { flex: 1; min-width: 0; min-height: 0; padding: 0 2px 2px; font-size: 12px; line-height: 1.25; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75); }
.felt-table .actions { flex: none; flex-direction: column; gap: 6px; min-height: 0; }
.felt-table .actions .btn { min-width: 112px; min-height: 40px; padding: 7px 14px; font-size: 14px; border-radius: 999px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4); }
.felt-table .actions .btn.success { background: linear-gradient(180deg, #4fd07f, #1f9a51); border: 1px solid rgba(255, 255, 255, 0.28); }
.felt-table .actions .btn.danger { background: linear-gradient(180deg, #ef6367, #c73237); border: 1px solid rgba(255, 255, 255, 0.24); }

/* Kozel: stol o'rtasida yurishlar ro'yxati */
.felt-table .kz-plays {
  --tw: min(12.4vw, 50px);
  --th: calc(var(--tw) * 1.42);
  position: relative;
  align-items: center; gap: 4px;
  max-width: 100%; max-height: 100%; padding: 0;
}
.felt-table .kz-play { padding: 3px 7px 3px 3px; background: rgba(var(--felt-ink), 0.55); }
.felt-table .kz-play.lead { background: rgba(60, 46, 10, 0.72); }
.felt-table .kz-who { width: 56px; font-size: 10.5px; }
.felt-table .kz-count { padding: 0 8px; color: #fff; text-align: right; }

/* Sakkizlik: koloda, ustki karta va mast stol o'rtasida */
.felt-table .sk-board { gap: 12px; --tw: min(14vw, 58px); --th: calc(var(--tw) * 1.42); }
.felt-table .sk-board .deck { position: static; transform: none; top: auto; left: auto; --tw: min(11.5vw, 46px); --th: calc(var(--tw) * 1.42); }
.felt-table .sk-board .deck.can-draw .card.back { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(244, 194, 79, 0.7); }
.felt-table .sk-suit { width: 40px; height: 40px; font-size: 23px; background: rgba(var(--felt-ink), 0.82); }
.felt-table .sk-info { min-width: 40px; }
.felt-table .sk-actions { flex-wrap: nowrap; }
.felt-table .sk-actions .btn { min-width: 112px; }

/* yelpig'ich qo'l */
.hand.fan {
  position: relative; display: block; flex: none;
  min-height: 0; padding: 0; overflow: visible;
}
.hand.fan::before {
  content: "";
  position: absolute; left: -14px; right: -14px; top: 4px; height: 70px;
  pointer-events: none;
  border-top: 2px solid var(--rail);
  border-radius: 50% 50% 0 0 / 34px 34px 0 0;
  background: linear-gradient(180deg, rgba(var(--felt-ink), 0.34), transparent 70%);
  opacity: 0.9;
}
.hand.fan .card {
  position: absolute;
  rotate: var(--rot, 0deg);
  transform-origin: 50% 100%;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.42);
}
.hand.fan .card + .card { margin-left: 0; }
.hand.fan .card.dim { opacity: 1; filter: brightness(0.62) saturate(0.75); }
.hand.fan .card.playable { box-shadow: 0 0 0 2px rgba(244, 194, 79, 0.9), 0 3px 10px rgba(0, 0, 0, 0.42); }
.hand.fan .card.selected { z-index: 50; transform: translateY(-14px); box-shadow: 0 0 0 3px var(--gold), 0 0 16px rgba(244, 194, 79, 0.75); }
.hand.fan:empty { height: 0; }
.hand.fan:empty::before { display: none; }

/* navbat va vaqt */
.turn-pill {
  position: relative; flex: none; align-self: center;
  width: min(74%, 310px); height: 36px;
  overflow: hidden;
  border: 1.5px solid var(--rail);
  border-radius: 999px;
  background: rgba(var(--felt-ink), 0.92);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}
.turn-pill .timer-fill { background: rgba(244, 194, 79, 0.28); }
.turn-pill .timer-fill.low { background: rgba(229, 72, 77, 0.55); }
.turn-pill span { position: relative; display: block; padding: 0 12px; overflow: hidden; font-size: 13px; font-weight: 700; line-height: 33px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.turn-pill span::before { content: "⏳ "; }
.turn-pill.mine { box-shadow: 0 0 16px rgba(244, 194, 79, 0.65); }
.turn-pill.mine span { color: var(--gold); }

@media (max-height: 700px) {
  #table.felt-table { --tw: min(12.6vw, 50px); padding-top: 6px; }
  .felt-table .opp .avatar { --size: 40px; }
  .me-seat .avatar { --size: 38px; }
  .felt-table .pairs.n1, .felt-table .pairs.n2, .felt-table .pairs.n3 { --tw: min(13.6vw, 54px); }
  .felt-table .pairs.n5, .felt-table .pairs.n6 { --tw: min(11vw, 42px); }
  .seat-fan i { top: -30px; width: 18px; height: 26px; left: -9px; }
  .felt-table .opp-badge { font-size: 10px; }
  .felt-table .actions .btn { min-height: 36px; padding: 5px 12px; font-size: 13px; }
  .turn-pill { height: 30px; }
  .turn-pill span { line-height: 27px; font-size: 12px; }
}

@media (max-height: 600px) {
  /* Juda past ekran: rol matni o'rniga kartalar soni yonida belgi */
  .felt-table .opp .opp-badge { display: none; }
  .felt-table .opp.attacker .seat-count::after { content: "⚔️"; }
  .felt-table .opp.defender .seat-count::after { content: "🛡"; }
}

/* ------------------------------------------------------------ yakka o'yin */

#solo { max-width: 460px; }
.jf-loading { display: grid; place-items: center; min-height: 60vh; }
.jf-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.jf-icon {
  flex: none; display: grid; place-items: center;
  width: 58px; height: 58px; overflow: hidden;
  font-size: 32px;
  border: 1.5px solid rgba(139, 92, 246, 0.7); border-radius: 16px;
  background: rgba(20, 14, 50, 0.8);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.4);
}
.jf-icon img { width: 100%; height: 100%; object-fit: cover; }
.jf-title { flex: 1; min-width: 0; }
.jf-title h1 { font-size: 26px; font-weight: 800; }
.jf-title p { margin: 2px 0 0; }
.jf-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.jf-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px; border-radius: 16px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  background: rgba(20, 14, 50, 0.75);
}
.jf-stat span { font-size: 12px; color: var(--muted); }
.jf-stat b { font-size: 24px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }

.jf-board {
  --gap: 10px; --cell: 70px;
  position: relative;
  width: 100%; aspect-ratio: 1;
  touch-action: none; user-select: none;
  border-radius: 18px;
  background: #1a1440;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.35), 0 12px 30px -12px rgba(0, 0, 0, 0.7);
}
.jf-grid {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); padding: var(--gap);
}
.jf-grid i { border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.jf-tiles { position: absolute; inset: 0; }
.jf-tile {
  position: absolute; left: var(--gap); top: var(--gap);
  display: grid; place-items: center;
  width: var(--cell); height: var(--cell);
  border-radius: 12px;
  font-weight: 800; font-size: calc(var(--cell) * 0.42); line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--t, #6b5cff);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 4px 10px -4px var(--t, #6b5cff);
  transform: translate(calc(var(--c) * (var(--cell) + var(--gap))), calc(var(--r) * (var(--cell) + var(--gap))));
  transition: transform 0.11s ease-in-out;
}
.jf-tile[data-len="3"] { font-size: calc(var(--cell) * 0.34); }
.jf-tile[data-len="4"] { font-size: calc(var(--cell) * 0.27); }
.jf-tile[data-len="5"] { font-size: calc(var(--cell) * 0.22); }
.jf-tile.dying { z-index: 0; }
.jf-tile.new { animation: jf-appear 0.16s 0.1s both; }
.jf-tile.merged { z-index: 2; animation: jf-pop 0.2s 0.09s both; }
@keyframes jf-appear { from { scale: 0.2; opacity: 0; } }
@keyframes jf-pop { 0% { scale: 0.6; } 55% { scale: 1.14; } 100% { scale: 1; } }
/* O'z ranglarimiz: sovuq ranglardan iliqqa, eng kattalari oltin va yashil */
.jf-tile.v2 { --t: #e7e9fb; color: #2a2560; }
.jf-tile.v4 { --t: #cfd4f7; color: #2a2560; }
.jf-tile.v8 { --t: #7ccaf7; }
.jf-tile.v16 { --t: #45a8f2; }
.jf-tile.v32 { --t: #3f7bf0; }
.jf-tile.v64 { --t: #5c5cf0; }
.jf-tile.v128 { --t: #8a52ec; }
.jf-tile.v256 { --t: #b44de0; }
.jf-tile.v512 { --t: #e04ab0; }
.jf-tile.v1024 { --t: #f0587a; }
.jf-tile.v2048 { --t: #f5b82e; box-shadow: 0 0 22px rgba(245, 184, 46, 0.75); }
.jf-tile.v4096, .jf-tile.v8192 { --t: #22c08a; box-shadow: 0 0 22px rgba(34, 192, 138, 0.7); }
.jf-over {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border-radius: 18px;
  text-align: center;
  background: rgba(13, 10, 38, 0.82);
  animation: fade 0.3s ease-out;
}
.jf-over h2 { margin: 0; font-size: 24px; }
.jf-over p { margin: 0 0 6px; color: var(--muted); }
.jf-over b { color: var(--ink); font-size: 18px; }
.jf-actions { margin: 14px 0; }
.jf-group h2 { font-size: 15px; }
.jf-group ol { margin: 0; padding: 0; list-style: none; }
.jf-group li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.jf-group li:last-child { border-bottom: 0; }
.jf-group li span { width: 26px; text-align: center; }
.jf-group li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jf-group li em { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }
.jf-group li.me { color: var(--gold); }

/* Ilon */
.il-board { overflow: hidden; }
.il-board canvas { display: block; width: 100%; height: 100%; border-radius: 18px; }
.il-pad {
  display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(2, 52px);
  gap: 8px; justify-content: center; margin-top: 14px;
  touch-action: none;
}
.il-pad .btn { min-height: 0; padding: 0; font-size: 20px; border-radius: 16px; background: rgba(47, 191, 95, 0.16); border: 1px solid rgba(47, 191, 95, 0.4); }
.il-pad .btn:active { background: rgba(47, 191, 95, 0.4); }
.il-up { grid-column: 2; grid-row: 1; }
.il-left { grid-column: 1; grid-row: 2; }
.il-down { grid-column: 2; grid-row: 2; }
.il-right { grid-column: 3; grid-row: 2; }
.jf-over .btn.success { background: linear-gradient(180deg, #4fd07f, #1f9a51); color: #fff; }

/* Sapyor: o'z ranglarimiz — ko'k yopiq kataklar, to'q fonda yorqin raqamlar */
.sp-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sp-mines {
  padding: 7px 12px; border-radius: 12px;
  font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums;
  border: 1px solid rgba(139, 92, 246, 0.3); background: rgba(20, 14, 50, 0.75);
}
.sp-mode button { padding: 8px 12px; font-size: 14px; }
.sp-board {
  aspect-ratio: auto; padding: 6px;
  touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none;
  background: #0d1842;
  box-shadow: inset 0 0 0 1px rgba(47, 124, 246, 0.45), 0 12px 30px -12px rgba(0, 0, 0, 0.7);
}
.sp-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px; }
.sp-grid i {
  display: grid; place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  font-style: normal; font-weight: 800; line-height: 1;
  font-size: clamp(15px, 5vw, 22px);
  cursor: pointer;
}
.sp-grid i.c {
  background: linear-gradient(180deg, #4f7ff8 0%, #3461e2 100%);
  box-shadow: inset 0 -3px 0 rgba(6, 18, 70, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.sp-grid i.c:active { filter: brightness(1.2); }
.sp-grid i.f { font-size: clamp(13px, 4.2vw, 19px); }
.sp-grid i.p { animation: sp-wait 0.45s ease-in-out infinite alternate; }
@keyframes sp-wait { to { filter: brightness(1.5); } }
.sp-grid i.bad { background: linear-gradient(180deg, #6b7090, #4e526e); }
.sp-grid i.o { cursor: default; background: rgba(255, 255, 255, 0.055); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04); }
.sp-grid i.n1 { color: #6cb4ff; }
.sp-grid i.n2 { color: #4fd08a; }
.sp-grid i.n3 { color: #ff6b6b; }
.sp-grid i.n4 { color: #b48cff; }
.sp-grid i.n5 { color: #ffb347; }
.sp-grid i.n6 { color: #3fd6cf; }
.sp-grid i.n7 { color: #ff8ad4; }
.sp-grid i.n8 { color: #e4e8ff; }
.sp-grid i.m { font-size: clamp(13px, 4.2vw, 19px); background: rgba(229, 72, 77, 0.2); }
.sp-grid i.boom { background: #e5484d; box-shadow: 0 0 14px rgba(229, 72, 77, 0.85); }
/* Topqir: o'z ranglarimiz — binafsha (o'z joyida), to'q sariq (bor), to'q (yo'q) */
.tq-label { margin: 0 0 8px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.tq-grid { display: grid; gap: 6px; width: min(100%, 300px); margin: 0 auto; }
.tq-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tq-t {
  --empty: rgba(20, 14, 50, 0.6);
  --bg: var(--empty);
  display: grid; place-items: center;
  aspect-ratio: 1;
  border: 2px solid rgba(139, 92, 246, 0.28); border-radius: 10px;
  font-style: normal; font-weight: 800; line-height: 1;
  font-size: clamp(17px, 5.6vw, 24px);
  background: var(--empty);
}
.tq-t.on { border-color: rgba(196, 170, 255, 0.8); animation: tq-pop 0.12s ease-out; }
.tq-t.c { --bg: #8b5cf6; }
.tq-t.p { --bg: #f0883e; }
.tq-t.x { --bg: #2c2752; }
.tq-t.c, .tq-t.p, .tq-t.x { color: #fff; border-color: transparent; background: var(--bg); }
.tq-t.flip { animation: tq-flip 0.5s var(--d, 0s) ease-in-out both; }
@keyframes tq-flip {
  0% { transform: rotateX(0); background: var(--empty); border-color: rgba(196, 170, 255, 0.8); }
  50% { transform: rotateX(90deg); background: var(--empty); border-color: rgba(196, 170, 255, 0.8); }
  51% { background: var(--bg); border-color: transparent; }
  100% { transform: rotateX(0); background: var(--bg); border-color: transparent; }
}
@keyframes tq-pop { 50% { transform: scale(1.08); } }
.tq-row.shake { animation: tq-shake 0.4s; }
@keyframes tq-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.tq-row.wait .tq-t { animation: sp-wait 0.45s ease-in-out infinite alternate; }
.tq-kb { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; user-select: none; -webkit-user-select: none; }
.tq-kr { display: flex; gap: 4px; }
.tq-k {
  flex: 1; min-width: 0; height: 46px; padding: 0;
  border: 0; border-radius: 9px;
  font-weight: 700; font-size: 15px; color: var(--ink);
  background: rgba(139, 92, 246, 0.24);
  cursor: pointer; touch-action: manipulation;
}
.tq-k.wide { flex: 1.5; font-size: 12px; }
.tq-k.c { background: #8b5cf6; color: #fff; }
.tq-k.p { background: #f0883e; color: #fff; }
.tq-k.x { background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.32); }
.tq-k:active { filter: brightness(1.3); }
.tq-result {
  margin-top: 14px; padding: 16px;
  text-align: center;
  border: 1px solid rgba(139, 92, 246, 0.4); border-radius: 18px;
  background: rgba(20, 14, 50, 0.75);
  animation: fade 0.3s ease-out;
}
.tq-result h2 { margin: 0 0 4px; font-size: 22px; }
.tq-result p { margin: 0 0 8px; }
.tq-result .row { justify-content: center; }
.jf-group li small { margin-left: auto; white-space: nowrap; }

/* natija taxtani yopmaydi — portlagan minani ko'rish mumkin */
.sp-over {
  inset: auto 10px 10px;
  padding: 16px 14px;
  border: 1px solid rgba(139, 92, 246, 0.45);
  background: rgba(13, 10, 38, 0.94);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
}

/* ------------------------------------------------------------ overlay/UI */

/* Emoji-stikerlar */
.react-pop {
  position: fixed; z-index: 40; right: 10px; top: calc(56px + var(--tg-content-safe-area-inset-top, 0px));
  display: grid; grid-template-columns: repeat(6, 44px); gap: 4px; padding: 8px;
  background: #10301f; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); animation: fade 0.12s ease-out;
}
.react-pop button { width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; font-size: 26px; cursor: pointer; }
.react-pop button:active { background: rgba(255, 255, 255, 0.12); transform: scale(0.92); }
.reaction {
  position: fixed; z-index: 35; pointer-events: none;
  font-size: 24px; line-height: 1; padding: 5px 6px; border-radius: 14px;
  background: rgba(255, 253, 246, 0.96); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.reaction.up { animation: react-up 2.6s ease forwards; }
.reaction.down { animation: react-down 2.6s ease forwards; }
@keyframes react-up {
  0% { transform: translate(-50%, -100%) scale(0.3); opacity: 0; }
  12% { transform: translate(-50%, -100%) scale(1.15); opacity: 1; }
  22% { transform: translate(-50%, -100%) scale(1); }
  80% { transform: translate(-50%, calc(-100% - 10px)); opacity: 1; }
  100% { transform: translate(-50%, calc(-100% - 26px)); opacity: 0; }
}
@keyframes react-down {
  0% { transform: translate(-50%, 0) scale(0.3); opacity: 0; }
  12% { transform: translate(-50%, 0) scale(1.15); opacity: 1; }
  22% { transform: translate(-50%, 0) scale(1); }
  80% { transform: translate(-50%, 10px); opacity: 1; }
  100% { transform: translate(-50%, 22px); opacity: 0; }
}

/* Uchib yuruvchi kartalar qatlami (animatsiyalar) */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
#fx .card { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4); }

#toasts {
  position: fixed; left: 50%; top: 34%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  z-index: 50; pointer-events: none; width: calc(100% - 32px); max-width: 420px;
}
.toast {
  background: rgba(10, 20, 14, 0.92); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.2s ease-out;
  text-align: center;
}
.toast.error { border-color: rgba(229, 72, 77, 0.8); }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }

#conn {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--red); color: #fff; text-align: center; font-size: 13px; font-weight: 600;
  padding: 6px 10px calc(6px + var(--safe-bottom));
}

#audio-unlock {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%); z-index: 45;
}

.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: #10301f; border-top-left-radius: 22px; border-top-right-radius: 22px;
  border: 1px solid var(--line); border-bottom: 0;
  padding: 18px 16px calc(18px + var(--safe-bottom));
  -webkit-user-select: text; user-select: text;
}
html:not([data-screen="lobby"]):not([data-screen="table"]) .sheet { background: #17103a; }
.sheet .stack { margin-bottom: 0; }
.rules { font-size: 14px; line-height: 1.5; }
.terms-card {
  max-width: 560px; margin: 8px auto 0; padding: 18px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
}
.terms-text { line-height: 1.55; }
.terms-text > b:first-of-type { font-size: 20px; }
.result { text-align: center; }
.result-emoji { font-size: 64px; line-height: 1.1; }
.result h2 { font-size: 22px; margin: 6px 0 12px; }
.places { list-style: none; padding: 0; margin: 0 0 12px; text-align: left; }
.places li { padding: 8px 12px; border-radius: 12px; background: var(--panel); margin-bottom: 6px; font-weight: 600; }

/* -------------------------------------------------------------- sakkizlik */

.sk-board { gap: 20px; min-height: calc(var(--th) * 1.3 + 24px); }
.sk-board .deck {
  position: static;
  transform: none;
  padding: 0;
  cursor: default;
  border: 0;
  background: none;
}
.sk-board .deck.can-draw { cursor: pointer; }
.sk-board .deck.can-draw .card.back { box-shadow: 0 0 0 2px rgba(244, 194, 79, 0.85), 0 4px 10px rgba(0, 0, 0, 0.35); }
.sk-pile { position: relative; width: calc(var(--tw) * 1.25); height: calc(var(--th) * 1.25); }
.sk-pile .card { --w: calc(var(--tw) * 1.25); position: absolute; inset: 0; width: 100%; height: 100%; cursor: default; }
.sk-pile .card.under { transform: rotate(-9deg); filter: brightness(0.82); }
.sk-pile .card.top { transform: rotate(3deg); }
.sk-info { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 46px; }
.sk-suit {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  font-size: 26px; line-height: 1;
  border: 2px solid var(--gold); border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
}
.sk-suit.red { color: #ff6b6f; }
.sk-dir { font-size: 24px; line-height: 1; color: var(--muted); }
.sk-dir.back { display: inline-block; transform: scaleX(-1); }
.sk-penalty {
  padding: 1px 8px;
  font-size: 13px; font-weight: 800;
  border-radius: 999px;
  background: var(--red); color: #fff;
}
.sk-actions { flex-wrap: wrap; }
.sk-actions .btn { min-width: 100px; }
.sk-alert { animation: sk-alert 0.7s ease-in-out infinite alternate; }
@keyframes sk-alert { to { transform: scale(1.06); } }
.opp.gone { opacity: 0.5; }
.sk-suits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.sk-suit-btn {
  aspect-ratio: 1;
  font-size: 34px; line-height: 1;
  cursor: pointer;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); color: var(--card-black);
}
.sk-suit-btn.red { color: var(--card-red); }
.sk-suit-btn:active { transform: scale(0.94); }

/* ------------------------------------------------------------------ mafia */

body[data-mf="intro"], body[data-mf="vote"], body[data-mf="last_word"] {
  background: radial-gradient(120% 90% at 50% 30%, #5a1f2e 0%, #220c14 75%) fixed;
}
body[data-mf="night"] { background: radial-gradient(120% 90% at 50% 15%, #232b5e 0%, #0a0f24 75%) fixed; }
body[data-mf="day"] { background: radial-gradient(120% 90% at 50% 15%, #3a6f8f 0%, #12303f 75%) fixed; }

.mf-banner { flex: none; padding: 4px 8px; text-align: center; }
.mf-banner h2 { margin: 0; font-size: 20px; }
.mf-banner p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.mf-banner p.mine { color: var(--gold); font-weight: 600; }
.mf-tabs { flex: none; display: flex; justify-content: center; }

.mf-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  align-content: start;
  gap: 6px;
  padding: 3px;
  overflow-y: auto;
}
.mf-tile {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 6px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.mf-tile .avatar { --size: 46px; }
button.mf-tile { cursor: pointer; }
button.mf-tile:active { transform: scale(0.96); }
.mf-tile.target { border-color: rgba(244, 194, 79, 0.6); }
.mf-tile.chosen { border-color: var(--gold); background: rgba(244, 194, 79, 0.18); box-shadow: 0 0 0 2px var(--gold); }
.mf-tile.ally { border-color: rgba(229, 72, 77, 0.65); }
.mf-tile.dead { opacity: 0.6; }
.mf-tile.dead .avatar { filter: grayscale(1); }
.mf-tile.dead::before { content: "💀"; position: absolute; top: 5px; left: 7px; font-size: 13px; }
.mf-tile.condemned { opacity: 1; border-color: var(--gold); }
.mf-name, .mf-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-name { font-size: 13px; font-weight: 600; }
.mf-sub { min-height: 15px; font-size: 11px; line-height: 15px; color: var(--muted); }
.mf-count {
  position: absolute; top: 4px; right: 4px; z-index: 1;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px;
  font-size: 12px; line-height: 20px;
  background: var(--red); color: #fff;
}
.mf-actions:empty { min-height: 0; }
.mf-me {
  flex: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 36px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel);
}
.mf-card {
  flex: 1;
  min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 20px 16px;
  overflow-y: auto;
  text-align: center;
  border: 1px solid var(--line); border-radius: 22px;
  background: var(--panel);
}
.mf-card.evil { border-color: rgba(229, 72, 77, 0.7); }
.mf-card-icon { font-size: 84px; line-height: 1.1; }
.mf-card h1 { font-size: 28px; }
.mf-card p { margin: 6px 0 0; }
.mf-allies { color: var(--gold); }
.sheet .mf-card { flex: none; }

/* ------------------------------------------------------------------ panoh */

.pn-top { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pn-scen {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 4px 10px;
  text-align: left; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel);
}
.pn-scen b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-seg { flex: none; }
.lang-seg button { padding: 6px 8px; font-size: 12px; }
.pn-sheet-head { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.pn-needs { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.pn-need { padding: 3px 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.pn-need.ok { border-color: var(--green); }
.pn-need.miss { border-color: var(--red); }
.pn-list { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 3px; overflow-y: auto; }
.pn-scroll { flex: 1; min-height: 0; padding: 2px; overflow-y: auto; }
.pn-row {
  position: relative;
  flex: none;
  display: block;
  width: 100%;
  padding: 7px 10px;
  text-align: left;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel);
}
button.pn-row { cursor: pointer; }
button.pn-row:active { transform: scale(0.98); }
.pn-row.target { border-color: rgba(244, 194, 79, 0.6); }
.pn-row.chosen { border-color: var(--gold); background: rgba(244, 194, 79, 0.18); box-shadow: 0 0 0 2px var(--gold); }
.pn-row.gone { opacity: 0.6; }
.pn-row.gone .avatar { filter: grayscale(1); }
.pn-row.condemned { opacity: 1; border-color: var(--gold); }
.pn-row-head { display: flex; align-items: center; gap: 8px; }
.pn-row-head .avatar { --size: 34px; flex: none; }
.pn-row-name { flex: 1; min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.pn-row-note { flex: none; padding-right: 22px; font-size: 12px; color: var(--muted); }
.pn-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pn-chip { padding: 2px 7px; font-size: 12px; line-height: 1.4; border-radius: 8px; background: rgba(255, 255, 255, 0.09); }
.pn-fx { margin-left: 4px; font-size: 11px; font-style: normal; color: #9fe0b8; white-space: nowrap; }
.pn-fx.bad { color: #ff9a9d; }
.pn-cards { display: flex; flex-direction: column; gap: 6px; }
.pn-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 9px 12px;
  text-align: left;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel);
}
button.pn-card { cursor: pointer; border-color: rgba(244, 194, 79, 0.6); }
button.pn-card:active { transform: scale(0.98); }
.pn-card small { display: block; font-size: 12px; color: var(--muted); }
.pn-card b { font-size: 15px; }
.pn-card em { position: absolute; top: 8px; right: 10px; font-size: 11px; font-style: normal; color: var(--gold); }
.pn-card.open { border-color: rgba(244, 194, 79, 0.45); }
.pn-scenario b { font-size: 18px; }
.pn-scenario p { margin: 4px 0 0; color: var(--muted); }
.pn-heading { margin: 14px 0 8px; font-size: 13px; color: var(--muted); }
.result .pn-heading { margin: 14px 0 6px; font-size: 13px; text-align: left; }

@media (max-height: 640px) {
  :root { --cw: min(15vw, 60px); --tw: min(12vw, 50px); }
  .opp .avatar { --size: 36px; }
  .hand { padding-top: 16px; }
}

/* ------------------------------------------------- taxta o'yinlari (Shaxmat, Shashka) */
.bg-wrap { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 520px; margin: 0 auto; padding: 2px 0 12px; }
.bg-player {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 14px;
  background: rgba(20, 14, 50, 0.6); border: 1px solid rgba(139, 92, 246, 0.25);
}
.bg-player.running { border-color: rgba(245, 184, 46, 0.75); box-shadow: 0 0 14px -4px rgba(245, 184, 46, 0.6); }
.bg-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bg-who > b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-taken { display: flex; align-items: center; min-height: 18px; }
.bg-taken .pc { width: 17px; height: 17px; margin-right: -5px; }
.bg-taken .ck { width: 15px; height: 15px; margin-right: 4px; }
.bg-taken .ck::before { display: none; }
.bg-taken b { margin-left: 8px; font-size: 12px; color: var(--muted); }
.bg-clock {
  min-width: 66px; padding: 4px 10px; border-radius: 10px;
  font-size: 20px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.35); color: rgba(255, 255, 255, 0.55);
}
.bg-clock.on { background: #f5f1e8; color: #1d1830; }
.bg-clock.on.low { background: #e5484d; color: #fff; }

.bg-board {
  display: grid;
  /* qator va ustunlar teng: bo'sh qator donali qatordan past bo'lib qolmasin (Android WebView) */
  grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr));
  width: 100%; aspect-ratio: 1;
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 0 0 3px #3b2a1e, 0 14px 32px -10px rgba(0, 0, 0, 0.75);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.sq { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; aspect-ratio: 1; cursor: pointer; }
.sq.lt { background: #ecdcbc; }
.sq.dk { background: #a97c58; }
.sq .cf, .sq .cr { position: absolute; z-index: 2; font-style: normal; font-size: 9px; font-weight: 700; opacity: 0.8; pointer-events: none; }
.sq .cf { right: 3px; bottom: 1px; }
.sq .cr { left: 3px; top: 1px; }
.sq.lt .cf, .sq.lt .cr { color: #a97c58; }
.sq.dk .cf, .sq.dk .cr { color: #ecdcbc; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(245, 200, 66, 0.38); }
.sq.sel { box-shadow: inset 0 0 0 100px rgba(139, 92, 246, 0.5); }
.sq::after { content: ""; position: absolute; z-index: 0; pointer-events: none; }
.sq.check::after { inset: 0; background: radial-gradient(circle, rgba(255, 60, 60, 0.95) 0%, rgba(255, 60, 60, 0.55) 45%, transparent 72%); }
.sq.dot::after { width: 30%; height: 30%; border-radius: 50%; background: rgba(30, 20, 60, 0.4); }
.sq.take::after { inset: 4%; border-radius: 50%; box-shadow: inset 0 0 0 4px rgba(30, 20, 60, 0.45); }
/* dona katak o'lchamiga ta'sir qilmaydi — mutlaq joylashgan */
.sq > .pc, .sq > .ck { position: absolute; z-index: 1; }
.sq > .pc { left: 6%; top: 6%; width: 88%; height: 88%; }
.sq > .ck { left: 11%; top: 11%; width: 78%; height: 78%; }
.sq.moved > .pc, .sq.moved > .ck { animation: bg-land 0.25s ease-out; }
@keyframes bg-land { from { transform: scale(0.7); opacity: 0.4; } }
.sq.hit > .ck { opacity: 0.4; }
.sq.must > .ck { box-shadow: 0 0 0 3px #f5b82e, 0 0 14px #f5b82e; }

/* O'z chizgan shaxmat donalari */
.pc { display: block; width: 88%; height: 88%; overflow: visible; }
.pc path, .pc circle { stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.pc.w path, .pc.w circle { fill: #fbf7ee; stroke: #1d1830; }
.pc.b path, .pc.b circle { fill: #2c2742; stroke: #0b0816; }
.pc.w .pc-line, .pc.b .pc-line { fill: none; }
.pc.w .pc-line { stroke: #1d1830; }
.pc.b .pc-line { stroke: #e8e2f5; }
.pc.w .pc-in { fill: #1d1830; stroke: none; }
.pc.b .pc-in { fill: #e8e2f5; stroke: none; }
.bg-board.chess .sq .pc { filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.35)); }

/* Shashka donalari */
.ck { display: grid; place-items: center; width: 78%; height: 78%; border-radius: 50%; }
.ck.w { background: radial-gradient(circle at 35% 30%, #fffdf6, #e4dccb 60%, #c9bfa9); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 3px 6px rgba(0, 0, 0, 0.45); }
.ck.b { background: radial-gradient(circle at 35% 30%, #5d5180, #2c2742 60%, #17132a); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35), 0 3px 6px rgba(0, 0, 0, 0.5); }
.ck::before { content: ""; position: absolute; inset: 18%; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.15); }
.ck.b::before { border-color: rgba(255, 255, 255, 0.16); }
.ck { position: relative; }
.ck-crown { position: relative; width: 54%; height: 54%; fill: #f5b82e; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6)); }

.bg-actions { justify-content: center; margin: 0; }
.bg-offer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.bg-history {
  display: flex; gap: 12px; overflow-x: auto; white-space: nowrap;
  padding: 2px; font-size: 13px; color: var(--muted); scrollbar-width: none;
}
.bg-history::-webkit-scrollbar { display: none; }
.bg-history i { margin-right: 4px; font-style: normal; opacity: 0.6; }
.bg-promos { display: flex; justify-content: center; gap: 10px; margin: 16px 0; }
.bg-promo { width: 64px; height: 64px; padding: 6px; border: 0; border-radius: 14px; background: #ecdcbc; cursor: pointer; }
.bg-promo .pc { width: 100%; height: 100%; }
.bg-offer .btn { min-height: 36px; padding: 6px 16px; }
