/* Talaba.uz Mini App — zamonaviy dizayn. Fon va matn Telegram mavzusidan, aksent — brend ranglari. */

:root {
  /* Telegram mavzusi (yorug' / qorong'i avtomatik) */
  --bg: var(--tg-theme-secondary-bg-color, #f3f5fb);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #0f172a);
  --hint: var(--tg-theme-hint-color, #7c8499);
  --danger: var(--tg-theme-destructive-text-color, #ef4444);

  /* Brend */
  --brand: #3d63ff;
  --brand-2: #7b5cff;
  --brand-3: #1fb6ff;
  --brand-deep: #0b1440;
  --gold: #ffc53d;
  --grad: linear-gradient(135deg, #5b4bff 0%, #3d63ff 52%, #1fb6ff 100%);
  --grad-deep: linear-gradient(135deg, #0b1440 0%, #1a2a7a 55%, #2747d6 100%);
  --accent: var(--brand);
  --accent-text: #ffffff;
  --link: var(--brand);

  --sep: color-mix(in srgb, var(--hint) 18%, transparent);
  --soft: color-mix(in srgb, var(--brand) 10%, transparent);
  --soft-2: color-mix(in srgb, var(--brand) 16%, transparent);
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 1px rgba(15, 23, 42, 0.03), 0 6px 20px -8px rgba(30, 41, 99, 0.16);
  --shadow-lg: 0 14px 34px -12px rgba(45, 72, 220, 0.45);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 66px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--tg-theme-secondary-bg-color, #0b0f1a);
    --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #141a29));
    --text: var(--tg-theme-text-color, #e8ecf6);
    --hint: var(--tg-theme-hint-color, #8790a6);
  }
}
/* Telegram qorong'i mavzusida brend rangini biroz yorqinroq qilamiz */
html.dark {
  --brand: #6f8cff;
  --link: #8ea4ff;
  --soft: color-mix(in srgb, #6f8cff 14%, transparent);
  --soft-2: color-mix(in srgb, #6f8cff 22%, transparent);
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: 0.5; cursor: default; }
h1 { font-size: 21px; line-height: 1.25; margin: 0; letter-spacing: -0.3px; }
img { display: block; max-width: 100%; }

#app { min-height: 100vh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon.big { width: 34px; height: 34px; color: var(--brand); }
.muted { color: var(--hint); }
.pad { padding: 16px; }
.center { text-align: center; }

/* ── kirish animatsiyasi ── */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view > * { animation: rise 0.28s ease-out both; }
.view > *:nth-child(2) { animation-delay: 0.03s; }
.view > *:nth-child(3) { animation-delay: 0.06s; }
.view > *:nth-child(4) { animation-delay: 0.09s; }
.view > *:nth-child(n + 5) { animation-delay: 0.12s; }

/* ── yuqori panel ── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 8px 12px 8px 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.8) blur(18px);
  -webkit-backdrop-filter: saturate(1.8) blur(18px);
}
.topbar[hidden] { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.t1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t2 { font-size: 13px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.topbar-actions { display: flex; gap: 4px; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; color: var(--link); background: var(--soft); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 10px; color: var(--hint); background: none; }
.icon-btn.sm .icon { width: 17px; height: 17px; }
.top-avatar { width: 40px; height: 40px; border-radius: 14px; overflow: hidden; }
.top-avatar .avatar { width: 40px; height: 40px; border-radius: 14px; }

.view { flex: 1; padding: 2px 14px 28px; }
body.has-tabbar .view { padding-bottom: calc(var(--tabbar-h) + 34px + var(--safe-b)); }
body.has-composer .view { padding-bottom: calc(96px + var(--safe-b)); }
body.bare .view { padding-top: 12px; }

/* ── suzuvchi pastki menyu ── */
.tabbar {
  position: fixed; z-index: 20;
  left: max(12px, calc(50% - 308px)); right: max(12px, calc(50% - 308px));
  bottom: calc(10px + var(--safe-b));
  height: var(--tabbar-h);
  display: flex; align-items: center; justify-content: space-around; padding: 6px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.28), inset 0 0 0 1px color-mix(in srgb, var(--hint) 14%, transparent);
}
.tabbar[hidden] { display: none; }
.tab {
  flex: 1; height: 100%; max-width: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 18px; font-size: 10.5px; font-weight: 600; color: var(--hint);
  transition: color 0.15s, background 0.15s;
}
.tab .icon { width: 23px; height: 23px; }
.tab.active { color: var(--brand); background: var(--soft); }

.fab {
  position: fixed; z-index: 15;
  right: max(18px, calc(50% - 302px)); bottom: calc(var(--tabbar-h) + 24px + var(--safe-b));
  width: 56px; height: 56px; border-radius: 20px;
  display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: var(--shadow-lg);
}
.fab .icon { width: 26px; height: 26px; }
.fab:active { transform: scale(0.94); }

/* ── kartalar ── */
.card { display: block; width: 100%; text-align: left; background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
button.card, article.card { transition: transform 0.12s; }
button.card:active, article.card:active { transform: scale(0.985); }
.list { display: flex; flex-direction: column; gap: 10px; }
.list.tight { gap: 8px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 4px 10px; font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }
.section-title .see-all { font-size: 13.5px; font-weight: 600; color: var(--link); }
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.author { display: flex; align-items: center; gap: 10px; }
.author-text { flex: 1; min-width: 0; }
.author-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.author-meta { font-size: 12.5px; color: var(--hint); }
.role-dot { color: var(--brand); }

.avatar {
  position: relative; flex: none; overflow: hidden;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff;
  background: var(--grad);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; box-shadow: 0 0 0 4px var(--card), 0 0 0 6px var(--soft-2); }
.avatar.group { border-radius: 14px; background: linear-gradient(135deg, #12b886, #1fb6ff); }
.avatar.group.lg { width: 68px; height: 68px; border-radius: 22px; font-size: 22px; }

.post-body { margin-top: 10px; white-space: pre-wrap; word-break: break-word; }
.post-body.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.post.full .post-body { font-size: 16.5px; }
.post-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.post-comments { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; color: var(--hint); font-size: 13px; font-weight: 600; }
.post-comments .icon { width: 17px; height: 17px; }
.tag { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--soft); color: var(--link); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 9px; white-space: nowrap; }
.badge.q { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #d97706; }
.badge.a { background: var(--soft); color: var(--link); }

.teaser { display: flex; align-items: center; gap: 12px; color: var(--hint); margin-bottom: 12px; padding: 12px 14px; }
.teaser > span:last-child { flex: 1; padding: 10px 14px; border-radius: 14px; background: var(--bg); }
.teaser .icon { color: var(--brand); }

/* ── bosh sahifa: salom, banner, tezkor tugmalar ── */
.hello { display: flex; align-items: center; gap: 12px; }
.hello-text { flex: 1; min-width: 0; }

.banners { position: relative; margin: 4px 0 14px; }
.banner-track {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -14px; padding: 0 14px; scroll-padding: 0 14px;
}
.banner-track::-webkit-scrollbar { display: none; }
.slide {
  position: relative; flex: 0 0 100%; scroll-snap-align: start;
  aspect-ratio: 2.15 / 1; border-radius: 24px; overflow: hidden; text-align: left;
  background: var(--grad-deep) center / cover no-repeat; color: #fff; box-shadow: var(--shadow-lg);
}
.slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6, 12, 40, 0.72) 0%, rgba(6, 12, 40, 0.25) 55%, rgba(6, 12, 40, 0) 100%); pointer-events: none; }
.slide.no-shade::after { display: none; }
.slide-body { position: absolute; z-index: 1; left: 18px; right: 40%; top: 50%; transform: translateY(-50%); }
.slide-title { font-size: 21px; font-weight: 850; line-height: 1.15; letter-spacing: -0.4px; text-wrap: balance; }
.slide-sub { margin-top: 6px; font-size: 13px; opacity: 0.88; line-height: 1.35; }
.slide-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 8px 14px; border-radius: 12px; background: #fff; color: var(--brand-deep); font-size: 13px; font-weight: 800; }
.slide-cta .icon { width: 15px; height: 15px; }
.slide.brand { background: var(--grad-deep); }
.slide.brand .mascot {
  position: absolute; right: -6%; bottom: -4%; height: 112%; width: auto; max-width: none;
  -webkit-mask-image: radial-gradient(circle at 60% 50%, #000 45%, transparent 72%);
  mask-image: radial-gradient(circle at 60% 50%, #000 45%, transparent 72%);
}
.slide.brand .slide-title { font-size: 24px; }
.slide.brand .slide-title b { background: linear-gradient(90deg, #6fd3ff, #9fb4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.slide.brand::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(circle at 85% 30%, rgba(31, 182, 255, 0.45), transparent 45%), radial-gradient(circle at 10% 110%, rgba(123, 92, 255, 0.55), transparent 50%);
}
.dots { display: flex; justify-content: center; gap: 5px; margin-top: 10px; }
.dots i { width: 6px; height: 6px; border-radius: 99px; background: var(--sep); transition: all 0.25s; }
.dots i.on { width: 18px; background: var(--brand); }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 4px 10px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); font-size: 11.5px; font-weight: 700; line-height: 1.2; text-align: center; }
.quick-btn:active { transform: scale(0.96); }
.quick-ico { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #fff; }
.quick-ico .icon { width: 22px; height: 22px; }
.qi-1 { background: linear-gradient(135deg, #5b4bff, #3d63ff); }
.qi-2 { background: linear-gradient(135deg, #ff8a3d, #ff5c7a); }
.qi-3 { background: linear-gradient(135deg, #12b886, #1fb6ff); }
.qi-4 { background: linear-gradient(135deg, #a855f7, #ec4899); }

.uni-strip { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; }
.uni-strip .uni-short { min-width: 48px; height: 40px; }
.uni-strip-text { flex: 1; min-width: 0; font-size: 13px; color: var(--hint); }
.uni-strip-text b { color: var(--text); font-size: 14px; }

/* ── materiallar ── */
.mat { display: flex; gap: 14px; align-items: flex-start; }
.mat-main { flex: 1; min-width: 0; }
.mat-title { font-weight: 700; line-height: 1.3; word-break: break-word; }
.mat-meta { font-size: 13px; color: var(--hint); margin-top: 3px; }
.mat-stats { display: flex; gap: 12px; margin-top: 8px; font-size: 12.5px; color: var(--hint); align-items: center; flex-wrap: wrap; font-weight: 600; }
.mat-stats span { display: inline-flex; align-items: center; gap: 4px; }
.mat-stats .icon { width: 15px; height: 15px; }
.file-badge {
  flex: none; width: 46px; height: 54px; border-radius: 12px;
  display: grid; place-items: end center; padding-bottom: 8px;
  font-size: 10.5px; font-weight: 900; letter-spacing: 0.4px; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 72%, #fff) 0%, var(--c) 100%);
  clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%);
}
.file-badge.big { width: 70px; height: 84px; font-size: 14px; padding-bottom: 12px; border-radius: 14px; }
.mat-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 26px 16px 18px; }
.mat-h1 { margin-top: 6px; }
.mat-desc { margin: 4px 0 0; white-space: pre-wrap; text-align: left; width: 100%; }
.file-name { font-size: 12px; color: var(--hint); word-break: break-all; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; width: 100%; margin-top: 10px; }
.kv-item { background: var(--bg); border-radius: 14px; padding: 10px 8px; }
.kv-k { font-size: 11.5px; color: var(--hint); font-weight: 600; }
.kv-v { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; margin: 14px 0; }
.actions .btn.block { flex: 1.4; }
.actions .btn.ghost { flex: 1; }

.group-card { display: flex; align-items: center; gap: 12px; }
.chev { color: var(--hint); width: 18px; height: 18px; margin-left: auto; }
.group-hero, .uni-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 24px 16px; margin-bottom: 12px; }

/* ── tugmalar ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 48px; padding: 0 20px; border-radius: 16px;
  background: var(--grad); color: #fff; font-weight: 750; letter-spacing: -0.1px;
  box-shadow: 0 8px 20px -10px rgba(61, 99, 255, 0.8);
}
.btn:active { transform: scale(0.97); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--soft); color: var(--link); box-shadow: none; }
.btn.ghost.on { background: var(--grad); color: #fff; }
.btn.danger { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); box-shadow: none; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.sm .icon { width: 17px; height: 17px; }
.btn.more { display: flex; margin: 14px auto 0; }
.group-hero + .btn.block, .uni-hero + .btn.block { margin-bottom: 12px; }

/* ── tanlovlar ── */
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: color-mix(in srgb, var(--hint) 13%, transparent); }
.segmented button { flex: 1; min-height: 36px; border-radius: 12px; font-size: 14px; font-weight: 700; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; transition: all 0.15s; }
.segmented button.active { background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1); }
.chips { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.form .chips { margin: 0; padding: 0; flex-wrap: wrap; }
.chip { flex: none; padding: 8px 14px; border-radius: 99px; background: var(--card); font-size: 13.5px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--sep); white-space: nowrap; transition: all 0.15s; }
.chip.active { background: var(--brand); color: #fff; box-shadow: 0 6px 14px -8px var(--brand); }
.filter-row { display: flex; align-items: center; gap: 8px; }
.filter-row .chips { flex: 1; margin-right: 0; }
.sort-btn { flex: none; font-size: 13px; font-weight: 700; color: var(--link); padding: 6px 4px; }

/* ── formalar ── */
.form { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 13px; font-weight: 700; color: var(--hint); margin: 10px 4px 0; }
.input {
  width: 100%; border: 0; outline: 0; border-radius: 14px;
  padding: 13px 15px; background: var(--card);
  box-shadow: inset 0 0 0 1px var(--sep); resize: none; transition: box-shadow 0.15s;
}
.input:focus { box-shadow: inset 0 0 0 2px var(--brand); }
.input.big { min-height: 160px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--hint) 50%), linear-gradient(135deg, var(--hint) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.hint { font-size: 12.5px; color: var(--hint); margin: 4px 4px 8px; }
.search-row { position: relative; }
.search-row .search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--hint); }
.search-input { padding-left: 42px; border-radius: 16px; }
.search-row + .list { margin-top: 10px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; padding: 18px; border-radius: var(--radius);
  background: var(--card); border: 2px dashed color-mix(in srgb, var(--brand) 40%, transparent); text-align: center;
}
.dropzone.filled { flex-direction: row; justify-content: flex-start; text-align: left; border-style: solid; gap: 12px; }
.dropzone.img { padding: 0; overflow: hidden; aspect-ratio: 2.15 / 1; min-height: 0; border-style: solid; }
.dropzone.img img { width: 100%; height: 100%; object-fit: cover; }
.drop-t { font-weight: 700; color: var(--link); }
.progress { height: 6px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--grad); transition: width 0.2s; }

/* ── izohlar ── */
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--card); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); }
.comment-body { margin-top: 8px; white-space: pre-wrap; word-break: break-word; }
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: flex-end; gap: 8px; max-width: 640px; margin: 0 auto;
  padding: 10px 12px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 -1px 0 var(--sep);
}
.composer .input { background: var(--bg); box-shadow: none; padding: 11px 15px; border-radius: 22px; max-height: 140px; }
.send-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; }

/* ── turli bloklar ── */
.link-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 15px; margin: 10px 0; border-radius: 16px; background: var(--card); color: var(--link); font-weight: 600; text-align: left; box-shadow: var(--shadow); }
.notice { padding: 11px 14px; border-radius: 14px; margin-bottom: 10px; font-size: 13.5px; font-weight: 500; }
.notice.warn { background: color-mix(in srgb, #f59e0b 15%, transparent); color: #b45309; }
.cta { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cta-t { font-weight: 800; font-size: 16px; }
.cta.accent { margin-top: 12px; color: #fff; background: var(--grad-deep); position: relative; overflow: hidden; }
.cta.accent .mat-meta { color: rgba(255, 255, 255, 0.78); }
.cta.accent .btn { background: #fff; color: var(--brand-deep); box-shadow: none; }
.cta.accent::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(31, 182, 255, 0.5), transparent 70%); }
.invite { margin: 12px 0; }
.invite-t { display: flex; align-items: center; gap: 6px; font-weight: 700; margin-bottom: 8px; }
.invite-t .icon { color: var(--brand); width: 18px; height: 18px; }
.invite-link { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; padding: 10px 12px; border-radius: 12px; background: var(--bg); word-break: break-all; }
.invite-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.group-hero ~ .segmented { margin-bottom: 12px; }

.profile { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 30px 16px 20px; }
.profile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 74px; background: var(--grad); opacity: 0.95; }
.profile > * { position: relative; }
.profile-name { font-size: 21px; font-weight: 800; margin-top: 10px; letter-spacing: -0.3px; }
.profile-uni { margin: 10px 0 6px; font-weight: 600; }
.menu { margin-top: 12px; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 15px 16px; text-align: left; font-weight: 600; }
.menu-item + .menu-item { box-shadow: inset 0 1px 0 var(--sep); }
.menu-item > .icon:first-child { width: 34px; height: 34px; padding: 7px; border-radius: 11px; background: var(--soft); color: var(--brand); }

/* ── onboarding ── */
.welcome { text-align: center; padding: 12px 8px 4px; }
.welcome p { color: var(--hint); margin: 8px 0 0; }
.welcome-art { width: 200px; height: 200px; margin: 0 auto 14px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 6px var(--card), 0 18px 40px -14px rgba(45, 72, 220, 0.6); }
.welcome-art img { width: 100%; height: 100%; object-fit: cover; }
.gate-logo { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 24px; overflow: hidden; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--shadow-lg); }
.gate-logo img { width: 100%; height: 100%; object-fit: cover; }
.gate-logo .icon { width: 36px; height: 36px; }
.gate { text-align: center; padding: 20vh 24px 0; }
.sub-gate { padding: 8vh 8px 0; display: flex; flex-direction: column; gap: 10px; }
.sub-gate h1 { margin-top: 4px; }
.sub-gate p { margin: 0 0 8px; line-height: 1.5; }
.pending-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; margin: 10px 0; background: color-mix(in srgb, #f59e0b 13%, transparent); color: #b45309; font-size: 13.5px; font-weight: 600; }
.badge.p { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #d97706; }
.req-actions { display: flex; gap: 8px; margin-top: 12px; }
.gate p { color: var(--hint); }
.step { font-size: 12.5px; font-weight: 800; color: var(--brand); margin: 20px 4px 10px; text-transform: uppercase; letter-spacing: 0.6px; }
.uni-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: 18px; background: var(--card); text-align: left; box-shadow: var(--shadow); }
.uni-item.active { box-shadow: inset 0 0 0 2px var(--brand); }
.uni-short { flex: none; min-width: 60px; max-width: 96px; height: 42px; padding: 0 8px; border-radius: 13px; display: grid; place-items: center; font-size: 12.5px; font-weight: 900; color: var(--brand); background: var(--soft); overflow: hidden; }
.uni-short.big { height: 64px; width: auto; min-width: 92px; font-size: 21px; border-radius: 20px; color: #fff; background: var(--grad); box-shadow: var(--shadow-lg); }
.uni-text { flex: 1; min-width: 0; }
.uni-name { font-weight: 600; line-height: 1.3; }
.add-fac { margin-top: 10px; }
.add-fac summary { cursor: pointer; color: var(--link); font-weight: 600; }
.row { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.row .input { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; margin-top: 12px; }
.stats.grid3 { grid-template-columns: repeat(3, 1fr); margin: 0 0 12px; }
.stat { background: var(--bg); border-radius: 14px; padding: 12px 4px; text-align: center; }
.grid3 .stat { background: var(--card); box-shadow: var(--shadow); }
.stat-n { font-size: 20px; font-weight: 900; letter-spacing: -0.4px; }
.stat-l { font-size: 11.5px; color: var(--hint); font-weight: 600; }

.report-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.report-head .mat-meta { margin: 0 0 0 auto; }
.report-text { margin: 8px 0 4px; white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.user-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-actions { display: flex; gap: 6px; }
.segmented + div { margin-top: 12px; }

.banner-admin { display: flex; gap: 12px; align-items: center; }
.banner-thumb { flex: none; width: 112px; aspect-ratio: 2.15 / 1; border-radius: 12px; background: var(--bg) center / cover no-repeat; }
.banner-admin.off .banner-thumb { filter: grayscale(1); opacity: 0.55; }
.switch { display: inline-block; position: relative; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--sep); transition: background 0.2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.switch.on { background: #22c55e; }
.switch.on::after { transform: translateX(18px); }

/* ── bo'sh holat, skelet ── */
.empty { text-align: center; padding: 36px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-title { font-weight: 800; font-size: 17px; }
.empty-sub { color: var(--hint); font-size: 14px; max-width: 320px; }
.empty .btn { margin-top: 10px; }
.spinner-wrap { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.skel { height: 96px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 0%, color-mix(in srgb, var(--hint) 10%, var(--card)) 50%, var(--card) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skel.wide { height: 160px; border-radius: 24px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── toast va sheet ── */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 30px + var(--safe-b)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 16px;
  background: rgba(15, 20, 40, 0.94); color: #fff; font-size: 14px; font-weight: 600; text-align: center;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: #dc2626; }
.sheet-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0); transition: background 0.2s; display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap.open { background: rgba(5, 10, 30, 0.45); }
.sheet { width: 100%; max-width: 640px; background: var(--card); border-radius: 26px 26px 0 0; padding: 8px 12px calc(14px + var(--safe-b)); transform: translateY(100%); transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 9px; margin: 4px auto 2px; background: var(--sep); }
.sheet-wrap.open .sheet { transform: none; }
.sheet-title { text-align: center; color: var(--hint); font-size: 13px; font-weight: 600; padding: 12px; }
.sheet-item { display: block; width: 100%; padding: 15px; border-radius: 14px; font-weight: 700; font-size: 16px; text-align: center; color: var(--link); }
.sheet-item:active { background: var(--soft); }
.sheet-item.cancel { margin-top: 6px; color: var(--text); background: var(--bg); }

.devbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 8px; justify-content: center; padding: 6px; background: #1f2937; color: #fde68a; font-size: 12px; }
.devbar input { width: 80px; padding: 2px 6px; border-radius: 6px; border: 0; color: #111; }
.devbar button { padding: 2px 10px; border-radius: 6px; background: #fde68a; color: #111; font-weight: 600; }
body:has(.devbar) .topbar { top: 34px; }

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

/* ───── profil va reyting ───── */
.author.clickable { cursor: pointer; }
.author.clickable .author-name { color: inherit; }
.profile-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 6px; }
.level-badge { font-size: 12.5px; font-weight: 800; padding: 5px 11px; border-radius: 99px; background: var(--soft); color: var(--link); }
.link-inline { font-weight: 600; color: inherit; text-align: center; }
.profile-bio { margin: 2px 6px 8px; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; max-width: 420px; }
.profile .joined { margin-top: 10px; font-size: 12px; }
.bio-form { width: 100%; margin: 4px 0 6px; text-align: left; }
.bio-form textarea { resize: vertical; min-height: 76px; }
.row.between { justify-content: space-between; margin-top: 2px; }
.row.between .row { margin-top: 0; }
.stats.grid4 { margin: 12px 0 0; }
.grid4 .stat { background: var(--card); box-shadow: var(--shadow); padding: 12px 2px; }
.grid4 .stat-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.level-card { margin-top: 12px; }
.level-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.level-top .muted { font-size: 12.5px; font-weight: 600; text-align: right; }
.progress { height: 8px; margin: 10px 0; border-radius: 99px; background: var(--sep); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width 0.4s; }
.level-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--hint); }
.level-foot .see-all { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: var(--link); white-space: nowrap; }
.level-foot .see-all .icon { width: 15px; height: 15px; }
.top-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.top-row.me { box-shadow: inset 0 0 0 2px var(--brand), var(--shadow); }
.top-rank { flex: none; width: 28px; text-align: center; font-weight: 900; font-size: 15px; color: var(--hint); }
.top-rank:not(:empty) { font-variant-numeric: tabular-nums; }
.top-points { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.top-points b { font-size: 18px; font-weight: 900; color: var(--brand); }
.top-points span { font-size: 11px; color: var(--hint); font-weight: 600; }
.top-mine { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; }
.points-help { margin-top: 14px; }
.points-list { margin: 10px 0 4px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.points-list b { display: inline-block; min-width: 34px; color: var(--brand); }

/* ───── eng yaxshi javob, izoh rasmi ───── */
.badge.s { background: color-mix(in srgb, #22c55e 15%, transparent); color: #16a34a; }
.comment.best { box-shadow: inset 0 0 0 2px #22c55e, var(--shadow); }
.best-badge { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 8px; padding: 3px 10px 3px 7px; border-radius: 99px; font-size: 12px; font-weight: 800; color: #16a34a; background: color-mix(in srgb, #22c55e 14%, transparent); }
.best-badge .icon { width: 16px; height: 16px; }
.comment-img { display: block; margin-top: 10px; max-width: 100%; border-radius: 14px; overflow: hidden; background: var(--soft); }
.comment-img img { display: block; max-width: 100%; max-height: 320px; width: auto; height: auto; object-fit: contain; }
.pick-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 700; color: #16a34a; background: color-mix(in srgb, #22c55e 10%, transparent); }
.pick-btn .icon { width: 16px; height: 16px; }
.pick-btn.on { color: var(--hint); background: color-mix(in srgb, var(--hint) 12%, transparent); }
.attach-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--link); background: var(--soft); }
.attach-btn.on { color: #fff; background: var(--grad); }
.attach-preview { position: absolute; left: 12px; bottom: calc(100% + 8px); display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; border-radius: 16px; background: var(--card); box-shadow: 0 8px 24px -10px rgba(15, 23, 42, 0.4), inset 0 0 0 1px var(--sep); font-size: 12px; color: var(--hint); font-weight: 600; }
.attach-preview[hidden] { display: none; }
.attach-preview img { width: 56px; height: 56px; border-radius: 11px; object-fit: cover; }
.attach-x { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--hint) 15%, transparent); color: var(--text); }
.attach-x .icon { width: 15px; height: 15px; }
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 16, 0.92); animation: rise 0.2s ease-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; object-fit: contain; }
.lightbox-x { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, 0.14); }

/* ───── saqlash, taklif ───── */
.save-btn.on { color: #fff; background: var(--grad); }
.invite-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.invite-count { display: flex; flex-direction: column; line-height: 1.1; color: rgba(255, 255, 255, 0.8); font-size: 11.5px; font-weight: 600; }
.invite-count b { font-size: 22px; font-weight: 900; color: #fff; }

/* ───── admin statistika ───── */
.stat-sub { margin-top: 2px; font-size: 10.5px; color: var(--hint); font-weight: 600; padding: 0 4px; line-height: 1.25; }
.chart-card { margin-top: 12px; }
.chart-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 14.5px; }
.chart-top .muted { font-size: 12.5px; font-weight: 600; }
.chart-cap { margin: 4px 0 10px; font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.chart { position: relative; height: 120px; display: flex; align-items: flex-end; gap: 2px; padding-top: 14px; border-bottom: 1px solid var(--sep); background: linear-gradient(var(--sep), var(--sep)) 0 14px / 100% 1px no-repeat; }
.chart-max { position: absolute; top: 0; right: 0; font-size: 10.5px; color: var(--hint); font-weight: 600; line-height: 1; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 0 1px; border-radius: 6px 6px 0 0; }
.bar i { display: block; width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--brand) 55%, transparent); transition: background 0.15s; }
.bar.today i { background: color-mix(in srgb, var(--brand) 80%, transparent); }
.bar.sel i, .bar:hover i { background: var(--brand); }
.bar.sel { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.chart-x { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--hint); font-weight: 600; }
.rank-table { padding: 6px 0; }
.rank-head, .rank-line { display: grid; grid-template-columns: 1fr 70px 70px; align-items: center; gap: 8px; width: 100%; padding: 10px 16px; text-align: left; }
.rank-line.two { grid-template-columns: 1fr auto; }
.rank-head { font-size: 11.5px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: 0.4px; padding-top: 6px; padding-bottom: 6px; }
.rank-head span:not(:first-child), .rank-line span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.rank-line + .rank-line, .rank-head + .rank-line { box-shadow: inset 0 1px 0 var(--sep); }
.rank-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
