/* =========================================================================
   Raqamli pasport — dizayn tizimi
   Ranglar dataviz palitrasidan olingan va validator orqali tekshirilgan:
     kategorial 1 (Faol)   #bf8a22 dark / #b8860b light  — oltin
     kategorial 2 (Nofaol) #3987e5 dark / #2a78d6 light  — ko'k
     holat: good #0ca30c · critical #d03b3b (ikkala rejimda ham >= 3:1)
     --accent (#d4a537) faqat bezak uchun — diagramma belgilarida ishlatilmaydi
   ========================================================================= */

:root {
  color-scheme: dark;

  --plane:          #0c0b09;
  --surface-1:      #17150f;
  --surface-2:      #201d15;
  --surface-3:      #2b271c;

  --text-primary:   #ffffff;
  --text-secondary: #bdb6a4;
  --text-muted:     #8d8677;

  --grid:           #262218;
  --axis:           #35301f;
  --border:         rgba(255, 244, 214, 0.10);
  --border-strong:  rgba(255, 244, 214, 0.19);

  --series-1:       #bf8a22;   /* Faoliyat ko'rsatayotgan — oltin */
  --series-2:       #3987e5;   /* Faoliyat ko'rsatmayotgan — ko'k */
  --series-1-wash:  rgba(191, 138, 34, 0.14);
  --series-2-wash:  rgba(57, 135, 229, 0.13);

  /* Bezak uchun yorqinroq oltin — diagramma belgilarida ISHLATILMAYDI */
  --accent:         #d4a537;
  --accent-soft:    #e8c46e;

  --good:           #0ca30c;
  --critical:       #d03b3b;
  --good-wash:      rgba(12, 163, 12, 0.13);
  --critical-wash:  rgba(208, 59, 59, 0.13);

  /* Sequential ramp — bitta ohang (kehribar), past -> yuqori */
  --seq-1: #241d10;
  --seq-2: #3a2c13;
  --seq-3: #5a4318;
  --seq-4: #7d5d1c;
  --seq-5: #a37820;
  --seq-6: #c99a35;
  --seq-null: #1b1810;

  --glow-a: rgba(212, 165, 55, 0.15);
  --glow-b: rgba(57, 135, 229, 0.09);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px -18px rgba(0, 0, 0, 0.85);
  --radius: 16px;
  --radius-sm: 10px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1280px;
}

:root[data-theme="light"] {
  color-scheme: light;

  --plane:          #faf8f4;
  --surface-1:      #ffffff;
  --surface-2:      #f7f4ee;
  --surface-3:      #ede8de;

  --text-primary:   #14120c;
  --text-secondary: #5b5546;
  --text-muted:     #6f6857;

  --grid:           #e9e5db;
  --axis:           #cec8b9;
  --border:         rgba(20, 18, 12, 0.12);
  --border-strong:  rgba(20, 18, 12, 0.22);

  --series-1:       #b8860b;
  --series-2:       #2a78d6;
  --series-1-wash:  rgba(184, 134, 11, 0.12);
  --series-2-wash:  rgba(42, 120, 214, 0.10);

  --accent:         #8a6508;
  --accent-soft:    #b8860b;

  --good:           #0ca30c;
  --critical:       #d03b3b;
  --good-wash:      rgba(12, 163, 12, 0.10);
  --critical-wash:  rgba(208, 59, 59, 0.10);

  --seq-1: #fbf1d8;
  --seq-2: #f5e1ad;
  --seq-3: #eccc7c;
  --seq-4: #d9ac47;
  --seq-5: #b8860b;
  --seq-6: #8a6208;
  --seq-null: #f2efe8;

  --glow-a: rgba(184, 134, 11, 0.10);
  --glow-b: rgba(42, 120, 214, 0.07);

  --shadow-card: 0 1px 2px rgba(20, 18, 12, 0.05), 0 10px 28px -20px rgba(20, 18, 12, 0.32);
}

/* ---------- Asos ---------- */

* { box-sizing: border-box; }

/* `hidden` atributi har doim ustun bo'lsin — .tv va .measure-row da
   display:flex uni bekor qilib qo'yadi */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  max-width: 100vw;
  font-family: var(--font);
  background: var(--plane);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -30vh -10vw auto -10vw;
  height: 95vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(46% 42% at 22% 30%, var(--glow-a), transparent 68%),
    radial-gradient(38% 38% at 82% 12%, var(--glow-b), transparent 66%);
  filter: blur(8px);
}

.wrap {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 96px;
}

/* Kontent ostidagi parda. To'liq qoraytirmaymiz — 3D xarita bo'limlar
   orasidan ko'rinib tursin, lekin matn ham o'qilishi kerak. */
.wrap::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg,
    transparent 0%,
    color-mix(in srgb, var(--plane) 42%, transparent) 5%,
    color-mix(in srgb, var(--plane) 68%, transparent) 11%,
    color-mix(in srgb, var(--plane) 74%, transparent) 100%);
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }

/* ---------- Sarlavha paneli ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--plane) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background .25s ease;
}
.topbar.is-stuck { border-bottom-color: var(--border); }

.topbar-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), var(--accent-soft));
  display: grid; place-items: center;
  color: #14120c; font-size: 15px; font-weight: 800; letter-spacing: -0.04em;
}
.brand-txt { min-width: 0; }
.brand-txt b { display: block; font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand-txt span { display: block; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.date-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}
.date-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-wash);
}

.icon-btn {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .i-sun { display: none; }
:root[data-theme="light"] .icon-btn .i-sun { display: block; }
:root[data-theme="light"] .icon-btn .i-moon { display: none; }

/* ---------- Hero + 3D sahna ---------- */

.hero {
  position: relative;
  min-height: min(94vh, 900px);
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.scene-host {
  position: fixed; inset: 0; z-index: 0;
  opacity: var(--scene-op, 1);
  transition: opacity .25s linear;
}
.scene-host canvas { display: block; width: 100% !important; height: 100% !important; }
.scene-host.scene-failed { background: radial-gradient(60% 60% at 70% 45%, var(--glow-a), transparent 70%); }

.scene-fade {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: var(--scene-op, 1);
  transition: opacity .25s linear;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--plane) 60%, transparent) 0%,
      transparent 22%, transparent 58%,
      color-mix(in srgb, var(--plane) 80%, transparent) 88%,
      var(--plane) 100%),
    linear-gradient(90deg,
      var(--plane) 0%,
      color-mix(in srgb, var(--plane) 80%, transparent) 30%,
      color-mix(in srgb, var(--plane) 20%, transparent) 52%,
      transparent 70%);
}

