/* Masofaviy ta'lim — Telegram WebApp. Kunduzgi/tungi mavzu: html[data-theme] (Telegram colorScheme'dan). */
:root{
  --bg:#F4F6FB;--card:#FFFFFF;--ink:#0F172A;--muted:#64748B;--line:#EEF2F7;--soft:#F1F5F9;
  --blue:#2563EB;--blue-ink:#1D4ED8;--blue-soft:#DBEAFE;--on-blue:#DBEAFE;
  --good:#15803D;--good-soft:#DCFCE7;--warn:#C2410C;--warn-soft:#FFEDD5;--bad:#B91C1C;--bad-soft:#FEE2E2;
  --shadow:0 4px 14px rgba(15,23,42,.05);--shadow-lg:0 10px 30px rgba(15,23,42,.12);
  /* fan ranglari: t0 binafsha, t1 ko'k, t2 shaftoli, t3 yashil */
  --t0-bg:#EDE9FE;--t0:#6D28D9;--t0-bar:#8B5CF6;
  --t1-bg:#DBEAFE;--t1:#1D4ED8;--t1-bar:#3B82F6;
  --t2-bg:#FFEDD5;--t2:#C2410C;--t2-bar:#FB923C;
  --t3-bg:#DCFCE7;--t3:#15803D;--t3-bar:#22C55E;
  color-scheme:light;
  font-family:'Onest',system-ui,-apple-system,'Segoe UI',sans-serif;
}
html[data-theme=dark]{
  --bg:#0F1420;--card:#182030;--ink:#E8ECF4;--muted:#94A3B8;--line:#243047;--soft:#1F2A3D;
  --blue:#2563EB;--blue-ink:#93C5FD;--blue-soft:rgba(59,130,246,.2);
  --good:#4ADE80;--good-soft:rgba(34,197,94,.16);--warn:#FDBA74;--warn-soft:rgba(249,115,22,.16);
  --bad:#FCA5A5;--bad-soft:rgba(239,68,68,.16);
  --shadow:none;--shadow-lg:0 10px 30px rgba(0,0,0,.4);
  --t0-bg:rgba(139,92,246,.2);--t0:#C4B5FD;
  --t1-bg:rgba(59,130,246,.2);--t1:#93C5FD;
  --t2-bg:rgba(251,146,60,.18);--t2:#FDBA74;
  --t3-bg:rgba(34,197,94,.18);--t3:#86EFAC;
  color-scheme:dark;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:var(--bg);color:var(--ink);font-size:15px;line-height:1.45}
