/* TarixPro umumiy paneli. Bo‘limlar CSS'i bilan to‘qnashmasligi uchun hamma narsa #tp-panel ichida
   va o‘z ranglariga ega (bo‘lim mavzusidan qat'i nazar bir xil ko‘rinadi). */
:root { --tp-h: 40px; }
html.tp-yashir body { visibility: hidden; }

#tp-panel {
  --tp-fon: #17140f; --tp-matn: #efe6d5; --tp-xira: #b9ad97; --tp-urg: #e2b25c; --tp-chiziq: #3a332a;
  position: relative; z-index: 2147483000; height: var(--tp-h); box-sizing: border-box;
  background: var(--tp-fon); color: var(--tp-matn); border-bottom: 1px solid var(--tp-chiziq);
  font: 500 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: normal; text-align: left;
}
#tp-panel *, #tp-panel *::before, #tp-panel *::after { box-sizing: border-box; }
#tp-panel .tp-ichi { display: flex; align-items: center; gap: 10px; height: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
#tp-panel a, #tp-panel button { font: inherit; color: inherit; text-decoration: none; margin: 0; }
#tp-panel a:focus-visible, #tp-panel button:focus-visible { outline: 2px solid var(--tp-urg); outline-offset: 2px; }

#tp-panel .tp-logo { display: inline-flex; align-items: center; gap: 7px; padding: 6px 4px; border-radius: 6px; font-weight: 600; font-size: 15px; white-space: nowrap; }
#tp-panel .tp-logo svg { width: 20px; height: 20px; color: var(--tp-urg); }
#tp-panel .tp-logo b { color: var(--tp-urg); font-weight: 700; }

#tp-panel .tp-menyu { position: relative; min-width: 0; }
#tp-panel .tp-bolim {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 30px; padding: 0 10px;
  background: transparent; border: 1px solid var(--tp-chiziq); border-radius: 8px; cursor: pointer; white-space: nowrap;
}
#tp-panel .tp-bolim span:first-child { overflow: hidden; text-overflow: ellipsis; }
#tp-panel .tp-bolim:hover { border-color: var(--tp-xira); }
#tp-panel .tp-uq { color: var(--tp-xira); font-size: 11px; }
#tp-panel .tp-royxat {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; margin: 0; padding: 6px; list-style: none;
  background: var(--tp-fon); border: 1px solid var(--tp-chiziq); border-radius: 10px; box-shadow: 0 12px 32px rgb(0 0 0 / .35);
}
#tp-panel .tp-royxat[hidden] { display: none; }
#tp-panel .tp-royxat li { margin: 0; padding: 0; }
#tp-panel .tp-royxat a { display: block; padding: 10px 12px; border-radius: 7px; line-height: 1.2; }
#tp-panel .tp-royxat a:hover { background: #2a241c; }
#tp-panel .tp-royxat a[aria-current] { color: var(--tp-urg); font-weight: 600; }

#tp-panel .tp-ong { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#tp-panel .tp-alifbo { height: 30px; padding: 0 10px; background: transparent; border: 1px solid var(--tp-chiziq); border-radius: 8px; cursor: pointer; color: var(--tp-xira); }
#tp-panel .tp-alifbo:hover { color: var(--tp-matn); border-color: var(--tp-xira); }

@media (max-width: 420px) {
  #tp-panel .tp-ichi { padding: 0 10px; gap: 8px; }
  #tp-panel .tp-logo span { display: none; }
}

/* Panel bor bo‘lsa bo‘limlardagi «← Barcha bo‘limlar» havolasi ortiqcha */
.tp-bor [data-bosh], .tp-bor .bosh-havola { display: none !important; }

/* Butun ekranli xarita: panel ostidan boshlanadi */
html.tp-bor[data-tp-bolim="xarita"] .ilova { top: var(--tp-h); }