.scene-tip {
  position: fixed; z-index: 20; pointer-events: none;
  transform: translate(-50%, -120%);
  padding: 7px 11px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  box-shadow: 0 12px 32px -14px rgba(0, 0, 0, .7);
  white-space: nowrap;
  opacity: 0; transition: opacity .16s ease;
}
.scene-tip.on { opacity: 1; }
.scene-tip b { display: block; font-size: 12.5px; font-weight: 600; }
.scene-tip span { display: block; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.hero-inner {
  position: relative; z-index: 2;
  width: 100%; max-width: var(--maxw);
  margin: 0 auto; padding: 0 24px;
  /* Blok o'zi bosishni ushlamaydi — bo'sh joylardan bosish 3D xaritaga
     o'tadi. Matn va tugmalar esa odatdagidek ishlaydi. */
  pointer-events: none;
}
.hero-inner > *, .hero-inner .hero-strip { pointer-events: auto; }

.hero h1 .ln { display: block; }
.hero .eyebrow, .hero h1 .ln, .hero-sub, .hero-strip, .scroll-cue {
  opacity: 0; transform: translateY(22px);
}
body.ready .hero .eyebrow,
body.ready .hero h1 .ln,
body.ready .hero-sub,
body.ready .hero-strip,
body.ready .scroll-cue {
  opacity: 1; transform: none;
  transition: opacity .8s ease, transform .8s cubic-bezier(.22, 1, .36, 1);
}
body.ready .hero .eyebrow  { transition-delay: .05s; }
body.ready .hero h1 .ln:nth-child(1) { transition-delay: .16s; }
body.ready .hero h1 .ln:nth-child(2) { transition-delay: .26s; }
body.ready .hero-sub    { transition-delay: .38s; }
body.ready .hero-strip  { transition-delay: .48s; }
body.ready .scroll-cue  { transition-delay: .62s; }

/* Hero ostidagi ko'rsatkich lentasi */
.hero-strip {
  display: flex; flex-wrap: wrap; gap: 0;
  margin-top: 34px;
  background: color-mix(in srgb, var(--surface-1) 72%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  width: fit-content; max-width: 100%;
}
.hero-strip .cell {
  padding: 15px 26px;
  border-right: 1px solid var(--border);
  min-width: 132px;
}
.hero-strip .cell:last-child { border-right: 0; }
.hero-strip .k {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 6px;
}
.hero-strip .v { font-size: 26px; font-weight: 650; letter-spacing: -0.03em; line-height: 1; }
.hero-strip .v small { font-size: 13px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0; }
.hero-strip .v.is-good { color: var(--good); }
.hero-strip .v.is-rank { color: var(--accent); }

.scroll-cue {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 30px;
  font-size: 12.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none;
}
.scroll-cue:hover { color: var(--text-primary); }
.scroll-cue svg { width: 15px; height: 15px; animation: bob 2.1s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.eyebrow .bar { width: 22px; height: 2px; border-radius: 2px; background: var(--series-1); }

.hero h1 {
  font-size: clamp(40px, 6.6vw, 78px);
  line-height: 1.0;
  letter-spacing: -0.04em;
  margin-bottom: 18px;
}
.hero h1 .accent {
  background: linear-gradient(94deg, var(--accent) 4%, var(--accent-soft) 55%, var(--accent) 96%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  max-width: 50ch;
  font-size: 15.5px; line-height: 1.62;
  color: var(--text-secondary);
  margin: 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

/* Hero raqam kartasi */
.hero-figure {
  position: relative;
  padding: 30px 32px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.hero-figure::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(90% 130% at 100% 0%, var(--series-1-wash), transparent 60%);
}
.hero-figure > * { position: relative; z-index: 1; }
.hero-figure .label {
  font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted);
}
.hero-figure .value {
  font-size: clamp(56px, 8.5vw, 92px);
  font-weight: 650; line-height: 1; letter-spacing: -0.045em;
  margin: 14px 0 4px;
}
.hero-figure .unit { font-size: 14.5px; color: var(--text-secondary); }
.hero-figure .foot {
  margin-top: auto; padding-top: 22px;
  display: flex; flex-wrap: wrap; gap: 8px;
  position: relative; z-index: 1;
}

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}
.pill b { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pill.is-good { color: var(--good); border-color: color-mix(in srgb, var(--good) 34%, transparent); background: var(--good-wash); }
.pill.is-rank { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 42%, transparent); background: var(--series-1-wash); }
.pill.is-rank b { color: inherit; }
.pill.is-bad  { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 34%, transparent); background: var(--critical-wash); }
.pill.is-good b, .pill.is-bad b { color: inherit; }

/* Halqa (faollik darajasi) */
.hero-gauge {
  padding: 26px 28px 24px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.hero-gauge .label {
  font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted);
  align-self: flex-start;
}
.gauge-wrap { position: relative; margin: 6px 0 4px; }
.gauge-wrap svg { display: block; overflow: visible; }
.gauge-track { fill: none; stroke: var(--surface-3); stroke-width: 13; }
.gauge-arc {
  fill: none; stroke: var(--series-1); stroke-width: 13; stroke-linecap: round;
  transition: stroke-dashoffset 1.05s cubic-bezier(.22, 1, .36, 1);
}
.gauge-center {
  position: absolute; inset: 0;
  display: grid; place-content: center; gap: 2px;
}
.gauge-center .pct {
  font-size: 40px; font-weight: 650; letter-spacing: -0.04em; line-height: 1;
}
.gauge-center .cap { font-size: 11.5px; color: var(--text-muted); }

.gauge-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  width: 100%; margin-top: 14px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.gauge-split div { text-align: left; }
.gauge-split .k {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--text-muted); margin-bottom: 5px;
}
.gauge-split .k i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.gauge-split .v { font-size: 21px; font-weight: 600; letter-spacing: -0.025em; }

/* ---------- KPI plitkalari ---------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.kpi {
  position: relative;
  padding: 20px 20px 18px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.kpi .k {
  font-size: 12.5px; color: var(--text-muted);
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 12px;
}
.kpi .k i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.kpi .v {
  font-size: 34px; font-weight: 650; letter-spacing: -0.035em; line-height: 1;
}
.kpi .v small { font-size: 15px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0; }
.kpi .d {
  margin-top: 10px;
  font-size: 12.5px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
}
.kpi .d .arrow { font-size: 11px; }
.kpi .d.up   { color: var(--good); }
.kpi .d.down { color: var(--critical); }

/* Miniatyura chizig'i (KPI ichida) */
.kpi-track {
  margin-top: 13px; height: 5px; border-radius: 3px;
  background: var(--surface-3); overflow: hidden;
  display: flex; gap: 2px;
}
.kpi-track i { display: block; height: 100%; border-radius: 3px; transition: width .9s cubic-bezier(.22,1,.36,1); }

/* ---------- Bo'limlar ---------- */

.section { margin-top: 56px; }
.section-head {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.section-head h2 { font-size: 25px; letter-spacing: -0.028em; }
.section-head p {
  margin: 5px 0 0; font-size: 13.5px; color: var(--text-muted); max-width: 62ch; line-height: 1.55;
}
.section-head .spacer { margin-left: auto; }

.legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.seg button {
  padding: 6px 12px;
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-muted); background: none; border: 0; border-radius: 7px;
  cursor: pointer; white-space: nowrap;
  transition: background .16s, color .16s;
}
.seg button:hover { color: var(--text-primary); }
.seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 22px;
}
.card + .card { margin-top: 14px; }

