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

:root {
  --c: #00ffe0;
  --c2: #a855f7;
  --c3: #ff6b35;
  --c4: #ffd700;
  --bg: #020609;
  --text: #c8e8f5;
  --dim: rgba(200,232,245,0.38);
  --panel: rgba(3,12,22,0.92);
  --border: rgba(0,255,224,0.1);
  --border2: rgba(168,85,247,0.15);
  --panel-w: 440px;
}

html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); }

body {
  font-family: 'Exo 2', sans-serif;
  color: var(--text);
  cursor: none;
}

/* ══════════════════════ CURSOR ══════════════════════ */
#cur {
  position: fixed; width: 6px; height: 6px;
  background: var(--c); border-radius: 50%;
  pointer-events: none; z-index: 9999;
  transform: translate(-50%,-50%);
  transition: width .12s, height .12s;
  box-shadow: 0 0 8px var(--c), 0 0 24px rgba(0,255,224,.4);
}
#cur-ring {
  position: fixed; width: 32px; height: 32px;
  border: 1px solid rgba(0,255,224,.5); border-radius: 50%;
  pointer-events: none; z-index: 9998;
  transform: translate(-50%,-50%);
  transition: transform .08s ease-out, width .2s, height .2s, border-color .2s;
}
body:has(button:hover) #cur-ring,
body:has(textarea:hover) #cur-ring { width: 44px; height: 44px; border-color: var(--c2); }

/* ══════════════════════ MAIN CANVAS ══════════════════════ */
#bg-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

/* ══════════════════════ HUD OVERLAYS ══════════════════════ */
#hud {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
}

/* top-left brand */
#brand {
  position: absolute; top: 28px; left: 32px;
  pointer-events: all;
}
#brand-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 28px; font-weight: 700;
  letter-spacing: 10px;
  color: transparent;
  -webkit-text-stroke: 1px var(--c);
  text-shadow: 0 0 40px rgba(0,255,224,.5);
  line-height: 1;
}
#brand-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 5px;
  color: var(--dim); margin-top: 5px;
  text-transform: uppercase;
}

/* top-right status cluster */
#status-cluster {
  position: absolute; top: 22px; right: 32px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  pointer-events: none;
}
.s-row {
  display: flex; align-items: center; gap: 8px;
}
.s-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--c3);
  box-shadow: 0 0 6px var(--c3);
  animation: blink 2.8s ease-in-out infinite;
}
.s-dot.active { background: var(--c); box-shadow: 0 0 6px var(--c); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }
.s-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 2px; color: var(--dim);
}

/* bottom ruler */
#ruler {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(0,255,224,.25) 20%, rgba(168,85,247,.4) 50%, rgba(0,255,224,.25) 80%, transparent 100%);
}

/* ══════════════════════ CORNER BRACKETS ══════════════════════ */
.bracket {
  position: fixed; width: 56px; height: 56px;
  pointer-events: none; z-index: 2;
}
.bracket svg { width: 100%; height: 100%; }
#b-tl { top: 10px; left: 10px; }
#b-tr { top: 10px; right: 10px; transform: scaleX(-1); }
#b-bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
#b-br { bottom: 10px; right: 10px; transform: scale(-1,-1); }

/* ══════════════════════ CENTER STAGE ══════════════════════ */
#stage {
  position: fixed; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 0;
  transition: transform .6s cubic-bezier(.4,0,.2,1);
}
#stage.shifted { transform: translateX(calc(var(--panel-w) / -2)); }

/* ── Core orb ── */
#orb-wrap {
  position: relative; width: 360px; height: 360px;
  display: flex; align-items: center; justify-content: center;
}

