* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

:root {
  --bg-dark: #040914;
  --panel-bg: rgba(8, 19, 36, 0.88);
  --border-cyan: rgba(0, 240, 255, 0.26);
  --cyan: #00f0ff;
  --gold: #ffb800;
  --text-main: #eaf8ff;
  --text-dim: #84aac0;
  --danger: #ff4d6d;
  --success: #00e676;
}

body {
  background: radial-gradient(circle at 50% 15%, #0b1f3f 0%, #040914 78%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.hud-grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: 0;
}

.ico {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
}

.ico-lg {
  width: 20px;
  height: 20px;
}

/* Top Header Bar */
.top-bar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(4, 11, 24, 0.94);
  border-bottom: 1px solid var(--border-cyan);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.arc-core-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 12%, var(--cyan) 55%, transparent 78%);
  box-shadow: 0 0 14px var(--cyan), 0 0 28px var(--cyan);
  animation: pulseDot 2.2s infinite ease-in-out;
}

.brand h1 {
  font-size: 1.25rem;
  letter-spacing: 3px;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
}

.subtitle {
  font-size: 0.67rem;
  letter-spacing: 1.8px;
  color: var(--text-dim);
  display: block;
}

.telemetry-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tele-item {
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.22);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
}

.tele-label {
  color: var(--text-dim);
  margin-right: 6px;
  font-weight: 600;
}

.tele-val {
  color: var(--cyan);
  font-weight: 700;
}

.status-cloud {
  color: var(--success);
}

.status-warn {
  color: var(--gold);
}

/* Main 3-Column Workspace */
.workspace {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: 330px 1fr 340px;
  gap: 14px;
  padding: 14px;
  max-width: 1640px;
  width: 100%;
  margin: 0 auto;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-cyan);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.48), inset 0 0 22px rgba(0, 240, 255, 0.03);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0, 240, 255, 0.07);
  border-bottom: 1px solid var(--border-cyan);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--cyan);
}

/* Left Hologram Panel */
.hologram-panel {
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
}

.hologram-panel .panel-header {
  width: 100%;
}

.holo-stage {
  position: relative;
  width: 285px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.hud-rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ring {
  fill: none;
  transform-origin: 200px 200px;
}

.ring-outer {
  stroke: rgba(0, 240, 255, 0.35);
  stroke-width: 2;
  stroke-dasharray: 18 10 4 10;
  animation: spinSlow 24s linear infinite;
}

.ring-mid {
  stroke: rgba(0, 240, 255, 0.55);
  stroke-width: 3;
  stroke-dasharray: 65 25 12 25;
  animation: spinReverse 16s linear infinite;
}

.ring-gold {
  stroke: rgba(255, 184, 0, 0.52);
  stroke-width: 1.8;
  stroke-dasharray: 30 15;
  animation: spinSlow 12s linear infinite;
}

.ring-inner {
  stroke: rgba(0, 240, 255, 0.25);
  stroke-width: 1.5;
}

.avatar-wrapper {
  position: relative;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(0, 240, 255, 0.24), rgba(4, 12, 26, 0.94) 72%);
  border: 2px solid rgba(0, 240, 255, 0.68);
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.35), inset 0 0 24px rgba(0, 240, 255, 0.28);
  transition: all 0.25s ease;
}

.avatar-wrapper.full-body-mode {
  border-radius: 18px;
  width: 190px;
  height: 260px;
}

.avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.45)) contrast(1.04);
  animation: holoBreath 4s ease-in-out infinite;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.holo-stage.listening .avatar-wrapper {
  border-color: var(--gold);
  box-shadow: 0 0 34px rgba(255, 184, 0, 0.65), inset 0 0 24px rgba(255, 184, 0, 0.35);
}

.holo-stage.speaking .avatar-wrapper {
  border-color: var(--cyan);
  box-shadow: 0 0 42px rgba(0, 240, 255, 0.85), inset 0 0 30px rgba(0, 240, 255, 0.45);
  animation: speakContainerPulse 0.45s infinite alternate ease-in-out;
}

.holo-stage.speaking .avatar-wrapper img {
  filter: drop-shadow(0 0 16px rgba(0, 240, 255, 0.85)) brightness(1.07);
}

.holo-scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 240, 255, 0.14) 50%, transparent 100%);
  height: 35%;
  animation: scanMove 3.5s linear infinite;
  pointer-events: none;
}

.holo-base-glow {
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 14px;
  background: radial-gradient(ellipse at center, rgba(0, 240, 255, 0.75), transparent 70%);
  pointer-events: none;
}

/* Audio Equalizer Bars */
.audio-bars {
  position: absolute;
  bottom: 4px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 26px;
}

.audio-bars span {
  width: 4px;
  height: 5px;
  background: var(--cyan);
  border-radius: 3px;
  box-shadow: 0 0 6px var(--cyan);
}

.holo-stage.speaking .audio-bars span,
.holo-stage.listening .audio-bars span {
  animation: eqBounce 0.45s infinite alternate ease-in-out;
}

.audio-bars span:nth-child(odd) { animation-delay: 0.12s; background: var(--gold); }
.audio-bars span:nth-child(3n) { animation-delay: 0.24s; }
.audio-bars span:nth-child(4n) { animation-delay: 0.06s; }

.state-readout {
  text-align: center;
  padding: 0 14px;
}

.state-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: var(--cyan);
  margin-bottom: 6px;
}

.voice-hint {
  font-size: 0.79rem;
  color: var(--text-dim);
  min-height: 36px;
  line-height: 1.35;
}

