@font-face {
  font-family: Geist;
  src: url("/muse/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #fff;
  --surface: #f5f5f2;
  --edge: #e0e0db;
  --ink: #0d0f14;
  --secondary: #54565d;
  --dim: #63656c;
  --accent-on: #fff;
  --azure: #10599f;
  --info: #10599f;
  --success: #1f7a3d;
  --warning: #855a00;
  --edge-glass: rgba(13, 15, 20, .11);
  --shadow: 0 3px 12px rgba(13, 15, 20, .05);
  font: 100%/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0c;
    --surface: #161618;
    --edge: #2b2b2f;
    --ink: #f5f5f2;
    --secondary: #ababaf;
    --dim: #929298;
    --accent-on: #0b0b0c;
    --info: #7eb9eb;
    --success: #82e293;
    --warning: #ffcb5c;
    --edge-glass: rgba(245, 245, 242, .16);
    --shadow: 0 3px 12px rgba(0, 0, 0, .22);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); }
h1, h2, p { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; color: inherit; background: transparent; border: 0; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.onboarding {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem max(1.5rem, env(safe-area-inset-right)) 2rem max(1.5rem, env(safe-area-inset-left));
}
.auth-content { width: min(100%, 23rem); }
.auth-avatar, .chat-avatar { display: block; border-radius: 23%; }
.auth-avatar { width: clamp(3.25rem, 18vw, 4.5rem); height: auto; }
.pairing-header { text-align: center; }
.pairing-icons { display: flex; align-items: center; justify-content: center; gap: .4rem; margin-bottom: 1.5rem; }
.pairing-connector {
  display: flex;
  align-items: center;
  flex: 0 1 4.75rem;
  color: var(--info);
}
.pairing-connector::before, .pairing-connector::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--edge);
}
.pairing-connector svg {
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: .39rem;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: var(--surface);
}
h1, h2, .primary { font-family: Geist, -apple-system, BlinkMacSystemFont, sans-serif; }
.auth-content h1 { font-size: clamp(1.8rem, 4vw, 2.2rem); line-height: 1.12; font-weight: 600; letter-spacing: -.045em; text-wrap: balance; }
#auth-hint { color: var(--secondary); margin: .75rem 0 1.75rem; overflow-wrap: anywhere; text-wrap: balance; }
.auth-content form { display: grid; gap: .6rem; }
.auth-content label { font-size: .9rem; font-weight: 600; }
.auth-content input {
  width: 100%;
  min-height: 3.2rem;
  border: 1px solid var(--edge);
  border-radius: 15px;
  padding: .75rem 1rem;
  color: var(--ink);
  background: var(--bg);
}
#code { letter-spacing: .18em; font-variant-numeric: tabular-nums; }
.primary {
  border-radius: 30px;
  min-height: 3.1rem;
  margin-top: .35rem;
  font-weight: 600;
  color: var(--accent-on);
  background: var(--ink);
}
.auth-actions { display: flex; justify-content: space-between; flex-wrap: wrap; }
#method-row { justify-content: center; margin-top: .35rem; }
.auth-actions button { min-height: 44px; padding: .5rem .15rem; color: var(--secondary); font-size: .9rem; }
.auth-actions button:hover, .quiet:hover { text-decoration: underline; }
.notice { color: var(--secondary); font-size: .9rem; overflow-wrap: anywhere; }
.auth-content .notice:not(:empty) { margin-top: 1rem; }

