/* =====================================================================
   MAFIA — "karta stoli" dizayn tizimi
   Bordo baxmal stol, fil suyagi kartalar, eskirgan latun.
   ===================================================================== */

@font-face { font-family: Pagella; src: url(fonts/pagella-regular.woff) format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Pagella; src: url(fonts/pagella-bold.woff) format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: Pagella; src: url(fonts/pagella-italic.woff) format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/inter-400.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/inter-500.woff) format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/inter-600.woff) format("woff"); font-weight: 600; font-display: swap; }

:root {
  --velvet: #1a0d10;
  --velvet-2: #231115;
  --velvet-3: #2e161b;
  --burgundy: #4a1219;
  --wine: #7a1e28;
  --wine-hi: #a33a44;
  --brass: #b8925a;
  --brass-hi: #e2c893;
  --brass-lo: #7a5b30;
  --ivory: #efe6d2;
  --ivory-2: #e3d6bc;
  --ink: #241a17;
  --ink-2: #5d4b40;
  --smoke: #bfb1a1;
  --smoke-2: #8f7f71;
  --ok: #8fae76;
  --line: rgba(184, 146, 90, .2);
  --line-2: rgba(184, 146, 90, .42);

  --serif: Pagella, "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--velvet);
  color: var(--ivory);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; border-radius: 6px; }

