/* ============================================
   JARVIS — Dark HUD Mobile Interface
   Palette: Deep Navy / Electric Cyan / Iron Blue
   ============================================ */

:root {
  --bg-deep:       #000d1a;
  --bg-panel:      #001428;
  --bg-card:       #001e3c;
  --cyan:          #00d4ff;
  --cyan-dim:      #0099cc;
  --cyan-glow:     rgba(0, 212, 255, 0.15);
  --cyan-glow2:    rgba(0, 212, 255, 0.35);
  --blue-bright:   #4fc3f7;
  --blue-mid:      #0277bd;
  --orange-arc:    #ff6b2b;
  --orange-glow:   rgba(255, 107, 43, 0.3);
  --text-primary:  #e0f7ff;
  --text-dim:      #5a8fa8;
  --text-muted:    #2a5570;
  --border:        rgba(0, 212, 255, 0.2);
  --border-bright: rgba(0, 212, 255, 0.6);
  --font-hud:      'Orbitron', monospace;
  --font-body:     'Rajdhani', sans-serif;
  --font-mono:     'Share Tech Mono', monospace;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow-x: hidden;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  position: relative;
}

/* ── Scan Lines ── */
.scanlines {
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 212, 255, 0.015) 2px,
    rgba(0, 212, 255, 0.015) 4px
  );
  pointer-events: none;
  z-index: 100;
  animation: scanMove 8s linear infinite;
}

@keyframes scanMove {
  0%   { background-position: 0 0; }
  100% { background-position: 0 100px; }
}

/* ── Noise Texture ── */
.noise {
  position: fixed; inset: 0;
  opacity: 0.03;
  pointer-events: none;
  z-index: 99;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ── HUD Corner Brackets ── */
.hud-corner {
  position: fixed;
  width: 28px; height: 28px;
  z-index: 200;
  pointer-events: none;
}
.hud-corner::before,
.hud-corner::after {
  content: '';
  position: absolute;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.hud-corner::before { width: 100%; height: 2px; }
.hud-corner::after  { width: 2px; height: 100%; }

.top-left    { top: 12px; left: 12px; }
.top-right   { top: 12px; right: 12px; transform: scaleX(-1); }
.bottom-left { bottom: 12px; left: 12px; transform: scaleY(-1); }
.bottom-right{ bottom: 12px; right: 12px; transform: scale(-1); }

/* ── Status Bar ── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0,20,40,0.9) 0%, transparent 100%);
  position: relative;
  z-index: 10;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #00ff88;
  box-shadow: 0 0 8px #00ff88;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.status-text {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
}

.jarvis-title {
  font-family: var(--font-hud);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan), 0 0 40px rgba(0,212,255,0.4);
}

.status-right {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan-dim);
  letter-spacing: 1px;
}

/* ── Main Interface ── */
.main-interface {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px 10px;
  gap: 14px;
  overflow-y: auto;
}

/* ── Arc Reactor Section ── */
.reactor-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 8px;
}

.reactor-container {
  position: relative;
  width: 180px; height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Rings */
.reactor-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--border);
}

.ring-outer {
  width: 180px; height: 180px;
  border-color: rgba(0,212,255,0.25);
  animation: spinSlow 20s linear infinite;
  position: relative;
}

.ring-tick {
  position: absolute;
  width: 6px; height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  top: 50%; left: 50%;
  transform-origin: -84px 0;
  transform: translateY(-50%) rotate(calc(var(--i) * 45deg)) translateX(-84px);
}

.ring-mid {
  width: 148px; height: 148px;
  border-color: rgba(0,212,255,0.15);
  animation: spinSlow 12s linear infinite reverse;
}

.ring-inner {
  width: 116px; height: 116px;
  border-color: rgba(0,212,255,0.3);
  border-style: dashed;
  animation: spinSlow 6s linear infinite;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Core Button */
.reactor-core {
  position: relative;
  width: 90px; height: 90px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: radial-gradient(circle at 40% 35%, #003a5c, #000d1a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 20px var(--cyan-glow2),
    0 0 40px var(--cyan-glow),
    inset 0 0 20px rgba(0,212,255,0.1);
  transition: all 0.3s ease;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}

.reactor-core:active,
.reactor-core.listening {
  box-shadow:
    0 0 30px var(--cyan),
    0 0 60px var(--cyan-glow2),
    0 0 100px rgba(0,212,255,0.2),
    inset 0 0 30px rgba(0,212,255,0.2);
  border-color: #fff;
  transform: scale(1.05);
}

.reactor-core.speaking {
  box-shadow:
    0 0 30px var(--orange-arc),
    0 0 60px var(--orange-glow),
    inset 0 0 30px rgba(255,107,43,0.15);
  border-color: var(--orange-arc);
}

.core-glow {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,212,255,0.2) 0%, transparent 70%);
  animation: coreBreath 3s ease-in-out infinite;
}

@keyframes coreBreath {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50%       { opacity: 1;   transform: scale(1.1); }
}

