/* ==========================================================================
   REGISTAN DIGITAL EXPERIENCE — style.css
   Palette taken from the site's own material: majolica cobalt + turquoise
   tilework, unfired brick terracotta, and the gold leaf of Tilya-Kori's
   mosque ceiling. Display face evokes carved portal inscriptions; body
   face stays quiet and legible in three languages.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* -- core palette, named for what it actually is on the building -- */
  --ink:            #1B1812;   /* warm near-black, not pure black */
  --parchment:      #F1E8D6;   /* manuscript cream */
  --parchment-dim:  #E6D9BE;
  --cobalt:         #163A5C;   /* deep majolica blue */
  --cobalt-deep:    #0E2740;
  --turquoise:      #1E7F78;   /* glazed tile teal */
  --turquoise-bright:#2FA89E;
  --gold:           #B8862E;   /* gilded relief, used sparingly */
  --gold-bright:    #D9A93F;
  --terracotta:     #A8552E;   /* unfired brick body, structural not decorative */

  /* -- blueprint / architect mode -- */
  --blue-navy:      #0A2036;
  --blue-line:      #6FE3FF;
  --blue-line-dim:  rgba(111, 227, 255, 0.35);

  /* -- kids mode -- */
  --kids-bg:        #FFF6E3;
  --kids-accent:    #E8792E;

  --radius-sm: 6px;
  --radius-md: 14px;
  --radius-lg: 26px;

  --font-display: 'Cormorant Garamond', 'Noto Serif', serif;
  --font-body: 'Manrope', 'Noto Sans', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  /* MUHIM: endi #landing uzun, skroll qilinadigan sahifa — shuning uchun
     overflow standart holatda ochiq. Faqat 3D sahna faol bo'lganda
     (body.stage-active) skroll bloklanadi, chunki u to'liq ekranli canvas. */
}
body { position: relative; }
html.stage-active, body.stage-active { overflow: hidden; height: 100%; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
a { color: inherit; }
:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* ==========================================================================
   Girih hairline rule — the signature device. An 8-point star lattice
   repeated as a thin structural divider, not decoration: it marks the
   same seam a real muqarnas cornice marks — where one register ends and
   the next begins.
   ========================================================================== */
.girih-rule {
  width: 100%;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='14' viewBox='0 0 56 14'%3E%3Cg fill='none' stroke='%23163A5C' stroke-width='1.1' stroke-opacity='0.55'%3E%3Cpath d='M0 7 L7 0 L14 7 L7 14 Z'/%3E%3Cpath d='M14 7 L21 0 L28 7 L21 14 Z'/%3E%3Cpath d='M28 7 L35 0 L42 7 L35 14 Z'/%3E%3Cpath d='M42 7 L49 0 L56 7 L49 14 Z'/%3E%3Ccircle cx='7' cy='7' r='1.4' fill='%23B8862E' stroke='none'/%3E%3Ccircle cx='21' cy='7' r='1.4' fill='%23B8862E' stroke='none'/%3E%3Ccircle cx='35' cy='7' r='1.4' fill='%23B8862E' stroke='none'/%3E%3Ccircle cx='49' cy='7' r='1.4' fill='%23B8862E' stroke='none'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 56px 14px;
  opacity: 0.9;
}
.girih-rule.on-dark {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='14' viewBox='0 0 56 14'%3E%3Cg fill='none' stroke='%236FE3FF' stroke-width='1.1' stroke-opacity='0.6'%3E%3Cpath d='M0 7 L7 0 L14 7 L7 14 Z'/%3E%3Cpath d='M14 7 L21 0 L28 7 L21 14 Z'/%3E%3Cpath d='M28 7 L35 0 L42 7 L35 14 Z'/%3E%3Cpath d='M42 7 L49 0 L56 7 L49 14 Z'/%3E%3C/g%3E%3C/svg%3E");
}

/* ==========================================================================
   NAV — sticky, minimal, shaffofdan qattiqqa o'tadi
   ========================================================================== */
#site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease), opacity 0.4s var(--ease), visibility 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
#site-nav.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#site-nav.scrolled {
  background: rgba(241,232,214,0.92);
  backdrop-filter: none; /* aniq talab: glassmorphism yo'q — qattiq fon */
  border-bottom-color: rgba(22,58,92,0.1);
  box-shadow: 0 4px 24px -12px rgba(22,58,92,0.2);
}
.nav-inner {
  max-width: 1320px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px;
}
.nav-logo {
  display: flex; align-items: baseline; gap: 9px; text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.28rem;
  color: var(--cobalt);
}
.nav-logo .mark { width: 21px; height: 21px; color: var(--gold); flex-shrink: 0; }
.nav-links { display: flex; gap: 2px; }
.nav-link {
  text-decoration: none; color: var(--ink); opacity: 0.62;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 9px 15px; border-radius: 999px; transition: all 0.25s var(--ease);
}
.nav-link:hover { opacity: 1; background: rgba(22,58,92,0.06); }
.nav-link.active { opacity: 1; color: var(--cobalt); background: rgba(22,58,92,0.08); }