/* ---------- Gorizontal ustunli diagramma ---------- */

.bars { display: flex; flex-direction: column; }
.bar-row {
  display: grid;
  grid-template-columns: var(--labelw, 168px) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 7px 8px;
  border-radius: 9px;
  cursor: default;
  transition: background .14s;
}
.bar-row:hover { background: var(--surface-2); }
.bar-row.is-focus { background: var(--series-1-wash); }

.bar-label {
  font-size: 13px; color: var(--text-secondary);
  min-width: 0;
  display: flex; align-items: center; gap: 8px;
}
.bar-label .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

#sectorBars { --labelw: 236px; }
.bar-row.is-focus .bar-label { color: var(--text-primary); font-weight: 600; }
.bar-label .rank {
  flex: none; width: 21px; text-align: right;
  font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--text-muted);
}

/* Yo'lak: [ustun maydoni][qiymat] — qiymat har doim ustun uchida turadi */
.bar-track {
  position: relative; height: 30px;
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.bar-area {
  flex: none; width: 0; min-width: 2px;
  transition: width .85s cubic-bezier(.22, 1, .36, 1);
}
.bar-fill {
  height: 18px; width: 100%; border-radius: 0 4px 4px 0;
  background: var(--series-1);
}
.bar-fill.muted { background: color-mix(in srgb, var(--text-muted) 42%, transparent); }
.bar-value {
  flex: none; white-space: nowrap;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.bar-row.is-focus .bar-value { color: var(--text-primary); }

/* Guruhlangan (Faol / Nofaol) qatorlar */
.bar-pair {
  flex: none; width: 0; min-width: 2px;
  display: flex; flex-direction: column; gap: 2px; justify-content: center;
  height: 30px;
  transition: width .85s cubic-bezier(.22, 1, .36, 1);
}
.bar-pair .seg-fill { height: 12px; border-radius: 0 3px 3px 0; }
.bar-pair .s1 { background: var(--series-1); }
.bar-pair .s2 { background: var(--series-2); }

.grid-lines {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; justify-content: space-between;
}
.grid-lines i { width: 1px; background: var(--grid); }

/* ---------- Ikki tomonlama (kapalak) diagramma ---------- */

.tornado-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 152px minmax(0, 1fr) 56px;
  align-items: center; gap: 10px;
  padding: 5px 8px; border-radius: 9px;
  transition: background .14s;
}
.tornado-row:hover { background: var(--surface-2); }
.tornado-row.is-focus { background: var(--series-1-wash); }
.tornado-name {
  text-align: center; font-size: 12.5px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tornado-row.is-focus .tornado-name { color: var(--text-primary); font-weight: 600; }
.t-side { display: flex; align-items: center; gap: 9px; height: 24px; }
.t-side.left  { justify-content: flex-end; }
.t-side.right { justify-content: flex-start; }
.t-bar { height: 15px; width: 0; transition: width .85s cubic-bezier(.22, 1, .36, 1); }
.t-side.left  .t-bar { border-radius: 4px 0 0 4px; background: var(--critical); }
.t-side.right .t-bar { border-radius: 0 4px 4px 0; background: var(--good); }
.t-num {
  font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-muted);
  min-width: 30px;
}
.t-side.left .t-num { text-align: right; }

.tornado-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 152px minmax(0, 1fr) 56px;
  gap: 10px; padding: 0 8px 10px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.tornado-head span { font-size: 12px; font-weight: 600; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.tornado-head .l { justify-content: flex-end; }
.tornado-head .c { justify-content: center; }
.tornado-head .r { justify-content: flex-end; text-align: right; }
.tornado-head i { width: 9px; height: 9px; border-radius: 2px; flex: none; }

.t-net {
  text-align: right;
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--good);
}
.t-net.neg { color: var(--critical); }

/* ---------- Issiqlik xaritasi ---------- */

.heat-scroll { overflow-x: auto; padding-bottom: 6px; }
.heat {
  display: grid;
  gap: 2px;
  min-width: 720px;
}
.heat-cell {
  height: 38px;
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: default;
  transition: transform .13s ease, outline-color .13s;
  outline: 2px solid transparent; outline-offset: -2px;
}
.heat-cell:hover { transform: scale(1.06); outline-color: var(--text-primary); z-index: 2; position: relative; }
.heat-rowlabel, .heat-collabel {
  font-size: 11.5px; color: var(--text-muted);
  display: flex; align-items: center;
}
.heat-rowlabel { justify-content: flex-end; padding-right: 10px; text-align: right; white-space: nowrap; }
.heat-rowlabel.is-focus { color: var(--text-primary); font-weight: 600; }
.heat-collabel { justify-content: center; text-align: center; padding-bottom: 8px; line-height: 1.25; }

.scale {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted);
}
.scale .steps { display: flex; gap: 2px; }
.scale .steps i { width: 30px; height: 11px; border-radius: 2px; }