#orb {
  position: absolute; width: 200px; height: 200px;
  border-radius: 50%; cursor: none;
  background: radial-gradient(circle at 38% 34%,
    rgba(0,255,224,.18) 0%,
    rgba(168,85,247,.14) 45%,
    rgba(0,255,224,.04) 80%,
    transparent 100%);
  border: 1px solid rgba(0,255,224,.25);
  transition: all .4s;
}
#orb::before {
  content:''; position:absolute; inset:-12px; border-radius:50%;
  border: 1px solid rgba(0,255,224,.12);
  animation: orb-pulse 4s ease-in-out infinite;
}
#orb::after {
  content:''; position:absolute; inset:-28px; border-radius:50%;
  border: 1px solid rgba(168,85,247,.08);
  animation: orb-pulse 4s ease-in-out infinite .8s;
}
@keyframes orb-pulse {
  0%,100%{transform:scale(1);opacity:.6}
  50%{transform:scale(1.06);opacity:1}
}
#orb.listening {
  border-color: rgba(0,255,163,.6);
  box-shadow: 0 0 60px rgba(0,255,163,.3), inset 0 0 40px rgba(0,255,163,.08);
}
#orb.processing {
  animation: orb-proc .6s ease-in-out infinite alternate;
}
@keyframes orb-proc {
  from{border-color:rgba(0,255,224,.4);box-shadow:0 0 30px rgba(0,255,224,.2)}
  to{border-color:rgba(168,85,247,.6);box-shadow:0 0 60px rgba(168,85,247,.3)}
}

/* Rotating rings */
.ring {
  position: absolute; border-radius: 50%;
  border: 1px solid transparent; pointer-events: none;
}
#ring1 {
  width: 270px; height: 270px;
  border-top-color: rgba(0,255,224,.35);
  border-right-color: rgba(0,255,224,.1);
  animation: spin 8s linear infinite;
}
#ring2 {
  width: 320px; height: 320px;
  border-bottom-color: rgba(168,85,247,.3);
  border-left-color: rgba(168,85,247,.1);
  animation: spin 14s linear infinite reverse;
}
#ring3 {
  width: 355px; height: 355px;
  border-top-color: rgba(255,107,53,.15);
  border-right-color: transparent;
  border-bottom-color: rgba(255,107,53,.15);
  animation: spin 22s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* Tick marks on ring1 */
.tick {
  position: absolute; width: 3px; height: 8px;
  background: rgba(0,255,224,.6);
  transform-origin: center 135px;
  border-radius: 1px;
  left: 50%; top: 50%;
  margin-left: -1.5px; margin-top: -135px;
}

/* Mic icon inside orb */
#mic-svg {
  position: relative; z-index: 1;
  color: rgba(0,255,224,.7);
  transition: color .3s;
}
#orb.listening #mic-svg { color: rgba(0,255,163,1); filter: drop-shadow(0 0 8px rgba(0,255,163,.6)); }

/* ── Orb data readouts ── */
.orb-readout {
  position: absolute;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 2px; color: var(--dim);
  white-space: nowrap;
}
#r-top    { top: -20px; left: 50%; transform: translateX(-50%); }
#r-right  { right: -100px; top: 50%; transform: translateY(-50%); text-align: right; }
#r-bottom { bottom: -20px; left: 50%; transform: translateX(-50%); }
#r-left   { left: -100px; top: 50%; transform: translateY(-50%); }

/* ── Voice transcript ── */
#voice-area {
  position: relative; z-index: 4;
  margin-top: -8px;
  text-align: center; width: 500px; max-width: 90vw;
}
#voice-q {
  font-family: 'Exo 2', sans-serif;
  font-size: 17px; font-weight: 300; font-style: italic;
  color: var(--text); min-height: 28px;
  opacity: 0; transition: opacity .3s;
  letter-spacing: .5px;
}
#voice-q.visible { opacity: 1; }
#voice-a {
  font-family: 'Exo 2', sans-serif;
  font-size: 13px; font-weight: 200; color: var(--dim);
  margin-top: 12px; min-height: 20px; line-height: 1.7;
  max-height: 160px; overflow-y: auto; scrollbar-width: none;
  opacity: 0; transition: opacity .4s;
}
#voice-a.visible { opacity: 1; }
#voice-hint {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 3px; color: var(--dim);
  margin-top: 20px;
  animation: fade-hint 3s ease-in-out infinite;
}
@keyframes fade-hint { 0%,100%{opacity:.4} 50%{opacity:.9} }

/* ══════════════════════ MODE BAR ══════════════════════ */
#mode-bar {
  position: fixed; bottom: 36px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex; gap: 2px;
  background: rgba(2,6,9,.95);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 0 1px rgba(0,255,224,.04), 0 24px 60px rgba(0,0,0,.7);
  transition: left .6s cubic-bezier(.4,0,.2,1);
}
#mode-bar.shifted { left: calc(50% - var(--panel-w)/2); }
.mb-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 26px; border-radius: 100px;
  border: none; background: transparent; cursor: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px; font-weight: 600;
  letter-spacing: 3px; color: var(--dim);
  transition: all .25s;
}
.mb-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.mb-btn:hover { color: var(--text); background: rgba(0,255,224,.05); }
.mb-btn.on {
  background: linear-gradient(135deg, rgba(0,255,224,.12) 0%, rgba(168,85,247,.12) 100%);
  color: var(--c);
  border: 1px solid rgba(0,255,224,.2);
  box-shadow: 0 0 24px rgba(0,255,224,.08), inset 0 0 20px rgba(168,85,247,.05);
}