/* ---------- zanjir nishoni va profil oynasi ---------- */
#tp-panel .tp-zanjir-qism { position: relative; }
#tp-panel .tp-zanjir { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; background: transparent; border: 1px solid var(--tp-chiziq); border-radius: 8px; cursor: pointer; color: var(--tp-xira); font-weight: 700; }
#tp-panel .tp-zanjir svg { width: 16px; height: 16px; }
#tp-panel .tp-zanjir.bajarildi { color: #ff9f43; border-color: #6b4a22; }
#tp-panel .tp-zanjir:hover { border-color: var(--tp-xira); }
#tp-panel .tp-profil {
  position: absolute; top: calc(100% + 8px); right: 0; width: min(340px, calc(100vw - 20px)); max-height: calc(100vh - 70px); overflow: auto;
  padding: 16px; background: var(--tp-fon); color: var(--tp-matn); border: 1px solid var(--tp-chiziq); border-radius: 12px;
  box-shadow: 0 14px 36px rgb(0 0 0 / .4); font-weight: 400; line-height: 1.4;
}
#tp-panel .tp-profil[hidden] { display: none; }
#tp-panel .tp-profil b { font-weight: 700; }
#tp-panel .tp-profil small { color: var(--tp-xira); font-size: 12.5px; }
#tp-panel .tp-profil-bosh { display: flex; align-items: center; gap: 12px; }
#tp-panel .tp-profil-bosh b { display: block; font-size: 22px; }
#tp-panel .tp-katta-olov { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: #2a241c; color: var(--tp-xira); }
#tp-panel .tp-katta-olov.bajarildi { color: #ff9f43; background: #3a2a14; }
#tp-panel .tp-katta-olov svg { width: 28px; height: 28px; }
#tp-panel .tp-bugun { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: #221d16; display: grid; gap: 6px; }
#tp-panel .tp-bugun-matn { display: flex; justify-content: space-between; gap: 8px; }
#tp-panel .tp-chiziq { display: block; height: 7px; border-radius: 99px; background: #3a332a; overflow: hidden; }
#tp-panel .tp-chiziq > span { display: block; height: 100%; background: #ff9f43; border-radius: inherit; }
#tp-panel .tp-chiziq.kichik { grid-column: 1 / -1; height: 5px; }
#tp-panel .tp-chiziq.kichik > span { background: var(--tp-urg); }
#tp-panel .tp-kunlar { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; list-style: none; margin: 12px 0 0; padding: 0; }
#tp-panel .tp-kunlar li { height: 16px; border-radius: 4px; background: #2e281f; }
#tp-panel .tp-kunlar li.bajarildi { background: #ff9f43; }
#tp-panel .tp-kunlar li.muzlatildi { background: #6fb7e0; }
#tp-panel .tp-kunlar li.bugun { outline: 1.5px dashed var(--tp-xira); outline-offset: -2px; background: transparent; }
#tp-panel .tp-muz { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; font-size: 13px; color: var(--tp-xira); }
#tp-panel .tp-muz svg { flex: none; width: 18px; height: 18px; color: #6fb7e0; margin-top: 1px; }
#tp-panel .tp-muz b { color: var(--tp-matn); }
#tp-panel .tp-unvon { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--tp-chiziq); }
#tp-panel .tp-unvon-nomi { margin: 0; display: flex; align-items: baseline; gap: 8px; }
#tp-panel .tp-unvon-nomi b { font: 700 22px Georgia, "Iowan Old Style", serif; color: var(--tp-urg); }
#tp-panel .tp-keyingi { margin: 8px 0 6px; font-size: 13.5px; }
#tp-panel .tp-unvon ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#tp-panel .tp-unvon li { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; font-size: 13px; }
#tp-panel .tp-unvon li.ok b { color: #6fcf97; }
#tp-panel .tp-izoh { margin: 10px 0 0; font-size: 12px; color: var(--tp-xira); }
#tp-panel .tp-nishonlar { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
#tp-panel .tp-nishonlar span { padding: 3px 9px; border-radius: 99px; background: #3a2a14; color: #ffb066; font-size: 12px; font-weight: 700; }
#tp-panel .tp-yashirin { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tp-xabar {
  position: fixed; left: 50%; bottom: 24px; z-index: 2147483001; transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 12px; background: #17140f; color: #efe6d5; border: 1px solid #6b4a22;
  font: 600 15px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; box-shadow: 0 10px 30px rgb(0 0 0 / .35);
  transition: opacity .5s, transform .5s;
}
.tp-xabar.ket { opacity: 0; transform: translate(-50%, 12px); }
@media (prefers-reduced-motion: reduce) { .tp-xabar { transition: none; } }
@media (max-width: 520px) {
  #tp-panel .tp-profil { position: fixed; top: calc(var(--tp-h) + 6px); left: 10px; right: 10px; width: auto; }
}

