/* Jarvis public HUD demo — mirror of the local hud_server DASHBOARD_HTML */
:root {
  --bg-0: #01060d;
  --bg-1: #030d1a;
  --panel: rgba(4, 16, 30, 0.86);
  --border: rgba(0, 180, 255, 0.28);
  --idle: #00d4ff;
  --listening: #ff3b3b;
  --awaiting: #b46bff;
  --thinking: #ffb84d;
  --speaking: #26f39a;
  --muted-clr: #ff8c00;
  --off: #4a5a6a;
  --text: #e7f4ff;
  --dim: #5a7a92;
  --stateclr: var(--idle);
  --stateglow: rgba(0, 212, 255, 0.55);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg-0); color: var(--text);
  font-family: "Chakra Petch","JetBrains Mono",ui-monospace,monospace;
  height: 100vh; overflow: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}
body {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  grid-template-rows: 56px 1fr 40px;
  grid-template-areas: "hdr hdr hdr" "lrail reactor rrail" "tick tick tick";
  padding: 14px; gap: 12px; position: relative;
  background:
    radial-gradient(1400px 900px at 15% 25%, rgba(0,140,220,0.10), transparent 55%),
    radial-gradient(1200px 800px at 90% 90%, rgba(0,90,180,0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 60%, var(--bg-0));
}
body::before {
  content:''; position: fixed; inset: 0; pointer-events: none; z-index: 30;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,212,255,0.020) 2px 4px);
}
body::after {
  content:''; position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.35;
  background-image:
    linear-gradient(rgba(0,180,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,180,255,0.035) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 85%);
}
.corner {
  position: fixed; width: 28px; height: 28px;
  border: 2px solid var(--stateclr); opacity: 0.7; pointer-events: none; z-index: 20;
  transition: border-color .35s, opacity .35s;
}
.corner.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.corner.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.corner.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

header {
  grid-area: hdr;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; border: 1px solid var(--border);
  border-radius: 4px; background: var(--panel); z-index: 5; position: relative;
}
header::before {
  content:''; position: absolute; left: 0; top: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--stateclr), transparent);
  opacity: 0.6; transition: background .35s;
}
.logo {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--stateclr); color: var(--stateclr);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  box-shadow: 0 0 16px var(--stateglow), inset 0 0 10px var(--stateglow);
  transition: color .35s, box-shadow .35s, border-color .35s;
}
h1 { font-size: 15px; letter-spacing: .28em; font-weight: 600; color: var(--stateclr); transition: color .35s; }
h1 small { color: var(--dim); font-weight: 400; letter-spacing: .14em; margin-left: 12px; font-size: 11px; }
.pip {
  margin-left: auto; display: flex; gap: 22px; align-items: center;
  font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--dim);
}
.pip .k { color: var(--dim); margin-right: 6px; letter-spacing: .14em; }
.pip .v { color: var(--text); }
.pip .mic {
  padding: 3px 10px; border: 1px solid var(--speaking); border-radius: 3px;
  color: var(--speaking); font-weight: 600; letter-spacing: .18em;
}
.pip .mic.muted { border-color: var(--muted-clr); color: var(--muted-clr); }

