/* Niyyatuz stat — oddiy, toza, Apple/Telegram uslubida */
:root {
  --fon: #ffffff;
  --fon-2: #f4f4f6;
  --fon-3: #ebebef;
  --chiziq: #e6e6ea;
  --matn: #111214;
  --matn-2: #6b6d76;
  --matn-3: #9a9ca5;
  --asosiy: #2f6bff;
  --asosiy-och: #e8efff;
  --yashil: #1f9d55;
  --yashil-2: #17864a;
  --meniki: #2f6bff;
  --meniki-matn: #ffffff;
  --uniki: #f1f1f4;
  --uniki-matn: #111214;
  --xato: #d93025;
  --soya: 0 1px 2px rgba(17, 18, 20, .06), 0 8px 24px rgba(17, 18, 20, .06);
  --radius: 14px;
  --shrift: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fon: #111214;
    --fon-2: #1a1b1f;
    --fon-3: #24252a;
    --chiziq: #2a2b31;
    --matn: #f2f2f4;
    --matn-2: #a3a5ad;
    --matn-3: #74767f;
    --asosiy: #5b8cff;
    --asosiy-och: #1d2742;
    --yashil: #2bb36a;
    --yashil-2: #239657;
    --meniki: #3b6ff0;
    --uniki: #23242a;
    --uniki-matn: #f2f2f4;
    --xato: #ff6b5e;
    --soya: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fon: #111214; --fon-2: #1a1b1f; --fon-3: #24252a; --chiziq: #2a2b31;
  --matn: #f2f2f4; --matn-2: #a3a5ad; --matn-3: #74767f;
  --asosiy: #5b8cff; --asosiy-och: #1d2742; --yashil: #2bb36a; --yashil-2: #239657;
  --meniki: #3b6ff0; --uniki: #23242a; --uniki-matn: #f2f2f4; --xato: #ff6b5e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fon);
  color: var(--matn);
  font: 15px/1.45 var(--shrift);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--asosiy); }

/* ---- umumiy elementlar ---- */
.belgi {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--matn); color: var(--fon);
  font-weight: 700; font-size: 16px; letter-spacing: -.02em;
}
.belgi-katta { width: 56px; height: 56px; border-radius: 16px; font-size: 28px; margin: 0 auto 16px; }

.tugma {
  border: 0; border-radius: 12px; padding: 12px 18px;
  background: var(--fon-2); font-weight: 600;
  transition: background .15s, transform .1s;
}
.tugma:hover { background: var(--fon-3); }
.tugma:active { transform: scale(.98); }
.tugma.asosiy { background: var(--asosiy); color: #fff; }
.tugma.asosiy:hover { filter: brightness(1.06); }
.tugma.keng { width: 100%; }
.tugma:disabled { opacity: .5; cursor: default; }

.ikon-tugma {
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: transparent; color: var(--matn-2);
  transition: background .15s, color .15s;
}
.ikon-tugma:hover { background: var(--fon-2); color: var(--matn); }
.ikon-tugma.aylanmoqda svg { animation: aylan .7s linear infinite; }
@keyframes aylan { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ikon-tugma.aylanmoqda svg { animation: none; } }

.ecover-tugma {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--yashil); color: #fff; text-decoration: none;
  font-weight: 650; font-size: 14px; letter-spacing: -.01em; white-space: nowrap;
  box-shadow: 0 2px 10px rgba(31, 157, 85, .28);
  transition: background .15s, transform .1s;
}
.ecover-tugma:hover { background: var(--yashil-2); }
.ecover-tugma:active { transform: scale(.97); }
.ecover-tugma svg { width: 16px; height: 16px; stroke-width: 2.4; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 650; font-size: 16px; color: #fff; border: 0;
  background: var(--av, #8e8e93);
  user-select: none;
}
.avatar-kichik { width: 34px; height: 34px; font-size: 13px; }
.avatar-katta { width: 76px; height: 76px; font-size: 28px; margin: 0 auto 12px; }

.izoh { color: var(--matn-2); margin: 0; }
.xato { color: var(--xato); min-height: 1.4em; margin: 8px 0; font-size: 14px; }

/* ---- kirish ---- */
.kirish {
  min-height: 100dvh; display: grid; place-items: center;
  padding: 24px 16px; background: var(--fon-2);
}
.kirish-karta {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--fon); border-radius: 22px; padding: 36px 28px 28px;
  box-shadow: var(--soya);
}
.kirish-karta h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.kirish-karta .izoh { margin-bottom: 24px; font-size: 14px; }
.maydon { display: block; text-align: left; }
.maydon > span { display: block; font-size: 13px; font-weight: 600; color: var(--matn-2); margin: 0 0 6px 2px; }
.maydon input, .maydon textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--chiziq); background: var(--fon-2);
  font-size: 16px; outline: none; transition: border-color .15s, background .15s;
}
.maydon input:focus, .maydon textarea:focus { border-color: var(--asosiy); background: var(--fon); }
.kirish-ecover { margin-top: 18px; }