.chat {
  height: 100vh;
  height: 100dvh;
  max-width: 48rem;
  margin-inline: auto;
  padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.chat-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: .25rem;
  padding-top: max(1.1rem, env(safe-area-inset-top));
  padding-bottom: .65rem;
}
.device-name { align-self: start; margin-block: .75rem; font-size: .95rem; font-weight: 550; letter-spacing: -.025em; color: var(--secondary); }
.identity { display: grid; justify-items: center; }
.chat-avatar { z-index: 1; }
.status-pill, .quiet, #message, .send {
  background: var(--bg);
  box-shadow: var(--shadow);
  border: 1px solid var(--edge-glass);
}
.status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  border-radius: 2rem;
  margin-top: -.2rem;
  padding: .35rem .75rem .25rem;
  font-size: .85rem;
  font-weight: 550;
  color: var(--secondary);
  text-align: center;
  max-width: 13rem;
}
.status-dot { width: .43rem; height: .43rem; border-radius: 50%; flex: none; background: var(--dim); }
[data-tone="active"] .status-dot { background: var(--success); }
[data-tone="thinking"] .status-dot { background: var(--info); }
[data-tone="attention"] .status-dot { background: var(--warning); }
.quiet { justify-self: end; border-radius: 24px; padding: .5rem .9rem; min-height: 44px; font-size: .9rem; }

.scroll-area { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
.conversation { padding: .35rem .15rem .9rem; }
.message { display: flex; flex-direction: column; margin-block: .45rem; align-items: flex-start; }
.message[data-role="user"] { align-items: flex-end; }
.timestamp { align-self: center; color: var(--dim); font-size: .8rem; margin: .3rem 0 .8rem; }
.bubble {
  max-width: min(82%, 37rem);
  min-width: 0;
  padding: .64rem .92rem;
  border-radius: 20px 20px 20px 6px;
  background: var(--surface);
  font-size: 1.05rem;
  line-height: 1.38;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.message[data-role="user"] .bubble { background: var(--azure); color: #fff; border-radius: 20px 20px 6px 20px; }
.failed { color: var(--warning); font-size: .85rem; margin-top: .25rem; }
.file { display: block; margin: .4rem 0 0; }
.file button { text-align: start; font-weight: 550; text-decoration: underline; min-height: 44px; padding: .35rem 0; }
.file img { display: block; max-width: 100%; max-height: 24rem; object-fit: contain; border-radius: 12px; }
.empty { color: var(--secondary); margin: 2.25rem 0; text-align: center; }
.prompt, .activity { margin-top: .65rem; max-width: min(92%, 35rem); background: var(--surface); padding: .9rem 1rem; border-radius: 18px; }
.prompt h2, .activity h2 { font-size: 1rem; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.prompt-label { color: var(--warning); font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }
#activity-detail, #question, #secure-hint { overflow-wrap: anywhere; margin-top: .2rem; }
#activity-detail, #secure-hint { color: var(--secondary); }
.choices { display: flex; flex-wrap: wrap; gap: .45rem; }
.choices button { min-height: 44px; background: var(--bg); border: 1px solid var(--edge); border-radius: 14px; padding: .48rem .85rem; margin-top: .55rem; }
.choices button[data-style="primary"] { background: var(--ink); color: var(--accent-on); }

footer { padding-block: .5rem max(1rem, env(safe-area-inset-bottom)); }
footer .notice:not(:empty) { margin: 0 .5rem .5rem; }
#composer { display: flex; gap: .5rem; align-items: flex-end; }
#message {
  min-width: 0;
  flex: 1;
  min-height: 3.05rem;
  max-height: 8rem;
  resize: none;
  field-sizing: content;
  border-radius: 24px;
  padding: .75rem 1.1rem;
  color: var(--ink);
}
#message::placeholder { color: var(--dim); }
.send { min-height: 3.05rem; min-width: 3.9rem; border-radius: 24px; padding: .55rem 1rem; font-weight: 600; }
.send:not(:disabled) { background: var(--ink); color: var(--accent-on); }
@media (max-width: 360px), (max-height: 460px) {
  .chat-header { padding-top: .5rem; padding-bottom: .3rem; }
  .chat-avatar { width: 36px; height: 36px; }
  .status-pill { max-width: 8.5rem; }
  .quiet { padding-inline: .6rem; }
}