/* ---------- Jadval ---------- */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-1);
  padding: 11px 12px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--text-muted); text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap; cursor: pointer; user-select: none;
}
thead th:first-child { text-align: left; }
thead th:hover { color: var(--text-primary); }
thead th .caret { opacity: 0; margin-left: 5px; font-size: 9px; }
thead th.sorted .caret { opacity: 1; }
thead th.sorted { color: var(--text-primary); }

tbody td {
  padding: 11px 12px;
  font-size: 13px; text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
tbody td:first-child { text-align: left; color: var(--text-primary); font-weight: 500; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr.is-focus td { background: var(--series-1-wash); color: var(--text-primary); }
tbody tr.is-total td {
  font-weight: 600; color: var(--text-primary);
  background: var(--surface-2);
  border-top: 1px solid var(--border-strong); border-bottom: 0;
}
.mini-meter {
  display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end;
}
.mini-meter .track { width: 52px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.mini-meter .track i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }

/* ---------- Maslahat oynasi ---------- */

.tip {
  position: fixed; z-index: 90; pointer-events: none;
  padding: 10px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 14px 40px -14px rgba(0, 0, 0, .65);
  font-size: 12.5px; line-height: 1.5;
  min-width: 150px; max-width: 260px;
  opacity: 0; transform: translateY(4px);
  transition: opacity .13s ease, transform .13s ease;
}
.tip.on { opacity: 1; transform: none; }
.tip .t { font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.tip .r { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.tip .r + .r { margin-top: 3px; }
.tip .r i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tip .r b { margin-left: auto; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tip .sep { height: 1px; background: var(--border); margin: 7px 0; }

/* ---------- Xulosa kartalari ---------- */

.notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.note {
  padding: 20px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--series-1);
  border-radius: var(--radius-sm);
}
.note.good { border-left-color: var(--good); }
.note.warn { border-left-color: var(--critical); }
.note h3 { font-size: 14px; margin-bottom: 8px; }
.note p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.note .big {
  display: block; font-size: 28px; font-weight: 650; letter-spacing: -0.03em;
  color: var(--text-primary); margin-bottom: 6px;
}

/* ---------- Footer ---------- */

.foot {
  margin-top: 64px; padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 12px 26px;
  font-size: 12.5px; color: var(--text-muted);
}
.foot b { color: var(--text-secondary); font-weight: 500; }

/* ---------- Yuklanish ekrani ---------- */

.preloader {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  background: var(--plane);
  transition: opacity .7s ease, visibility .7s;
}
.preloader.done { opacity: 0; visibility: hidden; }
.pre-mark {
  width: 54px; height: 54px; border-radius: 15px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-soft));
  color: #14120c; font-size: 20px; font-weight: 800; letter-spacing: -0.04em;
  animation: markPulse 1.7s ease-in-out infinite;
}
@keyframes markPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--series-1-wash); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 16px transparent; }
}
.pre-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.pre-sub { font-size: 12.5px; color: var(--text-muted); }
.pre-bar {
  width: 168px; height: 3px; border-radius: 2px; margin-top: 8px;
  background: var(--surface-3); overflow: hidden;
}
.pre-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  border-radius: 2px; transition: width .3s ease;
}

/* ---------- Skroll indikatori ---------- */

.scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 60;
  height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width .1s linear;
}

/* ---------- Hudud belgisi (sarlavha panelida) ---------- */

.unit-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text-primary);
  background: var(--series-1-wash);
  border: 1px solid color-mix(in srgb, var(--series-1) 34%, transparent);
  border-radius: 11px;
  white-space: nowrap;
}
.unit-chip::before {
  content: ""; width: 7px; height: 7px; border-radius: 2px; flex: none;
  background: var(--series-1);
}

/* ---------- 3D sahnaga biriktirilgan yorliq ---------- */

/* Xarita hozir nimani kodlayotganini bildiruvchi legenda.
   Ko'rsatkich almashganda qisqa yorug'lik bilan e'tibor tortadi. */
