/* Two themes, switched by voice: Arc Blue (default tokens) and Cyber Magenta. */
:root {
  --bg: #02040d;
  --bg-glow: #0a1530;
  --cyan: #22e4ff;
  --blue: #2a7bff;
  --violet: #8b5cff;
  --magenta: #ff3dc8;
  --c1: var(--cyan);   /* primary data colour */
  --c2: var(--blue);   /* secondary glow */
  --c3: var(--violet); /* accent */
  --text: #e6f7ff;
  --dim: #7fa6c4;
}
body[data-theme="magenta"] {
  --bg-glow: #1c0a36;
  --c2: #ff2bd6;
  --c3: #9d4dff;
  --dim: #b49ad6;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, var(--bg-glow) 0%, var(--bg) 70%);
  transition: background 1s;
  color: var(--text);
  font-family: "Exo 2", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; }

/* HUD */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: max(20px, env(safe-area-inset-top)) 24px 0;
  pointer-events: none;
}
.clock #time {
  font-family: Orbitron, sans-serif; font-weight: 700;
  font-size: clamp(24px, 5vw, 44px); letter-spacing: 3px; white-space: nowrap;
  color: var(--cyan); text-shadow: 0 0 18px rgba(34, 228, 255, .6);
}
.clock #date { color: var(--dim); font-size: 15px; letter-spacing: 2px; text-transform: uppercase; }
.daily-line {
  margin-top: 6px; font-family: Orbitron, sans-serif; font-size: 13px; letter-spacing: 2px;
  text-transform: uppercase; color: #ffd27a; text-shadow: 0 0 10px rgba(255, 190, 80, .45);
}
.daily-line:empty { display: none; }
/* ---------- Holographic data panel ---------- */
.hud-panel {
  position: fixed; left: 20px; bottom: max(18px, env(safe-area-inset-bottom));
  padding: 16px 18px 12px; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c2) 10%, transparent), rgba(4, 8, 24, .55));
  border: 1px solid color-mix(in srgb, var(--c1) 35%, transparent);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  box-shadow: inset 0 0 30px color-mix(in srgb, var(--c2) 18%, transparent);
  backdrop-filter: blur(6px);
}
/* A scanning light sweeps across the panel */
.hud-panel::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 40%, color-mix(in srgb, var(--c1) 16%, transparent) 50%, transparent 60%);
  transform: translateX(-100%); animation: scan 5s ease-in-out infinite;
}
@keyframes scan { 60%, 100% { transform: translateX(100%); } }