/* ---------- akkaunt ---------- */
#tp-panel .tp-akk-qism { position: relative; }
#tp-panel .tp-akk { display: inline-grid; place-items: center; width: 32px; height: 30px; padding: 0; background: transparent; border: 1px solid var(--tp-chiziq); border-radius: 8px; cursor: pointer; color: var(--tp-xira); }
#tp-panel .tp-akk svg { width: 17px; height: 17px; }
#tp-panel .tp-akk:hover { border-color: var(--tp-xira); color: var(--tp-matn); }
#tp-panel .tp-akk.kirgan { background: var(--tp-urg); border-color: var(--tp-urg); color: #17140f; }
#tp-panel .tp-bosh-harf { font-weight: 800; font-size: 14px; }
#tp-panel .tp-akk-oyna { width: min(320px, calc(100vw - 20px)); }
#tp-panel .tp-akk-ism { margin: 0 0 6px; }
#tp-panel .tp-akk-ism b { display: block; font-size: 17px; }
#tp-panel .tp-akk-tugma { display: block; width: 100%; margin-top: 12px; min-height: 42px; border-radius: 10px; border: 0; background: var(--tp-urg); color: #17140f; font-weight: 700; cursor: pointer; }
#tp-panel .tp-akk-tugma.tg { background: #2aabee; color: #fff; }
#tp-panel .tp-akk-tugma.ikkinchi { background: transparent; color: var(--tp-matn); border: 1px solid var(--tp-chiziq); }
#tp-panel .tp-akk-tugma:disabled { opacity: .6; cursor: default; }
#tp-panel .tp-akk-amallar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#tp-panel .tp-akk-holat { margin: 10px 0 0; font-size: 13px; color: var(--tp-matn); }
#tp-panel .tp-akk-holat a { color: #6fb7e0; }
@media (max-width: 420px) {
  #tp-panel .tp-ong { gap: 6px; }
  #tp-panel .tp-alifbo { padding: 0 8px; }
  #tp-panel .tp-zanjir { padding: 0 8px; }
}
@media (max-width: 520px) {
  #tp-panel .tp-akk-oyna { position: fixed; top: calc(var(--tp-h) + 6px); left: 10px; right: 10px; width: auto; }
}