.map-legend {
  position: fixed; z-index: 16; pointer-events: none;
  right: 24px; bottom: 24px;
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 17px;
  min-width: 196px; max-width: 260px;
  background: color-mix(in srgb, var(--surface-1) 90%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 13px;
  box-shadow: 0 14px 40px -16px rgba(0, 0, 0, .7);
  opacity: 0; transform: translateY(10px);
  transition: opacity .45s ease, transform .45s cubic-bezier(.22, 1, .36, 1);
}
.map-legend.on { opacity: 1; transform: none; }
.map-legend .ml-k {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
}
.map-legend .ml-v { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; }
.map-legend .ml-s { font-size: 11.5px; color: var(--text-secondary); max-width: 26ch; line-height: 1.4; }
.map-legend.flash { animation: mlFlash .9s ease; }
@keyframes mlFlash {
  0%   { border-left-color: var(--accent-soft); box-shadow: 0 0 0 0 var(--series-1-wash), 0 14px 40px -16px rgba(0,0,0,.7); }
  40%  { box-shadow: 0 0 0 8px transparent, 0 14px 40px -16px rgba(0,0,0,.7); }
  100% { border-left-color: var(--accent); }
}

@media (max-width: 860px) {
  .map-legend {
    right: 12px; left: 12px; bottom: 12px;
    min-width: 0; padding: 10px 13px;
  }
  .map-legend .ml-s { max-width: none; }
}

/* =========================================================================
   3D xarita bilan ishlash: boshqaruv maslahati va tanlangan hudud kartasi
   ========================================================================= */

.scene-ctl {
  position: fixed; z-index: 17;
  right: 24px; top: 92px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  opacity: 0; transition: opacity .5s ease;
}
.scene-ctl.on { opacity: 1; }

.sc-hint {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px;
  font-size: 12px; color: var(--text-secondary);
  background: color-mix(in srgb, var(--surface-1) 84%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 999px;
  pointer-events: none;
  transition: opacity .4s ease;
}
.sc-hint svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.sc-hint.faded { opacity: 0; }

.sc-reset {
  padding: 7px 13px;
  font: inherit; font-size: 12px; font-weight: 500;
  color: var(--accent);
  background: var(--series-1-wash);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  cursor: pointer;
}
.sc-reset:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* Tanlangan hudud kartasi — xaritadagi joyiga biriktiriladi */
.map-card {
  position: fixed; z-index: 18;
  transform: translate(-50%, calc(-100% - 14px));
  min-width: 226px;
  padding: 15px 17px 13px;
  background: color-mix(in srgb, var(--surface-1) 94%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .75);
  animation: mcIn .3s cubic-bezier(.22, 1, .36, 1);
}
@keyframes mcIn {
  from { opacity: 0; transform: translate(-50%, calc(-100% - 4px)) scale(.94); }
}
.mc-close {
  position: absolute; top: 9px; right: 9px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 0; border-radius: 6px;
  background: none; color: var(--text-muted); cursor: pointer;
}
.mc-close:hover { color: var(--text-primary); background: var(--surface-2); }
.mc-close svg { width: 12px; height: 12px; }
.mc-name {
  font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em;
  margin-bottom: 11px; padding-right: 22px;
}
.mc-rows { display: flex; flex-direction: column; gap: 6px; }
.mc-rows .r {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--text-secondary);
}
.mc-rows .r i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.mc-rows .r b {
  margin-left: auto; color: var(--text-primary);
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.mc-rows .sep { height: 1px; background: var(--border); margin: 3px 0; }
.mc-rows .r.hi b { color: var(--accent); }

@media (max-width: 860px) {
  .scene-ctl { right: 12px; top: auto; bottom: 96px; }
  .sc-hint { font-size: 11px; padding: 7px 11px; }
  .map-card {
    left: 12px !important; right: 12px;
    top: auto !important; bottom: 12px;
    transform: none; min-width: 0;
    animation: none;
  }
}

.scene-tag {
  position: fixed; z-index: 15; pointer-events: none;
  transform: translate(-50%, -140%);
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px;
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid color-mix(in srgb, var(--series-1) 45%, transparent);
  border-radius: 999px;
  box-shadow: 0 10px 34px -12px rgba(0, 0, 0, .6),
              0 0 0 6px color-mix(in srgb, var(--series-1) 8%, transparent);
  white-space: nowrap;
  opacity: 0; transition: opacity .5s ease;
}
.scene-tag.on { opacity: 1; }
.scene-tag { transition: opacity .35s ease; }
.scene-tag b { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.scene-tag .val { font-size: 12.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.scene-tag .sep { width: 1px; height: 13px; background: var(--border-strong); }
.scene-tag .dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--series-1);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--series-1) 60%, transparent);
  animation: tagPulse 2s ease-out infinite;
}
@keyframes tagPulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--series-1) 55%, transparent); }
  70%  { box-shadow: 0 0 0 11px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- Viloyat o'rtachasidan farq (ikki tomonlama) ---------- */

.dev-row {
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  align-items: center; gap: 16px;
  padding: 6px 8px; border-radius: 9px;
  transition: background .14s;
}
.dev-row:hover { background: var(--surface-2); }
.dev-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dev-track {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  align-items: center; height: 28px;
}
.dev-half { display: flex; align-items: center; gap: 9px; height: 100%; min-width: 0; }
.dev-half.l { justify-content: flex-end; }
.dev-half.r { justify-content: flex-start; }
.dev-axis { width: 1px; height: 100%; background: var(--axis); }
.dev-bar {
  height: 17px; width: 0;
  transition: width .9s cubic-bezier(.22, 1, .36, 1);
}
.dev-bar.pos { background: var(--series-1); border-radius: 0 4px 4px 0; }
.dev-bar.neg { background: var(--series-2); border-radius: 4px 0 0 4px; }
.dev-num {
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-secondary); flex: none;
}

/* ---------- Matritsa o'lchov tanlagichi ---------- */

.measure-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.measure-row > span { font-size: 12.5px; color: var(--text-muted); }

#matrixTbl thead th { cursor: default; }
#matrixTbl tbody td:first-child { white-space: nowrap; }
#matrixTbl tbody td b { color: var(--text-primary); }

/* ---------- Tarmoqlar tasnifi ---------- */

.gloss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.gloss {
  padding: 20px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.gloss-top {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.gloss-top h3 { font-size: 14px; font-weight: 600; margin: 0; }
.gloss .oked {
  flex: none;
  padding: 3px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--text-secondary);
  background: var(--surface-3);
  border-radius: 6px;
}
.gloss p {
  margin: 0 0 15px;
  font-size: 12.8px; line-height: 1.62; color: var(--text-secondary);
}
.gloss-nums {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding-top: 14px; border-top: 1px solid var(--grid);
}
.gloss-nums span { display: block; min-width: 0; }
.gloss-nums i {
  display: block; font-style: normal;
  font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gloss-nums b {
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ---------- Bo'lim raqami ---------- */

.sec-num {
  display: inline-block;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin-bottom: 7px;
}

/* ---------- Yetakchilik kartalari ---------- */

.lead-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 14px;
}

.lead-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 22px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  opacity: 0; transform: translateY(18px);
}
.lead-card .rank-dots { margin-top: auto; padding-top: 16px; }
.lead-card.in {
  opacity: 1; transform: none;
  transition: opacity .6s ease, transform .6s cubic-bezier(.22, 1, .36, 1);
}
.lead-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 120% at 100% 0%, var(--series-1-wash), transparent 62%);
  opacity: 0; transition: opacity .35s ease;
}
.lead-card.top1::before { opacity: 1; }
.lead-card.top1 { border-color: color-mix(in srgb, var(--series-1) 38%, var(--border)); }

.medal {
  position: relative; z-index: 1;
  align-self: flex-start;
  display: inline-flex; align-items: baseline; gap: 1px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--series-1) 45%, transparent);
  color: var(--series-1);
  background: var(--series-1-wash);
  margin-bottom: 15px;
}
.medal b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lead-card.top1 .medal { background: var(--series-1); color: #fff; border-color: transparent; }

.lead-card h3 {
  position: relative; z-index: 1;
  font-size: 14.5px; font-weight: 600; margin-bottom: 10px;
}
.lead-val {
  position: relative; z-index: 1;
  font-size: 40px; font-weight: 650; letter-spacing: -0.04em; line-height: 1;
  margin-bottom: 8px;
}
.lead-val small { font-size: 16px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0; }
.lead-card p {
  position: relative; z-index: 1;
  margin: 0; font-size: 12.8px; line-height: 1.6; color: var(--text-secondary);
}
.lead-card p b { color: var(--text-primary); font-weight: 600; }

/* 16 ta hudud orasidagi o'rin — nuqtali shkala */
.rank-dots {
  position: relative; z-index: 1;
  display: flex; align-items: flex-end; gap: 3px;
  margin-top: 16px; height: 11px;
}
.rank-dots i {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--surface-3);
}
.rank-dots i.me { height: 11px; background: var(--series-1); }
.rank-cap {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-size: 10.5px; color: var(--text-muted);
}

