:root {
  --bg0: #0b1020;
  --bg1: #131a2e;
  --card: rgba(255,255,255,0.04);
  --stroke: rgba(255,255,255,0.10);
  --text: #eaf0ff;
  --muted: #9aa6c4;
  --accent: #5b8cff;
  --accent2: #35d0ba;
  --good: #35d08a;
  --warn: #ffb454;
  --shadow: 0 20px 60px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased;
}
.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(91,140,255,0.20), transparent 60%),
    radial-gradient(900px 600px at 100% 10%, rgba(53,208,186,0.16), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* header */
.top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #061018;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  box-shadow: 0 8px 24px rgba(53,208,186,0.35);
}
.brand-text h1 { margin: 0; font-size: 20px; letter-spacing: 0.2px; }
.brand-text p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.head-right { display: flex; align-items: center; gap: 16px; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px rgba(255,180,84,0.15); }
.dot.on { background: var(--good); box-shadow: 0 0 0 4px rgba(53,208,138,0.15); }
.dot.off { background: #7a869f; box-shadow: none; }

/* engine dropdown */
.mode-pick { display: flex; flex-direction: column; gap: 3px; }
.mode-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); padding-left: 2px;
}
#mode {
  appearance: none; -webkit-appearance: none;
  background: var(--card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%239aa6c4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 11px center;
  border: 1px solid var(--stroke); color: var(--text);
  padding: 8px 30px 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; outline: none;
}
#mode:focus { border-color: var(--accent); }

/* mode-driven view switching */
.view { display: none; flex-direction: column; gap: 18px; }
body[data-mode="live"] .view-live { display: flex; }
body[data-mode="omni"] .view-omni { display: flex; }
body[data-mode="omni"] #conn { display: none; }
.foot-live, .foot-omni { display: none; }
body[data-mode="live"] .foot-live { display: inline; }
body[data-mode="omni"] .foot-omni { display: inline; }

/* stage */
.stage-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.stage {
  position: relative;
  width: min(520px, 92vw);
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  background: #1a2136;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}
#view, #omni-video { width: 100%; height: 100%; display: block; object-fit: cover; background: #1a2136; }
.overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted); font-size: 14px; letter-spacing: 0.3px;
  background: rgba(12,16,30,0.55); backdrop-filter: blur(3px);
  transition: opacity 0.25s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.badge {
  position: absolute; left: 14px; bottom: 14px;
  padding: 7px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: #041018;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  display: flex; align-items: center; gap: 7px;
}
.badge .pulse { width: 8px; height: 8px; border-radius: 50%; background: #041018; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{ opacity: .35 } 50%{ opacity: 1 } }

/* attire toggle */
.attire {
  display: inline-flex; padding: 4px; gap: 4px;
  background: var(--card); border: 1px solid var(--stroke); border-radius: 999px;
}
.seg {
  border: 0; cursor: pointer; color: var(--muted);
  padding: 8px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: transparent; transition: all 0.18s ease;
}
.seg.active { color: #061018; background: linear-gradient(135deg, var(--accent2), var(--accent)); }

/* panel */
.panel {
  background: var(--card); border: 1px solid var(--stroke);
  border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 14px;
}
.ask-row { display: flex; gap: 8px; }
#q-input {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,0.05); border: 1px solid var(--stroke);
  color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 14px; outline: none;
}
#q-input:focus { border-color: var(--accent); }
.send, .mic {
  border: 0; cursor: pointer; border-radius: 12px; font-weight: 700; font-size: 14px;
  color: #061018; background: linear-gradient(135deg, var(--accent2), var(--accent));
  padding: 0 18px;
}
.mic { padding: 0 14px; background: rgba(255,255,255,0.08); color: var(--text); }
.mic.active { background: linear-gradient(135deg, #ff6b6b, #ff9f43); color: #180404; }
.send:disabled, .mic:disabled { opacity: 0.45; cursor: not-allowed; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--stroke); cursor: pointer;
  background: rgba(255,255,255,0.04); color: var(--text);
  padding: 9px 14px; border-radius: 999px; font-size: 13px; transition: all 0.16s ease;
}
.chip:hover { border-color: var(--accent); background: rgba(91,140,255,0.12); }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }

.convo { display: flex; flex-direction: column; gap: 8px; max-height: 210px; overflow-y: auto; }
.convo:empty { display: none; }
.line { padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.45; max-width: 88%; }
.line.you { align-self: flex-end; background: rgba(91,140,255,0.16); border: 1px solid rgba(91,140,255,0.25); }
.line.amara { align-self: flex-start; background: rgba(255,255,255,0.05); border: 1px solid var(--stroke); }
.line.system { align-self: center; color: var(--muted); font-size: 12.5px; background: transparent; }
.line b { color: var(--accent2); font-weight: 700; }

/* omni gallery */
.omni-lead { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.badge.tag-omni {
  right: 14px; left: auto; color: var(--text);
  background: rgba(12,16,30,0.72); border: 1px solid var(--stroke);
  backdrop-filter: blur(4px); font-weight: 600;
}
#omni-video.loaded + #omni-overlay { opacity: 0; pointer-events: none; }

.foot { text-align: center; color: var(--muted); font-size: 12px; }

@media (max-width: 480px) {
  .brand-text p { display: none; }
  .chip { font-size: 12.5px; padding: 8px 12px; }
}