/* ---------- Atmosfera: bosqichga qarab stol yorug'ligi o'zgaradi ---------- */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.ambient > i { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease; }
.ambient .a-base  { opacity: 1; background: radial-gradient(130% 70% at 50% -5%, #3d151c 0%, var(--velvet) 62%); }
.ambient .a-night { background: radial-gradient(130% 75% at 75% -5%, #1d2a4a 0%, #0b1020 64%); }
.ambient .a-day   { background: radial-gradient(130% 75% at 25% -5%, #5a3a1c 0%, #1c130c 64%); }
.ambient .a-vote  { background: radial-gradient(130% 75% at 50% -5%, #6e1a27 0%, #1d090d 64%); }
.ambient .a-end   { background: radial-gradient(130% 75% at 50% -5%, #4b3a1d 0%, #160c0d 64%); }
body[data-phase="night"]    .a-night,
body[data-phase="day"]      .a-day,
body[data-phase="voting"]   .a-vote,
body[data-phase="finished"] .a-end { opacity: 1; }
.ambient::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.012) 0 2px, transparent 2px 5px);
}

/* ---------- Karkas ---------- */
.shell { max-width: 560px; margin: 0 auto; padding: 0 var(--gutter) calc(var(--tab-h) + var(--safe-b) + 24px); }
body[data-tab="admin"] .shell { max-width: 880px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 calc(var(--gutter) * -1); padding: 10px var(--gutter);
  background: linear-gradient(180deg, rgba(20, 9, 12, .94), rgba(20, 9, 12, .78));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ivory); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { font: 700 21px/1 var(--serif); letter-spacing: .02em; }
.purse {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 10px; border-radius: 999px;
  background: rgba(122, 30, 40, .35); border: 1px solid var(--line-2);
  color: var(--ivory); font-weight: 600; font-variant-numeric: tabular-nums;
}
.purse:hover { border-color: var(--brass); }

.pip { display: inline-block; width: .62em; height: .62em; background: var(--wine-hi); transform: rotate(45deg); border-radius: 1px; flex: none; }
.pip.brass { background: var(--brass); }

main { padding-top: 18px; }

/* ---------- Tipografiya ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; letter-spacing: .005em; }
.h-xl { font-size: 34px; line-height: 1.1; }
.h-l  { font-size: 27px; line-height: 1.15; }
.h-m  { font-size: 21px; line-height: 1.25; }
.h-s  { font-size: 17px; line-height: 1.3; }
.lede { color: var(--smoke); margin: 8px 0 0; max-width: 38em; }
.muted { color: var(--smoke); }
.faint { color: var(--smoke-2); font-size: 13px; }
.serif-i { font-family: var(--serif); font-style: italic; }
.num { font-variant-numeric: tabular-nums; }

.section { margin-top: 28px; }
.section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rule { height: 1px; border: 0; margin: 24px 0; background: linear-gradient(90deg, transparent, var(--line-2), transparent); }

/* ---------- Tugmalar va maydonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  min-height: 46px; padding: 11px 18px; border-radius: 8px;
  border: 1px solid transparent; font-weight: 600; font-size: 15px; line-height: 1.2;
  text-decoration: none; transition: transform .12s ease, filter .2s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-brass {
  color: var(--ink);
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 70%, #a8824d 100%);
  border-color: var(--brass-lo);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 2px 0 rgba(0, 0, 0, .35);
}
.btn-brass:hover:not(:disabled) { filter: brightness(1.06); }
.btn-wine { color: var(--ivory); background: var(--wine); border-color: var(--wine-hi); }
.btn-wine:hover:not(:disabled) { background: #8a2430; }
.btn-ghost { color: var(--ivory); background: rgba(239, 230, 210, .03); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brass); }
.btn-quiet { color: var(--smoke); background: transparent; min-height: 40px; padding: 8px 10px; }
.btn-quiet:hover { color: var(--ivory); }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 10px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--smoke); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 8px;
  background: rgba(10, 4, 6, .55); border: 1px solid var(--line-2); color: var(--ivory);
}
.textarea { min-height: 84px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--smoke-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(184, 146, 90, .18); }
.code-input { font: 700 20px/1 var(--serif); letter-spacing: .28em; text-transform: uppercase; text-align: center; }
.check { display: flex; gap: 10px; align-items: center; min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--brass); }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: rgba(10, 4, 6, .5); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; border: 0; background: transparent; color: var(--smoke); padding: 8px 12px; border-radius: 7px; font-weight: 500; font-size: 14px; white-space: nowrap; min-height: 36px; }
.seg.wrap { flex-wrap: wrap; overflow: visible; }
.seg.wrap button { flex: 1 1 auto; }
.seg button[aria-pressed="true"] { background: var(--burgundy); color: var(--ivory); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ---------- Panel ---------- */
.panel {
  background: linear-gradient(180deg, rgba(46, 22, 27, .82), rgba(30, 14, 18, .82));
  border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.panel + .panel { margin-top: 12px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

/* ---------- Bosh sahifa: yelpig'ich kartalar ---------- */
.hero { display: grid; gap: 18px; padding: 8px 0 4px; }
.fan { position: relative; height: 196px; margin: 4px auto 18px; width: 270px; }
.fan .card-mini { position: absolute; bottom: 0; left: 50%; margin-left: -52px; transform-origin: 50% 165%; }
.fan .card-mini:nth-child(1) { transform: rotate(-21deg); }
.fan .card-mini:nth-child(2) { transform: translateY(-8px); z-index: 2; }
.fan .card-mini:nth-child(3) { transform: rotate(21deg); }
.card-mini {
  width: 104px; height: 148px; border-radius: 10px; padding: 9px;
  background: linear-gradient(160deg, #f6efde, var(--ivory) 45%, var(--ivory-2));
  color: var(--ink); border: 1px solid var(--brass-lo);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
  display: grid; grid-template-rows: auto 1fr auto; text-align: center;
}
.card-mini::before { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(122, 30, 40, .35); border-radius: 7px; pointer-events: none; }
.card-mini .idx { font: 700 15px/1 var(--serif); color: var(--wine); text-align: left; }
.card-mini .emo { font-size: 40px; align-self: center; }
.card-mini .nm { font: 700 14px/1.1 var(--serif); }

.join-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

.roles { display: grid; gap: 8px; }
.role-line { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.role-line:first-child { border-top: 0; }
.role-line .emo { font-size: 26px; line-height: 1.2; text-align: center; }
.role-line b { font-family: var(--serif); font-size: 17px; }
.role-line p { margin: 2px 0 0; color: var(--smoke); font-size: 14px; }
.team-mafia b { color: #e6a1a8; }

.reward-note { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--smoke); }
.reward-note strong { color: var(--ivory); }

/* ---------- O'yin: bosqich relsi ---------- */
.rail { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 4px 0 14px; border-bottom: 1px solid var(--line); }
.rail h1 { font-size: 30px; line-height: 1.05; }
.rail p { margin: 4px 0 0; color: var(--smoke); font-size: 14px; }
.clock { position: relative; width: 62px; height: 62px; }
.clock svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.clock circle { fill: none; stroke-width: 4; }
.clock .bg { stroke: rgba(184, 146, 90, .18); }
.clock .fg { stroke: var(--brass); stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.clock.urgent .fg { stroke: var(--wine-hi); }
.clock span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 20px/1 var(--serif); font-variant-numeric: tabular-nums; }

.room-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.room-code .code { font: 700 34px/1 var(--serif); letter-spacing: .22em; color: var(--brass-hi); }

/* ---------- Mening rolim ---------- */
.mine {
  display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center;
  margin-top: 14px; padding: 12px; border-radius: 12px;
  background: linear-gradient(160deg, #f6efde, var(--ivory) 50%, var(--ivory-2));
  color: var(--ink); border: 1px solid var(--brass-lo);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.mine .emo { font-size: 38px; text-align: center; }
.mine b { font: 700 19px/1.2 var(--serif); }
.mine p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); }
.mine .allies { margin-top: 6px; font-size: 13.5px; color: var(--wine); font-weight: 600; }
.mine.dead { filter: grayscale(.7); opacity: .8; }

/* ---------- O'yinchilar stoli ---------- */
.table { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
@media (min-width: 460px) { .table { grid-template-columns: repeat(4, 1fr); } }
.seat {
  position: relative; min-height: 118px; padding: 9px 8px 10px; border-radius: 10px;
  background: linear-gradient(165deg, #f7f0df, var(--ivory) 55%, var(--ivory-2));
  color: var(--ink); border: 1px solid #c9b58f;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 8px 16px rgba(0, 0, 0, .3);
  display: grid; grid-template-rows: auto auto 1fr; justify-items: center; text-align: center; gap: 5px;
  transition: transform .15s ease, opacity .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent; font: inherit; width: 100%;
}
button.seat { cursor: pointer; }
button.seat:hover { transform: translateY(-2px); }
.seat .idx { position: absolute; top: 7px; left: 8px; font: 700 13px/1 var(--serif); color: var(--wine); }
.seat .crown { position: absolute; top: 6px; right: 7px; font-size: 13px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex: none;
  display: grid; place-items: center; font: 700 18px/1 var(--serif);
  background: var(--burgundy); color: var(--brass-hi); border: 1.5px solid var(--brass);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.seat .nm { font-weight: 600; font-size: 13px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.seat .tag { align-self: end; font-size: 12px; color: var(--ink-2); }
.seat .tag.role { font-family: var(--serif); font-weight: 700; color: var(--wine); font-size: 12.5px; }
.seat .votes {
  position: absolute; top: -7px; right: -7px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  display: grid; place-items: center; background: var(--wine); color: var(--ivory); font-weight: 700; font-size: 13px;
  border: 2px solid var(--ivory); box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.seat .tick { position: absolute; bottom: 7px; right: 8px; color: #4d7a3c; font-weight: 700; font-size: 13px; }
.seat.me { border-color: var(--brass); box-shadow: 0 0 0 2px rgba(184, 146, 90, .55), 0 8px 16px rgba(0, 0, 0, .3); }
.seat.dim { opacity: .45; }
.seat.sel { transform: translateY(-4px); border-color: var(--wine); box-shadow: 0 0 0 3px var(--wine), 0 12px 22px rgba(0, 0, 0, .45); }
.seat.sel::after {
  content: ""; position: absolute; bottom: -7px; left: 50%; width: 13px; height: 13px; margin-left: -6.5px;
  background: var(--wine); transform: rotate(45deg); border: 2px solid var(--ivory);
}
.seat.dead {
  background: repeating-linear-gradient(135deg, #3a1218 0 6px, #331016 6px 12px);
  color: var(--smoke); border-color: rgba(184, 146, 90, .35); box-shadow: none;
}
.seat.dead .idx { color: var(--brass-lo); }
.seat.dead .avatar { filter: grayscale(1); opacity: .6; }
.seat.dead .nm { color: var(--smoke); text-decoration: line-through; text-decoration-color: rgba(191, 177, 161, .5); }
.seat.dead .tag.role { color: var(--brass-hi); }
.seat.won { border-color: var(--brass); box-shadow: 0 0 0 2px var(--brass), 0 8px 16px rgba(0, 0, 0, .3); }
.seat .pts { font-weight: 700; font-size: 12.5px; color: #4d7a3c; }
.seat.dead .pts { color: var(--ok); }
.seat .kick { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; border: 0; background: transparent; color: var(--ink-2); font-size: 18px; line-height: 1; border-radius: 6px; }
.seat .kick:hover { color: var(--wine); }

/* ---------- Harakat paneli ---------- */
.dock {
  position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); z-index: 15;
  margin-top: 16px; padding: 12px; border-radius: 12px;
  background: rgba(24, 10, 13, .94); border: 1px solid var(--line-2);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.dock .q { font: 700 17px/1.3 var(--serif); }
.dock .hint { color: var(--smoke); font-size: 13.5px; margin-top: 2px; }
.dock .actions { display: flex; gap: 8px; margin-top: 10px; }
.dock .actions .btn { flex: 1; }

/* ---------- Suhbat ---------- */
.feed { display: grid; gap: 8px; max-height: 360px; overflow-y: auto; padding: 4px 2px 8px; overscroll-behavior: contain; scroll-behavior: smooth; }
.msg { font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.msg .who { font-weight: 600; color: var(--brass-hi); margin-right: 6px; }
.msg.chat { padding: 2px 0; }
.msg.system { font-family: var(--serif); font-style: italic; color: var(--smoke); font-size: 15px; padding: 2px 0; }
.msg.private { padding: 8px 10px; border-left: 3px solid var(--brass); background: rgba(184, 146, 90, .09); border-radius: 0 8px 8px 0; color: var(--ivory); }
.msg.mafia { padding: 8px 10px; border-left: 3px solid var(--wine-hi); background: rgba(122, 30, 40, .28); border-radius: 0 8px 8px 0; }
.msg.mafia .who { color: #f0b3ba; }
.msg.dead { color: var(--smoke-2); }
.msg.dead .who { color: var(--smoke); }
.msg .chan { font-size: 11.5px; font-weight: 600; color: var(--smoke-2); margin-right: 6px; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }

/* ---------- Yakun ---------- */
.verdict { text-align: center; padding: 18px 0 8px; }
.verdict .crest { width: 120px; margin: 0 auto 12px; }
.verdict h1 { font-size: 36px; line-height: 1.1; }
.verdict p { margin: 8px auto 0; color: var(--smoke); max-width: 30em; }

/* ---------- Sovrinlar: chipta ---------- */
.balance {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px;
  padding: 18px; border-radius: 14px; border: 1px solid var(--line-2);
  background: radial-gradient(120% 140% at 0% 0%, rgba(122, 30, 40, .55), rgba(30, 12, 16, .9) 70%);
}
.balance .big { font: 700 48px/1 var(--serif); font-variant-numeric: tabular-nums; color: var(--ivory); }
.balance .big small { font: 400 18px var(--serif); font-style: italic; color: var(--brass); margin-left: 6px; }
.balance .how { font-size: 13.5px; color: var(--smoke); margin-top: 8px; }

.tickets { display: grid; gap: 14px; }
.ticket {
  --stub: 78px;
  position: relative; display: grid; grid-template-columns: var(--stub) 1fr; min-height: 128px;
  border-radius: 10px; overflow: hidden; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .4));
  -webkit-mask: radial-gradient(circle 9px at var(--stub) 0, transparent 97%, #000) top / 100% 51% no-repeat,
                radial-gradient(circle 9px at var(--stub) 100%, transparent 97%, #000) bottom / 100% 51% no-repeat;
          mask: radial-gradient(circle 9px at var(--stub) 0, transparent 97%, #000) top / 100% 51% no-repeat,
                radial-gradient(circle 9px at var(--stub) 100%, transparent 97%, #000) bottom / 100% 51% no-repeat;
}
.ticket .stub {
  display: grid; place-items: center; gap: 4px; padding: 10px 6px; text-align: center;
  background: linear-gradient(170deg, var(--wine), var(--burgundy)); color: var(--ivory);
}
.ticket .stub .emo { font-size: 36px; line-height: 1; }
.ticket .stub .kind { font-size: 11px; color: var(--brass-hi); line-height: 1.2; }
.ticket .body {
  padding: 14px 14px 12px 16px; color: var(--ink);
  background: linear-gradient(165deg, #f7f0df, var(--ivory) 60%, var(--ivory-2));
  border-left: 2px dashed rgba(36, 26, 23, .28);
  display: grid; gap: 6px; align-content: start;
}
.ticket h3 { font-size: 19px; line-height: 1.2; }
.ticket p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.ticket .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.ticket .price { display: inline-flex; align-items: center; gap: 6px; font: 700 20px/1 var(--serif); font-variant-numeric: tabular-nums; }
.ticket .stock { font-size: 12.5px; color: var(--ink-2); }
.ticket .btn-ink { background: var(--ink); color: var(--ivory); border-color: var(--ink); min-height: 40px; padding: 8px 16px; }
.ticket .btn-ink:hover:not(:disabled) { background: #3a2b26; }
.ticket.off .body { opacity: .7; }

.claims { display: grid; }
.claim { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.claim:first-child { border-top: 0; }
.claim .emo { font-size: 24px; text-align: center; }
.claim b { font-weight: 600; }
.claim .note { font-size: 13px; color: var(--smoke); margin-top: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.chip.pending { background: rgba(184, 146, 90, .15); color: var(--brass-hi); border-color: rgba(184, 146, 90, .35); }
.chip.sending { background: rgba(184, 146, 90, .15); color: var(--brass-hi); }
.chip.delivered { background: rgba(143, 174, 118, .15); color: var(--ok); border-color: rgba(143, 174, 118, .35); }
.chip.rejected { background: rgba(163, 58, 68, .2); color: #f0b3ba; border-color: rgba(163, 58, 68, .4); }

/* ---------- Reyting ---------- */
.ladder { display: grid; }
.rung { display: grid; grid-template-columns: 36px 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--line); }
.rung:first-child { border-top: 0; }
.rung .rank { font: 700 22px/1 var(--serif); text-align: center; color: var(--smoke-2); font-variant-numeric: tabular-nums; }
.rung:nth-child(1) .rank { color: var(--brass-hi); font-size: 28px; }
.rung:nth-child(2) .rank { color: #d2d0cb; font-size: 25px; }
.rung:nth-child(3) .rank { color: #c98f5c; font-size: 24px; }
.rung .avatar { width: 40px; height: 40px; font-size: 16px; }
.rung .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rung .sub { font-size: 12.5px; color: var(--smoke-2); }
.rung .score { font: 700 19px/1 var(--serif); font-variant-numeric: tabular-nums; text-align: right; }
.rung.me { background: rgba(184, 146, 90, .08); border-radius: 8px; }

/* ---------- Profil: a'zolik kartasi ---------- */
.member {
  position: relative; overflow: hidden; padding: 18px; border-radius: 14px; color: var(--ink);
  background: linear-gradient(160deg, #f8f1e1, var(--ivory) 50%, var(--ivory-2));
  border: 1px solid var(--brass-lo); box-shadow: 0 12px 28px rgba(0, 0, 0, .45);
}
.member::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(122, 30, 40, .3); border-radius: 9px; pointer-events: none; }
.member .mark { position: absolute; right: -14px; top: -10px; width: 150px; height: 100px; opacity: .13; filter: grayscale(.4); pointer-events: none; }
.member .top { display: flex; gap: 14px; align-items: center; }
.member .avatar { width: 58px; height: 58px; font-size: 24px; }
.member h2 { font-size: 24px; line-height: 1.15; }
.member .handle { font-size: 13.5px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; position: relative; }
.stat { text-align: left; }
.stat b { display: block; font: 700 22px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-2); }

.ledger { display: grid; }
.ledger > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ledger > div:first-child { border-top: 0; }
.ledger .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.ledger .amt.plus { color: var(--ok); }
.ledger .amt.minus { color: #f0b3ba; }

/* ---------- Admin ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(30, 12, 16, .7); }
.kpi b { display: block; font: 700 26px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--smoke); }
.kpi.hot { border-color: var(--wine-hi); background: rgba(122, 30, 40, .3); }
.list { display: grid; }
.item { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .line1 { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.item .meta { font-size: 13px; color: var(--smoke); }
.item .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.gifts { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; }
.gift { display: grid; gap: 2px; justify-items: center; padding: 10px 4px; border-radius: 8px; border: 1px solid var(--line); background: rgba(10, 4, 6, .4); color: var(--ivory); }
.gift .emo { font-size: 26px; }
.gift small { font-size: 12px; color: var(--smoke); }
.gift[aria-pressed="true"] { border-color: var(--brass); background: rgba(184, 146, 90, .15); }
table.prices { width: 100%; border-collapse: collapse; font-size: 14px; }
table.prices td { padding: 8px 0; border-top: 1px solid var(--line); }
table.prices td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Pastki menyu ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: center;
  background: rgba(18, 8, 11, .96); border-top: 1px solid var(--line-2);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tabbar nav { display: flex; width: 100%; max-width: 560px; }
.tabbar button {
  position: relative; flex: 1; border: 0; background: transparent; color: var(--smoke-2);
  display: grid; justify-items: center; align-content: center; gap: 3px; font-size: 11.5px; font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--brass-hi); }
.tabbar button[aria-current="page"]::before {
  content: ""; position: absolute; top: -1px; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; margin-top: -5px;
  background: var(--brass); transform: rotate(45deg);
}
.tabbar .dot { position: absolute; top: 9px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--wine-hi); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }

/* ---------- Toast va modal ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 440px); padding: 11px 16px; border-radius: 10px;
  background: var(--ivory); color: var(--ink); font-weight: 500; font-size: 14.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #f3d6d6; color: #5c1018; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; justify-items: center; background: rgba(5, 2, 3, .66); }
.sheet {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto;
  padding: 20px var(--gutter) calc(20px + var(--safe-b)); border-radius: 16px 16px 0 0;
  background: var(--velvet-2); border-top: 1px solid var(--line-2);
  animation: rise .22s ease;
}
@media (min-width: 600px) { .modal { align-items: center; } .sheet { border-radius: 16px; border: 1px solid var(--line-2); } }
.sheet h2 { font-size: 22px; margin-bottom: 6px; }
.sheet .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* ---------- Kirish ekrani ---------- */
.gate { min-height: 88dvh; display: grid; align-content: center; justify-items: center; gap: 22px; text-align: center; padding: 24px 0; }
.gate .crest { width: 190px; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .55)); }
.gate .lede { margin: 0 auto; }
.gate .devlogin { display: grid; gap: 8px; width: 100%; max-width: 320px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }

.empty { text-align: center; padding: 26px 8px; color: var(--smoke); }
.empty b { display: block; font: 700 18px var(--serif); color: var(--ivory); margin-bottom: 4px; }
.spinner { width: 28px; height: 28px; margin: 40px auto; border: 3px solid var(--line-2); border-top-color: var(--brass); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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