/* ---------- Hero kartadagi mini ro'yxat ---------- */

.mini-list { position: relative; z-index: 1; margin-top: 22px; }
.mini-list .row {
  display: grid; grid-template-columns: 1fr 62px 46px;
  align-items: center; gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--grid);
}
.mini-list .row:first-child { border-top: 0; }
.mini-list .n { font-size: 12.8px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-list .t { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.mini-list .t i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; width: 0; transition: width .8s cubic-bezier(.22,1,.36,1); }
.mini-list .v { font-size: 12.8px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Tarmoq qatoridagi o'rin belgisi ---------- */

.rank-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; margin-left: 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  border-radius: 5px; flex: none;
  color: var(--series-1);
  background: var(--series-1-wash);
  border: 1px solid color-mix(in srgb, var(--series-1) 32%, transparent);
}
.rank-badge.gold { background: var(--series-1); color: #fff; border-color: transparent; }

/* ---------- Sichqoncha ortidan yorug'lik ---------- */

[data-spot] { position: relative; }
[data-spot]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%),
              color-mix(in srgb, var(--series-1) 13%, transparent), transparent 70%);
  opacity: 0; transition: opacity .3s ease;
}
[data-spot]:hover::after { opacity: 1; }

/* ---------- Ko'p qatorli segment ---------- */

.seg.wrap-seg { flex-wrap: wrap; max-width: 100%; }
.icon-btn.wide {
  width: auto; height: 36px; padding: 0 14px; gap: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
}
.icon-btn.wide svg { flex: none; }

/* =========================================================================
   Katta ekran rejimi — hokimiyat devoridagi ekran / proyektor uchun.
   Barcha o'lchamlar vmin/vw da: 40" ekranda ham, noutbukda ham to'g'ri o'qiladi.
   ========================================================================= */

.tv {
  position: fixed; inset: 0; z-index: 150;
  display: flex; flex-direction: column;
  background: var(--plane);
  overflow: hidden;
}
.tv::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(58% 52% at 78% 10%, var(--glow-a), transparent 68%),
    radial-gradient(46% 44% at 12% 92%, var(--glow-b), transparent 70%);
}

.tv-head {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 2vw;
  padding: 2.2vh 3vw;
  border-bottom: 1px solid var(--border);
}
.tv-brand { display: flex; align-items: center; gap: 1.1vw; }
.tv-mark {
  width: 3.4vw; height: 3.4vw; min-width: 40px; min-height: 40px;
  border-radius: 0.9vw;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  background: linear-gradient(145deg, var(--accent), var(--accent-soft));
  color: #14120c; font-size: 1.3vw; font-weight: 800; letter-spacing: -0.04em;
}
.tv-brand b { display: block; font-size: 1.6vw; font-weight: 650; letter-spacing: -0.02em; }
.tv-brand span { display: block; font-size: 0.95vw; color: var(--text-muted); }
.tv-clock {
  margin-left: auto;
  font-size: 1.7vw; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-secondary); letter-spacing: -0.02em;
}
.tv-exit {
  width: 2.8vw; height: 2.8vw; min-width: 34px; min-height: 34px;
  display: grid; place-items: center;
  border-radius: 0.7vw; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-secondary); cursor: pointer;
}
.tv-exit:hover { color: var(--text-primary); border-color: var(--border-strong); }
.tv-exit svg { width: 1.3vw; height: 1.3vw; min-width: 16px; min-height: 16px; }

.tv-stage {
  position: relative; z-index: 2;
  flex: 1; min-height: 0;
  padding: 3vh 3vw;
  display: grid;
}

/* Slayd */
.tv-slide {
  grid-area: 1 / 1;
  display: flex; flex-direction: column; justify-content: center;
  opacity: 0; transform: translateY(2.4vh) scale(.985);
  pointer-events: none;
  transition: opacity .55s ease, transform .55s cubic-bezier(.22, 1, .36, 1);
}
.tv-slide.on { opacity: 1; transform: none; pointer-events: auto; }

.tv-eyebrow {
  display: flex; align-items: center; gap: 0.9vw;
  font-size: 1.05vw; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 2vh;
}
.tv-eyebrow i { width: 3vw; height: 2px; background: var(--accent); border-radius: 2px; }

.tv-title {
  font-size: 3.4vw; font-weight: 650; letter-spacing: -0.035em; line-height: 1.04;
  margin-bottom: 1.6vh;
}
.tv-lede { font-size: 1.3vw; color: var(--text-secondary); max-width: 52ch; line-height: 1.5; }

