/* ============================================================
   SafoGame — app.css
   Dark/Light tema [data-theme] orqali. Telegram temasiga moslashadi.
   ============================================================ */

:root {
  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --surface-2: #f0f2f7;
  --soft:      #f0f2f7;
  --text:      #13203a;
  --muted:     #8190a8;
  --border:    rgba(20,40,80,.08);
  --primary:   #2E6DF2;
  --primary-d: #1f54d6;
  --danger:    #E5484D;
  --success:   #2BB673;
  --header-bg: rgba(255,255,255,.85);
  --nav-bg:    rgba(255,255,255,.92);
  --radius:    16px;
  --shadow:    0 6px 24px rgba(20,30,60,.06);
  --font:      'Manrope', system-ui, -apple-system, sans-serif;
}

html[data-theme="dark"] {
  --bg:        #060b14;
  --surface:   #0d1626;
  --surface-2: rgba(80,130,255,.07);
  --soft:      rgba(80,130,255,.07);
  --text:      #ddeaff;
  --muted:     #5d7099;
  --border:    rgba(80,130,255,.12);
  --header-bg: rgba(6,11,20,.94);
  --nav-bg:    rgba(6,11,20,.98);
  --shadow:    0 6px 24px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  vertical-align: middle;
  -webkit-font-feature-settings: 'liga';
}

/* ---------- App frame (mobil) ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}
.content {
  flex: 1;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
}

/* ---------- Topbar ---------- */
/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 20px;
  background: var(--header-bg);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 5px 14px rgba(46,109,242,.4);
}
.brand-mark .material-symbols-rounded { font-size: 19px; }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: -.6px; color: var(--text); }
.brand-name b { color: var(--primary); font-weight: 800; }

.topbar-right { display: flex; align-items: center; gap: 9px; }
.icon-round {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  background: var(--soft); border: 1px solid var(--border);
  display: grid; place-items: center; cursor: pointer;
  color: var(--muted); text-decoration: none;
  transition: transform .12s ease;
}
.icon-round:active { transform: scale(.92); }
.icon-round .material-symbols-rounded { font-size: 20px; }
.icon-round .dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}
.brand-name { font-size: 18px; font-weight: 700; }
.brand-name b { color: var(--primary); }

/* ---------- Headings ---------- */
.hello h1 { margin: 6px 0 2px; font-size: 26px; font-weight: 800; }
.hello p  { margin: 0 0 18px; color: var(--muted); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
.section-head h2 { font-size: 18px; font-weight: 700; margin: 0; }

/* ---------- Stat cards ---------- */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stat-num { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.dot-online { width: 9px; height: 9px; border-radius: 50%; background: var(--success); display: inline-block; }
.stat-ico { font-size: 21px; color: var(--primary); }

/* ---------- Game list (hero kartalar) ---------- */
.game-list { display: flex; flex-direction: column; gap: 14px; }

.game-card {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 20px; min-height: 158px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: #14202e;                 /* rasm kelmasa ham qorong'i fon */
  box-shadow: var(--shadow);
  cursor: pointer; transition: transform .14s ease;
}
.game-card:active { transform: scale(.985); }

.game-card-bg { position: absolute; inset: 0; z-index: 0; }
.game-card-bg img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Pastdan qorong'i gradient — oq matn o'qilishi uchun */
.game-card-shade {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top,
    rgba(8,12,20,.92) 0%, rgba(8,12,20,.45) 45%, rgba(8,12,20,.12) 100%);
}

/* Rasm umuman yo'q bo'lsa — markazda katta harf */
.game-card-letter {
  position: absolute; inset: 0; z-index: 0; display: none;
  align-items: center; justify-content: center;
  font-size: 72px; font-weight: 800; color: rgba(255,255,255,.18);
}
.game-card.no-img .game-card-letter { display: flex; }

/* Onlayn pill (yuqori chap burchak) */
.game-online-pill {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(8,12,20,.5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
}
.game-online-pill b { font-weight: 800; }
.game-online-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 3px rgba(43,182,115,.28);
}

/* Pastki kontent: sarlavha + rollar (chapda), O'ynash tugmasi (o'ngda) */
.game-card-body {
  position: relative; z-index: 2; padding: 16px;
}
.game-card-row { display: flex; align-items: center; gap: 12px; }
.game-card-title {
  flex: 1; min-width: 0;
  color: #fff; font-size: 23px; font-weight: 800; line-height: 1.1; letter-spacing: -.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-card-roles {
  color: rgba(255,255,255,.78); font-size: 12.5px; font-weight: 600; margin-top: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-play-btn {
  flex: none; padding: 0 20px; height: 40px; border-radius: 12px; font-size: 14.5px;
  box-shadow: 0 6px 16px rgba(46,109,242,.4);
}

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 20px; font-size: 14px; font-weight: 600;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Rank ---------- */
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: 14px; padding: 12px 14px;
  box-shadow: var(--shadow);
}
.rank-pos { width: 26px; text-align: center; font-weight: 800; color: var(--muted); }
.rank-1 { color: #e8a800; } .rank-2 { color: #9aa6bd; } .rank-3 { color: #c77b3d; }
.rank-ava {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface-2); color: var(--primary);
  display: grid; place-items: center; font-weight: 700;
}
.rank-name { flex: 1; font-weight: 600; }
.rank-score { font-weight: 800; color: var(--primary); }

/* ---------- Join box / rooms ---------- */
.join-box { display: flex; gap: 8px; }
.input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; color: var(--text);
  font-family: var(--font);
}
.input:focus { outline: none; border-color: var(--primary); }
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room-row {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text);
  background: var(--surface); border-radius: 14px; padding: 14px; box-shadow: var(--shadow);
}
.room-main { flex: 1; min-width: 0; }
.room-title { font-weight: 700; }
.room-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.room-count { font-weight: 800; color: var(--primary); }