/* ══════════════════════ SIDE PANEL ══════════════════════ */
#panel {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: var(--panel-w);
  background: linear-gradient(170deg, rgba(3,12,24,.98) 0%, rgba(5,3,16,.98) 100%);
  border-left: 1px solid var(--border2);
  z-index: 20;
  transform: translateX(100%);
  transition: transform .55s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  box-shadow: -40px 0 80px rgba(0,0,0,.6);
}
#panel.open { transform: translateX(0); }

/* Panel top accent line */
#panel::before {
  content:'';
  position:absolute; top:0; left:0; right:0; height:1px;
  background: linear-gradient(90deg, transparent, var(--c2), var(--c), transparent);
}

/* Panel header */
#ph {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
#ph-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px; font-weight: 600;
  letter-spacing: 4px; color: var(--c);
  display: flex; align-items: center; gap: 10px;
}
#ph-title::before {
  content:''; display: block; width: 16px; height: 1px;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}

/* evidence meter */
#ev-count {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 2px;
  color: var(--dim); align-self: flex-end;
  padding-bottom: 2px;
}

#ph-close {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
  color: var(--dim); cursor: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all .2s;
}
#ph-close:hover { border-color: var(--c); color: var(--c); box-shadow: 0 0 16px rgba(0,255,224,.2); }

/* Messages */
#msgs {
  flex: 1; overflow-y: auto;
  padding: 18px 16px;
  display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,255,224,.15) transparent;
}
#msgs::-webkit-scrollbar { width: 2px; }
#msgs::-webkit-scrollbar-thumb { background: rgba(0,255,224,.15); }

.msg { display: flex; flex-direction: column; gap: 5px; animation: msg-fade .3s ease-out; }
@keyframes msg-fade { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:none} }

.msg-who {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px; letter-spacing: 3px; color: var(--dim);
  display: flex; align-items: center; gap: 6px;
}
.msg-who::after { content:''; display:block; height:1px; width:30px; background: currentColor; opacity:.3; }
.msg.u .msg-who { flex-direction: row-reverse; color: rgba(168,85,247,.6); }
.msg.u .msg-who::after { display: none; }
.msg.u .msg-who::before { content:''; display:block; height:1px; width:30px; background: currentColor; opacity:.3; }

.msg-b {
  font-size: 13px; line-height: 1.75; font-weight: 300;
  padding: 12px 16px; border-radius: 14px;
  max-width: 92%;
}
.msg.u { align-items: flex-end; }
.msg.u .msg-b {
  background: linear-gradient(135deg, rgba(168,85,247,.18), rgba(0,255,224,.12));
  border: 1px solid rgba(168,85,247,.25);
  border-bottom-right-radius: 3px;
  color: var(--text);
}
.msg.a .msg-b {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(0,255,224,.1);
  border-bottom-left-radius: 3px;
  color: var(--text);
}

/* Typing indicator */
.typing-b {
  display: flex; gap: 5px; align-items: center;
  padding: 14px 18px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(0,255,224,.1);
  border-radius: 14px; border-bottom-left-radius: 3px;
  width: fit-content;
}
.t-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--c);
  animation: tdot 1.1s ease-in-out infinite;
}
.t-dot:nth-child(2){animation-delay:.18s}
.t-dot:nth-child(3){animation-delay:.36s}
@keyframes tdot{0%,60%,100%{transform:translateY(0);opacity:.3}30%{transform:translateY(-7px);opacity:1}}