/* Ulkan raqam */
.tv-huge {
  font-size: 13vw; font-weight: 680; line-height: 0.9; letter-spacing: -0.05em;
  background: linear-gradient(160deg, var(--accent-soft), var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.tv-huge.plain { background: none; -webkit-text-fill-color: var(--text-primary); }
.tv-unit { font-size: 1.5vw; color: var(--text-secondary); margin-top: 1.4vh; }

/* Uch-to'rt ustunli raqamlar qatori */
.tv-cols { display: grid; gap: 2.4vw; margin-top: 3.4vh; }
.tv-cols.c2 { grid-template-columns: repeat(2, 1fr); }
.tv-cols.c3 { grid-template-columns: repeat(3, 1fr); }
.tv-cols.c4 { grid-template-columns: repeat(4, 1fr); }
.tv-col .k {
  font-size: 1vw; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 1.1vh;
}
.tv-col .v {
  font-size: 4.6vw; font-weight: 650; line-height: 1; letter-spacing: -0.04em;
}
.tv-col .v small { font-size: 1.6vw; font-weight: 500; color: var(--text-secondary); letter-spacing: 0; }
.tv-col .v.gold { color: var(--accent); }
.tv-col .v.good { color: var(--good); }
.tv-col .s { font-size: 1.05vw; color: var(--text-secondary); margin-top: 0.9vh; }

/* Katta ekran uchun ustunli diagramma */
.tv-bars { margin-top: 3vh; display: flex; flex-direction: column; gap: 1.5vh; }
.tv-bar {
  display: grid; grid-template-columns: 18vw 1fr 7vw; align-items: center; gap: 1.6vw;
}
.tv-bar .n { font-size: 1.25vw; color: var(--text-secondary); white-space: nowrap;
             overflow: hidden; text-overflow: ellipsis; }
.tv-bar.hi .n { color: var(--text-primary); font-weight: 650; }
.tv-bar .t { height: 2.4vh; min-height: 16px; background: var(--surface-2); border-radius: 0 6px 6px 0; overflow: hidden; }
.tv-bar .t i {
  display: block; height: 100%; width: 0; border-radius: 0 6px 6px 0;
  background: var(--surface-3);
  transition: width 1s cubic-bezier(.22, 1, .36, 1);
}
.tv-bar.hi .t i { background: linear-gradient(90deg, var(--accent), var(--accent-soft)); }
.tv-bar .v { font-size: 1.35vw; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }

/* Yetakchilik plitkalari */
.tv-medals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.8vw; margin-top: 3.4vh; }
.tv-medal {
  padding: 2.4vh 1.8vw;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 1.1vw;
}
.tv-medal.gold { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--series-1-wash); }
.tv-medal .r {
  display: inline-block; padding: 0.5vh 0.9vw; margin-bottom: 1.4vh;
  font-size: 1vw; font-weight: 700; border-radius: 999px;
  color: var(--accent); background: var(--series-1-wash);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.tv-medal.gold .r { background: var(--accent); color: #14120c; border-color: transparent; }
.tv-medal .l { font-size: 1.15vw; color: var(--text-secondary); margin-bottom: 1vh; }
.tv-medal .v { font-size: 3.6vw; font-weight: 650; letter-spacing: -0.04em; line-height: 1; }

/* Pastki qism */
.tv-foot {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 2vw;
  padding: 1.8vh 3vw;
  border-top: 1px solid var(--border);
}
.tv-dots { display: flex; gap: 0.7vw; }
.tv-dots button {
  width: 2.6vw; min-width: 26px; height: 4px;
  border: 0; border-radius: 2px; padding: 0;
  background: var(--surface-3); cursor: pointer;
  transition: background .25s;
}
.tv-dots button[aria-current="true"] { background: var(--accent); }
.tv-hint { margin-left: auto; font-size: 0.9vw; color: var(--text-muted); }

.tv-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 3; background: transparent; }
.tv-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
}

body.tv-on { overflow: hidden; }

@media (max-width: 900px) {
  .tv-title { font-size: 6vw; }
  .tv-huge { font-size: 22vw; }
  .tv-cols.c3, .tv-cols.c4 { grid-template-columns: repeat(2, 1fr); }
  .tv-col .v { font-size: 9vw; }
  .tv-medals { grid-template-columns: 1fr; }
  .tv-bar { grid-template-columns: 26vw 1fr 12vw; }
  .tv-hint { display: none; }
}

/* =========================================================================
   3D pauza — sahna nafas oladigan bo'lim.
   Bu yerda karta yo'q: ustunning tarmoqlarga bo'linishi to'sib qo'yilmasin.
   ========================================================================= */

.beat {
  position: relative;
  min-height: 96vh;
  display: flex;
  align-items: center;
  margin: 40px 0;
}
.beat-txt {
  max-width: 34ch;
  opacity: 0; transform: translateY(26px);
  transition: opacity .8s ease, transform .9s cubic-bezier(.22, 1, .36, 1);
}
.beat.in-view .beat-txt { opacity: 1; transform: none; }