.pods { display: flex; gap: 14px; }
.pod { width: 96px; text-align: center; cursor: pointer; outline: none; transition: transform .35s; }
.pod:hover, .pod:focus { transform: translateY(-4px) scale(1.07); }
.pod svg { width: 96px; height: 96px; overflow: visible; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c1) 60%, transparent)); }
.pod circle { fill: none; transform-origin: 50px 50px; }
.pod .ticks { stroke: color-mix(in srgb, var(--c1) 55%, transparent); stroke-width: 2; stroke-dasharray: 1 5.2; animation: spin 24s linear infinite; }
.pod .track { stroke: rgba(255, 255, 255, .07); stroke-width: 6; }
.pod .arc {
  stroke: var(--c1); stroke-width: 6; stroke-linecap: butt; transform: rotate(-90deg);
  transition: stroke-dasharray 1.2s cubic-bezier(.2, .8, .2, 1), opacity .6s;
}
.pod[data-pod="Records"] .arc { stroke: var(--c2); }
.pod[data-pod="Memory"] .arc { stroke: var(--c3); }
.pod .inner { stroke: color-mix(in srgb, var(--c2) 70%, transparent); stroke-width: 1.5; stroke-dasharray: 18 7 4 7; animation: spin 7s linear infinite reverse; }
.pod .orbit { transform-origin: 50px 50px; animation: spin 3.6s linear infinite; }
.pod .orbit circle { fill: #fff; filter: drop-shadow(0 0 4px var(--c1)); }
.pod[data-pod="Records"] .orbit { animation-duration: 5s; }
.pod[data-pod="Memory"] .orbit { animation-duration: 4.3s; animation-direction: reverse; }
.pod .value { fill: #fff; font: 700 24px Orbitron, sans-serif; text-anchor: middle; dominant-baseline: middle; }
.pod .unit { fill: var(--dim); font: 500 7px Orbitron, sans-serif; letter-spacing: 1.5px; text-anchor: middle; }
.pod-label { margin-top: 4px; font: 700 11px Orbitron, sans-serif; letter-spacing: 3px; text-transform: uppercase; color: var(--c1); }
.pod[data-pod="Records"] .pod-label { color: var(--c2); }
.pod[data-pod="Memory"] .pod-label { color: var(--c3); filter: brightness(1.3); }
.pod-detail {
  max-height: 0; opacity: 0; overflow: hidden; transition: max-height .4s, opacity .4s;
  font-size: 11px; line-height: 1.4; color: var(--text);
}
.pod:hover .pod-detail, .pod:focus .pod-detail { max-height: 40px; opacity: .9; }
.pod.bump svg { animation: bump .8s ease-out; }
@keyframes bump { 30% { transform: scale(1.12); filter: drop-shadow(0 0 16px var(--c1)); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Live activity bars: calm when idle, lively while listening or speaking */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; margin-top: 10px; }
.bars i {
  flex: 1; height: 100%; transform-origin: bottom; border-radius: 1px;
  background: linear-gradient(to top, var(--c2), var(--c1));
  opacity: .55; animation: level 1.2s ease-in-out infinite alternate; transform: scaleY(.15);
}
@keyframes level { from { transform: scaleY(.12); } to { transform: scaleY(.45); } }
body[data-state="listening"] .bars i, body[data-state="speaking"] .bars i { opacity: .95; animation-name: level-high; }
body[data-state="thinking"] .bars i { animation-name: level-high; animation-duration: .35s !important; }
@keyframes level-high { from { transform: scaleY(.2); } to { transform: scaleY(1); } }
/* A song is playing: the bars follow the music itself, and the panel glows with it. */
body[data-music="on"] .bars i { animation: none; opacity: .95; transition: transform 60ms linear; background: linear-gradient(to top, var(--c3), var(--c2), var(--c1)); }
.brand { transition: opacity .8s ease; }
body[data-music="on"] .brand { opacity: .35; }
body[data-music="on"] .hud-panel { box-shadow: 0 0 calc(12px + var(--beat, 0) * 40px) color-mix(in srgb, var(--c2) 45%, transparent); }

@media (max-width: 600px) {
  .hud-panel { left: 50%; transform: translateX(-50%); padding: 12px 12px 10px; }
  .pods { gap: 8px; }
  .pod, .pod svg { width: 84px; }
  .pod svg { height: 84px; }
}

.status {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: 40px;
  border: 1px solid rgba(34, 228, 255, .35);
  background: rgba(10, 30, 60, .45); backdrop-filter: blur(8px);
  font-family: Orbitron, sans-serif; font-size: 13px; letter-spacing: 3px; text-transform: uppercase;
}
.status .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 12px var(--cyan);
  animation: blink 1.6s infinite;
}
body[data-state="listening"] .status .dot { background: var(--magenta); box-shadow: 0 0 12px var(--magenta); }
body[data-state="thinking"] .status .dot { background: var(--violet); box-shadow: 0 0 12px var(--violet); animation-duration: .5s; }
@keyframes blink { 50% { opacity: .35; } }

.brand {
  position: fixed; left: 0; right: 0; top: 17%;
  text-align: center; pointer-events: none;
  font-family: Orbitron, sans-serif; font-weight: 900;
  font-size: clamp(26px, 6vw, 56px); letter-spacing: clamp(6px, 1.4vw, 16px);
  color: #cfefff;
}
.brand span {
  background: linear-gradient(90deg, var(--c1), #fff 50%, var(--c2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--c2) 70%, transparent));
}
@media (max-width: 600px) and (min-height: 700px) { .brand { top: 21%; } } /* phones: room for the weather line */

.live {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(9%, env(safe-area-inset-bottom));
  padding: 6px 16px; border-radius: 30px; pointer-events: none;
  font-family: Orbitron, sans-serif; font-size: 12px; letter-spacing: 3px;
  color: #4dffb5; border: 1px solid rgba(77, 255, 181, .5);
  background: rgba(0, 40, 30, .45); box-shadow: 0 0 16px rgba(77, 255, 181, .35);
}
.live[hidden] { display: none; }

/* ---------- Now Playing: the song's name (top) and its lyrics (bottom) ---------- */
.now-playing, .lyrics {
  position: fixed; left: 50%; pointer-events: none; text-align: center;
  opacity: 0; transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1);
}
.now-playing { top: 10%; width: min(760px, 90vw); transform: translate(-50%, -14px); }
/* A soft shadow behind the text keeps it readable over the moving rings */
.now-playing::before, .lyrics::before {
  content: ''; position: absolute; inset: -10% -6%; z-index: -1;
  background: radial-gradient(closest-side, rgba(2, 4, 13, .62), transparent);
}
body[data-np="on"] .now-playing { opacity: 1; transform: translate(-50%, 0); }
body[data-np="on"] .brand { opacity: 0; }

.np-head {
  display: inline-flex; align-items: center; gap: 10px; margin-bottom: 8px;
  font: 700 12px Orbitron, sans-serif; letter-spacing: 5px; color: var(--c1);
  text-shadow: 0 0 10px color-mix(in srgb, var(--c1) 70%, transparent);
}
.np-label::after { content: 'NOW PLAYING'; }
body[data-paused="yes"] .np-label::after { content: 'PAUSED'; }
.np-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.np-eq i { width: 3px; height: 100%; background: var(--c2); transform-origin: bottom; animation: eq .9s ease-in-out infinite alternate; }
.np-eq i:nth-child(2) { animation-delay: -.3s; } .np-eq i:nth-child(3) { animation-delay: -.6s; } .np-eq i:nth-child(4) { animation-delay: -.15s; }
body[data-paused="yes"] .np-eq i { animation-play-state: paused; opacity: .4; }
@keyframes eq { from { transform: scaleY(.2); } to { transform: scaleY(1); } }

.np-title {
  font: 900 clamp(22px, 3.4vw, 44px)/1.15 Orbitron, sans-serif; letter-spacing: clamp(2px, .4vw, 5px);
  text-transform: uppercase; overflow-wrap: anywhere;
  background: linear-gradient(90deg, var(--c1), #fff 45%, var(--c2) 75%, var(--c1));
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 calc(10px + var(--beat, 0) * 22px) color-mix(in srgb, var(--c2) 65%, transparent));
  animation: shimmer 6s linear infinite;
}
/* A new song: the title materialises from a blur of light */
.np-title.enter { animation: shimmer 6s linear infinite, materialise 1.1s cubic-bezier(.2, .8, .2, 1); }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes materialise {
  from { opacity: 0; letter-spacing: .6em; filter: blur(14px) drop-shadow(0 0 30px var(--c2)); clip-path: inset(0 50% 0 50%); }
  to { clip-path: inset(0 0 0 0); }
}
.np-artist {
  margin-top: 6px; font: 400 clamp(14px, 1.5vw, 18px) "Exo 2", sans-serif;
  letter-spacing: 4px; text-transform: uppercase; color: var(--dim);
}
.np-progress {
  position: relative; width: min(420px, 70vw); height: 3px; margin: 14px auto 6px;
  background: color-mix(in srgb, var(--c1) 15%, transparent);
}
.np-progress i {
  position: absolute; inset: 0; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--c3), var(--c2), var(--c1));
  box-shadow: 0 0 12px var(--c2);
}
.np-times {
  display: flex; justify-content: space-between; width: min(420px, 70vw); margin: 0 auto;
  font: 500 11px Orbitron, sans-serif; letter-spacing: 2px; color: var(--dim);
}

