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

html {
  /* Prefer standard dynamic range where supported (e.g. less unwanted HDR on phones). */
  dynamic-range-limit: standard;
}

html, body {
  width: 100%;
  height: 100%;
  /* besan — warm chickpea-flour cream */
  background: #EFE0C4;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: system-ui, sans-serif;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(239, 224, 196, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 20;
  color: #1a1830;
  font-size: 14px;
}

#dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #bba98a;
  transition: background 0.4s;
}

#conn {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.5;
  transition: color 0.3s;
}

/* ── World wrap — horizontally scrollable 16:9 stage ─────────────────────── */
#world-wrap {
  position: fixed;
  /* push down below header; scrubbar sits above safe-area bottom */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-x: hidden;   /* JS controls scroll via scrollLeft */
  overflow-y: hidden;
  touch-action: none;
}

#world {
  /* Height = 100% of viewport; width is derived from 16:9 ratio in JS */
  position: relative;
  height: 100%;
  /* min-width enforced via JS; default wide so there is room to pan */
  background: #EFE0C4;
  will-change: transform;
}

/* Both canvases fill the world div absolutely */
#c, #ui {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#ui { pointer-events: none; }

/* ── Minimap — click / drag to pan the wide world ───────────────────────── */
#minimap {
  position: fixed;
  bottom: max(50px, calc(env(safe-area-inset-bottom) + 42px));
  right: 12px;
  width: 128px;
  height: 72px; /* 16:9 */
  border-radius: 6px;
  background: rgba(239, 224, 196, 0.7);
  border: 1px solid rgba(26, 24, 48, 0.15);
  cursor: pointer;
  touch-action: none;
  z-index: 30;
}

/* ── Scrub bar — manual horizontal scroll handle ─────────────────────────── */
#scrubbar {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(240px, 60vw);
  height: 6px;
  border-radius: 3px;
  background: rgba(26, 24, 48, 0.12);
  z-index: 20;
  cursor: pointer;
}

#scrubthumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  border-radius: 3px;
  background: rgba(26, 24, 48, 0.35);
  cursor: grab;
  transition: width 0.1s;
}

/* ── Hint ────────────────────────────────────────────────────────────────── */
#hint {
  position: fixed;
  bottom: max(26px, calc(env(safe-area-inset-bottom) + 12px));
  left: 0; right: 0;
  text-align: center;
  color: rgba(26, 24, 48, 0.28);
  font-size: 10px;
  pointer-events: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 10;
}
