/* ═══════════════════════════════════════════════════════
   AI DEVELOPER WORKSPACE — core styles & design tokens
   ═══════════════════════════════════════════════════════ */

:root {
  /* Palette */
  --bg: #050816;
  --bg-soft: #0a0f24;
  --cyan: #00f5ff;
  --violet: #7b61ff;
  --emerald: #00ff9d;
  --white: #eef2ff;
  --muted: #8b93b5;
  --line: rgba(139, 147, 181, 0.16);

  /* Glass */
  --glass: rgba(10, 15, 36, 0.72);
  --glass-light: rgba(123, 97, 255, 0.06);
  --glass-border: rgba(0, 245, 255, 0.18);

  /* Type */
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snap: cubic-bezier(0.6, 0.04, 0.1, 1);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a, button, input, textarea {
  cursor: pointer;
}

::selection {
  background: rgba(0, 245, 255, 0.25);
}

/* Scrollbars inside windows */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.25);
  border-radius: 99px;
}

/* ══════════ CANVAS ══════════ */
#webgl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  /* Without this, mobile browsers spend the first chunk of every drag
     deciding whether it's a page-scroll gesture before handing pointer
     events to JS — which is exactly what reads as "360° drag is slow". */
  touch-action: none;
}

/* ══════════ HUD ══════════ */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 32px;
  opacity: 0;
  pointer-events: none;
}

.hud__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan), 0 0 32px rgba(0, 245, 255, 0.5);
  animation: hud-pulse 3s ease-in-out infinite;
}

@keyframes hud-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.75); opacity: 0.6; }
}

.hud__name {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.24em;
  font-size: 0.82rem;
}

.hud__name em {
  font-style: normal;
  color: var(--cyan);
}

