:root {
  --bg: #02030a;
  --fg: #eaf2ff;
  --muted: #8aa0c8;
  --accent: #ff7a1a;
  --accent-2: #4ea8ff;
  --glow: 0 0 40px rgba(78, 168, 255, 0.25);
  --glass: rgba(10, 16, 32, 0.42);
  --glass-brd: rgba(140, 180, 255, 0.18);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  overflow: hidden;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.fallback-stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: none;
  background:
    radial-gradient(120% 120% at 50% 45%, transparent 12%, rgba(255, 122, 26, 0.18) 17%, transparent 24%),
    radial-gradient(circle at 50% 45%, #000 7%, transparent 9%),
    radial-gradient(140% 100% at 50% 50%, #0a1024 0%, #02030a 60%, #000 100%);
}
.fallback-stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 70% 60%, #cfe0ff, transparent),
    radial-gradient(1px 1px at 40% 80%, #fff, transparent),
    radial-gradient(1px 1px at 85% 20%, #9fb8ff, transparent),
    radial-gradient(1px 1px at 10% 70%, #fff, transparent);
  opacity: 0.7;
}
body.no-webgl #bg {
  display: none;
}
body.no-webgl .fallback-stars {
  display: block;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(60% 42% at 50% 62%, rgba(2, 3, 10, 0.62) 0%, transparent 70%),
    radial-gradient(125% 125% at 50% 48%, transparent 52%, rgba(0, 0, 0, 0.6) 100%);
}

.hud {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2rem;
  padding: 6vh 1.25rem;
  text-align: center;
}

.brand {
  user-select: none;
}

.logo {
  margin: 0;
  font-size: clamp(2.6rem, 9vw, 6.5rem);
  font-weight: 800;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  background: linear-gradient(180deg, #ffffff 0%, #bcd4ff 55%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 22px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 30px rgba(78, 168, 255, 0.4));
  position: relative;
  animation: floaty 7s ease-in-out infinite;
}
.logo::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.35;
  mix-blend-mode: screen;
}

.tagline {
  margin: 0.7rem 0 0;
  color: #cdd9f0;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  font-size: clamp(0.6rem, 1.6vw, 0.8rem);
  text-transform: uppercase;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.85), 0 0 4px rgba(0, 0, 0, 0.9);
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.search {
  display: flex;
  align-items: center;
  width: min(620px, 92vw);
  padding: 0.35rem 0.35rem 0.35rem 1.3rem;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--glow), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.search:focus-within {
  border-color: rgba(78, 168, 255, 0.55);
  box-shadow: 0 0 60px rgba(78, 168, 255, 0.35);
  transform: translateY(-1px);
}

.search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  outline: none;
}
.search__input::placeholder {
  color: rgba(138, 160, 200, 0.7);
}

.search__go {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  color: #0a0500;
  font-size: 1.25rem;
  line-height: 1;
  background: linear-gradient(135deg, #ffd08a, var(--accent));
  box-shadow: 0 0 24px rgba(255, 122, 26, 0.5);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.search__go:hover {
  transform: scale(1.07);
  box-shadow: 0 0 34px rgba(255, 122, 26, 0.75);
}
.search__go:active {
  transform: scale(0.96);
}

.dock {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}

.dock button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.4rem;
  border-radius: 14px;
  cursor: pointer;
  color: var(--fg);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.dock button:hover:not([disabled]) {
  transform: translateY(-3px);
  border-color: rgba(78, 168, 255, 0.6);
  box-shadow: 0 10px 40px rgba(78, 168, 255, 0.25);
  background: rgba(18, 28, 52, 0.55);
}
.dock button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.status[data-kind="busy"] {
  color: var(--accent-2);
  animation: pulse 1.2s ease-in-out infinite;
}
.status[data-kind="error"] {
  color: #ff6b6b;
}
@keyframes pulse {
  50% { opacity: 0.4; }
}

.sidebar {
  position: fixed;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.6rem;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--glow);
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translate(calc(-100% + 26px), -50%);
}
.sidebar.collapsed .side-btn {
  display: none;
}

.side-toggle {
  align-self: flex-end;
  width: 22px;
  height: 22px;
  margin-bottom: 0.2rem;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--glass-brd);
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.side-toggle:hover {
  color: var(--fg);
  border-color: rgba(78, 168, 255, 0.6);
}
.sidebar.collapsed .side-toggle {
  align-self: center;
}

.side-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 64px;
  padding: 0.6rem 0.3rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--fg);
  background: transparent;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.side-btn:hover {
  transform: translateX(2px);
  background: rgba(18, 28, 52, 0.55);
  border-color: rgba(78, 168, 255, 0.6);
}

.side-ico {
  font-size: 1.35rem;
  line-height: 1;
}
.side-label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.credit {
  position: fixed;
  bottom: 1rem;
  left: 0;
  right: 0;
  z-index: 3;
  text-align: center;
  color: rgba(190, 205, 235, 0.55);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  pointer-events: none;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9);
}

.ai {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
}
body.ai-open .ai {
  display: block;
}

.ai__scrim {
  position: absolute;
  inset: 0;
  background: rgba(2, 3, 10, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.ai__panel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  height: 100%;
  background: linear-gradient(180deg, rgba(6, 10, 22, 0.92), rgba(3, 5, 14, 0.94));
  border-left: 1px solid rgba(140, 180, 255, 0.16);
  box-shadow: -30px 0 90px rgba(0, 0, 0, 0.55);
  animation: ai-slide 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes ai-slide {
  from { transform: translateX(100%); }
}

.ai__bar {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 1.15rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(140, 180, 255, 0.1);
}
.ai__kicker {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.ai__name {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.34em;
  color: var(--muted);
}
.ai__x {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s ease;
}
.ai__x:hover { color: var(--fg); }

.ai__log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0 0.4rem;
}

.ai-msg {
  padding: 0.55rem 1.25rem 0.75rem;
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
  color: var(--fg);
}
.ai-msg::before {
  display: block;
  margin-bottom: 0.28rem;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.ai-msg--user {
  border-left: 2px solid var(--accent);
  background: linear-gradient(90deg, rgba(255, 122, 26, 0.07), transparent 70%);
}
.ai-msg--user::before {
  content: "you";
  color: var(--accent);
}
.ai-msg--bot {
  border-left: 2px solid rgba(78, 168, 255, 0.55);
}
.ai-msg--bot::before {
  content: "quantum";
  color: var(--accent-2);
}
.ai-msg--error {
  border-left: 2px solid #ff6b6b;
  color: #ffb3b3;
}
.ai-msg--error::before {
  content: "fault";
  color: #ff6b6b;
}
.ai-msg.is-pending {
  color: var(--muted);
  animation: pulse 1.2s ease-in-out infinite;
}

.ai-msg p { margin: 0 0 0.55em; }
.ai-msg > :last-child { margin-bottom: 0; }
.ai-msg ul, .ai-msg ol { margin: 0.3em 0; padding-left: 1.25em; }
.ai-msg li { margin: 0.15em 0; }
.ai-msg a { color: var(--accent-2); }
.ai-msg strong { color: #fff; }
.ai-msg h2, .ai-msg h3, .ai-msg h4 { margin: 0.5em 0 0.3em; line-height: 1.3; }
.ai-msg code {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 0.86em;
  background: rgba(140, 180, 255, 0.12);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}
.ai-msg pre {
  margin: 0.45em 0;
  padding: 0.7rem 0.85rem;
  background: rgba(2, 3, 10, 0.55);
  border: 1px solid rgba(140, 180, 255, 0.14);
  border-radius: 10px;
  overflow-x: auto;
}
.ai-msg pre code { padding: 0; background: none; font-size: 0.85em; }

.ai__composer {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem 1.2rem;
  border-top: 1px solid rgba(140, 180, 255, 0.1);
}
.ai__tool {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  cursor: pointer;
  opacity: 0.8;
  transition: color 0.2s ease, opacity 0.2s ease, text-shadow 0.2s ease;
}
.ai__tool:hover { color: var(--fg); opacity: 1; }
.ai__tool.is-live {
  color: var(--accent);
  opacity: 1;
  text-shadow: 0 0 12px rgba(255, 122, 26, 0.7);
}
.ai__input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 0.1rem;
  border: 0;
  border-bottom: 1px solid var(--glass-brd);
  background: transparent;
  color: var(--fg);
  font-size: 0.98rem;
  outline: none;
  transition: border-color 0.2s ease;
}
.ai__input::placeholder {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: rgba(138, 160, 200, 0.55);
}
.ai__input:focus { border-bottom-color: var(--accent); }
.ai__send {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.15s ease, text-shadow 0.2s ease;
}
.ai__send:hover {
  transform: translateX(2px);
  text-shadow: 0 0 14px rgba(255, 122, 26, 0.7);
}
.ai__send:active { transform: scale(0.92); }

@media (prefers-reduced-motion: reduce) {
  .logo { animation: none; }
  .status[data-kind="busy"] { animation: none; }
  .ai__panel { animation: none; }
}

#frame{
  z-index: 2;
  /* coincides with the hud's z-index of 2 but as of right now i dont see any problems */
}