.nav-lang { display: flex; gap: 1px; background: rgba(22,58,92,0.07); border-radius: 999px; padding: 3px; }
.nav-lang button {
  padding: 6px 11px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.04em;
  color: var(--cobalt); opacity: 0.5; transition: all 0.25s var(--ease);
}
.nav-lang button[aria-pressed="true"] { background: var(--cobalt); color: var(--parchment); opacity: 1; }

.nav-toggle-btn {
  display: none; width: 38px; height: 38px; border-radius: 50%;
  align-items: center; justify-content: center; color: var(--cobalt);
}
.nav-toggle-btn svg { width: 19px; height: 19px; }

#nav-mobile-menu {
  display: none;
}

@media (max-width: 880px) {
  .nav-links { display: none; }
  .nav-toggle-btn { display: flex; }
  #nav-mobile-menu {
    position: fixed; inset: 0 0 0 auto; width: min(320px, 84vw); height: 100dvh;
    background: var(--parchment); z-index: 29;
    transform: translateX(100%); transition: transform 0.4s var(--ease);
    padding: 100px 30px 40px; display: flex; flex-direction: column; gap: 4px;
    box-shadow: -20px 0 50px -20px rgba(0,0,0,0.3);
  }
  #nav-mobile-menu.open { transform: translateX(0); }
  #nav-mobile-menu a {
    text-decoration: none; color: var(--ink);
    font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
    padding: 14px 4px; border-bottom: 1px solid rgba(22,58,92,0.1);
  }
  .nav-lang-mobile { display: flex; gap: 8px; margin-top: 24px; }
  .nav-lang-mobile button {
    flex: 1; padding: 10px; border-radius: 10px; background: rgba(22,58,92,0.06);
    font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; color: var(--cobalt);
  }
  .nav-lang-mobile button[aria-pressed="true"] { background: var(--cobalt); color: var(--parchment); }
}
body.nav-open { overflow: hidden; }

/* ==========================================================================
   #landing — endi bitta ekran emas, to'liq skroll qilinadigan sahifa
   ========================================================================== */
#landing {
  position: relative;
  background: var(--parchment);
  transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}
#landing.hidden { opacity: 0; visibility: hidden; pointer-events: none; position: fixed; inset: 0; overflow: hidden; }

.section-inner { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

/* -- HERO -- */
.hero-section {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 6vw 10vh;
  overflow: hidden;
  background: var(--parchment);
}
.hero-text-zone {
  position: relative;
  width: 100%; min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding-top: 90px;
}
.hero-content {
  position: relative; z-index: 2;
  max-width: 680px; text-align: center;
}
.hero-content .eyebrow {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--turquoise); display: block; margin-bottom: 20px;
}
.hero-content h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.4rem, 4.6vw, 3.8rem); line-height: 1.08;
  margin: 0 0 22px; color: var(--ink);
}
.hero-content h1 em {
  font-style: normal; color: var(--cobalt);
  background: linear-gradient(180deg, transparent 62%, var(--gold-bright) 62%, var(--gold-bright) 78%, transparent 78%);
}
.hero-content p {
  font-size: 1.06rem; line-height: 1.65; color: var(--ink); opacity: 0.78; margin: 0 auto 34px; max-width: 480px;
}
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--cobalt); color: var(--parchment);
  font-family: var(--font-body); font-weight: 600; font-size: 0.95rem;
  padding: 15px 28px; border-radius: 999px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease);
  box-shadow: 0 14px 30px -14px rgba(22,58,92,0.5);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -14px rgba(22,58,92,0.6); }
.btn-primary svg { width: 15px; height: 15px; transition: transform 0.25s var(--ease); }
.btn-primary:hover svg { transform: translateX(3px); }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1.5px solid rgba(22,58,92,0.25); color: var(--cobalt);
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
  padding: 12px 22px; border-radius: 999px;
  transition: all 0.3s var(--ease);
}
.btn-ghost:hover { border-color: var(--cobalt); background: rgba(22,58,92,0.05); }
.btn-ghost svg { width: 13px; height: 13px; }

/* -- 3D preview: alohida, faqat pastga tushirilganda "ochiladigan" blok.
   Boshlang'ich ekranda ko'rinmaydi — shu bilan matn zonasi to'liq
   mustaqil, yagona fokus bo'lib qoladi. Skroll qilinganda kichikdan
   to'liq o'lchamga o'sib chiqadi. */