/* Lyrics: a holographic window; the sung line glows in the centre, its words lighting up as they are sung */
.lyrics { bottom: max(26px, env(safe-area-inset-bottom)); width: min(880px, 100vw - 780px); transform: translate(-50%, 14px); }
body[data-np="on"] .lyrics { opacity: 1; transform: translate(-50%, 0); }
.lyrics-view {
  position: relative; height: 200px; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
}
body[data-lyrics="none"] .lyrics-view { height: 0; }
.lyrics-lines { transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.ly {
  padding: 6px 12px; font: 600 clamp(22px, 2.9vw, 38px)/1.3 "Exo 2", sans-serif; letter-spacing: .5px;
  color: color-mix(in srgb, var(--text) 80%, var(--c3));
  transform: scale(.68); opacity: .3; filter: blur(1.5px);
  transition: transform .6s cubic-bezier(.2, .8, .2, 1), opacity .6s, filter .6s;
}
.ly[dir="rtl"] { line-height: 1.9; }
.ly.near { opacity: .55; filter: none; }
.ly.past { opacity: .2; }
.ly.past.near { opacity: .4; }
.ly.now { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 calc(6px + var(--beat, 0) * 18px) color-mix(in srgb, var(--c2) 75%, transparent)); }
.ly span { display: inline-block; margin: 0 .14em; }
/* Each word fills with light, left to right (right to left in Urdu), as it is sung */
.ly.now span {
  --lit: #fff; --unlit: color-mix(in srgb, var(--c1) 45%, #8aa0c0);
  background: linear-gradient(90deg, var(--lit) calc(var(--w, 0) * 100%), var(--unlit) calc(var(--w, 0) * 100% + .01%));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: wordIn .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 45ms);
}
.ly.now[dir="rtl"] span { background-image: linear-gradient(270deg, var(--lit) calc(var(--w, 0) * 100%), var(--unlit) calc(var(--w, 0) * 100% + .01%)); }
@keyframes wordIn { from { opacity: 0; transform: translateY(14px) scale(.9); filter: blur(6px); } }
.lyrics-note {
  font: 500 12px Orbitron, sans-serif; letter-spacing: 4px; text-transform: uppercase; color: var(--dim);
}
.lyrics-note:empty { display: none; }
body[data-lyrics="none"] .lyrics-note { animation: blink 1.6s infinite; }

