:root {
  --deep: #041024;
  --cyan: #5eeafc;
  --cyan-dim: #7fb6d9;
  --gold: #ffbe46;
  --text: #e8f4ff;
  --glass: rgba(10, 34, 66, 0.55);
  --glass-line: rgba(94, 234, 252, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #04101f;
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  cursor: default;
}

.hidden { display: none !important; }

/* ---------------- Access gate ---------------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 40%, #0b2a55 0%, #04101f 65%);
}

.gate-card {
  width: min(380px, 90vw);
  padding: 36px 32px;
  text-align: center;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  box-shadow: 0 0 60px rgba(20, 120, 200, 0.28);
}

.gate-card h1 {
  margin: 0 0 10px;
  font-family: Orbitron, Inter, sans-serif;
  font-weight: 700;
  letter-spacing: 0.34em;
  font-size: 30px;
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(94, 234, 252, 0.7);
}

.gate-card p {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--cyan-dim);
  letter-spacing: 0.05em;
}

#token-input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-line);
  background: rgba(4, 20, 40, 0.8);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

#token-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(94, 234, 252, 0.15); }

#token-submit {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cyan), #35a4d8);
  color: #04202c;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  font-family: Orbitron, Inter, sans-serif;
}

#token-submit:hover { filter: brightness(1.12); }

.gate-error {
  min-height: 18px;
  margin: 12px 0 0 !important;
  color: #ff7a7a !important;
  font-size: 12px;
}

/* ---------------- Stage ---------------- */

#app { position: fixed; inset: 0; }

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(120, 220, 255, 0.035) 0px,
    rgba(120, 220, 255, 0.035) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 45%, rgba(2, 8, 20, 0.75) 100%);
}

/* ---------------- HUD frames ---------------- */

.hud { position: absolute; z-index: 10; }

.hud-tl { top: 22px; left: 26px; max-width: 300px; }
.hud-tc { top: 22px; left: 50%; transform: translateX(-50%); }
.hud-tr { top: 22px; right: 26px; }
.hud-status { top: 46%; right: 30px; text-align: right; }

.hud-bottom {
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 26px;
}

/* Weather + ticker */

.weather { margin-bottom: 16px; }

.weather-temp {
  font-family: Orbitron, Inter, sans-serif;
  font-size: 34px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 22px rgba(94, 234, 252, 0.55);
  line-height: 1;
}

.weather-meta {
  margin-top: 5px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--cyan-dim);
  text-transform: uppercase;
}

.ticker { border-left: 1px solid var(--glass-line); padding-left: 12px; }

.ticker-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  letter-spacing: 0.24em;
  color: rgba(94, 234, 252, 0.75);
  margin-bottom: 6px;
}

.ticker-window { height: 84px; overflow: hidden; position: relative; }

.ticker-track { transition: transform 0.7s ease; }

.ticker-item {
  height: 84px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(200, 226, 248, 0.72);
  overflow: hidden;
}

/* Pills / buttons */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--text);
  font-family: Orbitron, Inter, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(94, 234, 252, 0.35);
}

.pill-gold {
  border-color: rgba(255, 190, 70, 0.5);
  color: #ffe6b0;
}

.pill-gold:hover { box-shadow: 0 0 18px rgba(255, 190, 70, 0.4); border-color: var(--gold); }

.pill.listening {
  border-color: var(--gold);
  background: rgba(80, 44, 6, 0.6);
  color: #ffe0a3;
  box-shadow: 0 0 26px rgba(255, 190, 70, 0.45);
}

.pill.muted {
  border-color: rgba(140, 160, 180, 0.35);
  color: #8fa2b5;
}

.pill.muted .rec-dot { background: #46586c; box-shadow: none; }

/* Idle-but-armed: a slow breathing dot means "I'm listening, just talk" */
.pill-listen:not(.muted):not(.listening) .rec-dot {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe { 50% { opacity: 0.3; } }

/* Gesture cursor feedback on any target */

.gesture-target.gesture-hover {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(94, 234, 252, 0.55), 0 0 26px rgba(94, 234, 252, 0.45);
}

.gesture-target.gesture-press {
  transform: scale(0.93);
  background: rgba(94, 234, 252, 0.28);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4b5b70;
  transition: background 0.2s, box-shadow 0.2s;
}

.pill.listening .rec-dot {
  background: #ff5f5f;
  box-shadow: 0 0 12px #ff5f5f;
  animation: blink 1.1s infinite;
}

@keyframes blink { 50% { opacity: 0.35; } }

/* Status readouts */

#status-badge {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(94, 234, 252, 0.6);
}

.focus-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 190, 70, 0.5);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #ffd48a;
}

/* Waveform */

.wave-group { text-align: center; }

#wave { display: block; width: 420px; height: 46px; }

.wave-label {
  font-family: Orbitron, Inter, sans-serif;
  font-size: 10px;
  letter-spacing: 0.32em;
  color: rgba(255, 190, 70, 0.85);
  margin-top: 2px;
}

/* Chat panel */

.chat-panel {
  position: absolute;
  top: 74px;
  right: 26px;
  z-index: 20;
  width: min(400px, 90vw);
  height: min(520px, 64vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background: rgba(5, 22, 44, 0.82);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(94, 234, 252, 0.2);
  font-family: Orbitron, Inter, sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--cyan);
}

.chat-close {
  border: 1px solid var(--glass-line);
  background: transparent;
  color: var(--cyan-dim);
  border-radius: 6px;
  width: 26px;
  height: 24px;
  cursor: pointer;
  font-size: 12px;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-log::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-thumb { background: rgba(94, 234, 252, 0.3); border-radius: 3px; }

.msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.msg.user {
  align-self: flex-end;
  background: rgba(94, 234, 252, 0.16);
  border: 1px solid rgba(94, 234, 252, 0.35);
}

.msg.assistant {
  align-self: flex-start;
  background: rgba(255, 190, 70, 0.1);
  border: 1px solid rgba(255, 190, 70, 0.28);
}

.msg.system {
  align-self: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--cyan-dim);
  background: none;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(94, 234, 252, 0.2);
}

#chat-input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-line);
  background: rgba(4, 18, 36, 0.85);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

#chat-input:focus { border-color: var(--cyan); }

/*
  Camera feed is deliberately never visible. It stays laid out (so the browser
  keeps decoding frames for hand tracking) but sits behind the opaque canvas.
*/

.cam-offscreen {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: -1;
  width: 160px;
  height: 120px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.cam-offscreen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Gesture cursor */

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: rgba(94, 234, 252, 0.14);
  box-shadow: 0 0 20px rgba(94, 234, 252, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, background 0.1s, transform 0.04s linear, border-color 0.15s;
}

.cursor.visible { opacity: 1; }

.cursor.pinch {
  background: rgba(255, 190, 70, 0.55);
  border-color: var(--gold);
  box-shadow: 0 0 26px rgba(255, 190, 70, 0.8);
}

/* Toast */

.toast {
  position: absolute;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: rgba(5, 22, 44, 0.9);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  backdrop-filter: blur(10px);
}

@media (max-width: 900px) {
  #wave { width: 220px; }
  .hud-bottom { gap: 12px; }
  .cam-tile { width: 104px; }
  .hud-tl { max-width: 190px; }
}