.hero-canvas-wrap {
  position: relative; z-index: 1; margin-top: 6vh;
  width: min(100%, 1180px); height: min(68vh, 760px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, rgba(217,169,63,0.08), transparent 70%);
  opacity: 0; visibility: hidden;
}
.hero-canvas-wrap.ready { visibility: visible; }
.hero-canvas-wrap.ready[data-reveal="grow"] { opacity: 0; transform: scale(0.72); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.hero-canvas-wrap.ready[data-reveal="grow"].revealed { opacity: 1; transform: scale(1); }
.hero-canvas-wrap canvas { width: 100%; height: 100%; display: block; }

.scroll-hint {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 2;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink); opacity: 0.45;
}
.scroll-hint .line { width: 26px; height: 1px; background: currentColor; position: relative; overflow: hidden; }
.scroll-hint .line::after {
  content: ""; position: absolute; inset: 0; background: var(--gold-bright);
  animation: scrollhint 2.2s ease-in-out infinite;
}
@keyframes scrollhint { 0% { transform: translateX(-100%); } 50% { transform: translateX(0); } 100% { transform: translateX(100%); } }

@media (max-width: 880px) {
  .hero-text-zone { padding-top: 100px; min-height: 92vh; }
  .hero-canvas-wrap { height: 46vh; }
  .scroll-hint { display: none; }
}

/* -- Umumiy bo'lim qobig'i -- */
.content-section { padding: 12vh 0; position: relative; }
.content-section.alt { background: #FBF6EA; }
.section-eyebrow {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--turquoise); display: block; margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-display); font-weight: 700; color: var(--ink);
  font-size: clamp(1.9rem, 3.4vw, 2.8rem); line-height: 1.12; margin: 0 0 22px; max-width: 640px;
}
.section-text { font-size: 1.02rem; line-height: 1.72; color: var(--ink); opacity: 0.78; margin: 0 0 16px; max-width: 560px; }
.section-hook { font-family: var(--font-display); font-style: italic; font-size: 1.2rem; color: var(--terracotta); margin-top: 24px; max-width: 520px; }