/* ---------- Profile ---------- */
.profile-head { text-align: center; padding: 18px 0 8px; }
.profile-ava {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px; display: block;
}
.profile-ava-letter { background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 34px; font-weight: 800; }
.profile-name { font-size: 20px; font-weight: 800; }
.profile-user { color: var(--muted); }
.stat-list { display: flex; flex-direction: column; gap: 8px; }
.stat-line {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-radius: 14px; padding: 14px; box-shadow: var(--shadow);
}
.stat-line-name { font-weight: 700; }
.stat-line-vals { text-align: right; font-size: 13px; color: var(--muted); }
.stat-line-score { display: block; color: var(--primary); font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; -webkit-appearance: none; margin: 0;
  border: none; border-radius: 12px; padding: 12px 18px; font-size: 15px; font-weight: 700;
  font-family: var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-d); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: sticky; bottom: 0; z-index: 8;
  /* .app allaqachon 480px va markazda — tab-bar uni TO'LIQ egallashi kerak.
     Avval bu yerda margin:0 auto bor edi: flex ichida u tab-barni kontent
     eniga qisqartirib markazga yig'ardi (shuning uchun kichik ko'rinardi). */
  width: 100%;
  display: grid; grid-template-columns: repeat(3, 1fr);
  align-items: stretch; padding: 0 8px;
  /* Tugmalar qatori 60px bo'lib qoladi, iPhone'dagi pastki "home indicator"
     uchun esa qo'shimcha joy ajratiladi — shunda "Do'stlar" matni kesilmaydi. */
  min-height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.tab {
  /* <button> bo'lgani uchun standart tugma ko'rinishini tozalaymiz */
  appearance: none; -webkit-appearance: none;
  background: none; border: 0; margin: 0; width: 100%;
  font-family: var(--font); cursor: pointer; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding-top: 6px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700;
}
.tab .material-symbols-rounded { font-size: 25px; }
.tab.active { color: var(--primary); }

/* ---------- Empty ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* ---------- Auth screen ---------- */
.auth-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px;
}
.auth-logo { width: 64px; height: 64px; border-radius: 18px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 26px; }
.auth-title { font-size: 24px; font-weight: 800; }
.auth-msg { color: var(--muted); }