.rail {
  border: 1px solid var(--border); border-radius: 4px; background: var(--panel);
  padding: 14px 14px 12px; overflow: hidden; z-index: 5;
  display: flex; flex-direction: column; gap: 12px;
}
.rail h3 {
  font-size: 10px; letter-spacing: .22em; color: var(--dim);
  border-bottom: 1px solid var(--border); padding-bottom: 6px; font-weight: 500;
}
.rail .item { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.rail .item .k {
  color: var(--dim); font-size: 9px; letter-spacing: .2em;
  font-family: "JetBrains Mono", monospace;
}
.rail .item .v {
  color: var(--text); font-family: "JetBrains Mono", monospace;
  font-size: 11px; line-height: 1.35; word-break: break-word;
}
.rail .item .v.hot { color: var(--stateclr); transition: color .35s; }
.rail .prose {
  font-size: 12px; color: var(--dim); line-height: 1.5;
  font-family: "Chakra Petch", sans-serif;
}
.rail .prose a { color: var(--stateclr); text-decoration: none; }
.rail .prose a:hover { text-decoration: underline; }

.stage { grid-area: reactor; display: grid; grid-template-rows: 1fr auto; gap: 10px; z-index: 4; }
.reactor-panel {
  border: 1px solid var(--border); border-radius: 4px; background: var(--panel);
  padding: 20px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden;
}
.reactor-panel::before {
  content:''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, var(--stateglow), transparent 65%);
  opacity: 0.35; transition: background .35s; pointer-events: none;
}
.reactor { position: relative; width: min(340px, 46vmin); height: min(340px, 46vmin); margin-bottom: 22px; z-index: 2; }
.ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--stateclr);
  box-shadow: 0 0 24px var(--stateglow), inset 0 0 24px var(--stateglow);
  transition: border-color .35s, box-shadow .35s;
}
.ring.r1 { border-width: 2px; }
.ring.r2 { inset: 8%; opacity: .75; animation: spin 26s linear infinite; border-style: dashed; }
.ring.r3 { inset: 18%; opacity: .85; animation: spin 18s linear infinite reverse; }
.ring.r4 { inset: 28%; opacity: .55; border-style: dotted; }
.ticks {
  position: absolute; inset: -6px; border-radius: 50%;
  background:
    conic-gradient(from 0deg,
      var(--stateclr) 0 1deg, transparent 1deg 30deg,
      var(--stateclr) 30deg 31deg, transparent 31deg 60deg,
      var(--stateclr) 60deg 61deg, transparent 61deg 90deg,
      var(--stateclr) 90deg 91deg, transparent 91deg 120deg,
      var(--stateclr) 120deg 121deg, transparent 121deg 150deg,
      var(--stateclr) 150deg 151deg, transparent 151deg 180deg,
      var(--stateclr) 180deg 181deg, transparent 181deg 210deg,
      var(--stateclr) 210deg 211deg, transparent 211deg 240deg,
      var(--stateclr) 240deg 241deg, transparent 241deg 270deg,
      var(--stateclr) 270deg 271deg, transparent 271deg 300deg,
      var(--stateclr) 300deg 301deg, transparent 301deg 330deg,
      var(--stateclr) 330deg 331deg, transparent 331deg 360deg);
  mask: radial-gradient(circle at 50% 50%, transparent 50%, black 51%, black 53%, transparent 54%);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 50%, black 51%, black 53%, transparent 54%);
  opacity: 0.7; animation: spin 60s linear infinite;
}
.core {
  position: absolute; inset: 38%; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--stateclr), rgba(0,0,0,0.6) 75%);
  box-shadow: 0 0 40px var(--stateglow), inset 0 0 20px var(--stateglow);
  filter: blur(1px); animation: pulse 2.4s ease-in-out infinite;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { transform: scale(.92); opacity: .85; } 50% { transform: scale(1.14); opacity: 1; } }
body[data-state="listening"] .core { animation-duration: .7s; }
body[data-state="thinking"] .core { animation-duration: 1.5s; }
body[data-state="speaking"] .core { animation-duration: .9s; }
body[data-state="awaiting"] .core { animation-duration: 1.6s; }

.status-block { text-align: center; z-index: 2; }
.status-label {
  font-size: 20px; letter-spacing: .38em; text-transform: uppercase;
  color: var(--stateclr); font-weight: 600; transition: color .35s;
  text-shadow: 0 0 22px var(--stateglow);
}
.state-hint { margin-top: 6px; color: var(--dim); font-size: 12px; font-family: "JetBrains Mono", monospace; letter-spacing: .1em; }

.feed {
  border: 1px solid var(--border); border-radius: 4px; background: var(--panel);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 6px;
  min-height: 140px; max-height: 180px; overflow: hidden;
}
.feed-title {
  font-size: 10px; letter-spacing: .22em; color: var(--dim); font-weight: 500;
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.turns { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.turns::-webkit-scrollbar { width: 4px; }
.turns::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.turn {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 4px 8px; font-size: 12px; line-height: 1.4;
  border-left: 2px solid var(--dim); font-family: "JetBrains Mono", monospace;
}
.turn.you { border-color: var(--listening); }
.turn.jarvis { border-color: var(--speaking); }
.turn .who {
  font-size: 9px; letter-spacing: .18em; color: var(--dim);
  min-width: 54px; padding-top: 2px;
}
.turn.you .who { color: var(--listening); }
.turn.jarvis .who { color: var(--speaking); }

.ticker {
  grid-area: tick; padding: 10px 16px; border: 1px solid var(--border);
  border-radius: 4px; background: var(--panel);
  display: flex; align-items: center; gap: 16px;
  font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--dim);
  overflow: hidden; white-space: nowrap; z-index: 5;
}
.ticker .lbl { color: var(--stateclr); font-weight: 600; letter-spacing: .22em; transition: color .35s; }
.ticker .msg { flex: 1; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ticker .clk { color: var(--dim); font-variant-numeric: tabular-nums; }
.wave { display: inline-flex; align-items: end; gap: 2px; height: 14px; margin-right: 4px; }
.wave i { display: block; width: 2px; background: var(--stateclr); animation: wv 1.1s ease-in-out infinite; }
.wave i:nth-child(1) { height: 40%; animation-delay: -.1s; }
.wave i:nth-child(2) { height: 70%; animation-delay: -.4s; }
.wave i:nth-child(3) { height: 55%; animation-delay: -.2s; }
.wave i:nth-child(4) { height: 90%; animation-delay: -.6s; }
.wave i:nth-child(5) { height: 45%; animation-delay: -.3s; }
@keyframes wv { 0%,100% { transform: scaleY(.5); } 50% { transform: scaleY(1.4); } }
body[data-state="idle"] .wave i { animation-play-state: paused; opacity: .5; }
body[data-state="off"] .wave i { animation-play-state: paused; opacity: .3; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; grid-template-areas: "hdr" "reactor" "tick"; }
  .rail { display: none; }
}