[data-reveal] { opacity: 0; transform: translateY(34px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
[data-reveal].revealed { opacity: 1; transform: translateY(0); }

/* -- Registan intro bo'limi -- */
#registan .section-inner { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 8vw; align-items: center; }
.registan-visual {
  aspect-ratio: 4/5; border-radius: var(--radius-lg); overflow: hidden; position: relative;
  background:
    repeating-linear-gradient(135deg, rgba(22,58,92,0.05) 0 2px, transparent 2px 22px),
    repeating-linear-gradient(45deg, rgba(184,134,46,0.06) 0 2px, transparent 2px 22px),
    linear-gradient(160deg, #E7D9B8, #D9C79E);
}
.registan-visual .center-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.registan-visual .center-mark svg { width: 46%; height: 46%; color: var(--gold); opacity: 0.85; }
@media (max-width: 880px) {
  #registan .section-inner { grid-template-columns: 1fr; gap: 8vh; }
  .registan-visual { order: -1; aspect-ratio: 16/10; }
}

/* -- Split bo'limlar (3D / Arxitektura / Minecraft): matn + portal karta -- */
.split-section .section-inner {
  display: grid; grid-template-columns: 0.95fr 1.05fr; gap: 7vw; align-items: center;
}
.split-section.reverse .section-inner { grid-template-columns: 1.05fr 0.95fr; }
.split-section.reverse .portal-card { order: -1; }
@media (max-width: 880px) {
  .split-section .section-inner, .split-section.reverse .section-inner { grid-template-columns: 1fr; gap: 6vh; }
  .split-section.reverse .portal-card { order: 0; }
  .portal-card { order: -1; }
}

.stat-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 28px; }
.stat-chips span {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.02em;
  background: rgba(22,58,92,0.07); color: var(--cobalt);
  padding: 8px 14px; border-radius: 999px;
}

.btn-secondary {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.03em;
  color: var(--cobalt); padding-bottom: 4px; border-bottom: 1.5px solid var(--cobalt);
}
.btn-secondary svg { width: 13px; height: 13px; transition: transform 0.25s var(--ease); }
.btn-secondary:hover svg { transform: translateX(4px); }
.split-section:nth-of-type(1) .btn-secondary,
#architecture .btn-secondary { color: var(--blue-navy); border-color: var(--blue-navy); }
#minecraft .btn-secondary { color: var(--kids-accent); border-color: var(--kids-accent); }

/* -- Portal kartalar: har biri o'z rejimiga xos vizual til -- */
.portal-card {
  position: relative; aspect-ratio: 5/4; border-radius: var(--radius-lg);
  overflow: hidden; cursor: pointer; border: none; padding: 0; width: 100%;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.portal-card:hover { transform: translateY(-6px); box-shadow: 0 30px 60px -24px rgba(22,58,92,0.4); }
.portal-card .portal-fill { position: absolute; inset: 0; }
.portal-card .portal-icon {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.portal-card .portal-icon svg { width: 34%; height: 34%; }
.portal-card .portal-enter {
  position: absolute; right: 18px; bottom: 18px;
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(241,232,214,0.95); color: var(--cobalt);
  transition: transform 0.3s var(--ease);
}
.portal-card:hover .portal-enter { transform: scale(1.1) rotate(-8deg); }
.portal-card .portal-enter svg { width: 17px; height: 17px; }

.portal-card.tone-3d .portal-fill {
  background:
    radial-gradient(circle at 30% 25%, rgba(217,169,63,0.35), transparent 55%),
    radial-gradient(ellipse at 75% 80%, rgba(30,127,120,0.3), transparent 60%),
    linear-gradient(160deg, #E7D9B8, #CBB88C);
}
.portal-card.tone-3d .dot-field {
  position: absolute; inset: 0; opacity: 0.5;
  background-image: radial-gradient(circle, rgba(22,58,92,0.35) 1px, transparent 1px);
  background-size: 16px 16px;
  animation: dotdrift 14s linear infinite;
}
@keyframes dotdrift { from { background-position: 0 0; } to { background-position: 160px 160px; } }
.portal-card.tone-3d .portal-icon { color: var(--cobalt); }

.portal-card.tone-arch .portal-fill { background: var(--blue-navy); }
.portal-card.tone-arch .grid-field {
  position: absolute; inset: 0; opacity: 0.55;
  background-image:
    repeating-linear-gradient(0deg, rgba(111,227,255,0.18) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(111,227,255,0.18) 0 1px, transparent 1px 28px);
}
.portal-card.tone-arch .portal-icon { color: var(--blue-line); }
.portal-card.tone-arch .portal-enter { background: rgba(10,32,54,0.9); color: var(--blue-line); }

.portal-card.tone-mc .portal-fill {
  background-image:
    linear-gradient(45deg, rgba(232,121,46,0.14) 25%, transparent 25%, transparent 75%, rgba(232,121,46,0.14) 75%),
    linear-gradient(45deg, rgba(232,121,46,0.14) 25%, transparent 25%, transparent 75%, rgba(232,121,46,0.14) 75%),
    linear-gradient(160deg, #FFF0D6, #F4D9A8);
  background-size: 32px 32px, 32px 32px, 100% 100%;
  background-position: 0 0, 16px 16px, 0 0;
}
.portal-card.tone-mc .portal-icon { color: var(--kids-accent); }
.portal-card.tone-mc .portal-enter { background: var(--kids-accent); color: #fff; }

/* -- Loyiha / About bo'limi -- */
.skill-tags { display: flex; flex-wrap: wrap; gap: 10px; margin: 30px 0 0; max-width: 640px; }
.skill-tags span {
  font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.02em;
  border: 1px solid rgba(22,58,92,0.2); color: var(--cobalt);
  padding: 9px 16px; border-radius: 999px; background: transparent;
}

/* -- Footer -- */
#site-footer { background: var(--cobalt-deep); color: var(--parchment); padding: 8vh 0 4vh; }
#site-footer .footer-top {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 40px;
  padding-bottom: 6vh; margin-bottom: 4vh; border-bottom: 1px solid rgba(241,232,214,0.14);
}
#site-footer .nav-logo { color: var(--parchment); }
#site-footer .nav-logo .mark { color: var(--gold-bright); }
#site-footer .footer-tagline { opacity: 0.6; font-size: 0.92rem; margin-top: 10px; max-width: 280px; }
#site-footer .footer-links { display: flex; gap: 40px; flex-wrap: wrap; }
#site-footer .footer-links-col { display: flex; flex-direction: column; gap: 10px; }
#site-footer .footer-links-col .head {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase;
  opacity: 0.45; margin-bottom: 4px;
}
#site-footer .footer-links-col a { color: var(--parchment); opacity: 0.75; text-decoration: none; font-size: 0.9rem; }
#site-footer .footer-links-col a:hover { opacity: 1; }
#site-footer .footer-credit { font-size: 0.78rem; opacity: 0.5; max-width: 640px; line-height: 1.6; }
#site-footer .footer-credit a { color: var(--turquoise-bright); text-decoration: underline; text-underline-offset: 2px; }


#loading {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--cobalt-deep);
  color: var(--parchment);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}
#loading.active { opacity: 1; visibility: visible; pointer-events: all; }

.loading-scene { margin-bottom: 20px; filter: drop-shadow(0 10px 30px rgba(0,0,0,0.35)); }

.ring-track {
  fill: none; stroke: rgba(241,232,214,0.12); stroke-width: 9;
}
.ring-progress {
  fill: none; stroke: url(#ringGrad); stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 816.81; stroke-dashoffset: 816.81;
  transition: stroke-dashoffset 0.25s linear;
}

.monument { filter: drop-shadow(0 0 14px rgba(217,169,63,0.35)); }

.stalls .stall {
  fill: #3a4a55;
  opacity: 0.4;
  transform-box: fill-box;
  transition: fill 0.5s var(--ease), opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.stalls .stall.lit {
  fill: var(--gold-bright);
  opacity: 1;
}

#loading .pct {
  font-family: var(--font-mono); font-size: 0.95rem; letter-spacing: 0.06em;
  color: var(--gold-bright); margin-bottom: 10px;
}
#loading .fact {
  max-width: 420px; text-align: center; font-size: 0.9rem; line-height: 1.6;
  opacity: 0.68; min-height: 3.2em; padding: 0 20px;
}
#loading .stage {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; opacity: 0.45; margin-top: 18px;
}
.loading-credit {
  position: absolute; bottom: 22px; left: 0; right: 0; text-align: center;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.04em;
  opacity: 0.32;
}

/* ==========================================================================
   Chiqish xabari — menyuga qaytganda BUTUN EKRANLI, bir necha soniyalik xabar
   ========================================================================== */
#exit-toast {
  position: fixed; inset: 0; z-index: 25;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 8vh 8vw;
  background: var(--cobalt-deep); color: var(--parchment);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}
#exit-toast.show { opacity: 1; visibility: visible; pointer-events: all; }
#exit-toast .mark {
  width: 48px; height: 48px; color: var(--gold-bright); margin-bottom: 26px;
  opacity: 0; transform: scale(0.7) translateY(10px);
  transition: opacity 0.6s var(--ease) 0.15s, transform 0.6s var(--ease) 0.15s;
}
#exit-toast.show .mark { opacity: 1; transform: scale(1) translateY(0); }
#exit-toast h5 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 4.5vw, 3.2rem);
  margin: 0 0 20px; color: var(--parchment);
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.6s var(--ease) 0.25s, transform 0.6s var(--ease) 0.25s;
}
#exit-toast.show h5 { opacity: 1; transform: translateY(0); }
#exit-toast p {
  font-size: clamp(1rem, 1.6vw, 1.2rem); line-height: 1.65; margin: 0; opacity: 0;
  max-width: 560px; color: var(--parchment); 
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease) 0.35s, transform 0.6s var(--ease) 0.35s;
}
#exit-toast.show p { opacity: 0.78; transform: translateY(0); }
#exit-toast .toast-close {
  position: absolute; top: 26px; right: 26px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(241,232,214,0.1); color: var(--parchment);
  display: flex; align-items: center; justify-content: center;
}
#exit-toast .toast-close svg { width: 15px; height: 15px; }

