/* ===== efidget — enhanced visual layer =====
   Load after styles.css. Adds to, doesn't replace.
   ================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&display=swap');

/* ── Typography ────────────────────────────────────────────── */
*, *::before, *::after {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Deep space background ─────────────────────────────────── */
html {
  background:
    radial-gradient(ellipse at 50% 0%, #0d0d1f 0%, #06060f 55%, #000005 100%)
    fixed;
  overscroll-behavior: none;
}
body {
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
canvas {
  -webkit-touch-callout: none;
}
@media (max-width: 768px) {
  html, body { height: 100dvh; }
}

/* ── OLED grain overlay — desktop only ────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}
@media (max-width: 768px) {
  body::before { display: none; }
}

/* ── HUD labels ─────────────────────────────────────────────── */
.world-name {
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.28);
}
.world-mood {
  font-size: 9px;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.12);
}

/* ── HUD buttons ────────────────────────────────────────────── */
.hud-btn {
  background: rgba(8, 8, 20, 0.72);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.42);
  width: 32px;
  height: 32px;
  font-size: 13px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.hud-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.88);
}
.hud-btn.active {
  color: var(--theme);
  border-color: rgba(255, 255, 255, 0.18);
}
.hud-btn-bg {
  border-radius: 10px !important;
  width: auto !important;
  padding: 0 10px !important;
  font-size: 9px !important;
  letter-spacing: 0.06em;
}
@media (max-width: 768px) {
  .hud-btn {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(4, 4, 14, 0.94);
  }
}

/* ── Theme picker ───────────────────────────────────────────── */
.theme-picker {
  background: rgba(8, 8, 20, 0.72);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  padding: 8px 12px;
  gap: 8px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
@media (max-width: 768px) {
  .theme-picker {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(4, 4, 14, 0.96);
  }
}
.theme-dot {
  width: 11px;
  height: 11px;
  opacity: 0.32;
  border: 1.5px solid transparent;
  transition: opacity 0.18s, transform 0.18s, border-color 0.18s;
}
.theme-dot:hover { opacity: 0.78; transform: scale(1.38); }
.theme-dot.active {
  opacity: 1;
  transform: scale(1.5);
  border-color: rgba(255, 255, 255, 0.78);
}

/* ── Controls panel ─────────────────────────────────────────── */
#controls-panel {
  background: rgba(8, 8, 20, 0.88);
  border: 0.5px solid rgba(255, 255, 255, 0.09);
  border-radius: 40px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
#controls-panel label {
  color: rgba(255, 255, 255, 0.28);
  font-weight: 300;
  letter-spacing: 0.07em;
  font-size: 10px;
}
@media (max-width: 768px) {
  #controls-panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(4, 4, 14, 0.97);
  }
}

/* ── Ctrl button ────────────────────────────────────────────── */
.ctrl-btn {
  background: rgba(255, 255, 255, 0.055);
  border: 0.5px solid rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.07em;
  padding: 4px 12px;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.26);
  color: #fff;
}
.ctrl-btn.active {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* ── Divider ────────────────────────────────────────────────── */
.ctrl-divider { background: rgba(255, 255, 255, 0.07); }

/* ── Sliders ────────────────────────────────────────────────── */
input[type="range"] {
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 7px rgba(255, 255, 255, 0.26);
}
input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 7px rgba(255, 255, 255, 0.26);
  border: none;
}
@media (pointer: coarse) {
  input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; }
}

/* ── Speed readout ──────────────────────────────────────────── */
#speed-val { color: rgba(255, 255, 255, 0.28); font-weight: 300; }

/* ── Time counter ───────────────────────────────────────────── */
#time-counter {
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.15);
}

/* ── Share toast ────────────────────────────────────────────── */
#share-toast {
  background: rgba(8, 8, 20, 0.92);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-weight: 300;
  letter-spacing: 0.06em;
  border-radius: 24px;
}

/* ── Custom cursor ──────────────────────────────────────────── */
#cursor { width: 8px; height: 8px; border-width: 1px; }

/* ── Extra world buttons (export / clear / undo) ─────────────  */
.extra-btn {
  background: rgba(8, 8, 20, 0.88);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.07em;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.extra-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}
@media (max-width: 768px) {
  .extra-btn {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(4, 4, 14, 0.96);
  }
}

/* ── Draw / drag hints ──────────────────────────────────────── */
#draw-hint .hint-text,
#drag-hint .hint-text {
  font-weight: 300;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.2);
}

/* ── Breathe world text & picker ────────────────────────────── */
#breathe-text   { font-weight: 300; letter-spacing: 0.22em; }
#breathe-phase  { font-weight: 300; letter-spacing: 0.14em; }
#breathe-pattern-picker {
  background: rgba(8, 8, 20, 0.85);
  border: 0.5px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.pattern-btn { font-weight: 300; letter-spacing: 0.08em; }
@media (max-width: 768px) {
  #breathe-pattern-picker {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(4, 4, 14, 0.97);
  }
}

/* ── Sand world controls ────────────────────────────────────── */
#sand-controls {
  background: rgba(8, 8, 20, 0.9) !important;
  border: 0.5px solid rgba(255, 255, 255, 0.09) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
}
.sand-mode-btn { font-weight: 300; letter-spacing: 0.09em; }
@media (max-width: 768px) {
  #sand-controls {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(4, 4, 14, 0.97) !important;
  }
}

/* ── Kids back button ───────────────────────────────────────── */
#k-back {
  background: rgba(8, 8, 20, 0.75) !important;
  border: 0.5px solid rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
  transition: background 0.18s ease, border-color 0.18s ease !important;
}
#k-back:active {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}
@media (max-width: 768px) {
  #k-back {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(4, 4, 14, 0.94) !important;
  }
}

/* ── Star-tooltip (constellation world) ────────────────────── */
#star-tooltip {
  background: rgba(8, 8, 20, 0.85);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  font-weight: 300;
  letter-spacing: 0.05em;
}

/* ── Session-complete modal (breathe) ───────────────────────── */
#session-complete h2 { font-weight: 300; letter-spacing: 0.14em; }
#session-complete p  { font-weight: 300; }
#session-complete button {
  background: rgba(255, 255, 255, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  font-weight: 300;
  letter-spacing: 0.1em;
}

/* ── Radar hint text ────────────────────────────────────────── */
canvas + script,
.hint-text { font-weight: 300; }