.core-icon {
  color: var(--cyan);
  width: 32px; height: 32px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 6px var(--cyan));
  transition: color 0.3s;
}

.reactor-core.speaking .core-icon { color: var(--orange-arc); filter: drop-shadow(0 0 6px var(--orange-arc)); }

/* Pulse Rings */
.pulse-ring {
  position: absolute;
  width: 90px; height: 90px;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  opacity: 0;
  animation: pulseOut 2.5s ease-out infinite;
}
.pulse-ring.delay1 { animation-delay: 1.25s; }

@keyframes pulseOut {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ── Waveform ── */
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 36px;
  opacity: 0.3;
  transition: opacity 0.4s;
}

.waveform.active { opacity: 1; }

.wave-bar {
  width: 3px;
  background: linear-gradient(180deg, var(--cyan) 0%, var(--blue-mid) 100%);
  border-radius: 2px;
  height: 4px;
  box-shadow: 0 0 4px var(--cyan);
  transition: height 0.1s ease;
}

.waveform.active .wave-bar {
  animation: waveAnim 0.8s ease-in-out infinite alternate;
  animation-delay: calc(var(--d) * 0.06s);
}

.waveform.speaking .wave-bar {
  background: linear-gradient(180deg, var(--orange-arc) 0%, #cc4400 100%);
  box-shadow: 0 0 4px var(--orange-arc);
  animation: waveAnimSpeak 0.5s ease-in-out infinite alternate;
  animation-delay: calc(var(--d) * 0.04s);
}

@keyframes waveAnim {
  0%   { height: 4px; }
  100% { height: calc(8px + var(--d) * 2px); }
}

@keyframes waveAnimSpeak {
  0%   { height: 6px; }
  100% { height: calc(12px + var(--d) * 1.5px); }
}

/* ── Mic Label ── */
.mic-label {
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-dim);
  text-align: center;
  transition: color 0.3s;
  animation: idlePulseText 3s ease-in-out infinite;
}

@keyframes idlePulseText {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

.mic-label.listening {
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan);
  animation: none;
}
.mic-label.speaking  {
  color: var(--orange-arc);
  text-shadow: 0 0 10px var(--orange-arc);
  animation: none;
}

/* ── Response Section ── */
.response-section,
.transcript-section {
  width: 100%;
}

.response-header,
.transcript-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.response-tag,
.transcript-tag {
  font-family: var(--font-hud);
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--cyan-dim);
  white-space: nowrap;
}

.transcript-tag { color: var(--text-muted); }

.response-line,
.transcript-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-bright), transparent);
}

.transcript-line {
  background: linear-gradient(90deg, var(--text-muted), transparent);
}

.response-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: 0 6px 6px 0;
  padding: 12px 14px;
  min-height: 70px;
  position: relative;
  overflow: hidden;
}

.response-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

.response-text {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.transcript-box {
  background: rgba(0,20,40,0.5);
  border: 1px solid var(--text-muted);
  border-radius: 6px;
  padding: 8px 12px;
  min-height: 36px;
}

.transcript-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ── Quick Commands ── */
.quick-commands {
  width: 100%;
}

.commands-label {
  font-family: var(--font-hud);
  font-size: 8px;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.chips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--cyan-dim);
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 1px;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}

.chip:hover,
.chip:active {
  background: var(--cyan-glow);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  transform: scale(0.97);
}

/* ── HUD Footer ── */
.hud-footer {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 20px 16px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, rgba(0,20,40,0.9) 0%, transparent 100%);
}

.footer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.footer-label {
  font-family: var(--font-hud);
  font-size: 7px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.footer-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan-dim);
}

/* ── Typing Cursor Animation ── */
@keyframes typeCursor {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.typing-cursor::after {
  content: '|';
  animation: typeCursor 0.7s infinite;
  color: var(--cyan);
  margin-left: 2px;
}

/* ── Boot Animation ── */
@keyframes bootFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status-bar    { animation: bootFadeIn 0.6s ease 0.1s both; }
.reactor-section { animation: bootFadeIn 0.6s ease 0.3s both; }
.response-section { animation: bootFadeIn 0.6s ease 0.5s both; }
.transcript-section { animation: bootFadeIn 0.6s ease 0.6s both; }
.quick-commands { animation: bootFadeIn 0.6s ease 0.7s both; }
.hud-footer    { animation: bootFadeIn 0.6s ease 0.8s both; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Responsive tweaks ── */
@media (max-height: 700px) {
  .reactor-container { width: 150px; height: 150px; }
  .ring-outer { width: 150px; height: 150px; }
  .ring-mid   { width: 122px; height: 122px; }
  .ring-inner { width: 96px;  height: 96px; }
  .reactor-core { width: 76px; height: 76px; }
  .pulse-ring   { width: 76px; height: 76px; }
  .ring-tick { transform-origin: -69px 0; transform: translateY(-50%) rotate(calc(var(--i) * 45deg)) translateX(-69px); }
}

@media (min-width: 430px) {
  .chips-grid { grid-template-columns: repeat(4, 1fr); }
  .response-text { font-size: 16px; }
}