/* ==========================================================================
   3D stage
   ========================================================================== */
#stage { position: fixed; inset: 0; z-index: 5; opacity: 0; visibility: hidden; }
#stage.active { opacity: 1; visibility: visible; }
#viewport { position: absolute; inset: 0; display: block; outline: none; }

.hud {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  display: flex; flex-direction: column; justify-content: space-between;
}
.hud-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 20px; pointer-events: none;
}
.hud-badge {
  pointer-events: all;
  display: flex; align-items: center; gap: 10px;
  background: rgba(241,232,214,0.92); backdrop-filter: blur(6px);
  padding: 8px 14px 8px 10px; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; color: var(--cobalt);
  box-shadow: 0 8px 22px -10px rgba(0,0,0,0.35);
}
.hud-badge .mark { width: 20px; height: 20px; color: var(--gold); }
.hud-badge .mode-name {
  font-family: var(--font-mono); font-weight: 500; font-size: 0.62rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--turquoise);
  border-left: 1px solid rgba(22,58,92,0.25); padding-left: 10px; margin-left: 2px;
}

.hud-controls {
  pointer-events: all;
  display: flex; align-items: center; gap: 6px;
  background: rgba(241,232,214,0.92); backdrop-filter: blur(6px);
  border-radius: 999px; padding: 5px;
  box-shadow: 0 8px 22px -10px rgba(0,0,0,0.35);
}
.hud-controls button {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--cobalt); transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.hud-controls button svg { width: 18px; height: 18px; }
.hud-controls button:hover { background: rgba(22,58,92,0.1); }
.hud-controls button[aria-pressed="true"] { background: var(--cobalt); color: var(--parchment); }
.hud-controls .exit-labeled {
  width: auto; border-radius: 999px; padding: 0 14px 0 12px; gap: 7px;
  color: var(--terracotta); font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em;
}
.hud-controls .exit-labeled svg { width: 16px; height: 16px; flex-shrink: 0; }
.hud-controls .sep { width: 1px; height: 20px; background: rgba(22,58,92,0.2); margin: 0 2px; }

/* Drone/erkin uchish rejimi faol bo'lganda — butun ekranga yengil belgi */
body.fly-mode #stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border: 3px solid rgba(111,227,255,0.5); box-sizing: border-box; z-index: 6;
}

