/* ===== v3.1 telefon va planshet (mobile.js bilan). Eng oxirida yuklanadi. ===== */
.mtop, .mbar, .mnav-scrim { display: none; }

/* --- planshet / tor oyna (761–1180 px): ikonkali chap panel qoladi, doska panel enini hisobga oladi --- */
@media (max-aspect-ratio: 1/1) {
  .board-host { --size: min(calc(94vw - var(--nav-w)), 62vh); }
}

/* --- telefon (≤760 px) --- */
@media (max-width: 760px) {
  :root { --nav-w: 0px; --mtop: 56px; --mbar: 62px; --sab: env(safe-area-inset-bottom, 0px); --sat: env(safe-area-inset-top, 0px); }
  html, body { overscroll-behavior-y: none; }
  body { padding: calc(var(--mtop) + var(--sat)) 0 calc(var(--mbar) + var(--sab)) 0 !important; }
  /* body aylanmaydi (overflow: hidden) — har bir ekran o'zi aylanadi (telefonda svayp) */
  .screen, body.arena-on .screen { height: calc(100dvh - var(--mtop) - var(--mbar) - var(--sat) - var(--sab)) !important; overflow-y: auto !important;
    overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }

  /* yuqori panel */
  .mtop { display: flex; align-items: center; gap: 6px; position: fixed; z-index: 45; left: 0; right: 0; top: 0; height: calc(var(--mtop) + var(--sat));
    padding: var(--sat) 8px 0; box-sizing: border-box; background: linear-gradient(180deg, #262a74, #1b1f5c); color: #fff; box-shadow: 0 4px 18px -10px rgba(18, 21, 58, .7); }
  .mtop-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: none; color: #fff; cursor: pointer; }
  .mtop-btn:active { background: rgba(255, 255, 255, .12); }
  .mtop-btn .ico-l { width: 24px; height: 24px; }
  .mtop-btn .badge { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: #ff3d57; color: #fff; font: 900 10px/16px "Nunito", sans-serif; font-style: normal; }
  .mtop-brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; color: #fff; cursor: pointer; padding: 0; }
  .mtop-brand img { width: 32px; height: 32px; border-radius: 9px; }
  .mtop-brand b { font: 800 19px/1 var(--display, "Nunito"); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mtop-streak { font: 900 14px "Nunito", sans-serif; padding: 5px 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); filter: grayscale(1); opacity: .7; }
  .mtop-streak.on { filter: none; opacity: 1; background: rgba(255, 138, 61, .25); }

  /* pastki navigatsiya */
  .mbar { display: flex; position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: calc(var(--mbar) + var(--sab)); padding-bottom: var(--sab); box-sizing: border-box;
    background: #fffdf8; border-top: 1px solid rgba(18, 21, 58, .1); box-shadow: 0 -6px 20px -14px rgba(18, 21, 58, .5); }
  .mbar button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none;
    color: #6b7194; font: 800 11.5px/1 "Nunito", sans-serif; cursor: pointer; padding: 6px 2px; }
  .mbar button .ico-l { width: 23px; height: 23px; }
  .mbar button.on { color: #3b3fc4; }
  .mbar button.on .ico-l { stroke-width: 2.6; }
  .mbar button[hidden] { display: none; }
  .mbar button span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html[data-mode=dark] .mbar { background: #171a3d; border-top-color: rgba(255, 255, 255, .08); }
  html[data-mode=dark] .mbar button { color: #9aa0cf; }
  html[data-mode=dark] .mbar button.on { color: #ffd57a; }

  /* yon panel → chiqib-kiruvchi menyu (to'liq yozuvlar bilan) */
  .sidenav { width: min(300px, 84vw) !important; z-index: 50; transform: translateX(-105%); transition: transform .25s ease; padding: calc(14px + var(--sat)) 14px calc(14px + var(--sab)) !important;
    align-items: stretch !important; visibility: hidden; }
  body.nav-open .sidenav { transform: none; visibility: visible; }
  .mnav-scrim { display: block; position: fixed; inset: 0; z-index: 49; background: rgba(10, 12, 40, .45); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.nav-open .mnav-scrim { opacity: 1; pointer-events: auto; }
  .sidenav .brand { justify-content: flex-start !important; padding: 4px 8px 14px !important; }
  .sidenav .brand-text, .sn-item > span:not(.badge), .sn-live, .sn-who, .sn-stats { display: revert !important; }
  .sidenav .brand-text { display: block !important; }
  .sn-item > span:not(.badge) { display: block !important; }
  .sn-stats { display: flex !important; }
  .sn-who { display: flex !important; }
  .sn-group h6 { display: block !important; height: auto !important; margin: 4px 14px 6px !important; color: #7f86c4 !important; background: none !important; }
  .sn-item { justify-content: flex-start !important; padding: 12px 14px !important; }
  .sn-item .badge { position: static !important; }
  .sn-profile { justify-content: flex-start !important; padding: 12px !important; }
  .sn-tools { flex-direction: row !important; }
  .sn-tools .lang-toggle button:not(.on) { display: block !important; }
  .sn-tools .icon-btn { width: 44px !important; }
  .sn-bell { display: none; }

  /* bosh sahifa */
  .page-wrap, .home-head, .home-top, .home-tiles, .tier-tabs, .map { padding-left: 12px !important; padding-right: 12px !important; }
  .home-head h1 { font-size: 26px !important; line-height: 1.15; }
  .home-head p { font-size: 15px; }
  .home-top { grid-template-columns: 1fr !important; gap: 12px !important; }
  .hero { grid-template-columns: 1fr auto !important; padding: 18px !important; min-height: 0 !important; }
  .hero h2, #hero-lesson { font-size: 20px !important; line-height: 1.2 !important; word-break: normal !important; overflow-wrap: anywhere; }
  .hero-mascot img { width: 96px !important; height: auto !important; }
  .hero-buttons { flex-wrap: wrap; }
  .home-tiles { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .home-tile { padding: 12px !important; gap: 8px !important; }
  .home-tile small { display: none; }
  .home-pro { width: calc(100% - 24px) !important; flex-wrap: wrap; }
  .tier-tabs { grid-template-columns: repeat(5, minmax(120px, 1fr)) !important; overflow-x: auto; scroll-snap-type: x mandatory; }
  .tier-tab { scroll-snap-align: start; }
  .map { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; gap: 10px !important; }

  /* doska + panel: doska tepada, ekran enicha; sarlavha doskadan oldin */
  .stage { display: flex !important; flex-direction: column; height: auto !important; gap: 10px !important; padding: 10px 8px 16px !important; }
  .stage-side { display: contents !important; }
  .stage-side > * { order: 2; }
  .stage-side > .lesson-head { order: 0; }
  .stage-board { order: 1; display: flex; flex-direction: column; align-items: center; }
  .board-host, .analysis .board-host, .fb-board, .lv-wrap .fb-board, .w-wrap .fb-board, .vs-board, .du-board {
    --size: min(calc(100vw - 16px), 560px) !important; }
  .lesson-head { gap: 8px !important; }
  .lesson-head h2 { font-size: 18px !important; }
  .coach { gap: 8px !important; }
  .coach-mascot { width: 64px !important; height: auto !important; }
  .speech { font-size: 15.5px !important; }
  .task-actions { flex-wrap: wrap; }
  .task-actions .btn { flex: 1 1 40%; }
  .player-controls .ctrl { width: 52px; height: 52px; }

  /* umumiy panjaralar → bitta ustun */
  .hub, .cab-grid, .vs-wrap, .ar-game, .tp-kpis, .report-grid, .two-col { grid-template-columns: 1fr !important; }
  .card { border-radius: 16px; }
  .ch-card { flex-wrap: wrap; width: calc(100% - 24px) !important; }
  .ch-card .t-rep-main { flex: 1 1 200px; min-width: 0; }
  .ch-card > .btn, .ch-card button { flex: 1 1 40%; }
  dialog.dialog { width: calc(100vw - 20px) !important; max-width: none !important; max-height: calc(100dvh - 24px); overflow-y: auto; padding: 18px 16px !important; box-sizing: border-box; }
  .pro-sheet { padding: 20px 14px !important; }
  .pro-hero { flex-direction: column; text-align: center; }
  .pro-plans.n4 { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .pro-plan { padding: 14px 8px !important; }
  .pp-price { font-size: 18px !important; }
  .pro-cmp { font-size: 13px; }
  .nt-panel { left: 8px !important; right: 8px; width: auto !important; top: calc(var(--mtop) + var(--sat) + 6px) !important; }
  .rc-doors { grid-template-columns: 1fr !important; }
  .exam-result .celebrate-actions .btn { flex: 1 1 100%; }
  .tt-row { grid-template-columns: minmax(0, 1fr) 70px 44px; }
  /* ekranlarda «orqaga» kabi tugmalar barmoq uchun kattaroq */
  .btn { min-height: 44px; }
}

/* juda tor (≤360 px) */
@media (max-width: 360px) {
  .map { grid-template-columns: 1fr 1fr !important; }
  .mtop-brand b { font-size: 17px; }
}

/* Android ilova ichida: matnni tasodifan belgilash va ko'k bosish chaqnashi yo'q */
html.tq-android { -webkit-tap-highlight-color: transparent; }
html.tq-android body { -webkit-user-select: none; user-select: none; }
html.tq-android input, html.tq-android textarea { -webkit-user-select: text; user-select: text; }

/* v3.1 Google bilan kirish */
.g-row { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 14px; text-align: center; }
.g-signin { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; box-shadow: 0 1px 3px rgba(0,0,0,.12); gap: 10px; }
.g-signin:hover { background: #f8f9fa; }
.g-logo { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 900 15px Arial, sans-serif;
  color: #fff; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); }
.cab-google { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; margin: 16px 0; }
.cab-google > div { flex: 1 1 280px; }
.g-ov { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(10, 12, 40, .55); }
.g-box { background: #fff; color: #1f1f1f; border-radius: 18px; padding: 22px 26px; display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 280px; }

/* v3.1.1: ko'p bosqichli darsda nuqtalar qatori chetdan chiqmasin (min-width 4px × 60+ nuqta) */
.beat-progress { min-width: 0; max-width: 100%; }
.beat-progress i { min-width: 0; }
.beat-progress:has(i:nth-child(40)) { gap: 2px; }
@media (max-width: 760px) {
  .page-head { flex-wrap: wrap; }
  .page-head #report-print { margin-left: 0; }
}
@media (max-width: 760px) {
  /* yangilanish paneli: matn tepada, tugmalar pastda (tor ustunga siqilmasin) */
  #update-bar { flex-wrap: wrap; left: 8px !important; right: 8px !important; transform: none !important; width: auto !important; max-width: none !important; top: calc(var(--mtop) + var(--sat) + 8px) !important; }
  #update-bar #update-text { flex: 1 1 100%; }
}