.voice-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
}

.btn-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Center Chat Panel */
.chat-panel {
  height: calc(100vh - 96px);
  min-height: 540px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 89%;
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.52;
  word-wrap: break-word;
}

.msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0, 140, 255, 0.28), rgba(0, 240, 255, 0.16));
  border: 1px solid rgba(0, 240, 255, 0.42);
  color: #fff;
}

.msg-ai {
  align-self: flex-start;
  background: rgba(11, 25, 46, 0.94);
  border: 1px solid rgba(255, 184, 0, 0.32);
  color: var(--text-main);
}

.msg-meta {
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* Code Blocks inside Chat */
.code-card {
  margin-top: 10px;
  background: #030711;
  border: 1px solid rgba(0, 240, 255, 0.36);
  border-radius: 8px;
  overflow: hidden;
}

.code-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(0, 240, 255, 0.1);
  border-bottom: 1px solid rgba(0, 240, 255, 0.25);
  font-size: 0.72rem;
  color: var(--cyan);
  flex-wrap: wrap;
  gap: 6px;
}

.code-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.code-card pre {
  padding: 12px;
  overflow-x: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  color: #b8f3ff;
  line-height: 1.45;
}

/* Quick Chips & Command Bar */
.quick-chips {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  border-top: 1px solid rgba(0, 240, 255, 0.15);
  background: rgba(4, 10, 22, 0.65);
}

.quick-chips button {
  white-space: nowrap;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.28);
  color: var(--cyan);
  padding: 5px 11px;
  border-radius: 16px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: 0.2s;
}

.quick-chips button:hover {
  background: rgba(0, 240, 255, 0.22);
}

.command-bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(4, 11, 24, 0.96);
  border-top: 1px solid var(--border-cyan);
}

.command-bar input {
  flex: 1;
  background: rgba(9, 22, 42, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.92rem;
  outline: none;
}

.command-bar input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}

.btn-mic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  background: rgba(0, 240, 255, 0.14);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
}

.btn-mic.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 0 18px var(--danger);
  animation: pulseDot 1s infinite;
}

.btn-send, .btn-hud, .btn-mini {
  background: rgba(0, 240, 255, 0.14);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.7px;
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-accent {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255, 184, 0, 0.12);
}

.btn-send {
  background: linear-gradient(135deg, #00b4d8, #0077b6);
  color: #fff;
  padding: 8px 16px;
}

.btn-mini {
  padding: 4px 8px;
  font-size: 0.69rem;
}

.btn-hud:hover, .btn-mini:hover {
  background: rgba(0, 240, 255, 0.26);
}

.btn-toggle.active {
  background: rgba(255, 184, 0, 0.22);
  border-color: var(--gold);
  color: var(--gold);
}

.hud-select {
  background: #071428;
  color: var(--cyan);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.76rem;
  outline: none;
}

.full-w {
  width: 100%;
}

/* Right Side Panel */
.side-panel {
  height: calc(100vh - 96px);
  min-height: 540px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border-cyan);
}

.tab-btn {
  padding: 11px 4px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  background: rgba(0, 240, 255, 0.08);
}

.tab-content {
  display: none;
  padding: 12px;
  flex: 1;
  overflow-y: auto;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.16);
}

.stack-form input[type="text"] {
  background: rgba(5, 14, 28, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.32);
  border-radius: 6px;
  padding: 8px 10px;
  color: #fff;
  font-size: 0.82rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.hud-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-list li {
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.22);
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.item-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.badge-tag {
  background: rgba(0, 240, 255, 0.14);
  color: var(--cyan);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-high {
  background: rgba(255, 184, 0, 0.2);
  color: var(--gold);
}

.hud-list li.done .item-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

.small-note {
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.launcher-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.launch-card {
  text-decoration: none;
  background: rgba(0, 240, 255, 0.07);
  border: 1px solid rgba(0, 240, 255, 0.26);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: 0.2s;
}

.launch-card:hover {
  border-color: var(--gold);
  background: rgba(255, 184, 0, 0.1);
}

.launch-card strong {
  color: var(--cyan);
  font-size: 0.81rem;
}

.launch-card span {
  color: var(--text-dim);
  font-size: 0.7rem;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 15, 0.86);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: #071326;
  border: 1px solid var(--cyan);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.25);
  overflow: hidden;
}

.modal-wide {
  max-width: 940px;
  height: 84vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 240, 255, 0.1);
  border-bottom: 1px solid var(--border-cyan);
}

.modal-header h2 {
  font-size: 0.88rem;
  letter-spacing: 1.5px;
  color: var(--cyan);
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-body label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
}

.modal-body input[type="text"],
.modal-body input[type="password"],
.modal-body input[type="url"] {
  background: #040b18;
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-size: 0.88rem;
}

.inline-link {
  color: var(--gold);
  margin-left: 6px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

#livePreviewFrame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

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

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

@keyframes holoBreath {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-4px) scale(1.015); }
}

@keyframes speakContainerPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.028); }
}

@keyframes scanMove {
  0% { top: -35%; }
  100% { top: 105%; }
}

@keyframes eqBounce {
  0% { height: 5px; }
  100% { height: 24px; }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.12); }
}

/* Responsive */
@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .chat-panel, .side-panel {
    height: auto;
    min-height: 460px;
  }
  .holo-stage {
    width: 240px;
    height: 250px;
  }
  .avatar-wrapper {
    width: 180px;
    height: 180px;
  }
}
