:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111827;
  color: #f7f8fc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -20%, rgba(124, 92, 255, .28), transparent 60%),
    #111827;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.assistant-shell {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 0 max(2rem, env(safe-area-inset-bottom));
}

.assistant-header {
  display: flex;
  min-height: 3.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.back-link, .assistant-brand { color: #d9dded; text-decoration: none; }
.assistant-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.brand-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; background: #7c5cff; color: white; }

.install-button, .token-row button, .send-button {
  border: 0;
  border-radius: .8rem;
  background: #7c5cff;
  color: white;
  font-weight: 700;
}

.install-button { padding: .65rem .85rem; }
.assistant-card, .privacy-note { padding: clamp(1.25rem, 5vw, 2.5rem); border: 1px solid #31394d; border-radius: 1.25rem; background: rgba(24, 32, 49, .92); box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, .2); }
.eyebrow { color: #a99aff; font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
h1 { margin: .4rem 0 .75rem; font-size: clamp(1.8rem, 7vw, 2.7rem); line-height: 1.1; }
.intro, .hint, .privacy-note p { color: #b8bfd0; line-height: 1.65; }
.token-form { margin-top: 1.5rem; }
.token-form label { display: block; margin-bottom: .45rem; font-weight: 650; }
.token-row { display: flex; gap: .65rem; }
input, textarea { width: 100%; border: 1px solid #414b63; border-radius: .75rem; padding: .8rem .9rem; background: #101624; color: #f7f8fc; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #36d6bd; outline-offset: 2px; }
.token-row button { flex: 0 0 auto; padding: 0 1rem; }
.hint { margin: .55rem 0 0; font-size: .82rem; }
.chat-log { display: grid; max-height: 22rem; gap: .8rem; overflow-y: auto; margin: 1.5rem 0; }
.welcome-message, .chat-message { margin: 0; padding: .8rem 1rem; border-radius: .85rem; background: #202a40; color: #d8deec; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.user { justify-self: end; max-width: 90%; background: #33285e; color: #fff; }
.chat-message.assistant { justify-self: start; max-width: 100%; }
.chat-form textarea { resize: vertical; min-height: 3.5rem; }
.chat-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .85rem; margin-top: .75rem; }
.mic-button, .send-button { min-height: 2.8rem; padding: .65rem 1rem; }
.mic-button { border: 1px solid #49536d; border-radius: .8rem; background: #202a40; color: #f7f8fc; }
.mic-button[aria-pressed="true"] { border-color: #ff758f; background: #482438; }
.voice-toggle { display: flex; align-items: center; gap: .45rem; margin-right: auto; color: #c6ccda; font-size: .9rem; }
.voice-toggle input { width: auto; accent-color: #7c5cff; }
.status { min-height: 1.5rem; margin: .8rem 0 0; color: #aeb8ce; font-size: .9rem; }
.privacy-note { margin-top: 1rem; padding-block: 1.25rem; }
.privacy-note h2 { margin: 0; font-size: 1rem; }
.privacy-note p { margin: .6rem 0 0; font-size: .88rem; }
.setup-note { margin: 1rem 0; padding: 1rem 1.25rem; border: 1px solid #31394d; border-radius: 1rem; background: rgba(24, 32, 49, .72); color: #c6ccda; }
.setup-note summary { cursor: pointer; color: #d9dded; font-weight: 700; }
.setup-note ol { padding-left: 1.3rem; line-height: 1.65; }
.setup-note li + li { margin-top: .45rem; }
.setup-note code { color: #c6baff; overflow-wrap: anywhere; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 480px) {
  .assistant-header { margin-bottom: 1.25rem; }
  .back-link { font-size: .85rem; }
  .assistant-brand { font-size: .9rem; }
  .install-button { padding: .55rem .65rem; font-size: .8rem; }
  .token-row { align-items: stretch; flex-direction: column; }
  .token-row button { min-height: 2.8rem; }
}