.hint {
  position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%);
  pointer-events: none;
  background: rgba(10,32,54,0.72); color: var(--parchment);
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.03em;
  padding: 10px 18px; border-radius: 999px;
  display: flex; gap: 16px; align-items: center;
  opacity: 1; transition: opacity 0.6s var(--ease);
  white-space: nowrap;
}
.hint.fade { opacity: 0; }
.hint kbd {
  font-family: var(--font-mono); background: rgba(241,232,214,0.16);
  padding: 2px 6px; border-radius: 4px; font-size: 0.7rem;
}

.crosshair {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(241,232,214,0.85);
  box-shadow: 0 0 0 1px rgba(10,32,54,0.5);
  pointer-events: none;
}

.enter-prompt {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  /* MUHIM: 'none', 'all' emas — aks holda bu butun ekranni qoplab,
     yuqoridagi rejim tugmalarini bosib bo'lmay qolar edi. Faqat pastdagi
     tugmaning o'zi (pastda) klikni ushlaydi. */
  pointer-events: none; background: rgba(10,32,54,0.35);
  opacity: 0; visibility: hidden; transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
}
.enter-prompt.show { opacity: 1; visibility: visible; }
.enter-prompt button {
  pointer-events: all;
  background: var(--parchment); color: var(--cobalt);
  font-family: var(--font-display); font-weight: 600; font-size: 1.2rem;
  padding: 16px 34px; border-radius: 999px;
  box-shadow: 0 20px 40px -16px rgba(0,0,0,0.5);
  display: flex; align-items: center; gap: 12px;
}

/* touch controls */
.touch-only { display: none; }
.is-touch .touch-only { display: block; }
.is-touch .desktop-only { display: none; }

.joystick-zone {
  position: absolute; left: 0; bottom: 0; width: 46%; height: 46%;
  pointer-events: all;
}
.joystick-base {
  position: absolute; width: 108px; height: 108px; border-radius: 50%;
  background: rgba(241,232,214,0.16); border: 1.5px solid rgba(241,232,214,0.4);
  display: none;
}
.joystick-knob {
  position: absolute; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(241,232,214,0.85); top: 31px; left: 31px;
}
.look-zone { position: absolute; right: 0; bottom: 0; width: 54%; height: 100%; pointer-events: all; }

.interact-chip {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(10px);
  pointer-events: all;
  background: var(--gold-bright); color: var(--cobalt-deep);
  font-family: var(--font-mono); font-weight: 600; font-size: 0.78rem;
  padding: 11px 20px; border-radius: 999px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 12px 26px -10px rgba(0,0,0,0.5);
  opacity: 0; visibility: hidden;
  transition: all 0.25s var(--ease);
}
.interact-chip.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   CSS2D qatlami — Three.js CSS2DRenderer shu konteynerga chizadi.
   ========================================================================== */
#css2d-layer {
  position: absolute; inset: 0; overflow: hidden;
  pointer-events: none; /* individual .holo-panel o'zi qayta yoqadi */
  z-index: 4;
}

/* ==========================================================================
   Hologram panel — hotspot yonida 3D fazoda "suzadi"
   ========================================================================== */
.holo-anchor {
  /* CSS2DRenderer BU elementning transform'ini har freym o'zi yozadi
     (joylashuv uchun, .center=(0.5,1) — pastki-markaz nuqtaga bog'langan).
     Shu sabab bu yerda hech qanday transform/animatsiya qo'yilmaydi —
     ular ICHKI .holo-panel'da. */
  pointer-events: none;
}
.holo-panel {
  position: relative;
  width: min(300px, 78vw);
  margin-bottom: 8px; /* anchor nuqtasidan biroz yuqorida "suzsin" */
  background: linear-gradient(165deg, rgba(14,39,64,0.42), rgba(14,39,64,0.32));
  border: 1px solid rgba(111,227,255,0.4);
  border-radius: 14px;
  padding: 18px 18px 16px;
  color: var(--parchment);
  text-shadow: 0 1px 6px rgba(0,0,0,0.55); /* orqa fon och bo'lganda ham matn o'qilishi uchun */
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 20px 44px -18px rgba(0,0,0,0.55), 0 0 0 1px rgba(111,227,255,0.06);
  opacity: 0; visibility: hidden;
  transform: scale(0.92) translateY(6px);
  transform-origin: bottom center;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease), transform 0.3s var(--ease);
  pointer-events: none;
}
.holo-panel.open {
  opacity: 1; visibility: visible; pointer-events: all;
  transform: scale(1) translateY(0);
}
.holo-panel::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  width: 12px; height: 12px; background: rgba(14,39,64,0.85);
  border-right: 1px solid rgba(111,227,255,0.35); border-bottom: 1px solid rgba(111,227,255,0.35);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.holo-close {
  position: absolute; top: 10px; right: 10px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(241,232,214,0.1); color: var(--parchment);
  display: flex; align-items: center; justify-content: center;
}
.holo-close svg { width: 11px; height: 11px; }
.holo-eyebrow {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--blue-line); display: block; margin-bottom: 6px;
}
.holo-panel h4 {
  font-family: var(--font-display); font-size: 1.28rem; font-weight: 700;
  margin: 0 0 2px; line-height: 1.1; padding-right: 20px;
}
.holo-years { font-family: var(--font-mono); font-size: 0.68rem; color: var(--gold-bright); display: block; margin-bottom: 10px; }
.holo-body { max-height: 190px; overflow-y: auto; margin-bottom: 10px; }
.holo-body p { font-size: 0.83rem; line-height: 1.55; margin: 0 0 10px; opacity: 0.88; }
.holo-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.holo-tags span {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.03em;
  background: rgba(111,227,255,0.12); color: var(--blue-line);
  padding: 4px 9px; border-radius: 999px;
}
.holo-tp {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--gold-bright); color: var(--blue-navy);
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 9px; border-radius: 8px;
}
@media (max-width: 600px) { .holo-body { max-height: 34vh; } }

