:root {
  --aster-ink: #08090b;
  --aster-surface: rgba(15, 18, 24, 0.72);
  --aster-surface-strong: rgba(10, 12, 17, 0.9);
  --aster-line: rgba(255, 255, 255, 0.085);
  --aster-line-blue: rgba(38, 149, 255, 0.28);
  --aster-ivory: #f4efe6;
  --aster-copy: #c8c2b8;
  --aster-muted: #8d8983;
  --aster-gold: #d9ad52;
  --aster-cyan: #25d9ff;
  --aster-blue: #2478ff;
  --aster-violet: #8a4dff;
  --focus-ring: 0 0 0 3px rgba(37, 217, 255, 0.24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--aster-ivory);
  background: var(--aster-ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--aster-ink);
}

body {
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input { font: inherit; }

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.neural-background,
.ambient-vignette {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.neural-background { z-index: 0; }

.ambient-vignette {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 40%, transparent 0 18%, rgba(8, 9, 11, 0.08) 46%, rgba(8, 9, 11, 0.66) 82%),
    linear-gradient(180deg, rgba(8, 9, 11, 0.18), rgba(8, 9, 11, 0.5));
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 760px);
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 12px)
    max(16px, env(safe-area-inset-right, 0px))
    calc(env(safe-area-inset-bottom, 0px) + 12px)
    max(16px, env(safe-area-inset-left, 0px));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 4px 2px 12px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  color: var(--aster-cyan);
  font-size: 25px;
  line-height: 1;
  text-shadow:
    0 0 10px rgba(37, 217, 255, 0.8),
    0 0 28px rgba(36, 120, 255, 0.58);
}

.brand-copy h1,
.brand-copy p { margin: 0; }

.brand-copy h1 {
  color: var(--aster-ivory);
  font-size: 20px;
  font-weight: 520;
  letter-spacing: 0.22em;
  line-height: 1.05;
}

.brand-copy p {
  margin-top: 4px;
  color: var(--aster-gold);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.27em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--aster-line);
  border-radius: 999px;
  color: var(--aster-copy);
  background: rgba(8, 10, 15, 0.46);
  backdrop-filter: blur(18px) saturate(1.2);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--aster-cyan);
  box-shadow: 0 0 12px rgba(37, 217, 255, 0.72);
}

.status-dot[data-state="listening"] { background: #33f0bd; box-shadow: 0 0 14px rgba(51, 240, 189, 0.8); }
.status-dot[data-state="thinking"] { background: var(--aster-violet); box-shadow: 0 0 14px rgba(138, 77, 255, 0.78); }
.status-dot[data-state="tool"] { background: var(--aster-gold); box-shadow: 0 0 14px rgba(217, 173, 82, 0.72); }
.status-dot[data-state="speaking"] { background: var(--aster-cyan); box-shadow: 0 0 14px rgba(37, 217, 255, 0.84); }
.status-dot[data-state="offline"] { background: #826d6d; box-shadow: none; }

.conversation {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px 0 18px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.message {
  width: fit-content;
  max-width: min(88%, 620px);
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--aster-line);
  border-radius: 18px;
  line-height: 1.45;
  word-break: break-word;
  backdrop-filter: blur(20px) saturate(1.12);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.26);
}

.message p { margin: 0; }

.message-author {
  display: block;
  margin-bottom: 4px;
  color: var(--aster-cyan);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.18em;
}

.message-user {
  margin-left: auto;
  color: var(--aster-ivory);
  background: rgba(18, 25, 37, 0.78);
  border-color: rgba(66, 143, 255, 0.24);
}

.message-system {
  margin-right: auto;
  color: var(--aster-ivory);
  background:
    linear-gradient(145deg, rgba(25, 38, 59, 0.58), rgba(11, 14, 20, 0.72));
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px 50px;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--aster-line);
  border-radius: 22px;
  background: rgba(9, 11, 16, 0.76);
  backdrop-filter: blur(26px) saturate(1.2);
  box-shadow:
    0 22px 64px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.composer input {
  min-width: 0;
  width: 100%;
  min-height: 50px;
  padding: 0 12px;
  border: 0;
  color: var(--aster-ivory);
  background: transparent;
  outline: none;
  font-size: 16px;
}

.composer input::placeholder { color: rgba(200, 194, 184, 0.55); }

.mic-button,
.send-button {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  cursor: pointer;
}

.mic-button {
  position: relative;
  color: var(--aster-cyan);
  background:
    radial-gradient(circle at 50% 40%, rgba(37, 217, 255, 0.14), transparent 58%),
    rgba(17, 23, 33, 0.82);
  box-shadow: inset 0 0 22px rgba(37, 217, 255, 0.05);
}

.mic-button[aria-pressed="true"] {
  border-color: rgba(37, 217, 255, 0.62);
  box-shadow:
    0 0 0 1px rgba(37, 217, 255, 0.15),
    0 0 24px rgba(37, 217, 255, 0.24),
    inset 0 0 24px rgba(37, 217, 255, 0.1);
}

.mic-glyph {
  display: inline-block;
  font-size: 29px;
  line-height: 1;
  transform: rotate(90deg);
}

.send-button {
  color: #081018;
  background: linear-gradient(145deg, #59e6ff, #2d9bff 58%, #6a5cff);
  font-size: 24px;
  font-weight: 500;
  box-shadow: 0 10px 24px rgba(36, 120, 255, 0.2);
}

button:disabled,
input:disabled { opacity: 0.55; cursor: not-allowed; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 760px) {
  .app-shell {
    padding-left: 24px;
    padding-right: 24px;
  }

  .topbar,
  .composer { margin-left: 6px; margin-right: 6px; }
}

@media (max-width: 360px) {
  .brand-copy p { display: none; }
  .status { padding: 0 9px; }
  .composer { grid-template-columns: minmax(0, 1fr) 48px 48px; }
  .mic-button,
  .send-button { width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
