/* Mini App v3 — «Lapis»: Interhouse brendi (DESIGN.md: lapis + zafaron), tepada to'q ko'k panel, ustida oq kartochkalar,
   suzuvchi pastki menyu. Yorug'/qorong'i — Telegram colorScheme bo'yicha (html.tg-dark). */
:root {
  --lapis-deep: #0A1F45; --lapis: #0E2A5C; --lapis-8: #163A7A; --cobalt: #1F4FA3; --cobalt-4: #5B8BEA; --cobalt-50: #EAF0FB;
  --saf: #F28C1B; --saf-ink: #A85200; --saf-3: #FFB25C; --saf-50: #FEF2E4;
  --ground: #F4F6FB; --card: #FFFFFF; --ink: #0B1A3A; --text: #162036; --muted: #56617A; --line: #E6EAF2;
  --ok: #127A4D; --ok-bg: #E3F6EC; --late: #9A5205; --late-bg: #FFF0DE; --bad: #B3261E; --bad-bg: #FDE8E6;
  --info: #1F4FA3; --info-bg: #EAF0FB;
  --shadow: 0 2px 12px rgba(10, 31, 69, .07);
  --top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
}
html.tg-dark {
  --ground: #0B1220; --card: #131C2E; --ink: #EEF2FA; --text: #DCE3F1; --muted: #9AA6BF; --line: #22304A;
  --cobalt-50: #1A2846; --saf-50: #3A2810;
  --ok: #4CD3AE; --ok-bg: #12352A; --late: #FFB25C; --late-bg: #3D2A10; --bad: #FF8F85; --bad-bg: #42201E;
  --info: #8FB2F5; --info-bg: #1C2A4A; --shadow: 0 2px 12px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--ground); color: var(--text);
  font: 16px/1.35 "Golos Text", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 0 16px calc(112px + var(--tg-safe-area-inset-bottom, 0px)); }
.sprite { position: absolute; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; flex: none; }