/* ==========================================================================
   Architect / skeleton mode readout
   ========================================================================== */
.tech-readout {
  position: absolute; left: 20px; bottom: 24px; pointer-events: none;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--blue-line);
  background: rgba(10,32,54,0.65); border: 1px solid var(--blue-line-dim);
  border-radius: 10px; padding: 12px 16px; line-height: 1.8;
  max-width: 260px;
}
.tech-readout .row { display: flex; justify-content: space-between; gap: 14px; opacity: 0.85; }
.tech-readout .row b { color: var(--parchment); font-weight: 500; }
.tech-readout .head {
  text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.62rem;
  color: var(--blue-line); opacity: 0.7; margin-bottom: 6px;
}

/* ==========================================================================
   Kids mode — Minecraft bridge panel
   ========================================================================== */
#kids-panel {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  pointer-events: all; width: min(360px, 90vw);
  background: var(--kids-bg); border: 2px solid var(--kids-accent);
  border-radius: var(--radius-lg); padding: 18px 20px;
  box-shadow: 0 20px 40px -16px rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden; transform: translateX(-50%) translateY(20px);
  transition: all 0.4s var(--ease);
}
#kids-panel.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
#kids-panel h4 {
  font-family: var(--font-display); font-size: 1.3rem; margin: 0 0 6px; color: var(--kids-accent);
}
#kids-panel p { font-size: 0.85rem; line-height: 1.5; margin: 0 0 14px; opacity: 0.85; }
.mc-fallback-note { font-size: 0.72rem !important; opacity: 0.65 !important; line-height: 1.5 !important; margin: -4px 0 12px !important; }
.mc-download-btn {
  width: 100%; background: var(--kids-accent); color: #fff;
  font-weight: 700; font-size: 0.92rem; padding: 13px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 10px 22px -10px rgba(232,121,46,0.7);
}
.mc-steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: step; }
.mc-steps li {
  counter-increment: step; font-size: 0.78rem; line-height: 1.5;
  padding: 6px 0 6px 30px; position: relative; opacity: 0.85;
}
.mc-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 5px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--kids-accent);
  color: #fff; font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ==========================================================================
   Calibration tool (architect utility — see README)
   ========================================================================== */
#calib-readout {
  position: absolute; right: 20px; bottom: 24px; pointer-events: all;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--parchment);
  background: rgba(10,32,54,0.78); border: 1px solid var(--blue-line-dim);
  border-radius: 10px; padding: 12px 14px; max-width: 260px;
  opacity: 0; visibility: hidden; transition: all 0.3s var(--ease);
}
#calib-readout.show { opacity: 1; visibility: visible; }
#calib-readout .xyz { color: var(--blue-line); margin-bottom: 8px; word-break: break-all; }
#calib-readout button {
  font-size: 0.68rem; background: var(--blue-line); color: var(--blue-navy);
  padding: 6px 10px; border-radius: 6px; font-weight: 600;
}

/* ==========================================================================
   Theme variants applied to .hud / #stage via body[data-mode]
   ========================================================================== */
body[data-mode="architect"] #stage { background: var(--blue-navy); }
body[data-mode="architect"] .hud-badge,
body[data-mode="architect"] .hud-controls { background: rgba(10,32,54,0.85); color: var(--parchment); }
body[data-mode="architect"] .hud-badge { color: var(--parchment); }
body[data-mode="architect"] .hud-controls button { color: var(--blue-line); }
body[data-mode="architect"] .hud-controls button:hover { background: rgba(111,227,255,0.12); }

body[data-mode="kids"] .hud-badge,
body[data-mode="kids"] .hud-controls { background: rgba(255,246,227,0.95); }
body[data-mode="kids"] .hud-controls button { color: var(--kids-accent); }

/* ==========================================================================
   Small screens
   ========================================================================== */