.beat h2 {
  font-size: clamp(30px, 3.6vw, 50px);
  line-height: 1.05; letter-spacing: -0.035em;
  margin: 0 0 16px;
}
.beat h2 .accent {
  background: linear-gradient(94deg, var(--accent) 6%, var(--accent-soft) 92%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.beat p {
  margin: 0; font-size: 14.5px; line-height: 1.65; color: var(--text-secondary);
}
.beat p b { color: var(--text-primary); font-weight: 600; }

/* Qatlam kalitlari — rang shkalasi ma'nosini ochadi */
.beat-keys { margin-top: 24px; display: flex; flex-direction: column; gap: 7px; }
.beat-key {
  display: grid; grid-template-columns: 12px 1fr 54px;
  align-items: center; gap: 11px;
  font-size: 12.5px; color: var(--text-secondary);
  opacity: 0; transform: translateX(-12px);
  transition: opacity .5s ease, transform .55s cubic-bezier(.22, 1, .36, 1);
  transition-delay: var(--d, 0ms);
}
.beat.in-view .beat-key { opacity: 1; transform: none; }
.beat-key i { width: 12px; height: 12px; border-radius: 3px; }
.beat-key b {
  text-align: right; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

@media (max-width: 860px) {
  .beat { min-height: 88vh; margin: 20px 0; }
  .beat-txt {
    max-width: none;
    background: color-mix(in srgb, var(--plane) 78%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
  }
  .beat h2 { font-size: 27px; }
}

/* =========================================================================
   Skroll animatsiyalari
   ========================================================================= */

/* Sarlavha so'zlari pastdan ko'tariladi */
.section-head h2 { overflow: hidden; }
.section-head h2 .w {
  display: inline-block;
  opacity: 0; transform: translateY(0.9em) rotate(2deg);
  transition: opacity .6s ease, transform .75s cubic-bezier(.22, 1, .36, 1);
  transition-delay: calc(var(--i, 0) * 55ms);
}
.section.in-view .section-head h2 .w { opacity: 1; transform: none; }

/* Bo'lim raqami va tavsifi */
.section-head .sec-num,
.section-head p {
  opacity: 0; transform: translateY(12px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.22, 1, .36, 1);
}
.section-head .sec-num { transition-delay: .05s; }
.section-head p { transition-delay: .3s; }
.section.in-view .section-head .sec-num,
.section.in-view .section-head p { opacity: 1; transform: none; }

/* Parallaks uchun — transform JS dan keladi, o'tish bo'lmasin */
.section-head { will-change: transform; }

/* Kaskadli kartalar: 3D chuqurlik bilan pastdan burilib kiradi */
.lead-grid, .kpi-row, .gloss-grid { perspective: 1400px; }
.lead-grid > *, .kpi-row > *, .gloss-grid > * {
  opacity: 0;
  transform: translateY(34px) rotateX(9deg) scale(.965);
  transform-origin: 50% 0%;
  transition: opacity .7s ease, transform .95s cubic-bezier(.19, 1, .3, 1);
  transition-delay: var(--d, 0ms);
}
.section.in-view .lead-grid > *,
.section.in-view .kpi-row > *,
.section.in-view .gloss-grid > * { opacity: 1; transform: none; }

/* Yetakchilik kartalari bo'ylab bir marta o'tadigan oltin yorug'lik */
.lead-card { position: relative; overflow: hidden; }
.lead-card::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(105deg,
    transparent 38%,
    color-mix(in srgb, var(--accent) 26%, transparent) 50%,
    transparent 62%);
  transform: translateX(-130%);
}
.section.in-view .lead-card::after {
  animation: sheen 1.5s cubic-bezier(.3, .7, .4, 1) forwards;
  animation-delay: calc(var(--d, 0ms) + 420ms);
}
@keyframes sheen {
  to { transform: translateX(130%); }
}

/* Karta konteynerlari — pastdan, yengil egilish bilan */
.card, .hero-figure, .hero-gauge {
  transform-origin: 50% 0%;
}
.card.reveal { transform: translateY(28px) scale(.985); }

/* Issiqlik xaritasi — diagonal to'lqin */
.heat-cell.wave {
  opacity: 0; transform: scale(.72);
  transition: opacity .5s ease, transform .55s cubic-bezier(.22, 1, .36, 1);
  transition-delay: var(--d, 0ms);
}
#heat.lit .heat-cell.wave { opacity: 1; transform: none; }

/* Jadval qatorlari */
tbody tr.row-in {
  opacity: 0; transform: translateX(-14px);
  transition: opacity .45s ease, transform .5s cubic-bezier(.22, 1, .36, 1);
  transition-delay: var(--d, 0ms);
}
tbody.lit tr.row-in { opacity: 1; transform: none; }

/* ---------- Ochilish animatsiyasi ---------- */

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity .6s ease, transform .6s cubic-bezier(.22, 1, .36, 1);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .lead-card { opacity: 1; transform: none; transition: none; }
  .section-head h2 .w, .section-head .sec-num, .section-head p,
  .lead-grid > *, .kpi-row > *, .gloss-grid > *,
  .heat-cell.wave, tbody tr.row-in { opacity: 1; transform: none; transition: none; }
  .section-head { transform: none !important; }
  .lead-card::after { animation: none !important; display: none; }
  .map-legend { transition: none; animation: none !important; }
  .bar-fill, .seg-fill, .t-bar, .gauge-arc, .kpi-track i, .mini-list .t i { transition: none; }
  .scroll-cue svg, .pre-mark { animation: none; }
  .hero .eyebrow, .hero h1 .ln, .hero-sub, .hero-strip, .scroll-cue {
    opacity: 1; transform: none;
  }
}

/* =========================================================================
   Keng ekranda: kontent chapga suriladi, o'ng tomon 3D xaritaga ochiq qoladi.
   Aks holda xarita parda ostida qolib, o'zgarishlari sezilmaydi.
   ========================================================================= */

@media (min-width: 1280px) {
  .wrap {
    max-width: 856px;
    margin-left: clamp(40px, 5.5vw, 110px);
    margin-right: auto;
  }
  /* Parda faqat kontent ustuni ostida — o'ng chekka toza qoladi */
  .wrap::before {
    left: -56px; right: -84px;
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 72%, transparent 100%);
            mask-image: linear-gradient(90deg, #000 0%, #000 72%, transparent 100%);
  }
  .hero-inner { max-width: 1040px; margin: 0; padding-left: clamp(40px, 5.5vw, 110px); }
  .topbar-in  { max-width: none; padding-left: clamp(40px, 5.5vw, 110px); padding-right: 28px; }
  .foot       { max-width: 856px; }
  /* Sahna o'ng tomonda — legendani ham shu yerga tortamiz */
  .map-legend { right: 32px; bottom: 32px; }
}

/* ---------- Moslashuvchanlik ---------- */

@media (max-width: 1080px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .wrap { padding: 0 16px 72px; }
  .topbar-in { padding: 10px 16px; flex-wrap: wrap; }
  .brand-txt span { display: none; }
  .hero { min-height: 92vh; }
  .hero-inner { padding: 0 16px; }
  .hero-strip .cell { padding: 12px 16px; min-width: 104px; }
  .hero-strip .v { font-size: 21px; }
  .scene-fade {
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--plane) 82%, transparent) 0%,
      color-mix(in srgb, var(--plane) 55%, transparent) 40%,
      color-mix(in srgb, var(--plane) 88%, transparent) 78%,
      var(--plane) 100%);
  }
  .hero-grid { grid-template-columns: 1fr; }
  .date-chip { display: none; }
  .bar-row { grid-template-columns: var(--labelw-s, 118px) minmax(0, 1fr); gap: 9px; }
  #sectorBars { --labelw: 128px; }
  .dev-row { grid-template-columns: 118px minmax(0, 1fr); gap: 9px; }
  .rank-badge { display: none; }
  .unit-chip { padding: 7px 11px; font-size: 12.5px; }
  .scene-tag { padding: 7px 11px; max-width: calc(100vw - 24px); }
  .scene-tag .val { display: none; }
  .scene-tag .sep { display: none; }
  /* Tor ekranda "Katta ekran" tugmasi faqat ikonka */
  .icon-btn.wide { padding: 0 10px; }
  #tvBtn { font-size: 0; gap: 0; padding: 0; width: 36px; }
  #tvBtn svg { font-size: initial; }
  .tornado-row, .tornado-head { grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr); }
  .section { margin-top: 42px; }
  .card { padding: 16px; }
}
@media (max-width: 560px) {
  .kpi-row { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 21px; }
  .hero-strip { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .hero-strip .cell { min-width: 0; border-bottom: 1px solid var(--border); }
  .hero-strip .cell:nth-child(2n) { border-right: 0; }
  .hero-strip .cell:nth-last-child(-n+2) { border-bottom: 0; }
}

@media print {
  body::before { display: none; }
  .topbar, .icon-btn, .seg { display: none; }
  .card, .kpi, .hero-figure, .hero-gauge { box-shadow: none; break-inside: avoid; }
}