/* ---- to'q ko'k panel: bosh ekran (katta) va ichki sahifalar (kichik) */
.hero, .phead { margin: 0 -16px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 85% 0%, #2A5BB8 0%, var(--lapis) 45%, var(--lapis-deep) 100%); }
.hero { padding: calc(var(--top) + 14px) 20px 66px; }
.phead { padding: calc(var(--top) + 14px) 20px 44px; }
.hero::after, .phead::after { content: ""; position: absolute; right: -50px; top: 30px; width: 220px; height: 220px;
  border-radius: 50%; background: radial-gradient(circle, rgba(242, 140, 27, .32), transparent 65%); pointer-events: none; }
.hero > *, .phead > * { position: relative; z-index: 1; }
.hero + *, .phead + * { margin-top: -46px; position: relative; z-index: 1; }
.phead + * { margin-top: -28px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; border-radius: 11px; background: #fff; padding: 4px; }
.brand b { display: block; font-weight: 700; font-size: 15px; }
.brand small { display: block; font-size: 12px; color: #C3D0EE; }
.hello { margin: 22px 0 0; font-size: 14px; color: #D3DBEF; }
.big { margin: 4px 0 0; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.3px; }
.phead h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.2px; }
.phead p { margin: 4px 0 0; font-size: 14px; color: #D3DBEF; }
.chips { display: flex; gap: 8px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; }
button.chip { display: flex; align-items: center; gap: 8px; border: 0; padding: 6px 14px 6px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; flex: none; }
button.chip[aria-pressed="true"] { background: #fff; color: var(--lapis); }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 13px; background: var(--saf); color: var(--lapis-deep); }

/* ---- kartochkalar */
.sec { margin: 0 0 14px; }
.sec-h { margin: 20px 4px 10px; font-size: 17px; font-weight: 700; color: var(--ink); display: flex;
  justify-content: space-between; align-items: baseline; gap: 8px; }
.sec-h small { font-size: 13px; font-weight: 600; color: var(--muted); }
.box { background: var(--card); border-radius: 22px; padding: 4px 18px; box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 11px 0;
  border-top: 1px solid var(--line); width: 100%; }
.box > .row:first-child { border-top: 0; }
.who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.who .t { overflow-wrap: anywhere; font-weight: 500; }
.who .s { font-size: 14px; color: var(--muted); }
.r { color: var(--muted); font-size: 15px; flex: none; text-align: right; max-width: 55%; }
button.row { background: none; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit;
  text-align: left; cursor: pointer; }
button.link::after { content: "›"; color: var(--muted); font-size: 22px; line-height: 1; margin-left: auto; padding-left: 4px; }
button.link > .r, button.link > .badge, button.link > .count { margin-left: auto; }
button.row:active, button.tile:active, button.les:active { opacity: .65; }
button.jr.off .who { color: var(--bad); }
button.jr::after { content: none; }

/* ---- farzand: bugungi holat */
.today { display: flex; gap: 14px; align-items: center; padding: 16px 0 4px; }
.ring { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.ring svg.i { width: 30px; height: 30px; stroke-width: 2.6; }
.ring.keldi { background: var(--ok); } .ring.kechikdi { background: #D98418; } .ring.kelmadi { background: var(--bad); }
.ring.uzrli, .ring.kutilmoqda { background: var(--cobalt); } .ring.x { background: var(--line); color: var(--muted); }
.today h3 { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }
.today p { margin: 2px 0 6px; font-size: 14px; color: var(--muted); }
.times { display: flex; border-top: 1px solid var(--line); margin-top: 12px; padding: 12px 0 10px; }
.times div { flex: 1; text-align: center; }
.times b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.times span { font-size: 12px; color: var(--muted); }

/* ---- holat belgisi */
.badge { flex: none; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.b-keldi { background: var(--ok-bg); color: var(--ok); }
.b-kechikdi { background: var(--late-bg); color: var(--late); }
.b-kelmadi { background: var(--bad-bg); color: var(--bad); }
.b-kutilmoqda, .b-uzrli { background: var(--info-bg); color: var(--info); }
.b-x { background: var(--ground); color: var(--muted); }
.count { min-width: 26px; padding: 3px 8px; border-radius: 999px; background: var(--saf); color: #fff; font-size: 13px;
  font-weight: 800; text-align: center; }

/* ---- raqamlar */
.nums { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding: 14px 0; }
.nums div { text-align: center; }
.nums b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.nums span { font-size: 12px; color: var(--muted); }
.n-keldi b { color: var(--ok); } .n-kechikdi b { color: var(--late); } .n-kelmadi b { color: var(--bad); }
.n-uzrli b { color: var(--info); }

/* ---- plitkalar (bo'limlar) */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 14px; }
button.tile { background: var(--card); border: 0; border-radius: 22px; padding: 16px; min-height: 112px; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px; box-shadow: var(--shadow);
  font: inherit; color: var(--ink); cursor: pointer; position: relative; }
button.tile b { font-size: 15px; font-weight: 700; display: block; }
button.tile small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
button.tile .count { position: absolute; top: 14px; right: 14px; }
.ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; }
.ic.o { background: var(--saf-50); color: var(--saf); } .ic.b { background: var(--cobalt-50); color: var(--cobalt); }
.ic.g { background: var(--ok-bg); color: var(--ok); } .ic.r { background: var(--bad-bg); color: var(--bad); }
html.tg-dark .ic.b { color: var(--cobalt-4); }

/* ---- dars jadvali */
.days { display: flex; gap: 6px; margin: 0 0 12px; }
button.day { flex: 1; border: 0; border-radius: 14px; padding: 8px 0; font: inherit; font-size: 12px; font-weight: 600;
  background: var(--card); color: var(--muted); cursor: pointer; box-shadow: var(--shadow); }
button.day b { display: block; font-size: 16px; color: var(--ink); margin-top: 2px; }
button.day[aria-pressed="true"] { background: var(--lapis); color: #C3D0EE; }
button.day[aria-pressed="true"] b { color: #fff; }
button.day.is-today:not([aria-pressed="true"]) { outline: 2px solid var(--saf); outline-offset: -2px; }
button.day.dam { opacity: .45; }
.les { display: flex; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); width: 100%; background: none;
  border-left: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit; text-align: left; }
.box > .les:first-child { border-top: 0; }
button.les { cursor: pointer; }
.les .tm { width: 50px; flex: none; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ink); }
.les .tm small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.les .bar { width: 4px; border-radius: 4px; background: var(--line); flex: none; }
.les.hozir .bar { background: var(--saf); } .les.zamena .bar { background: var(--cobalt-4); }
.les.otdi { opacity: .55; } .les.boshqa .who .t { text-decoration: line-through; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; margin-left: 6px;
  vertical-align: 2px; background: var(--saf); color: #fff; }
.tag.z { background: var(--cobalt); } .tag.ok { background: var(--ok-bg); color: var(--ok); }

/* ---- tugmalar */
.acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0 14px; }
button.act { min-height: 42px; border: 0; border-radius: 13px; padding: 9px 14px; font: inherit; font-size: 14px;
  font-weight: 600; background: var(--ground); color: var(--ink); cursor: pointer; }
button.act:active { transform: scale(.98); opacity: .8; }
button.act.on { background: var(--lapis); color: #fff; }
button.act.primary { background: linear-gradient(180deg, #F79A33, #E57F0D); color: #fff;
  box-shadow: 0 6px 16px rgba(242, 140, 27, .32); }
button.act.big { flex: 1 1 140px; min-height: 50px; }
button.act.ok { background: var(--ok-bg); color: var(--ok); flex: 1; }
button.act.no { background: var(--bad-bg); color: var(--bad); flex: 1; }
button.act.wide { display: block; width: 100%; min-height: 52px; margin: 4px 0 14px; border-radius: 16px; font-size: 16px; }
.row button.act { flex: none; }

/* ---- matnlar */
.note { margin: 2px 0 10px; font-size: 14px; color: var(--muted); }
.note.warn { color: var(--late); }
.lead { margin: 0 4px 12px; font-size: 14px; color: var(--muted); }
.empty { margin: 28px 16px; text-align: center; color: var(--muted); }
.box > .empty { margin: 22px 0; }
.foot { text-align: center; font-size: 13px; color: var(--muted); margin: 10px 0; }
.err { margin: 32px 16px 16px; text-align: center; color: var(--bad); }

/* ---- baholar */
.marks { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.mk { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; }
.m5 { background: var(--ok-bg); color: var(--ok); } .m4 { background: var(--info-bg); color: var(--info); }
.m3 { background: var(--late-bg); color: var(--late); } .m2 { background: var(--bad-bg); color: var(--bad); }
.score { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.score b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.score small { font-size: 12px; color: var(--muted); }

/* ---- oy chizig'i */
.mbar { display: grid; grid-template-columns: repeat(auto-fill, 20px); gap: 5px; padding: 4px 0 14px; }
.mbar i { width: 20px; height: 20px; border-radius: 6px; background: var(--line); }
.mbar .b-keldi { background: var(--ok); } .mbar .b-kechikdi { background: #D98418; }
.mbar .b-uzrli { background: var(--cobalt); } .mbar .b-kelmadi { background: var(--bad); }

/* ---- qidiruv */
input.search { width: 100%; font: inherit; padding: 13px 16px; margin: 0 0 14px; border: 0; border-radius: 16px;
  background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ---- skelet */
.sk { height: 96px; border-radius: 22px; margin: 0 0 14px; background: linear-gradient(90deg, var(--card) 0%, var(--line) 50%,
  var(--card) 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; }
.sk.tall { height: 200px; margin: 0 -16px 14px; border-radius: 0;
  background: linear-gradient(120deg, var(--lapis) 0%, var(--lapis-8) 50%, var(--lapis) 100%); background-size: 200% 100%; }
.sk.short { height: 52px; width: 60%; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---- suzuvchi pastki menyu */
#tabbar { position: fixed; left: 12px; right: 12px; bottom: calc(14px + var(--tg-safe-area-inset-bottom, 0px)); z-index: 3;
  max-width: 616px; margin: 0 auto; display: flex; justify-content: space-around; gap: 2px; padding: 7px;
  border-radius: 24px; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); box-shadow: 0 8px 28px rgba(10, 31, 69, .18); }
#tabbar[hidden] { display: none; }
button.tab { flex: 1; min-height: 54px; border: 0; border-radius: 17px; background: none; color: var(--muted); font: inherit;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
button.tab .tl { font-size: 11px; font-weight: 600; }
button.tab[aria-current="page"] { background: var(--cobalt-50); color: var(--lapis); }
html.tg-dark button.tab[aria-current="page"] { color: #fff; }
button.tab[aria-current="page"] svg.i { color: var(--saf); }

:focus-visible { outline: 2px solid var(--saf); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } button.act:active { transform: none; } }
