:root {
  --ink: #edeae4;
  --ink-muted: rgba(237, 234, 228, 0.62);
  --ink-faint: rgba(237, 234, 228, 0.5);
  --accent: #d8a25a;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: #000;
  color: var(--ink);
  font-family: var(--font-mono);
  overflow: hidden;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }
#scene:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.hud {
  position: fixed;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 1.4s ease 0.3s, transform 1.4s ease 0.3s;
}
.hud.is-ready { opacity: 1; transform: none; }

/* notch/buruq qurilmalarda HUD xavfsiz zonada qolsin */
.hud--tl {
  top: max(clamp(20px, 4vh, 44px), env(safe-area-inset-top));
  left: max(clamp(20px, 4vw, 52px), env(safe-area-inset-left));
}
.hud--bl {
  bottom: max(clamp(20px, 4vh, 44px), env(safe-area-inset-bottom));
  left: max(clamp(20px, 4vw, 52px), env(safe-area-inset-left));
}
.hud--br {
  bottom: max(clamp(20px, 4vh, 44px), env(safe-area-inset-bottom));
  right: max(clamp(20px, 4vw, 52px), env(safe-area-inset-right));
  text-align: right;
}

.hud-label {
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.hud-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(42px, 7vw, 84px);
  line-height: 1.02;
  letter-spacing: 0.01em;
  margin-top: 10px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 2px 28px rgba(0, 0, 0, 0.6);
}

.hud-sub {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
}

.hud-hint {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}

.hud-credit {
  font-size: 9px;
  letter-spacing: 0.08em;
  line-height: 1.6;
  color: var(--ink-faint);
}

@media (max-width: 640px) {
  .hud--br { display: none; }
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 3;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: opacity 0.9s ease;
}
.loader.is-done { opacity: 0; pointer-events: none; }

.loader-num {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  padding: 0 12px;
}
/* watchdog/xato xabarlari uchun — uzun matn o'qiladigan bo'lsin */
.loader-num.is-msg {
  letter-spacing: 0.06em;
  line-height: 1.7;
  max-width: min(84vw, 520px);
  text-align: center;
}

.loader-track {
  width: 168px;
  height: 1px;
  background: rgba(237, 234, 228, 0.14);
  overflow: hidden;
}

.loader-line {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.fallback {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #000;
  padding: 24px;
  font-size: 13px;
  line-height: 2;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}
.fallback[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .hud { transition: none; }
  .loader { transition: none; }
  .loader-line { transition: none; }
}