/* Mid-size screens: keep the lyrics clear of the data panel (bottom left) */
@media (min-width: 601px) and (max-width: 1180px) {
  .lyrics, body[data-np="on"] .lyrics { left: auto; right: 20px; width: calc(100vw - 420px); transform: none; }
  .lyrics-view { height: 170px; }
  .ly { font-size: clamp(20px, 2.6vw, 30px); }
}
@media (max-width: 600px) {
  .now-playing { top: 18%; }
  .lyrics { bottom: 178px; width: 94vw; }
  .lyrics-view { height: 140px; }
  .ly { font-size: 21px; }
}
[dir="rtl"] { font-family: "Noto Nastaliq Urdu", serif; line-height: 2.1; }

/* Overlays */
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(2, 4, 13, .72); backdrop-filter: blur(6px); z-index: 10;
}
.overlay[hidden] { display: none; }

.panel {
  width: min(520px, 100%); padding: 36px 32px; border-radius: 24px;
  background: linear-gradient(160deg, rgba(20, 40, 80, .75), rgba(10, 12, 40, .85));
  border: 1px solid rgba(34, 228, 255, .35);
  box-shadow: 0 0 60px rgba(42, 123, 255, .25), inset 0 0 30px rgba(139, 92, 255, .12);
}
.panel h2 {
  font-family: Orbitron, sans-serif; font-size: 24px; letter-spacing: 2px;
  color: var(--cyan); margin-bottom: 20px;
}
.panel ol { padding-left: 22px; margin-bottom: 22px; font-size: 18px; line-height: 1.9; }
.panel a { color: var(--cyan); }
.panel input {
  width: 100%; padding: 18px 20px; font-size: 18px; border-radius: 14px;
  border: 1px solid rgba(34, 228, 255, .4); background: rgba(0, 0, 0, .35);
  color: var(--text); outline: none; margin-bottom: 16px;
}
.panel input:focus { border-color: var(--cyan); box-shadow: 0 0 18px rgba(34, 228, 255, .35); }

.btn {
  width: 100%; padding: 18px; font-size: 20px; letter-spacing: 3px; cursor: pointer;
  font-family: Orbitron, sans-serif; font-weight: 700; color: #02040d;
  border: 0; border-radius: 14px;
  background: linear-gradient(90deg, var(--cyan), var(--blue) 55%, var(--violet));
  box-shadow: 0 0 28px rgba(34, 228, 255, .45);
}
.btn:disabled { opacity: .5; cursor: wait; }
.error { color: var(--magenta); margin-top: 12px; min-height: 1.2em; }
.note { color: var(--dim); margin-top: 6px; font-size: 14px; }

.sleep { background: rgba(2, 4, 13, .94); text-align: center; z-index: 20; }
.sleep h2 {
  font-family: Orbitron, sans-serif; font-size: clamp(26px, 5vw, 44px); letter-spacing: 4px;
  color: var(--cyan); text-shadow: 0 0 24px rgba(34, 228, 255, .6); margin-bottom: 16px;
}
.sleep p { color: var(--dim); font-size: clamp(18px, 2.6vw, 24px); letter-spacing: 1px; }

.tap { cursor: pointer; text-align: center; gap: 24px; align-content: center; }
.tap p { font-size: clamp(20px, 3vw, 28px); letter-spacing: 2px; }
.tap-ring {
  width: 120px; height: 120px; margin: 0 auto; border-radius: 50%;
  border: 3px solid var(--cyan); box-shadow: 0 0 40px var(--cyan), inset 0 0 30px var(--violet);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.15); opacity: .6; } }