a{color:inherit;text-decoration:none}
button{font:inherit;border:0;cursor:pointer;color:inherit;background:none}
svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
h1,h2,h3{margin:0}
[hidden]{display:none!important}
.wrap{max-width:560px;margin:0 auto;padding:16px 16px calc(104px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:16px}

/* sarlavha */
.top{display:flex;align-items:center;gap:12px}
.top-t{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.top-t span{font-size:13px;color:var(--muted)}
.top-t h1{font-size:20px;font-weight:800;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.top-t h1.big{font-size:24px}
.avatar{width:46px;height:46px;flex-shrink:0;border-radius:50%;background:var(--blue-soft);color:var(--blue-ink);display:grid;place-items:center;font-size:17px;font-weight:800}
.icon-btn{width:44px;height:44px;flex-shrink:0;border-radius:14px;background:var(--card);box-shadow:var(--shadow);display:grid;place-items:center}
.icon-btn svg{width:20px;height:20px;stroke-width:2.2}
.back-week{align-self:flex-start;margin-top:-6px;font-size:14px;font-weight:600;color:var(--blue-ink);padding:6px 0}

/* asosiy karta (hozirgi/keyingi dars) */
.spot{position:relative;overflow:hidden;background:var(--blue);color:#fff;border-radius:26px;padding:20px;display:flex;flex-direction:column;gap:16px;box-shadow:0 14px 30px rgba(37,99,235,.28)}
.spot::before,.spot::after{content:"";position:absolute;border-radius:50%;background:rgba(255,255,255,.08);pointer-events:none}
.spot::before{width:190px;height:190px;top:-70px;right:-50px}
.spot::after{width:120px;height:120px;bottom:-50px;right:60px;background:rgba(255,255,255,.06)}
.spot>*{position:relative;z-index:1}
.spot-row{display:flex;align-items:center;justify-content:space-between;gap:8px}
.pill{display:inline-flex;align-items:center;gap:7px;border-radius:999px;padding:6px 12px;font-size:12px;font-weight:700;background:rgba(255,255,255,.18)}
.pill.live{background:#fff;color:#DC2626}
.pill.live i{width:8px;height:8px;border-radius:50%;background:#EF4444;animation:pulse 1.6s infinite}
.spot-time{font-size:13px;font-weight:600;color:var(--on-blue);font-variant-numeric:tabular-nums}
.spot-body{display:flex;flex-direction:column;gap:10px}
.spot h2{font-size:23px;font-weight:800;line-height:1.2;letter-spacing:-.01em}
.who{display:flex;align-items:center;gap:10px;font-size:14px;font-weight:500;color:#EFF6FF}
.who i{width:30px;height:30px;border-radius:50%;background:#FDE68A;color:#92400E;display:grid;place-items:center;font-style:normal;font-size:13px;font-weight:800}
.tags{display:flex;flex-wrap:wrap;gap:6px}
.tags span{font-size:13px;font-weight:600;background:rgba(255,255,255,.18);border-radius:10px;padding:5px 10px}
.spot-progress{display:flex;flex-direction:column;gap:6px}
.spot-progress .bar{height:6px;border-radius:3px;background:rgba(255,255,255,.25)}
.spot-progress .bar i{display:block;height:100%;border-radius:3px;background:#fff}
.spot-progress span{font-size:12px;font-weight:500;color:var(--on-blue)}
.spot-count{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.spot-count span{font-size:13px;color:var(--on-blue)}
.spot-count strong{font-size:28px;font-weight:800;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.spot-btns{display:flex;gap:8px}

/* tugmalar */
.btn{flex:1;min-height:50px;padding:0 16px;border-radius:15px;background:var(--blue);color:#fff;font-size:15px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:9px;text-align:center}
.btn svg{width:20px;height:20px;stroke-width:2.2}
.btn.white{background:#fff;color:#1D4ED8;min-height:54px;font-size:16px}
.btn.glass{background:rgba(255,255,255,.18);color:#fff;min-height:54px;flex:0 1 auto}
.spot-btns .btn.glass:only-child{flex:1}
.btn.soft{background:var(--blue-soft);color:var(--blue-ink)}
.btn:disabled{opacity:.75;cursor:default}
.btn.glass:disabled{opacity:1;color:var(--on-blue);font-weight:600;font-size:14px}

/* ko'rsatkichlar */
.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.stat{background:var(--card);border-radius:20px;padding:14px 12px;display:flex;flex-direction:column;gap:2px;box-shadow:var(--shadow)}
.stat .tile{width:36px;height:36px;border-radius:12px;margin-bottom:8px}
.stat .tile svg{width:20px;height:20px}
.stat b{font-size:22px;font-weight:800;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.stat b small{font-size:14px;font-weight:600;color:var(--muted)}
.stat span{font-size:12px;color:var(--muted)}

/* rangli belgi (fan, holat) */
.tile{width:48px;height:48px;flex-shrink:0;border-radius:15px;display:grid;place-items:center;background:var(--soft);color:var(--muted)}
.tile svg{width:22px;height:22px}
.t0{--tb:var(--t0-bg);--tf:var(--t0);--tbar:var(--t0-bar)}
.t1{--tb:var(--t1-bg);--tf:var(--t1);--tbar:var(--t1-bar)}
.t2{--tb:var(--t2-bg);--tf:var(--t2);--tbar:var(--t2-bar)}
.t3{--tb:var(--t3-bg);--tf:var(--t3);--tbar:var(--t3-bar)}
.tile.t0,.tile.t1,.tile.t2,.tile.t3{background:var(--tb);color:var(--tf)}
.tile.good{background:var(--good-soft);color:var(--good)}
.tile.bad{background:var(--bad-soft);color:var(--bad)}
.tone{color:var(--tf)}

/* bo'lim sarlavhasi */
.sec{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:-6px}
.sec h2{font-size:18px;font-weight:800}
.sec span{font-size:13px;color:var(--muted)}
.sec a{font-size:14px;font-weight:600;color:var(--blue-ink);min-height:44px;display:flex;align-items:center}

/* darslar ro'yxati (ixcham) */
.rows{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.lrow{width:100%;background:var(--card);border-radius:20px;padding:12px;display:flex;align-items:center;gap:12px;box-shadow:var(--shadow);text-align:left}
.lrow.is-live{box-shadow:0 0 0 2px #93C5FD,var(--shadow)}
.lrow.is-note{background:transparent;box-shadow:none;border:1.5px dashed var(--line)}
.lrow.is-note .tile{width:40px;height:40px;border-radius:13px}
.lrow.is-note .tile svg{width:20px;height:20px}
.lrow.is-off .main b{text-decoration:line-through;color:var(--muted)}
.main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.main b{font-size:15px;font-weight:700;line-height:1.3}
.main span{font-size:13px;color:var(--muted)}
.ico-s{width:13px;height:13px;vertical-align:-2px}

/* holat belgilari */
.chip{flex-shrink:0;display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:700;font-style:normal;border-radius:10px;padding:6px 9px;background:var(--soft);color:var(--muted);white-space:nowrap}
.chip.good{background:var(--good-soft);color:var(--good)}
.chip.warn{background:var(--warn-soft);color:var(--warn)}
.chip.bad{background:var(--bad-soft);color:var(--bad)}
.chip.live{background:var(--bad-soft);color:var(--bad)}
.chip.live i{width:6px;height:6px;border-radius:50%;background:#EF4444;animation:pulse 1.6s infinite}
@keyframes pulse{50%{opacity:.35}}

/* dars kartasi (jadval) */
.lcard{background:var(--card);border-radius:22px;padding:14px;display:flex;flex-direction:column;gap:12px;box-shadow:var(--shadow)}
.lcard.is-live{box-shadow:0 0 0 2px #93C5FD,0 8px 22px rgba(37,99,235,.12)}
.lcard.is-off{opacity:.7}
.lcard-in{display:flex;gap:14px}
.lcard .main{justify-content:center;gap:5px}
.lcard .main .chip{align-self:flex-start;padding:4px 8px;border-radius:8px}
.timebox{width:60px;flex-shrink:0;border-radius:16px;background:var(--tb,var(--soft));color:var(--tf,var(--ink));display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:10px 0;font-variant-numeric:tabular-nums}
.timebox b{font-size:15px;font-weight:800}
.timebox span{font-size:11px;font-weight:600;opacity:.85}
.timebox.on{background:var(--blue);color:#fff}
.btns{display:flex;gap:8px}

/* hafta kunlari */
.days{background:var(--card);border-radius:22px;padding:8px;box-shadow:var(--shadow);display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px}
.day{height:70px;border-radius:16px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px}
.day small{font-size:12px;font-weight:600;color:var(--muted);text-transform:capitalize}
.day b{font-size:17px;font-weight:800}
.day i{display:flex;gap:3px;height:5px}
.day i s{width:5px;height:5px;border-radius:50%;background:#93C5FD}
.day.today b{color:var(--blue-ink)}
.day.free b{color:var(--muted)}
.day[aria-selected=true]{background:var(--blue);color:#fff;box-shadow:0 8px 18px rgba(37,99,235,.3)}
.day[aria-selected=true] small{color:#DBEAFE}
.day[aria-selected=true] b{color:#fff}
.day[aria-selected=true] i s{background:#fff}
.day-panel{display:flex;flex-direction:column;gap:12px}

/* vazifalar */
.seg{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;background:var(--card);border-radius:18px;padding:6px;box-shadow:var(--shadow)}
.seg button{min-height:44px;border-radius:13px;font-size:13px;font-weight:600;color:var(--muted)}
.seg button[aria-selected=true]{background:var(--blue);color:#fff;font-weight:700}
.task{background:var(--card);border-radius:24px;padding:16px;display:flex;flex-direction:column;gap:12px;box-shadow:var(--shadow)}
.task-head{display:flex;align-items:center;gap:12px}
.task-head .tile{width:44px;height:44px;border-radius:14px}
.task-head .main b{font-size:12px;font-weight:600}
.task-head .main span{font-size:12px}
.task h2{font-size:17px;font-weight:800;line-height:1.3}
.task p{margin:-4px 0 0;font-size:14px;line-height:1.45;color:var(--muted)}
.task-foot{display:flex;align-items:center;justify-content:space-between;gap:12px}
.task-foot span{font-size:13px;color:var(--muted)}
.task-foot .btn{flex:0 0 auto;min-width:140px}

/* profil */
.me{position:relative;overflow:hidden;background:var(--blue);color:#fff;border-radius:26px;padding:18px;display:flex;align-items:center;gap:14px;box-shadow:0 14px 30px rgba(37,99,235,.25)}
.me::before{content:"";position:absolute;width:160px;height:160px;border-radius:50%;background:rgba(255,255,255,.08);top:-60px;right:-40px}
.me>*{position:relative}
.me>i{width:60px;height:60px;flex-shrink:0;border-radius:50%;background:#fff;color:#1D4ED8;display:grid;place-items:center;font-style:normal;font-size:24px;font-weight:800}
.me div{display:flex;flex-direction:column;gap:3px;min-width:0}
.me h1{font-size:20px;font-weight:800}
.me span{font-size:13px;color:var(--on-blue)}
.card{background:var(--card);border-radius:24px;padding:16px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:14px}
.card-h{font-size:16px;font-weight:800}
.att{flex-direction:row;align-items:center;gap:16px}
.ring{position:relative;width:96px;height:96px;flex-shrink:0}
.ring svg{width:96px;height:96px}
.ring circle{stroke:var(--soft);stroke-width:10}
.ring circle.val{stroke:#22C55E;stroke-linecap:round}
.ring b{position:absolute;inset:0;display:grid;place-items:center;font-size:22px;font-weight:800}
.att-t{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
.att-t h2{font-size:16px;font-weight:800}
.att-t>span{font-size:12px;color:var(--muted)}
.legend{list-style:none;margin:4px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--muted)}
.legend li{display:flex;align-items:center;gap:8px}
.legend i{width:10px;height:10px;border-radius:3px;background:#CBD5E1}
.legend i.good{background:#22C55E}.legend i.warn{background:#FB923C}
.subj{display:flex;align-items:center;gap:12px}
.subj .tile{width:40px;height:40px;border-radius:13px}
.subj .tile svg{width:20px;height:20px}
.subj-t{display:flex;justify-content:space-between;gap:8px;font-size:14px}
.subj-t b{font-weight:600}
.subj-t strong{font-weight:800}
.bar{height:6px;border-radius:3px;background:var(--soft)}
.bar i{display:block;height:100%;border-radius:3px;background:var(--tbar,var(--blue))}
.rows.plain .lrow{box-shadow:var(--shadow)}
.rows.plain .tile{width:40px;height:40px;border-radius:13px}
.rows.plain .tile svg{width:20px;height:20px}

/* bo'sh holat */
.empty{background:var(--card);border-radius:22px;padding:24px 16px;display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center;box-shadow:var(--shadow)}
.empty svg{width:34px;height:34px;color:var(--blue-ink);margin-bottom:4px}
.empty b{font-size:15px}
.empty span{font-size:13px;color:var(--muted)}

/* pastki menyu */
.tabbar{position:fixed;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));z-index:10;max-width:536px;margin:0 auto;height:70px;padding:0 6px;background:var(--card);border-radius:24px;box-shadow:var(--shadow-lg);display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}
.tabbar a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;color:var(--muted);font-size:11px;font-weight:600}
.tabbar a i{position:relative;width:52px;height:30px;border-radius:15px;display:grid;place-items:center}
.tabbar svg{width:22px;height:22px;stroke-width:1.9}
.tabbar a.on{color:var(--blue-ink);font-weight:700}
.tabbar a.on i{background:var(--blue);color:#fff}
.tabbar a.on svg{width:20px;height:20px;stroke-width:2}
.badge{position:absolute;top:-2px;right:6px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:#F97316;color:#fff;font-size:10px;font-weight:800;display:grid;place-items:center;font-style:normal}

/* kirish / bog'lash */
.boot{min-height:100vh;display:grid;place-items:center;padding:24px}
.boot-card{width:100%;max-width:400px;background:var(--card);border-radius:24px;padding:24px;box-shadow:var(--shadow-lg)}
.boot-card img{width:60px;height:60px;padding:10px;border-radius:16px;background:var(--blue);object-fit:contain;box-sizing:border-box}  /* logotip oq: ko‘k asosda ko‘rinadi */
.boot-card h1{margin:12px 0 4px;font-size:20px;font-weight:800}
.boot-card p{margin:0 0 16px;color:var(--muted);font-size:14px}
.boot-card .btn{width:100%}
.field{display:block;margin-bottom:12px}
.field span{display:block;margin-bottom:6px;font-size:13px;font-weight:600;color:var(--muted)}
.field input{width:100%;height:50px;padding:0 14px;border-radius:14px;border:1px solid var(--line);background:var(--bg);color:var(--ink);font:inherit;font-size:16px;outline:none}
.field input:focus{border-color:var(--blue)}
.err{margin:0 0 12px;padding:10px 12px;border-radius:12px;background:var(--bad-soft);color:var(--bad);font-size:13px}
.spinner{display:block;width:22px;height:22px;border-radius:50%;border:2.5px solid rgba(255,255,255,.35);border-top-color:currentColor;animation:spin .8s linear infinite;margin:0 auto}
.boot .spinner{width:34px;height:34px;border-width:3px;border-color:var(--blue-soft);border-top-color:var(--blue)}
@keyframes spin{to{transform:rotate(360deg)}}
.toast{position:fixed;left:16px;right:16px;bottom:calc(96px + env(safe-area-inset-bottom));z-index:20;max-width:528px;margin:0 auto;padding:12px 14px;border-radius:14px;background:#0F172A;color:#fff;font-size:14px;opacity:0;transform:translateY(8px);transition:.2s;pointer-events:none}
.toast.show{opacity:1;transform:none}
@media (prefers-reduced-motion:reduce){.pill.live i,.chip.live i,.spinner{animation:none}}

/* Qoldirilgan soat kartasi: oddiy holatda kulrang chiziq, 36 soatdan qip-qizil, 74 soatda to‘q qizil */
.absence{gap:10px}
.absence .abs-top{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.absence h2{font-size:16px;font-weight:800;margin:0}
.absence .abs-top b{font-size:22px;font-weight:800;font-variant-numeric:tabular-nums}
.absence .abs-top small{font-size:13px;font-weight:600;color:var(--muted)}
.absence .abs-bar{height:8px;border-radius:99px;background:var(--line);overflow:hidden}
.absence .abs-bar i{display:block;height:100%;border-radius:inherit;background:var(--warn)}
.absence p{margin:0;font-size:13px;color:var(--muted)}
.absence.is-warn,.absence.is-limit{background:#DC2626;color:#fff}
.absence.is-limit{background:#991B1B}
.absence.is-warn small,.absence.is-limit small,.absence.is-warn p,.absence.is-limit p{color:#fff}
.absence.is-warn .abs-bar,.absence.is-limit .abs-bar{background:rgba(255,255,255,.3)}
.absence.is-warn .abs-bar i,.absence.is-limit .abs-bar i{background:#fff}

/* Til tanlagichi */
.tg-lang{display:flex;gap:8px}
.tg-lang button{flex:1;padding:10px 0;border:1px solid var(--line);border-radius:12px;background:var(--soft);color:var(--ink);font:700 14px/1 inherit;letter-spacing:.04em}
.tg-lang button.on{background:var(--blue);border-color:transparent;color:#fff}