.hud__status {
  display: flex;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.hud__status-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.pulse--green {
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: hud-pulse 2s ease-in-out infinite;
}

/* ══════════ TOOLTIP (3D hover) ══════════ */
.tooltip {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: translate(18px, -50%) scale(0.9);
  opacity: 0;
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.tooltip.is-visible {
  opacity: 1;
  transform: translate(18px, -50%) scale(1);
}

.tooltip__kicker {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.3em;
  color: var(--emerald);
}

.tooltip__label {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.tooltip__desc {
  max-width: 220px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 2px;
}

.tooltip__action {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.26em;
  color: var(--cyan);
  margin-top: 7px;
}

/* ══════════ 360° COMPASS (large center overlay) ══════════ */
.compass {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s var(--ease-out);
}

.compass.is-visible { opacity: 1; }

.compass__dial {
  position: relative;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(0, 245, 255, 0.08);
  display: grid;
  place-items: center;
}

/* Tick marks */
.compass__dial::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background:
    conic-gradient(
      var(--muted) 0 1.2%, transparent 1.2% 24.4%,
      var(--muted) 24.4% 25.6%, transparent 25.6% 49.4%,
      var(--muted) 49.4% 50.6%, transparent 50.6% 74.4%,
      var(--muted) 74.4% 75.6%, transparent 75.6% 98.8%,
      var(--muted) 98.8%
    );
  mask: radial-gradient(circle, transparent 62%, #000 63%);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%);
  opacity: 0.6;
}

.compass__needle {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 36px solid var(--cyan);
  filter: drop-shadow(0 0 10px rgba(0, 245, 255, 0.7));
  transform-origin: 50% 100%;
  translate: 0 -18px;
}

.compass__label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 2;
  letter-spacing: 0.3em;
  text-align: center;
  color: var(--muted);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.compass__label em {
  font-style: normal;
  font-size: 0.9rem;
  color: var(--cyan);
}

/* Mini variant — persistent, bottom-left */
.compass--mini {
  top: auto;
  left: 32px;
  bottom: 30px;
  transform: none;
  flex-direction: row;
  gap: 12px;
}

.compass--mini .compass__dial {
  width: 52px;
  height: 52px;
  box-shadow: none;
}

.compass--mini .compass__needle {
  border-left-width: 5px;
  border-right-width: 5px;
  border-bottom-width: 16px;
  translate: 0 -8px;
}

.compass--mini .compass__label {
  font-size: 0.56rem;
  line-height: 1.7;
  letter-spacing: 0.22em;
  text-align: left;
}

/* ══════════ HINT ══════════ */
.hint {
  position: fixed;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 99px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.hint.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hint__icon {
  color: var(--cyan);
  animation: hud-pulse 2.4s ease-in-out infinite;
}

/* ══════════ SECTION DOCK ══════════ */
/* Two layers on purpose: .dock is the fixed, rounded, blurred shell —
   overflow: hidden here is what actually clips the scrollbar to the
   pill shape. .dock__scroll is the inner strip that does the real
   horizontal scrolling; its own scrollbar would ignore the outer
   border-radius if it lived on the same element (a common cross-
   browser quirk), which is exactly what let it poke out past the
   rounded ends before. */
.dock {
  position: fixed;
  bottom: 16px; /* the hint pill it used to clear is gone now */
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  max-width: calc(100vw - 20px);
  overflow: hidden;
  background: rgba(10, 15, 36, 0.5); /* 50% transparent, not the shared --glass (0.72) */
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.dock__scroll {
  display: flex;
  gap: 3px;
  padding: 5px;
  padding-bottom: 7px; /* a little extra room so the thin scrollbar doesn't crowd the icons above it */
  max-width: calc(100vw - 20px);
  overflow-x: auto;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(0, 245, 255, 0.35) transparent; /* Firefox */
}

.dock__scroll::-webkit-scrollbar { height: 4px; }
.dock__scroll::-webkit-scrollbar-track { background: transparent; }
.dock__scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.35);
  border-radius: 4px;
}

.dock__item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 11px;
  color: var(--muted);
  transition: background 0.25s, color 0.25s;
}

.dock__item:active,
.dock__item.is-active {
  background: rgba(0, 245, 255, 0.12);
  color: var(--cyan);
}

.dock__icon {
  font-size: 0.82rem;
  line-height: 1;
}

.dock__label {
  font-family: var(--font-mono);
  font-size: 0.42rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ══════════ ALPHA'S SPEECH BUBBLE ══════════ */
.speech {
  position: fixed;
  z-index: 46;
  max-width: 250px;
  padding: 13px 17px;
  transform: translate(-50%, -115%) scale(0.9);
  font-family: var(--font-body);
  font-size: 0.8rem;
  line-height: 1.55;
  text-align: left;
  color: var(--white);
  background: var(--glass);
  border: 1px solid rgba(159, 216, 255, 0.4);
  border-radius: 16px 16px 16px 4px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 30px rgba(159, 216, 255, 0.12);
  opacity: 0;
  pointer-events: auto;
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.speech::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid rgba(159, 216, 255, 0.4);
}

.speech.is-visible {
  opacity: 1;
  transform: translate(-50%, -115%) scale(1);
  animation: speech-pop 0.5s var(--ease-out);
}

@keyframes speech-pop {
  0% { transform: translate(-50%, -115%) scale(0.6); }
  70% { transform: translate(-50%, -115%) scale(1.06); }
  100% { transform: translate(-50%, -115%) scale(1); }
}

.speech:hover { border-color: var(--cyan); }

/* ══════════ SHARED UI PRIMITIVES ══════════ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 26px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  border: 1px solid rgba(0, 245, 255, 0.35);
  border-radius: 10px;
  background: rgba(0, 245, 255, 0.06);
  overflow: hidden;
  transition: color 0.3s, border-color 0.3s, box-shadow 0.3s, transform 0.3s var(--ease-out);
  will-change: transform;
}

.btn:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(0, 245, 255, 0.25), inset 0 0 18px rgba(0, 245, 255, 0.08);
}

.btn--ghost {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--white);
  border-color: var(--muted);
  box-shadow: none;
}

.chip {
  display: inline-block;
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--emerald);
  border: 1px solid rgba(0, 255, 157, 0.25);
  border-radius: 99px;
  background: rgba(0, 255, 157, 0.06);
}