/* ---------- AI ustoz ---------- */
#tp-panel .tp-ustoz-tugma { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--tp-urg); background: transparent; border: 1px solid var(--tp-chiziq); border-radius: 8px; cursor: pointer; }
#tp-panel .tp-ustoz-tugma:hover { border-color: var(--tp-urg); }
.tp-ustoz {
  --u-fon: #fffdf8; --u-matn: #1f1b14; --u-xira: #6b6455; --u-chiziq: #e2dac9; --u-urg: #8a5a12; --u-och: #f5ecd9; --u-togri: #2d6a4f; --u-xato: #a23b2a;
  width: min(640px, calc(100vw - 24px)); max-height: min(86vh, 760px); padding: 0; border: 1px solid var(--u-chiziq); border-radius: 14px;
  background: var(--u-fon); color: var(--u-matn); font: 15.5px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; box-shadow: 0 20px 50px rgb(0 0 0 / .35);
}
@media (prefers-color-scheme: dark) {
  .tp-ustoz { --u-fon: #1d1a15; --u-matn: #efe6d5; --u-xira: #b9ad97; --u-chiziq: #3a332a; --u-urg: #e2b25c; --u-och: #2b2419; --u-togri: #74c69d; --u-xato: #f08c7a; }
}
.tp-ustoz::backdrop { background: rgb(0 0 0 / .45); }
.tp-ustoz[open] { display: flex; flex-direction: column; }
.tp-u-bosh { display: flex; align-items: baseline; gap: 8px; padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--u-chiziq); }
.tp-u-bosh b { font-size: 1.05rem; color: var(--u-urg); }
.tp-u-bosh span { color: var(--u-xira); font-size: .85rem; }
.tp-u-yop { margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--u-xira); font-size: 16px; cursor: pointer; }
.tp-u-yop:hover { background: var(--u-och); }
.tp-u-ich { overflow-y: auto; padding: 14px 18px 18px; }
.tp-u-ich p { margin: 0 0 8px; }
.tp-u-ich h3 { margin: 16px 0 6px; font-size: .98rem; }
.tp-u-forma { display: grid; gap: 8px; }
.tp-u-yorliq { font-weight: 600; font-size: .9rem; }
.tp-u-forma textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 72px; padding: 10px 12px; border: 1px solid var(--u-chiziq); border-radius: 10px; background: transparent; color: inherit; font: inherit; }
.tp-u-forma textarea:focus { outline: 2px solid var(--u-urg); outline-offset: 1px; }
.tp-u-tugma { justify-self: start; min-height: 40px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--u-urg); color: var(--u-fon); font: 600 .95rem inherit; font-family: inherit; cursor: pointer; }
.tp-u-tugma:disabled { opacity: .55; cursor: wait; }
.tp-u-javob { margin-top: 12px; }
.tp-u-kut { color: var(--u-xira); }
.tp-u-savoli { padding: 8px 12px; margin-bottom: 10px; border-radius: 10px; background: var(--u-och); font-weight: 600; }
.tp-u-band { padding-left: 14px; position: relative; }
.tp-u-band::before { content: "•"; position: absolute; left: 2px; color: var(--u-urg); }
.tp-u-belgi { color: var(--u-urg); font-size: .72em; font-weight: 700; }
.tp-u-manba { margin-top: 10px !important; padding-top: 8px; border-top: 1px dashed var(--u-chiziq); color: var(--u-xira); font-size: .86rem; }
.tp-u-qoldi, .tp-u-izoh { color: var(--u-xira); font-size: .8rem; }
.tp-u-izoh { margin-top: 14px !important; }
.tp-u-variant { padding: 4px 10px; border-left: 3px solid; font-size: .92rem; }
.tp-u-variant.xato { border-color: var(--u-xato); }
.tp-u-variant.togri { border-color: var(--u-togri); }
.tp-u-xato { padding: 12px 14px; border-radius: 10px; background: var(--u-och); }
.tp-u-xato .tp-u-tugma { margin-top: 4px; }
.tp-u-tuzoq { margin-top: 10px; padding: 12px; border: 1px solid var(--u-chiziq); border-radius: 10px; }
.tp-u-tuzoq button { display: block; width: 100%; margin-top: 6px; padding: 8px 10px; text-align: left; border: 1px solid var(--u-chiziq); border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.tp-u-tuzoq button span { font-weight: 700; color: var(--u-urg); }
.tp-u-tuzoq button.togri { border-color: var(--u-togri); background: color-mix(in srgb, var(--u-togri) 14%, transparent); }
.tp-u-tuzoq button.xato { border-color: var(--u-xato); background: color-mix(in srgb, var(--u-xato) 14%, transparent); }
.tp-u-tuzoq button.xira { opacity: .55; }
.tp-u-tuzoq-izoh { margin-top: 8px !important; color: var(--u-xira); font-size: .9rem; }
.nega-tugma { margin-top: 8px; padding: 6px 12px; border: 1px solid currentColor; border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }

/* Audio-podkast pleyeri (umumiy/audio.js) — bo‘lim ranglarini meros qilib oladi */
.tp-podkast { margin: 14px 0; padding: 12px 14px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); border-radius: 12px; background: color-mix(in srgb, currentColor 5%, transparent); }
.tp-pk-bosh { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tp-pk-bosh svg { flex: none; opacity: .8; }
.tp-pk-bosh b { display: block; font-size: 1rem; }
.tp-pk-bosh span { font-size: .88rem; opacity: .75; }
.tp-podkast audio { display: block; width: 100%; height: 40px; }
.tp-pk-amallar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tp-pk-amallar button { padding: 5px 12px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.tp-pk-amallar button.bor { border-color: currentColor; }
.tp-pk-amallar button:disabled { opacity: .6; cursor: progress; }
@media print { .tp-podkast { display: none; } }