/* ── Evidence section ── */
#ev-section {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  flex-shrink: 0;
  max-height: 130px; overflow-y: auto;
  scrollbar-width: none;
}
#ev-section:empty, #ev-section:not(.has-items) { display: none; }
.ev-item {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 0; border-bottom: 1px solid rgba(0,255,224,.05);
  font-size: 11px;
}
.ev-item:last-child { border-bottom: none; }
.ev-score {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px; color: var(--c); min-width: 28px;
  background: rgba(0,255,224,.08); border-radius: 3px;
  padding: 2px 4px; text-align: center;
}
.ev-text { color: var(--dim); font-weight: 200; font-size: 11px; line-height: 1.4; }
.ev-src { font-family: 'Share Tech Mono', monospace; font-size: 7px; color: rgba(168,85,247,.5); letter-spacing: 1px; margin-top: 1px; }

/* ── Input area ── */
#input-area {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#iw {
  display: flex; gap: 10px; align-items: flex-end;
  background: rgba(0,255,224,.03);
  border: 1px solid rgba(0,255,224,.12);
  border-radius: 14px; padding: 10px 12px;
  transition: border-color .2s, box-shadow .2s;
}
#iw:focus-within {
  border-color: rgba(0,255,224,.3);
  box-shadow: 0 0 0 3px rgba(0,255,224,.05), 0 0 30px rgba(0,255,224,.07);
}
#inp {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'Exo 2', sans-serif;
  font-size: 13px; font-weight: 300; line-height: 1.55;
  resize: none; max-height: 110px; scrollbar-width: none;
  caret-color: var(--c);
}
#inp::placeholder { color: var(--dim); }
#send {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px; border: none;
  background: linear-gradient(135deg, var(--c), var(--c2));
  color: #050303; cursor: none;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  box-shadow: 0 0 20px rgba(0,255,224,.25);
}
#send:hover { transform: scale(1.08); box-shadow: 0 0 30px rgba(0,255,224,.4); }
#send svg { width: 15px; height: 15px; }

/* ── Input footer ── */
#input-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; padding: 0 2px;
}
.ifooter-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px; letter-spacing: 2px; color: var(--dim);
}

/* ══════════════════════ PROCESSING BAR ══════════════════════ */
#proc-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 30;
  background: linear-gradient(90deg, transparent, var(--c), var(--c2), var(--c3), var(--c), transparent);
  background-size: 400% 100%;
  animation: proc-run 1.2s ease-in-out infinite;
  opacity: 0; transition: opacity .3s;
}
#proc-bar.on { opacity: 1; }
@keyframes proc-run {
  0%{background-position:100% 0}
  100%{background-position:-100% 0}
}

/* ══════════════════════ SCANLINES ══════════════════════ */
#scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,.04) 3px,
    rgba(0,0,0,.04) 4px
  );
}

/* ══════════════════════ PARTICLES CANVAS ══════════════════════ */
#particle-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}

/* ══════════════════════ DATA STREAMS ══════════════════════ */
#streams {
  position: fixed; left: 18px; top: 80px; bottom: 80px;
  width: 30px; pointer-events: none; z-index: 2;
  overflow: hidden;
}
.stream-col {
  position: absolute; top: 0; width: 10px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px; color: rgba(0,255,224,.2);
  display: flex; flex-direction: column;
  animation: stream-fall linear infinite;
  letter-spacing: 0;
  line-height: 1.3;
}
.stream-col:nth-child(1){left:0;animation-duration:6s;animation-delay:0s}
.stream-col:nth-child(2){left:10px;animation-duration:8s;animation-delay:-3s;color:rgba(168,85,247,.15)}
.stream-col:nth-child(3){left:20px;animation-duration:5s;animation-delay:-1.5s}
@keyframes stream-fall { 0%{transform:translateY(-100%)} 100%{transform:translateY(100%)} }

#streams-r {
  position: fixed; right: 18px; top: 80px; bottom: 80px;
  width: 30px; pointer-events: none; z-index: 2; overflow: hidden;
}

/* ══════════════════════ METRICS ══════════════════════ */
#metrics {
  position: fixed; bottom: 90px; right: 24px;
  z-index: 5; display: flex; flex-direction: column;
  align-items: flex-end; gap: 8px;
  pointer-events: none;
}
.metric {
  display: flex; align-items: center; gap: 8px;
}
.metric-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px; letter-spacing: 2px; color: var(--dim);
}
.metric-bar-wrap {
  width: 60px; height: 2px;
  background: rgba(255,255,255,.06); border-radius: 1px;
}
.metric-bar {
  height: 100%; border-radius: 1px;
  background: var(--c); transition: width 1s ease;
}
.metric-val {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px; color: var(--c); min-width: 22px; text-align: right;
}