@media (max-width: 600px) {
  .hero p { font-size: 0.98rem; }
  .hud-top { padding: 14px; }
  .hud-badge .mode-name { display: none; }
  #hotspot-panel { width: 100vw; }
  .tech-readout { max-width: 200px; font-size: 0.66rem; }
}

/* ==========================================================================
   Avtomatik tur (tanishtiruv) — orqa fonsiz, kino-uslubidagi sarlavha
   ========================================================================== */
#tour-overlay {
  position: absolute; inset: 0; z-index: 8;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
}
#tour-overlay.active { opacity: 1; visibility: visible; pointer-events: none; }

#tour-caption {
  position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%) translateY(10px);
  width: min(640px, 82vw); text-align: center;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0,0,0,0.85), 0 1px 4px rgba(0,0,0,0.9);
  opacity: 0; transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
#tour-caption.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#tour-caption-eyebrow {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-bright); display: block; margin-bottom: 10px;
}
#tour-caption-title { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; margin: 0 0 10px; color: #fff; }
#tour-caption-text { font-size: 0.98rem; line-height: 1.6; margin: 0; opacity: 0.92; }

#tour-stop-btn {
  position: absolute; right: 22px; bottom: 22px; pointer-events: all;
  display: flex; align-items: center; gap: 8px;
  background: rgba(10,32,54,0.55); color: #fff; border: 1px solid rgba(255,255,255,0.25);
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.03em;
  padding: 10px 16px; border-radius: 999px;
  backdrop-filter: blur(6px);
}
#tour-stop-btn svg { width: 12px; height: 12px; }
@media (max-width: 600px) {
  #tour-caption { bottom: 20%; width: 88vw; }
  #tour-caption-title { font-size: 1.3rem; }
  #tour-caption-text { font-size: 0.86rem; }
}

/* ==========================================================================
   3D kirish rejimini tanlash oynasi (modal)
   ========================================================================== */
#mode-modal {
  position: fixed; inset: 0; z-index: 26;
  display: flex; align-items: center; justify-content: center; padding: 6vw;
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
}
#mode-modal.show { opacity: 1; visibility: visible; }
.mode-modal-backdrop {
  position: absolute; inset: 0; background: rgba(10,32,54,0.6); backdrop-filter: blur(2px);
}
.mode-modal-panel {
  position: relative; width: min(640px, 100%);
  background: var(--parchment); border-radius: var(--radius-lg);
  padding: 40px 34px 34px;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.5);
  transform: scale(0.94) translateY(10px);
  transition: transform 0.35s var(--ease);
}
#mode-modal.show .mode-modal-panel { transform: scale(1) translateY(0); }
.mode-modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(22,58,92,0.07); color: var(--cobalt);
  display: flex; align-items: center; justify-content: center;
}
.mode-modal-close svg { width: 14px; height: 14px; }
#mode-modal-title {
  font-family: var(--font-display); font-weight: 700; font-size: 1.7rem;
  text-align: center; margin: 0 0 28px; color: var(--ink);
}
.mode-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-choice {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 12px; padding: 28px 18px; border-radius: 16px;
  border: 1.5px solid rgba(22,58,92,0.14); background: #FBF6EA;
  transition: all 0.3s var(--ease);
}
.mode-choice:hover { border-color: var(--gold); transform: translateY(-4px); box-shadow: 0 20px 34px -18px rgba(22,58,92,0.3); }
.mode-choice svg { width: 34px; height: 34px; color: var(--cobalt); }
.mode-choice-title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--cobalt); }
.mode-choice-desc { font-size: 0.82rem; line-height: 1.5; opacity: 0.7; }
@media (max-width: 560px) {
  .mode-choice-grid { grid-template-columns: 1fr; }
  .mode-modal-panel { padding: 34px 22px 26px; }
}

/* ==========================================================================
   Yordam paneli — barcha klaviatura tugmalari ro'yxati
   ========================================================================== */
#help-panel {
  position: absolute; right: 20px; top: 76px; pointer-events: all;
  background: rgba(22,58,92,0.95); color: var(--parchment);
  border-radius: 14px; padding: 16px 18px; width: 240px;
  box-shadow: 0 20px 44px -18px rgba(0,0,0,0.5);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: all 0.28s var(--ease);
}
#help-panel.show { opacity: 1; visibility: visible; transform: translateY(0); }
#help-panel .head {
  font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase;
  opacity: 0.55; margin-bottom: 10px;
}
#help-panel .row {
  display: flex; align-items: center; gap: 10px; padding: 5px 0;
  font-size: 0.8rem; opacity: 0.92;
}
#help-panel .row kbd {
  font-family: var(--font-mono); font-size: 0.68rem; background: rgba(241,232,214,0.14);
  padding: 3px 7px; border-radius: 5px; min-width: 26px; text-align: center; flex-shrink: 0;
}
#btn-help[aria-pressed="true"] { background: var(--cobalt); color: var(--parchment); }