/* ---------- Room page ---------- */
.room-page { padding: 0 0 16px; }
.room-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  padding-top: calc(10px + var(--tg-ctop, 0px));
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.icon-btn { appearance: none; -webkit-appearance: none; border: 0; font: inherit; cursor: pointer; color: var(--text); text-decoration: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); }
.room-bar .icon-btn { width: 34px; height: 34px; }
.room-bar .icon-btn .material-symbols-rounded { font-size: 20px; }
.room-bar-title { flex: 1; min-width: 0; }
.room-bar-name { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-bar-sub { color: var(--muted); font-size: 11px; }
.room-bar-count { font-weight: 800; font-size: 13px; color: var(--primary); background: var(--surface-2); padding: 4px 10px; border-radius: 16px; }
.room-view { padding: 14px; }
/* Xona qobig'i: bu o'ramlar layout'da ko'rinmaydi — ichidagilar to'g'ridan-to'g'ri
   .room-view bolasi kabi joylashadi (margin'lar o'zgarmaydi). #roomChatWrap chatni
   qat'iy joyda ushlab turadi — u hech qachon ko'chmaydi (mobil klaviatura yopilmaydi). */
#roomTop, #roomBottom, #roomChatWrap { display: contents; }
.room-loading, .room-missing { text-align: center; color: var(--muted); padding: 48px 16px; }
.room-missing .material-symbols-rounded { font-size: 54px; display: block; margin-bottom: 12px; }
.room-missing p { margin-bottom: 16px; }

/* ---------- Lobby (app.js to'ldiradi) ---------- */
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.code-box .room-sub { font-size: 11px; margin-top: 0; }
.code-box .btn { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.code-val { font-size: 16px; font-weight: 800; letter-spacing: 1px; }
/* Lobby o'yinchi avatari: asl Telegram profil rasmi (bo'lmasa rangli harf) */
.player-ava-img { position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover; }
.players-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.player {
  width: 64px; text-align: center;
}
.player-ava {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 4px;
  display: grid; place-items: center; font-weight: 800; font-size: 22px; color: #fff; position: relative;
}
.player-ava.ready::after {
  content: 'check'; font-family: 'Material Symbols Rounded'; font-size: 16px;
  position: absolute; right: -2px; bottom: -2px; background: var(--success); color: #fff;
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
}
.player-name { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player.is-owner .player-name::before { content: '★ '; color: #e8a800; }

/* ---------- Chat ---------- */
.chat { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.chat-head { padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--border); }
.chat-body { max-height: 220px; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { font-size: 14px; }
.chat-msg .who { font-weight: 700; }
.chat-msg.sys { color: var(--muted); text-align: center; font-size: 13px; }
.chat-input { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.chat-input .input { padding: 10px 14px; flex: 1; min-width: 0; border-radius: 22px; }
/* Telegram uslubidagi yuborish ikonkasi (dumaloq, faqat ikonka) */
.chat-send {
  flex: none; width: 40px; height: 40px; padding: 0; border: none; cursor: pointer;
  border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center;
  transition: transform .12s ease, background .15s ease, opacity .15s ease;
}
.chat-send:active { transform: scale(.9); }
.chat-send:hover { background: var(--primary-d); }
.chat-send .material-symbols-rounded { font-size: 21px; transform: translateX(1px); }

/* ---------- Lobby actions ---------- */
.lobby-actions { display: flex; gap: 10px; margin-top: 14px; }
.lobby-actions .btn { flex: 1; padding: 10px 14px; font-size: 14px; }

/* ---------- Game phases ---------- */
.phase-banner { text-align: center; padding: 18px; border-radius: 14px; margin-bottom: 14px; font-weight: 700; }
.phase-night { background: #1f2638; color: #cdd6ee; }
.phase-day   { background: #fff4d6; color: #7a5b00; }
.phase-timer { font-size: 30px; font-weight: 800; }
.role-card { text-align: center; padding: 24px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); margin-bottom: 14px; }
.role-name { font-size: 24px; font-weight: 800; margin-top: 6px; }
.vote-list { display: flex; flex-direction: column; gap: 8px; }
.vote-row { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); border: 2px solid transparent; transition: border-color .15s ease, background .15s ease; cursor: pointer; }
.vote-row.dead { opacity: .45; }
.vote-row.chosen { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.vote-row.chosen .material-symbols-rounded { color: var(--primary); }
.vote-row.vote-skip { color: var(--muted); font-weight: 600; }
.vote-row.vote-skip.chosen { color: var(--text); }
.action-note { display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 10px; font-size: 13.5px; font-weight: 700; color: var(--success); }
.action-note.muted { color: var(--muted); font-weight: 600; }
.action-note .material-symbols-rounded { font-size: 18px; }
.gameover { text-align: center; padding: 40px 16px; }
.gameover h2 { font-size: 26px; }

/* Chat: voqealar (faqat o'qish) va mafiya kanali */
.chat.events .chat-body { max-height: 150px; }
.chat-mafia { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.chat-mafia .chat-head { color: var(--danger); }
.chat-msg.mafia .who { color: var(--danger); }
.chat-locked { display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13.5px; font-weight: 600; }
.chat-locked .material-symbols-rounded { font-size: 18px; }

/* ---------- Modal (xona yaratish) ---------- */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal {
  background: var(--surface); width: 100%; max-width: 480px;
  border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
.modal-title { font-size: 18px; font-weight: 800; }
.modal-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-row span { color: var(--muted); font-size: 14px; }
.input-sm { flex: 0 0 90px; text-align: center; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

/* ============================================================
   Do'stlar sahifasi
   ============================================================ */
.page-title { font-size: 25px; font-weight: 800; letter-spacing: -.5px; margin: 4px 0 16px; }
.list-label {
  font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; margin: 22px 0 10px;
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow);
}

/* Taklif hero */
.friends-hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 20px; color: #fff;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 76%, #0a1f4d));
  box-shadow: 0 14px 30px rgba(46,109,242,.3);
}
.hero-glyph { position: absolute; right: -14px; top: -18px; font-size: 120px; color: rgba(255,255,255,.09); line-height: 1; }
.hero-title { font-size: 18px; font-weight: 800; position: relative; }
.hero-sub   { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.82); margin-top: 4px; max-width: 250px; position: relative; }
.invite-link {
  display: flex; align-items: center; gap: 8px; margin-top: 14px; cursor: pointer;
  background: rgba(255,255,255,.15); border: 1px dashed rgba(255,255,255,.4);
  border-radius: 12px; padding: 11px 14px; position: relative;
}
.invite-link .material-symbols-rounded { font-size: 18px; }
.invite-text { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-white {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  margin-top: 12px; background: #fff; color: var(--primary);
  border: none; border-radius: 12px; padding: 12px; cursor: pointer;
  font-family: var(--font); font-size: 14.5px; font-weight: 800; transition: transform .12s ease;
}
.btn-white:active { transform: scale(.98); }
.btn-white .material-symbols-rounded { font-size: 19px; }

/* Kod bilan qo'shish — yangilangan karta */
.addcode-card { margin-top: 14px; padding: 16px; }

/* Sarlavha qatori: ikonka + matn */
.addcode-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.addcode-ico {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}
.addcode-ico .material-symbols-rounded { font-size: 24px; }
.addcode-top-main { min-width: 0; }
.addcode-title { font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.2; }
.addcode-desc { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 3px; line-height: 1.35; }

.search-row { display: flex; gap: 9px; }
.search-row .input { flex: 1; min-width: 0; }
.search-row .btn { display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: 0 18px; }
.search-row .btn .material-symbols-rounded { font-size: 18px; }

/* Do'st kodi maydoni — harf/raqam yoziladi, chiziqcha avtomatik qo'yiladi */
.code-input {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.code-input::placeholder {
  text-transform: none; letter-spacing: 2px;
  font-weight: 600; color: var(--muted); opacity: .5;
}
.code-input:focus { letter-spacing: 2.5px; }

/* Qidiruv natijasi / qatorlar umumiy */
.avatar {
  position: relative; width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 17px;
  background: oklch(0.96 0.04 var(--hue, 250)); color: oklch(0.5 0.15 var(--hue, 250));
}
.avatar .st-dot, .st-dot {
  position: absolute; bottom: 1px; right: 1px; width: 11px; height: 11px;
  border-radius: 50%; border: 2px solid var(--surface);
}
.st-dot.online { background: var(--success); }
.st-dot.busy   { background: #F5B301; }

.result-row, .req-row, .friend-row { display: flex; align-items: center; gap: 12px; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-size: 15px; font-weight: 800; color: var(--text); }
.row-sub  { font-size: 12px; font-weight: 600; color: var(--muted); }
.row-sub.is-online { color: var(--success); }

.result-row { margin-top: 12px; background: var(--soft); border-radius: 14px; padding: 11px 13px; animation: sg-fade .2s ease; }
.btn-sm {
  display: inline-flex; align-items: center; gap: 5px; border: none; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 800; color: #fff;
  background: var(--primary); padding: 8px 14px; border-radius: 11px; transition: transform .12s ease;
}
.btn-sm:active { transform: scale(.95); }
.btn-sm:disabled { opacity: .5; cursor: default; }
.btn-sm .material-symbols-rounded { font-size: 16px; }
.result-note { font-size: 12px; font-weight: 700; color: var(--muted); }

/* So'rovlar */
.req-list, .friend-list { padding: 6px; }
.req-row { padding: 11px 12px; }
.icon-act { width: 36px; height: 36px; border-radius: 11px; border: none; cursor: pointer; display: grid; place-items: center; transition: transform .12s ease; }
.icon-act:active { transform: scale(.92); }
.icon-act .material-symbols-rounded { font-size: 20px; }
.icon-act.ok { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.icon-act.no { background: var(--soft); color: var(--muted); }

/* Do'stlar ro'yxati */
.friend-row { padding: 11px 12px; }
.friend-row.is-off { opacity: .6; }
.icon-del { width: 36px; height: 36px; border-radius: 11px; border: none; cursor: pointer; display: grid; place-items: center; background: transparent; color: var(--muted); transition: transform .12s ease, color .12s ease; }
.icon-del:active { transform: scale(.92); }
.icon-del:hover { color: var(--danger); }
.icon-del .material-symbols-rounded { font-size: 21px; }

.btn-danger { background: var(--danger); color: #fff; }

/* Modal (umumiy) */
.sg-modal-overlay {
  position: fixed; inset: 0; z-index: 80; display: none;
  align-items: center; justify-content: center; padding: 28px;
  background: rgba(10,20,40,.55); animation: sg-fade .2s ease;
}
.sg-modal-overlay.open { display: flex; }
.sg-modal {
  background: var(--surface); border-radius: 22px; padding: 24px 22px;
  width: 100%; max-width: 320px; box-shadow: 0 20px 50px rgba(10,20,40,.3); animation: sg-pop .25s ease;
}
.sg-modal-icon {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 16px;
  background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger);
}
.sg-modal-icon .material-symbols-rounded { font-size: 28px; }
.sg-modal-title { font-size: 19px; font-weight: 800; color: var(--text); }
.sg-modal-body { font-size: 14px; font-weight: 600; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.sg-modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.sg-modal-actions .btn { flex: 1; }

/* sg-pop/sg-fade animatsiyalari (agar app.css'da bo'lmasa) */
@keyframes sg-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes sg-pop  { 0% { transform: scale(.4); opacity: 0 } 50% { opacity: 1 } 100% { transform: scale(1); opacity: 1 } }

/* ===== Do'stlar: rasm avatar, username, nusxalash tugmasi, toast ===== */

/* Avatar ichidagi profil rasmi (xato bo'lsa JS o'chiradi -> harf ko'rinadi) */
.avatar-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
}

/* Ism ostidagi @username */
.row-user {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  opacity: .85; line-height: 1.25; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* O'z kodi uchun ajratilgan "chip": chap tomonda kod, o'ngda kichik nusxalash ikonkasi */
.code-chip {
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--primary) 7%, var(--soft));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: 14px; padding: 10px 10px 10px 14px; margin-bottom: 12px;
}
.code-chip-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.code-chip-label {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.code-chip-val {
  font-size: 19px; font-weight: 800; color: var(--primary);
  letter-spacing: 1px; line-height: 1.25; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.code-copy {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center; border: none; cursor: pointer;
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 12px rgba(46,109,242,.28);
  transition: transform .12s ease, background .15s ease;
}
.code-copy:active { transform: scale(.9); }
.code-copy.copied { background: var(--success); box-shadow: 0 4px 12px rgba(43,182,115,.3); }
.code-copy .material-symbols-rounded { font-size: 20px; }

/* Toast bildirishnomasi */
.sg-toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  background: rgba(20, 20, 25, .92); color: #fff;
  padding: 10px 16px; border-radius: 12px;
  font-size: 13px; font-weight: 700; z-index: 9999;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.sg-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Profil: menyu havolalari (qo'llab-quvvatlash, yangiliklar) ===== */
.menu-list { margin-top: 8px; display: flex; flex-direction: column; gap: 0; }
.menu-row {
  display: flex; align-items: center; gap: 13px; padding: 14px 14px;
  text-decoration: none; color: var(--text); cursor: pointer;
  border-bottom: 1px solid var(--soft); transition: background .12s ease;
}
.menu-row:last-child { border-bottom: none; }
.menu-row:active { background: var(--soft); }
.menu-ico {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; background: var(--soft); color: var(--primary);
}
.menu-ico .material-symbols-rounded { font-size: 22px; }
.menu-row .menu-main { flex: 1; min-width: 0; }
.menu-row .menu-title { font-size: 14.5px; font-weight: 800; }
.menu-row .menu-sub { font-size: 12px; font-weight: 600; color: var(--muted); }
.menu-row .menu-chev { color: var(--muted); }

/* ============================================================
   O'YIN MODALI + YARATISH MODALI (bottom-sheet)
   ============================================================ */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3, 8, 18, .55); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .18s ease;
}
.sheet-wrap.show { opacity: 1; }
.sheet {
  width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(24px); transition: transform .2s ease;
  box-shadow: 0 -16px 40px rgba(0, 0, 0, .35);
}
.sheet-wrap.show .sheet { transform: translateY(0); }
.sheet-grip { width: 38px; height: 4px; border-radius: 99px; background: var(--muted);
  opacity: .4; margin: 2px auto 12px; }

.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sheet-thumb {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 20px;
  background: linear-gradient(135deg, var(--primary), #7aa2ff); color: #fff;
}
.sheet-head-main { flex: 1; min-width: 0; }
.sheet-title { font-size: 19px; font-weight: 800; color: var(--text); }
.sheet-online { font-size: 12.5px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.sheet-x {
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer; flex: none;
  background: var(--surface-2); color: var(--muted); display: grid; place-items: center;
}
.sheet-x:active { transform: scale(.94); }

.sheet-label { font-size: 11px; font-weight: 800; letter-spacing: .6px;
  color: var(--muted); margin: 16px 2px 8px; }
.sheet-label:first-child { margin-top: 2px; }
.sheet-note, .sheet-empty { color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 14px 4px; text-align: center; }
.sheet-empty { background: var(--soft); border-radius: 14px; }

.sheet-foot { margin-top: 18px; }
.btn-block { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-block .material-symbols-rounded { font-size: 20px; }
.btn-soft { background: var(--surface-2); color: var(--muted); display: inline-flex;
  align-items: center; gap: 6px; }
.btn-soft:not(:disabled) { color: var(--text); }
.btn-soft .material-symbols-rounded { font-size: 18px; }

/* Xona qatorlari */
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 12px;
}
.room-row-mine { border-color: color-mix(in srgb, var(--primary) 55%, transparent);
  background: color-mix(in srgb, var(--primary) 12%, transparent); }
.room-row-active { border-color: color-mix(in srgb, var(--success) 55%, transparent);
  background: color-mix(in srgb, var(--success) 13%, transparent); }
.room-live-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--success); flex: none;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 70%, transparent); animation: roomLivePulse 1.6s infinite; }
.room-row-game { color: var(--muted); font-weight: 700; font-size: 12.5px; }
@keyframes roomLivePulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); }
  70%  { box-shadow: 0 0 0 7px color-mix(in srgb, var(--success) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 0%, transparent); }
}
.room-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex: none; }
.room-ava {
  width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font-weight: 800; background: var(--surface-2); color: var(--primary);
}
.room-row-main { flex: 1; min-width: 0; }
.room-row-title { font-size: 14.5px; font-weight: 800; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-row-sub { font-size: 12px; font-weight: 600; color: var(--muted); }
.btn-join { padding: 8px 16px; border-radius: 11px; font-size: 13px; flex: none; }

/* Kod kiritish */
.code-enter { display: flex; gap: 9px; }
.code-enter .input { flex: 1; min-width: 0; letter-spacing: 1px; }
.code-enter .btn { white-space: nowrap; padding: 0 16px; }

/* Yaratish modali */
.field-label { font-size: 13px; font-weight: 800; color: var(--text); margin: 16px 2px 8px; }
.field-label:first-child { margin-top: 2px; }
.slider-head { display: flex; align-items: center; justify-content: space-between; }
.slider-val { font-weight: 700; color: var(--muted); font-size: 13px; }
.slider-val b { color: var(--primary); font-size: 15px; }

.type-row { display: flex; gap: 10px; }
.type-card {
  flex: 1; position: relative; cursor: pointer; text-align: left;
  background: var(--soft); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 13px 13px; color: var(--text); font-family: var(--font);
  display: flex; flex-direction: column; gap: 2px; transition: border-color .15s ease, background .15s ease;
}
.type-card .material-symbols-rounded { font-size: 22px; color: var(--muted); margin-bottom: 4px; }
.type-card b { font-size: 15px; font-weight: 800; }
.type-card small { font-size: 11px; color: var(--muted); font-weight: 600; }
.type-card .type-check { position: absolute; top: 11px; right: 11px; font-size: 20px;
  color: var(--primary); opacity: 0; }
.type-card.is-on { border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent); }
.type-card.is-on > .material-symbols-rounded:first-child { color: var(--primary); }
.type-card.is-on .type-check { opacity: 1; }

.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  border-radius: 99px; background: var(--surface-2); outline: none; margin: 2px 0; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%; background: #fff; cursor: pointer;
  border: 4px solid var(--primary); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff;
  cursor: pointer; border: 4px solid var(--primary); }
.slider-ends { display: flex; justify-content: space-between; font-size: 11px;
  font-weight: 700; color: var(--muted); margin-top: 2px; }

.roles-box { margin-top: 14px; background: var(--soft); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px 14px; }
.roles-title { font-size: 11px; font-weight: 800; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px; }
.role-line { display: flex; align-items: center; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--border); }
.role-line:last-child { border-bottom: none; }
.role-line.is-zero { opacity: .45; }
.role-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface); color: var(--primary); font-size: 19px; }
.role-name { flex: 1; font-size: 14px; font-weight: 700; color: var(--text); }
.role-count { font-size: 15px; font-weight: 800; color: var(--text); }

/* Vaqt sozlamalari (mafiya) — yig'iladigan bo'lim */
.cr-timers { margin-top: 12px; background: var(--soft); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.cr-timers > summary { display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  cursor: pointer; font-weight: 700; font-size: 14px; list-style: none; user-select: none; }
.cr-timers > summary::-webkit-details-marker { display: none; }
.cr-timers > summary .material-symbols-rounded { font-size: 20px; color: var(--primary); }
.cr-timers > summary .cr-timers-t { flex: 1; }
.cr-timers > summary .chev { color: var(--muted); transition: transform .2s ease; }
.cr-timers[open] > summary .chev { transform: rotate(180deg); }
.cr-timers-body { padding: 4px 14px 14px; }
.tm-row { padding: 10px 0; border-top: 1px solid var(--border); }
.tm-row:first-child { border-top: none; }
.tm-head { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.tm-val { color: var(--muted); }
.tm-val b { color: var(--primary); font-size: 15px; }

/* Xona egasi: yopish */
.owner-zone { margin-top: 18px; }
.owner-zone-label { font-size: 11px; font-weight: 800; letter-spacing: .6px; color: var(--muted); margin: 0 2px 8px; }
.btn-danger-soft { background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger); display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-danger-soft .material-symbols-rounded { font-size: 19px; }
/* Xonani yopish — qizil eshik tugmasi (faqat xona egasida ko'rinadi) */
.room-close {
  flex: none; border: none; cursor: pointer; padding: 0;
  width: 34px; height: 34px; border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 18%, transparent) !important;
  color: var(--danger) !important;
  transition: transform .12s ease, background .15s ease;
}
.room-close:hover { background: color-mix(in srgb, var(--danger) 28%, transparent) !important; }
.room-close:active { transform: scale(.9); }
.room-close .material-symbols-rounded { font-size: 20px; }

/* ============================================================
   Tasdiqlash modali (sgConfirm) — PC va telefonda bir xil
   ============================================================ */
.sg-confirm-wrap {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center; padding: 22px;
  background: rgba(8, 14, 28, .5); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .18s ease;
}
.sg-confirm-wrap.show { opacity: 1; }
.sg-confirm {
  width: 100%; max-width: 340px; background: var(--surface);
  border-radius: 22px; padding: 24px 22px 18px; text-align: center;
  box-shadow: 0 24px 60px rgba(8, 14, 28, .35);
  transform: translateY(12px) scale(.96); transition: transform .2s cubic-bezier(.2,.9,.3,1.2);
}
.sg-confirm-wrap.show .sg-confirm { transform: translateY(0) scale(1); }
.sg-confirm-ico {
  width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 14px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary);
}
.sg-confirm-ico.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.sg-confirm-ico .material-symbols-rounded { font-size: 30px; }
.sg-confirm-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.sg-confirm-text { font-size: 14px; color: var(--muted); line-height: 1.45; margin-bottom: 20px; }
.sg-confirm-actions { display: flex; gap: 10px; }
.sg-confirm-actions .btn { flex: 1; padding: 12px; font-size: 14.5px; }

/* ============================================================
   "Hona yopildi" ekrani (faol o'yinchilar uchun)
   ============================================================ */
.room-closed {
  min-height: 60vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: sg-fade .25s ease;
}
.room-closed-card {
  width: 100%; max-width: 360px; text-align: center;
  background: var(--surface); border-radius: 24px; padding: 34px 24px 26px;
  box-shadow: var(--shadow);
}
.room-closed-ico {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--danger), color-mix(in srgb, var(--danger) 60%, #7a1018));
  color: #fff; box-shadow: 0 14px 30px color-mix(in srgb, var(--danger) 38%, transparent);
  animation: sg-pop .4s cubic-bezier(.2,.9,.3,1.3);
}
.room-closed-ico .material-symbols-rounded { font-size: 42px; }
.room-closed-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.room-closed-sub { font-size: 14.5px; color: var(--muted); line-height: 1.5; margin-bottom: 24px; }
.room-closed-btn { padding: 13px; font-size: 15px; }
/* ============================================================
   O'yin logosi (modal thumb + xona avatari) va xona cheklovi izohi
   ============================================================ */
.sheet-thumb.has-img,
.room-ava.has-img { padding: 0; overflow: hidden; }
.sheet-thumb img,
.room-ava img {
  width: 100%; height: 100%;
  object-fit: cover; display: block; border-radius: inherit;
}

/* "Yangi xona yaratish" bloklanganda sabab izohi */
.create-hint {
  font-size: 12px; font-weight: 600; line-height: 1.4;
  color: var(--muted); text-align: center; margin-bottom: 10px;
}
/* ============================================================
   SPA (pjax) qobiq — #sg-view faqat passthrough konteyner.
   display:contents tufayli ichidagi .content to'g'ridan-to'g'ri .app
   flex bolasi bo'ladi → eski tartib (header sticky, content flex:1,
   tabbar sticky) aynan saqlanadi.
   ============================================================ */
#sg-view { display: contents; }

/* Xona (chrome=none): doimiy topbar va tabbar yashirin — xona o'z panelini
   ko'rsatadi. */
.app[data-chrome="none"] > .topbar,
.app[data-chrome="none"] > .tabbar { display: none; }

/* Sahifa almashayotganda yuqorida ingichka progress chizig'i (faqat
   yuklash 120ms dan uzoq cho'zilsa ko'rinadi). */
.sg-progress {
  position: fixed; left: 0; top: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  background-size: 200% 100%;
  transform: scaleX(0); transform-origin: left;
  opacity: 0; transition: opacity .15s ease;
  z-index: 50; pointer-events: none;
}
.sg-progress.show {
  opacity: 1; transform: scaleX(1);
  animation: sgProg 1s linear infinite;
}
@keyframes sgProg { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   XONA — o'yin ko'rinishi (karta-grid dizayn, ekran maketlari bo'yicha)
   ============================================================ */

/* Lobby: tayyor soni + tayyor belgisi + ega toji */
.ready-count { font-size: 13px; font-weight: 700; color: var(--muted); }
.player { position: relative; }
.player-ava.ready::after { content: none; }              /* eski ::after o'rniga aniq belgi */
.player-ready { position: absolute; right: -2px; bottom: -2px; font-size: 18px;
  color: var(--success); background: var(--surface); border-radius: 50%; }
.player-crown { position: absolute; left: 50%; top: -13px; transform: translateX(-50%);
  font-size: 16px; color: #e8a800; }
.player.is-owner .player-name::before { content: none; }

/* Faza sarlavhasi (belgi + nom + kun/tirik + taymer) */
.phase-head { display: flex; align-items: center; gap: 12px; background: var(--surface);
  border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.phase-head-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; flex: none; }
.phase-head.is-night .phase-head-ico { background: linear-gradient(135deg,#3b4a6b,#243049); }
.phase-head.is-day .phase-head-ico   { background: linear-gradient(135deg,#f6b73c,#e8932b); }
.phase-head.is-vote .phase-head-ico  { background: linear-gradient(135deg,#7b5cff,#5b3aa6); }
.phase-head.is-night { background: linear-gradient(180deg, color-mix(in srgb,#3b4a6b 14%, var(--surface)), var(--surface)); }
.phase-head.is-day   { background: linear-gradient(180deg, color-mix(in srgb,#f6b73c 14%, var(--surface)), var(--surface)); }
.phase-head.is-vote  { background: linear-gradient(180deg, color-mix(in srgb,#7b5cff 14%, var(--surface)), var(--surface)); }
.phase-head-ico .material-symbols-rounded { font-size: 24px; }
.phase-head-main { flex: 1; min-width: 0; }
.phase-head-title { font-weight: 800; font-size: 18px; }
.phase-head-sub { color: var(--muted); font-size: 12px; }
.phase-pill { display: flex; align-items: center; justify-content: center; gap: 5px; background: var(--surface-2);
  color: var(--text); font-weight: 800; font-size: 14px; padding: 6px 12px; border-radius: 20px; flex: none;
  min-width: 78px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.phase-pill #timer { min-width: 38px; text-align: center; }
.phase-pill .material-symbols-rounded { font-size: 16px; color: var(--primary); }

/* Sizning rolingiz banneri */
.role-banner { display: flex; align-items: center; gap: 12px; border-radius: 14px; padding: 12px 14px;
  margin-bottom: 12px; background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent); }
.role-banner.is-mafia { background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.role-banner-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 20%, var(--surface)); color: var(--primary); flex: none; }
.role-banner.is-mafia .role-banner-ico { background: color-mix(in srgb, var(--danger) 22%, var(--surface)); color: var(--danger); }
.role-banner-ico .material-symbols-rounded { font-size: 20px; }
.role-banner-main { flex: 1; min-width: 0; }
.role-banner-label { font-size: 10.5px; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.role-banner-name { font-weight: 800; font-size: 16px; color: var(--primary); }
.role-banner.is-mafia .role-banner-name { color: var(--danger); }
.role-banner-tag { color: var(--danger); font-weight: 800; font-size: 12px; flex: none; }

/* So'nggi voqea banneri (Voqealar ro'yxati o'rniga) */
.result-banner { display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 12px 14px;
  margin-bottom: 12px; background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent); }
.result-banner .material-symbols-rounded { color: var(--primary); font-size: 22px; flex: none; }
.result-banner-text { font-weight: 700; font-size: 14px; }

/* Harakat so'rovi bar */
.action-prompt { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.action-prompt .material-symbols-rounded { font-size: 20px; color: var(--primary); }
.action-prompt.muted, .action-prompt.muted .material-symbols-rounded { color: var(--muted); }

/* O'yinchilar gridi (kartalar) */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; margin-bottom: 14px; }
.game-grid.dense { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; }
.gp-card { appearance: none; -webkit-appearance: none; font-family: var(--font); cursor: pointer; text-align: center;
  color: var(--text);
  background: var(--surface); border: 2px solid transparent; border-radius: 14px; padding: 9px 5px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 5px;
  position: relative; transition: border-color .15s ease, background .15s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent; }
.gp-card:not(:disabled):active { transform: scale(.96); }
.gp-card:disabled { cursor: default; }
.gp-card.is-me { border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.gp-card.chosen { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.gp-card.is-dead { opacity: .55; }
.gp-card.flag-mafia { border-color: color-mix(in srgb, var(--danger) 60%, transparent); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
.gp-card.flag-clean { border-color: color-mix(in srgb, var(--success) 55%, transparent); background: color-mix(in srgb, var(--success) 9%, var(--surface)); }
.gp-ava { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: #fff; position: relative; }
.game-grid.dense .gp-ava { width: 38px; height: 38px; font-size: 15px; }
.game-grid.dense .gp-card { padding: 7px 4px; border-radius: 12px; }
.gp-ava.is-dead { background: var(--surface-2); color: var(--muted); }
.gp-ava.chosen { box-shadow: 0 0 0 3px var(--primary); }
.gp-ava-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.gp-x { font-size: 24px; }
.gp-check { position: absolute; top: -4px; right: -4px; font-size: 20px; color: var(--primary);
  background: var(--surface); border-radius: 50%; }
.gp-name { font-size: 11.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.game-grid.dense .gp-name { font-size: 10.5px; }
.gp-role { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.gp-checkres { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; font-weight: 800;
  padding: 1px 6px; border-radius: 999px; margin-top: 1px; }
.gp-checkres .material-symbols-rounded { font-size: 12px; }
.gp-checkres.mafia { color: #fff; background: var(--danger); }
.gp-checkres.clean { color: #fff; background: var(--success); }

/* Ovoz: o'tkazib yuborish tugmasi */
.vote-skip { appearance: none; -webkit-appearance: none; width: 100%; font-family: var(--font); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface);
  border: 2px solid transparent; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow);
  color: var(--muted); font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.vote-skip.chosen { border-color: var(--primary); color: var(--text); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.vote-skip .material-symbols-rounded { font-size: 18px; }

/* O'yin tugadi ekrani */
.gameover { text-align: center; padding: 24px 8px; }
.gameover-cup { width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; margin: 8px auto 14px; }
.gameover-cup .material-symbols-rounded { font-size: 44px; }
.gameover-cup.win  { background: color-mix(in srgb, var(--success) 16%, var(--surface)); color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent); }
.gameover-cup.lose { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.gameover-title { font-size: 24px; font-weight: 800; margin-bottom: 16px; }
.gameover-title.win  { color: var(--success); }
.gameover-title.lose { color: var(--danger); }
.gameover-btn { margin: 0 auto 20px; }

/* O'yin tugagach: ega tugmalari (yangidan / yopish) va oddiy o'yinchi holati */
.gameover-sub { color: var(--muted); font-size: 14px; margin: -8px auto 18px; max-width: 320px; line-height: 1.5; }
.gameover-actions { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 0 auto 20px; }
.gameover-actions .gameover-btn { margin: 0; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.gameover-actions .material-symbols-rounded { font-size: 20px; }
.gameover-wait { display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--muted); font-size: 14px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; max-width: 320px; margin: 0 auto 12px; }
.gameover-wait .material-symbols-rounded { font-size: 20px; }
.gameover-wait + .gameover-btn { width: 100%; max-width: 320px; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* Bosh sahifa: faol xonaga "qaytish" eslatmasi */
.resume-banner { display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 16%, var(--surface)),
    color-mix(in srgb, var(--primary) 6%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: var(--radius); padding: 12px 14px; margin: 0 0 18px;
  color: var(--text); transition: transform .12s ease, box-shadow .12s ease; }
.resume-banner:active { transform: scale(.99); }
.resume-ico { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 22%, var(--surface)); color: var(--primary); }
.resume-ico .material-symbols-rounded,
.resume-ico.material-symbols-rounded { font-size: 24px; }
.resume-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.resume-text b { font-size: 15px; font-weight: 700; }
.resume-text small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-cta { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border-radius: 999px; padding: 7px 14px; }


/* ════════════════════════════════════════════════════════════
   O'YIN EFFEKTLARI — sanоq · faza o'tishi · tun natijasi · konfetti
   ════════════════════════════════════════════════════════════ */

/* Umumiy to'liq-ekran qatlam (barcha effektlar shu ustida) */
.fx-layer { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center;
  pointer-events: none; overflow: hidden; }

/* ── 5·4·3·2·1 sanоq ── */
.fx-countdown { background: radial-gradient(circle at 50% 40%, rgba(46,109,242,.28), rgba(3,7,15,.92) 70%);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.cd-num { font-size: clamp(96px, 38vw, 200px); font-weight: 900; line-height: 1; color: #fff;
  text-shadow: 0 10px 40px rgba(46,109,242,.6); animation: cdPop .8s ease both; }
.cd-go { font-size: clamp(40px, 12vw, 76px); font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--primary), #6aa0ff); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; animation: cdGo .7s ease both; }
@keyframes cdPop {
  0%   { transform: scale(2.4); opacity: 0; filter: blur(8px); }
  35%  { transform: scale(1);   opacity: 1; filter: blur(0); }
  80%  { transform: scale(1);   opacity: 1; }
  100% { transform: scale(.5);  opacity: 0; }
}
@keyframes cdGo {
  0%   { transform: scale(.4) rotate(-6deg); opacity: 0; }
  45%  { transform: scale(1.12) rotate(0);   opacity: 1; }
  100% { transform: scale(1) rotate(0);      opacity: 1; }
}

/* ── Faza o'tishi (tun / kun / ovoz) ── */
.fx-phase { opacity: 0; transition: opacity .3s ease; }
.fx-phase.show { opacity: 1; }
.fx-phase.fx-night { background: radial-gradient(circle at 50% 35%, #1b2746, #04060d 75%); }
.fx-phase.fx-day   { background: radial-gradient(circle at 50% 35%, #ffe6a8, #ff9d3c 80%); }
.fx-phase.fx-vote  { background: radial-gradient(circle at 50% 35%, #5b3aa6, #1a1030 80%); }
.fx-phase-card { text-align: center; transform: translateY(14px) scale(.96); opacity: 0;
  transition: transform .4s cubic-bezier(.2,.8,.2,1), opacity .4s ease; padding: 0 24px; }
.fx-phase.show .fx-phase-card { transform: translateY(0) scale(1); opacity: 1; }
.fx-phase-ico { width: 96px; height: 96px; border-radius: 28px; display: grid; place-items: center; margin: 0 auto 16px;
  background: rgba(255,255,255,.16); box-shadow: 0 12px 50px rgba(0,0,0,.35); }
.fx-phase-ico .material-symbols-rounded { font-size: 54px; }
.fx-night .fx-phase-ico .material-symbols-rounded { color: #cfe0ff; }
.fx-day   .fx-phase-ico .material-symbols-rounded { color: #7a3b00; }
.fx-vote  .fx-phase-ico .material-symbols-rounded { color: #e9ddff; }
.fx-phase-title { font-size: 30px; font-weight: 900; margin-bottom: 6px; }
.fx-night .fx-phase-title { color: #eaf1ff; }
.fx-day   .fx-phase-title { color: #6a2f00; }
.fx-vote  .fx-phase-title { color: #f3ecff; }
.fx-phase-sub { font-size: 15px; font-weight: 600; opacity: .9; }
.fx-night .fx-phase-sub { color: #aebde0; }
.fx-day   .fx-phase-sub { color: #8a4a10; }
.fx-vote  .fx-phase-sub { color: #c9badf; }

/* Tundan keyingi natija (otildi / qutqarildi / tinch) */
.fx-night-res { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px;
  padding: 11px 18px; border-radius: 999px; font-weight: 800; font-size: 16px; color: #fff;
  animation: resPop .5s .15s ease both; }
.fx-night-res .material-symbols-rounded { font-size: 24px; }
.fx-night-res.kill  { background: linear-gradient(135deg,#e5484d,#7a1f24); animation: resPop .5s .15s ease both, shake .5s .65s; }
.fx-night-res.save  { background: linear-gradient(135deg,#2bb673,#0e7a4a); }
.fx-night-res.peace { background: linear-gradient(135deg,#5b6b8c,#2f3a52); }
@keyframes resPop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes shake {
  0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}

/* ── Konfetti (g'alaba) ── */
.fx-confetti { align-items: flex-start; }
.cf { position: absolute; top: -16px; width: 10px; height: 16px; border-radius: 2px; opacity: .95;
  animation-name: cfFall; animation-timing-function: cubic-bezier(.3,.6,.5,1); animation-iteration-count: 1; }
@keyframes cfFall {
  0%   { transform: translateY(-20px) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 1; }
}

/* ── Komissar tekshiruvi: tezkor bildirishnoma (toast) ── */
.sg-toast { position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 20px); z-index: 9100;
  display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: 14px;
  font-weight: 700; font-size: 14px; color: #fff; box-shadow: 0 10px 34px rgba(0,0,0,.34);
  opacity: 0; transition: opacity .25s ease, transform .25s ease; max-width: 86vw; pointer-events: none; }
.sg-toast.show { opacity: 1; transform: translate(-50%, 0); }
.sg-toast .material-symbols-rounded { font-size: 22px; }
.sg-toast.bad  { background: linear-gradient(135deg,#e5484d,#a31318); }
.sg-toast.good { background: linear-gradient(135deg,#2bb673,#0e7a4a); }
.sg-toast b { font-weight: 900; }

/* ── So'nggi voqea banneri — turiga qarab rang ── */
.result-banner.ev-kill  { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); animation: bannerPop .4s ease both; }
.result-banner.ev-kill  .material-symbols-rounded { color: var(--danger); }
.result-banner.ev-save  { background: color-mix(in srgb, var(--success) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--success) 30%, transparent); animation: bannerPop .4s ease both; }
.result-banner.ev-save  .material-symbols-rounded { color: var(--success); }
.result-banner.ev-vote  { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.result-banner.ev-vote  .material-symbols-rounded { color: var(--primary); }
.result-banner.ev-peace .material-symbols-rounded { color: var(--muted); }
.result-banner.ev-win   { background: color-mix(in srgb, #ffd166 22%, var(--surface)); border: 1px solid color-mix(in srgb, #ffd166 45%, transparent); }
.result-banner.ev-win   .material-symbols-rounded { color: #e0a800; }
@keyframes bannerPop { from { transform: scale(.97); opacity: .4; } to { transform: scale(1); opacity: 1; } }

/* ── O'yin ichidagi chat — kattaroq, pastda to'liq ── */
.chat-game { margin-top: 4px; }
.chat-game .chat-head { font-size: 14.5px; padding: 12px 16px; }
.chat-game .chat-body { max-height: 320px; min-height: 190px; padding: 14px 16px; gap: 10px; }
.chat-game .chat-msg { font-size: 15px; line-height: 1.45; }
.chat-game .chat-input { padding: 12px 14px; }
.chat-game .chat-input .input { padding: 13px 16px; font-size: 15px; }
.chat-game .chat-locked { padding: 14px; font-size: 13.5px; }

/* Material 'skull' yo'q bo'lsa ham — biz 'dangerous' ishlatamiz, bu mavjud */

/* ════════════════════════════════════════════════════════════
   O'LIM EKRANI · O'LGAN O'YINCHI · MAFIYA JAMOASI · OVOZ CHEGARASI
   ════════════════════════════════════════════════════════════ */

/* ── "SIZ O'LDINGIZ" to'liq-ekran ── */
.fx-death { background: radial-gradient(circle at 50% 38%, rgba(229,72,77,.30), rgba(4,6,13,.94) 72%);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s ease; }
.fx-death.show { opacity: 1; }
.fx-death-card { text-align: center; padding: 0 26px; transform: scale(.9); opacity: 0;
  transition: transform .4s cubic-bezier(.2,.8,.2,1), opacity .4s ease; }
.fx-death.show .fx-death-card { transform: scale(1); opacity: 1; }
.fx-death-ico { width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px;
  background: rgba(229,72,77,.18); box-shadow: 0 0 0 6px rgba(229,72,77,.12), 0 14px 50px rgba(0,0,0,.45); }
.fx-death-ico .material-symbols-rounded { font-size: 60px; color: #ff6b70; }
.fx-death-title { font-size: 34px; font-weight: 900; letter-spacing: 1px; color: #ffd9da; }
.fx-death-sub { font-size: 16px; font-weight: 600; color: #f3c0c2; margin-top: 8px; }
.fx-death-sub b { color: #fff; }
.fx-death-note { font-size: 13.5px; color: #c98a8d; margin-top: 12px; }

/* ── O'lgan o'yinchi: aniq, bilinarli belgilash ── */
.gp-card.is-dead { opacity: .92; background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.gp-card.is-dead .gp-ava { background: color-mix(in srgb, var(--danger) 14%, var(--surface)) !important;
  filter: grayscale(.4); }
.gp-card.is-dead .gp-name { color: var(--muted); text-decoration: line-through; }
.gp-card.is-dead .gp-x { color: var(--danger); }
.gp-dead-tag { display: inline-block; font-size: 9.5px; font-weight: 800; color: #fff; background: var(--danger);
  border-radius: 999px; padding: 1px 7px; margin-top: 1px; letter-spacing: .3px; }

/* ── Mafiya jamoasi paneli (faqat mafiyaga) ── */
.mafia-team { display: flex; align-items: center; gap: 11px; border-radius: 14px; padding: 11px 14px; margin-bottom: 12px;
  background: color-mix(in srgb, var(--danger) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent); }
.mafia-team-ico { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--danger) 24%, var(--surface)); color: var(--danger); }
.mafia-team-ico .material-symbols-rounded { font-size: 21px; }
.mafia-team-main { flex: 1; min-width: 0; }
.mafia-team-label { font-size: 10.5px; letter-spacing: .5px; color: var(--danger); font-weight: 800; }
.mafia-team-names { font-size: 14.5px; font-weight: 700; color: var(--text); }

/* Mafiya jamoadoshi kartasi belgisi */
.gp-checkres.mate { color: #fff; background: var(--danger); }
.gp-card.flag-mate { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }

/* ── Ovoz chegarasi (ko'pchilik) ── */
.vote-need { display: flex; align-items: center; gap: 8px; justify-content: center;
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
  border-radius: 12px; padding: 9px 14px; margin-bottom: 10px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.vote-need .material-symbols-rounded { font-size: 18px; color: var(--primary); }
.vote-need b { font-weight: 900; color: var(--primary); }