/* ---- ilova joylashuvi ---- */
.ilova {
  height: 100dvh; display: grid;
  grid-template-columns: 340px 1fr 300px;
  grid-template-rows: 60px 1fr;
  grid-template-areas: "ustki ustki ustki" "royxat suhbat yon";
}
.ustki {
  grid-area: ustki; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--chiziq); background: var(--fon);
  padding-top: env(safe-area-inset-top);
}
.brend { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.ustki-ong { display: flex; align-items: center; gap: 6px; }

.men-menyu { position: relative; margin-left: 4px; }
.menyu-oyna {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 200px;
  background: var(--fon); border: 1px solid var(--chiziq); border-radius: 14px;
  box-shadow: var(--soya); padding: 6px;
}
.menyu-bosh { padding: 10px 12px; display: grid; gap: 2px; border-bottom: 1px solid var(--chiziq); margin-bottom: 6px; }
.menyu-bosh span { color: var(--matn-2); font-size: 13px; }
.menyu-band { width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; color: var(--xato); font-weight: 600; }
.menyu-band:hover { background: var(--fon-2); }

/* ---- suhbatlar roʻyxati ---- */
.royxat { grid-area: royxat; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--chiziq); }
.qidiruv {
  margin: 12px 12px 8px; display: flex; align-items: center; gap: 8px;
  background: var(--fon-2); border-radius: 12px; padding: 0 12px; color: var(--matn-3);
}
.qidiruv svg { width: 18px; height: 18px; }
.qidiruv input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 10px 0; font-size: 15px; color: var(--matn); }
.suhbatlar { list-style: none; margin: 0; padding: 4px 8px 16px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.suhbat-band {
  width: 100%; display: flex; gap: 12px; align-items: center;
  padding: 10px; border: 0; border-radius: 14px; background: none; text-align: left;
  transition: background .12s;
}
.suhbat-band:hover { background: var(--fon-2); }
.suhbat-band.faol { background: var(--asosiy-och); }
.band-matn { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.band-qator { display: flex; align-items: center; gap: 8px; min-width: 0; }
.suhbatlar { overflow-x: hidden; }
.band-ism { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-vaqt { font-size: 12px; color: var(--matn-3); flex: none; }
.band-oxirgi { flex: 1; min-width: 0; color: var(--matn-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.band-oxirgi .belgilar { flex: none; }
.band-oxirgi span { overflow: hidden; text-overflow: ellipsis; }
.oqilmagan {
  flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--asosiy); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.bosh-royxat { color: var(--matn-3); text-align: center; padding: 32px 16px; font-size: 14px; }

/* ---- suhbat oynasi ---- */
.suhbat { grid-area: suhbat; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--fon); }
.bosh { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--matn-3); }
.bosh-ikon { width: 64px; height: 64px; border-radius: 50%; background: var(--fon-2); display: grid; place-items: center; }
.bosh-ikon svg { width: 28px; height: 28px; }
.bosh p { margin: 0; }

.suhbat-yuqori {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-bottom: 1px solid var(--chiziq); min-height: 60px;
}
.orqaga { display: none; }
.sherik { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; text-align: left; padding: 4px 6px; border-radius: 12px; }
.sherik:hover { background: var(--fon-2); }
.sherik .avatar { width: 40px; height: 40px; font-size: 15px; }
.sherik-matn { min-width: 0; display: grid; }
.sherik-matn strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.holat { font-size: 13px; color: var(--matn-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.holat.yaqin { color: var(--asosiy); }

.xabarlar {
  flex: 1; overflow-y: auto; padding: 16px max(16px, calc((100% - 760px) / 2)) 8px;
  display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain;
  background: var(--fon-2);
}
.sana-belgi {
  align-self: center; margin: 14px 0 8px; padding: 4px 12px; border-radius: 999px;
  background: var(--fon); color: var(--matn-2); font-size: 12px; font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.eslatma {
  align-self: center; text-align: center; max-width: 320px;
  margin: 2px 0 6px; font-size: 12px; color: var(--matn-3);
}
.xabar {
  max-width: min(78%, 560px); padding: 8px 12px 6px; border-radius: 18px;
  background: var(--uniki); color: var(--uniki-matn);
  align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.xabarlar .xabar { background: var(--fon); }
.xabar.meniki { align-self: flex-end; background: var(--meniki); color: var(--meniki-matn); }
.xabar + .xabar:not(.meniki), .xabar.meniki + .xabar.meniki { margin-top: 0; }
.xabar:not(.meniki) + .xabar.meniki, .xabar.meniki + .xabar:not(.meniki) { margin-top: 8px; }
.xabar.meniki a { color: #fff; }
.xabar-oyoq { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; color: var(--matn-3); user-select: none; }
.xabar.meniki .xabar-oyoq { color: rgba(255,255,255,.75); }
.belgilar { display: inline-flex; align-items: center; }
.belgilar svg { width: 16px; height: 16px; stroke-width: 2.2; }
.belgilar.oqildi { color: #b9f6ca; }
.band-oxirgi .belgilar { color: var(--matn-3); }
.band-oxirgi .belgilar.oqildi { color: var(--asosiy); }
.xabar.yangi { animation: chiq .18s ease-out; }
@keyframes chiq { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .xabar.yangi { animation: none; } }

.yozish {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px max(12px, calc((100% - 760px) / 2)); padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--chiziq); background: var(--fon);
}
.yozish textarea {
  flex: 1; min-width: 0; resize: none; max-height: 160px;
  padding: 10px 14px; border-radius: 20px; border: 1px solid var(--chiziq);
  background: var(--fon-2); font-size: 16px; line-height: 1.35; outline: none;
}
.yozish textarea:focus { border-color: var(--asosiy); background: var(--fon); }
.yubor {
  width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%;
  background: var(--asosiy); color: #fff; display: grid; place-items: center;
  transition: transform .1s, opacity .15s;
}
.yubor:active { transform: scale(.94); }
.yubor:disabled { opacity: .35; cursor: default; }

/* ---- reklama banneri ---- */
.yon { grid-area: yon; border-left: 1px solid var(--chiziq); padding: 16px; overflow-y: auto; }
.banner {
  border-radius: 20px; padding: 20px; color: #fff;
  background: linear-gradient(150deg, #14532d 0%, #1f9d55 60%, #34c77b 100%);
  box-shadow: var(--soya);
}
.banner-yorliq { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: rgba(255,255,255,.18); padding: 4px 9px; border-radius: 999px; }
.banner h3 { margin: 12px 0 6px; font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }
.banner p { margin: 0 0 14px; opacity: .9; font-size: 14px; }
.banner ul { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.banner li { display: flex; gap: 8px; font-size: 14px; background: rgba(255,255,255,.12); padding: 9px 11px; border-radius: 12px; }
.banner li::before { content: ""; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: #fff; flex: none; }
.banner-tugma {
  display: flex; justify-content: center; align-items: center; gap: 6px;
  background: #fff; color: #14532d; text-decoration: none; font-weight: 700;
  padding: 11px 14px; border-radius: 12px; transition: transform .1s;
}
.banner-tugma:active { transform: scale(.98); }
.banner-tugma svg { width: 16px; height: 16px; }

.banner-ixcham { display: none; }
.banner-ixcham a {
  margin: 0 12px 8px; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 16px; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, #14532d, #1f9d55);
}
.banner-ixcham .bi-matn { flex: 1; min-width: 0; display: grid; }
.banner-ixcham strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-ixcham span { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-ixcham svg { width: 18px; height: 18px; }

/* ---- profil oynasi ---- */
.profil {
  border: 0; border-radius: 22px; padding: 28px 24px 22px; width: min(360px, calc(100% - 32px));
  background: var(--fon); color: var(--matn); box-shadow: var(--soya); text-align: center;
}
.profil::backdrop { background: rgba(0,0,0,.35); }
.profil h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.profil dl { margin: 18px 0; text-align: left; background: var(--fon-2); border-radius: 14px; }
.profil dl div { padding: 10px 14px; }
.profil dl div + div { border-top: 1px solid var(--chiziq); }
.profil dt { font-size: 12px; color: var(--matn-2); }
.profil dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---- oʻrta ekranlar: banner chap panel tepasiga ---- */
@media (max-width: 1100px) {
  .ilova { grid-template-columns: 320px 1fr; grid-template-areas: "ustki ustki" "royxat suhbat"; }
  .yon { display: none; }
  .banner-ixcham { display: block; }
}

/* ---- telefon: roʻyxat va suhbat alohida ekran ---- */
@media (max-width: 760px) {
  .ilova { grid-template-columns: 1fr; grid-template-rows: auto 1fr; grid-template-areas: "ustki" "royxat"; }
  .ustki { padding-left: 12px; padding-right: 8px; min-height: 56px; }
  .brend span { font-size: 16px; }
  .ecover-tugma { height: 34px; padding: 0 12px; }
  .suhbat { display: none; }
  .ilova.suhbat-ochiq { grid-template-rows: 1fr; grid-template-areas: "suhbat"; }
  .ilova.suhbat-ochiq .ustki, .ilova.suhbat-ochiq .royxat { display: none; }
  .ilova.suhbat-ochiq .suhbat { display: flex; height: 100dvh; }
  .suhbat-yuqori { padding-top: max(8px, env(safe-area-inset-top)); }
  .orqaga { display: grid; }
  .royxat { border-right: 0; }
  .xabar { max-width: 85%; }
  .xabarlar { padding: 12px 10px 6px; }
  .yozish { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 360px) {
  .brend span { display: none; }
}
@media (hover: none) {
  .ikon-tugma:hover, .suhbat-band:hover, .sherik:hover { background: transparent; }
  .suhbat-band.faol { background: var(--asosiy-och); }
  .suhbat-band:active, .sherik:active, .ikon-tugma:active { background: var(--fon-2); }
}
