/* Riley Desktop - account pages and the BUILD0101 home. Tokens first; dark mode follows the system. */
:root {
  --bg: #f6f2ee; --surface: #fffdfb; --ink: #2a2522; --muted: #7a6f68; --line: #e6ddd5;
  --accent: #b5654a; --accent-ink: #fff; --error: #a8322b; --notice: #2f6b4f; --halo: #e9b9a2;
  --radius: 14px; --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16131a; --surface: #211d25; --ink: #f1ebe6; --muted: #a79d96; --line: #342e38;
          --accent: #e08a6c; --accent-ink: #1a1512; --error: #ff8a80; --notice: #7fd1a8; --halo: #8a4d3a; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
a { color: var(--accent); }
.bar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; color: var(--ink);
         text-decoration: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: breathe 5s ease-in-out infinite; }
nav { display: flex; gap: 16px; align-items: center; }
nav a { color: var(--ink); text-decoration: none; }
main.card { max-width: 440px; margin: 6vh auto 48px; padding: 32px; background: var(--surface);
            border: 1px solid var(--line); border-radius: var(--radius); }
main.card.wide { max-width: 620px; }
@media (max-width: 520px) { main.card { margin: 16px; padding: 24px 20px; } }
h1 { margin: 0 0 8px; font-size: 26px; font-weight: 600; }
h2 { margin: 28px 0 4px; font-size: 18px; }
.lede, .aside, .opt { color: var(--muted); }
.opt { font-size: 13px; font-weight: 400; }
.aside { font-size: 14px; margin-top: 20px; }
form { display: grid; gap: 14px; margin-top: 16px; }
form.inline { display: inline; margin: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input:not([type=checkbox]), select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
         background: var(--bg); color: var(--ink); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button { font: inherit; font-weight: 600; padding: 11px 16px; border: 0; border-radius: 10px; cursor: pointer;
         background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-block; text-align: center; }
button.link { background: none; color: var(--muted); padding: 0; font-weight: 400; text-decoration: underline; }
.error { color: var(--error); margin: 12px 0 0; }
.notice { color: var(--notice); margin: 12px 0 0; }
.sessions { list-style: none; padding: 0; margin: 8px 0 0; }
.sessions li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
               font-size: 14px; }
main.stage { display: grid; place-items: center; text-align: center; min-height: 70vh; padding: 16px; }
.presence { width: 180px; height: 180px; display: grid; place-items: center; }
.halo { width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, var(--halo), transparent 70%);
        animation: breathe 5s ease-in-out infinite; }
.greeting { font-size: 34px; margin-top: 12px; }
@keyframes breathe { 0%, 100% { transform: scale(0.94); opacity: 0.8; } 50% { transform: scale(1.06); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dot, .halo { animation: none; } }

/* Riley present (BUILD0102). The stage fills the space between the bar and the greeting; the presence light breathes
   until her first frame, then she fades in over it. */
main.riley-stage { display: flex; flex-direction: column; align-items: center; height: calc(100vh - 64px);
                   padding: 0 16px 24px; }
.riley { position: relative; flex: 1; width: min(100%, 900px); min-height: 240px; }
.riley canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 900ms ease; }
.riley.present canvas { opacity: 1; }
/* The model ends at the neck: fade the last of it into the page instead of showing a cut edge. */
.riley canvas { -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 94%);
               mask-image: linear-gradient(to bottom, #000 72%, transparent 94%); }
.presence-light { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity 900ms ease; }
.riley.present .presence-light { opacity: 0; }
.presence-light .halo { width: 180px; height: 180px; }
.riley.unavailable .presence-light .halo { animation-duration: 8s; opacity: 0.5; }
main.riley-stage .greeting { font-size: 24px; font-weight: 500; margin: 4px 0 0; text-align: center; }
.perf { position: fixed; left: 12px; bottom: 12px; margin: 0; padding: 6px 10px; border-radius: 8px;
        background: rgba(0, 0, 0, 0.6); color: #cfe; font: 12px/1.4 ui-monospace, Menlo, monospace; }
.dev { position: fixed; right: 12px; bottom: 12px; display: grid; gap: 6px; padding: 10px; border-radius: 10px;
       background: var(--surface); border: 1px solid var(--line); font-size: 13px; max-width: 360px; }
.dev div { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.dev span { color: var(--muted); width: 60px; }
.dev button { padding: 4px 8px; font-size: 12px; font-weight: 500; }
.dev .state { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* Conversation (BUILD0103): beneath Riley, secondary to her. */
.chat { width: min(100%, 720px); display: grid; gap: 8px; margin-top: 8px; }
.chat .messages { list-style: none; margin: 0; padding: 0; max-height: 26vh; overflow-y: auto; display: flex;
                  flex-direction: column; gap: 6px; }
.chat .messages li { padding: 8px 12px; border-radius: 12px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat .messages li.msg-person { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.chat .messages li.msg-riley { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.chat .messages li.msg-system { align-self: center; color: var(--muted); font-size: 13px; }
.chat .note { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
.chat form { display: flex; gap: 8px; margin: 0; }
.chat textarea { flex: 1; resize: none; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
                 background: var(--surface); color: var(--ink); }
.chat textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat button[disabled] { opacity: 0.5; cursor: default; }

/* Voice (BUILD0105) */
.chat button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.chat button.voice-toggle[aria-pressed="false"] { color: var(--muted); }
.chat button.mic.recording { background: var(--error); color: #fff; border-color: transparent; }
@media (max-width: 520px) { .chat form { flex-wrap: wrap; } .chat textarea { flex-basis: 100%; } }
/* The microphone's live level while listening (--level 0..1, set from the recorder). */
.chat button.mic.recording { box-shadow: 0 0 0 calc(var(--level, 0) * 10px) rgba(224, 138, 108, 0.45); transition: box-shadow 60ms linear; }
.chat button.mic.recording.hearing { background: var(--notice); }
.invite-link { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.invite-ready { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; margin-top: 12px; }
.invite-link { width: 100%; }
.invite-actions { display: flex; gap: 8px; flex-wrap: wrap; }
button.secondary, .button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
