/* IDYL Chat — layout, conversation list, thread, composer, model picker, Unbound dialog.
   Tokens come from idyl.css. The Standby Sun is the assistant's presence: it rests in the gap,
   breathes while a computer is answering, and is drawn hollow in Unbound. */

/* ---------- Route shell: chat owns the viewport ---------- */
html[data-route="chat"] body { overflow: hidden; overscroll-behavior: none; }
html[data-route="chat"] .shell { height: 100vh; height: var(--app-h, 100dvh); min-height: 0; }
html[data-route="chat"] .main-col { height: 100%; min-height: 0; overflow: hidden; }
html[data-route="chat"] main { padding: 0; max-width: none; flex: 1 1 auto; min-height: 0; display: flex; }
html[data-route="chat"] .app-foot { display: none; }
html[data-route="chat"] .toast, .snack { bottom: auto; top: 124px; }
.view-chat { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; animation: none; }
.view-chat[hidden] { display: none !important; }
/* Before app.js runs, the inline head script has already set data-route: show Chat at once, no flash. */
html[data-route="chat"] .view-chat[hidden] { display: flex !important; }

/* Desktop: the app sidebar folds into an icon rail so the conversation has the room. */
@media (min-width: 961px) {
  html[data-route="chat"] .shell { grid-template-columns: 64px minmax(0, 1fr); }
  html[data-route="chat"] .side { height: 100%; padding: 16px 8px 14px; align-items: center; z-index: 45; }
  html[data-route="chat"] .side .brand { padding: 4px 0 0; }
  html[data-route="chat"] .side .wordmark,
  html[data-route="chat"] .side-status,
  html[data-route="chat"] .nav-tag { display: none; }
  html[data-route="chat"] .nav { margin-top: 26px; align-items: center; }
  html[data-route="chat"] .nav a { width: 44px; height: 40px; padding: 0; justify-content: center; }
  html[data-route="chat"] .nav-sep { width: 28px; margin: 10px auto; }
  html[data-route="chat"] .nav a[aria-current="page"]::after { right: 6px; top: 8px; margin: 0; width: 5px; height: 5px; box-shadow: 0 0 0 2px rgba(242,184,91,.16); }
  html[data-route="chat"] .nav a > span:not(.nav-tag) {
    position: absolute; left: calc(100% + 10px); top: 50%; transform: translate(-4px, -50%); z-index: 2;
    padding: 6px 10px; border-radius: 7px; background: var(--ink-800); border: 1px solid var(--line-strong);
    color: var(--bone); font-size: 12.5px; white-space: nowrap; pointer-events: none; opacity: 0;
    box-shadow: var(--shadow-lift); transition: opacity .15s, transform .15s var(--ease);
  }
  html[data-route="chat"] .nav a:hover > span:not(.nav-tag),
  html[data-route="chat"] .nav a:focus-visible > span:not(.nav-tag) { opacity: 1; transform: translate(0, -50%); }
  html[data-route="chat"] .topbar { height: 52px; padding: 0 20px; }
}

/* ---------- Two panes ---------- */
.chat { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; display: grid; grid-template-columns: 268px minmax(0, 1fr); }
.chat[data-pane="closed"] { grid-template-columns: 0 minmax(0, 1fr); }
.chat[data-pane="closed"] .chat-pane { visibility: hidden; }

.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); background: var(--ink-950); }
.pane-top { display: none; }
.new-chat {
  flex: none; margin: 14px 12px 4px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 12px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--ink-900); color: var(--bone);
  font: 500 14px/1 var(--font-ui); cursor: pointer; transition: border-color .2s, background .2s;
}
.new-chat:hover { border-color: #3A4556; background: var(--ink-850); }
.new-chat svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; color: var(--gold); }
.kbd { display: inline-block; font: 500 10.5px/1 var(--font-mono); color: var(--mute); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px 2px; }
.new-chat .kbd { margin-left: auto; color: var(--faint); }

.conv-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.conv-g { font-size: 12px; color: var(--faint); padding: 16px 10px 6px; }
.conv-ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.conv { position: relative; display: flex; align-items: center; border-radius: 9px; }
.conv:hover { background: var(--ink-900); }
.conv.is-active { background: var(--ink-850); }
.conv-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--bone-2); font: 400 13.5px/1.2 var(--font-ui); text-align: left; cursor: pointer;
}
.conv.is-active .conv-btn { color: var(--bone); }
.conv-btn:focus-visible { outline-offset: -2px; }
.conv-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-ub { display: inline-grid; place-items: center; flex: none; }
.conv-ub svg { width: 11px; height: 11px; fill: none; stroke: var(--gold); stroke-width: 2.6; }
.conv-live { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: sun-breathe 1.6s var(--ease) infinite; }
.conv-tools { position: absolute; right: 4px; top: 4px; display: none; }
.conv:hover .conv-tools, .conv:focus-within .conv-tools, .conv.is-active .conv-tools { display: flex; }
.conv:hover .conv-btn, .conv:focus-within .conv-btn, .conv.is-active .conv-btn { padding-right: 64px; }
.conv-input {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--gold-deep); background: var(--ink-950);
  color: var(--bone); font: 400 13.5px/1 var(--font-ui); outline: none; box-shadow: 0 0 0 3px rgba(242,184,91,.14);
}
.conv-empty { padding: 18px 10px; font-size: 13px; color: var(--faint); }
.pane-foot { flex: none; border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.pane-note { font-size: 11.5px; color: var(--faint); line-height: 1.45; }
.pane-app { display: none; }

/* Icon buttons */
.icon-btn {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 0;
  background: transparent; color: var(--bone-2); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--ink-850); color: var(--bone); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; color: var(--mute); }
.icon-btn.sm svg { width: 15px; height: 15px; }
.icon-btn.sm:hover { background: var(--ink-800); }

/* ---------- Thread ---------- */
.thread { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread-head { position: relative; z-index: 6; flex: none; display: flex; align-items: center; gap: 6px; height: 54px; padding: 0 14px; transition: box-shadow .2s; }
.thread.is-scrolled .thread-head { box-shadow: 0 1px 0 var(--line); }
.picker:focus, .chat-pane:focus { outline: none; }
.drawer-btn { display: none; }
.thread-head-r { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.ub-badge {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 9px 0 8px; border-radius: 999px;
  border: 1px solid rgba(242,184,91,.32); color: var(--gold-2); font: 500 10.5px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase;
}
.ub-badge svg { width: 11px; height: 11px; fill: none; stroke: var(--gold); stroke-width: 2.6; }

/* Model picker button */
.picker-wrap { position: relative; min-width: 0; }
.picker-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 36px; padding: 0 9px 0 11px; border: 0; border-radius: 10px;
  background: transparent; color: var(--bone); font: 500 15px/1 var(--font-ui); cursor: pointer; white-space: nowrap; transition: background .15s;
}
.picker-btn:hover, .picker-btn[aria-expanded="true"] { background: var(--ink-850); }
.picker-btn.is-ub::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--gold); }
.picker-name { flex: none; }
.picker-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; font-weight: 400; color: var(--mute); }
.picker-sub:empty { display: none; }
.picker-chev { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--mute); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.picker-btn[aria-expanded="true"] .picker-chev { transform: rotate(180deg); }

/* Model picker panel */
.picker {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 50; width: 392px; max-height: min(600px, calc(var(--app-h, 100vh) - 150px));
  overflow-y: auto; overscroll-behavior: contain; padding: 8px; border-radius: 16px; border: 1px solid var(--line-strong);
  background: var(--ink-850); box-shadow: var(--shadow-lift), 0 24px 60px -18px rgba(0,0,0,.7); animation: pop-in .18s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.picker-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; border-radius: 11px; background: var(--ink-950); border: 1px solid var(--line); }
.picker-seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: var(--mute); font: 500 13px/1 var(--font-ui); cursor: pointer; transition: background .15s, color .15s;
}
.picker-seg button:hover { color: var(--bone-2); }
.picker-seg button[aria-selected="true"] { background: var(--ink-800); color: var(--bone); box-shadow: inset 0 0 0 1px var(--line-strong); }
.picker-seg button:focus-visible { outline-offset: -2px; }
.ring-ico { width: 12px; height: 12px; fill: none; stroke: var(--gold); stroke-width: 2.6; }
.seg-age { font: 500 9.5px/1 var(--font-mono); letter-spacing: .04em; color: var(--mute); border: 1px solid var(--line-strong); border-radius: 4px; padding: 2px 4px; }
.picker-hint { font-size: 12.5px; color: var(--mute); padding: 10px 8px 6px; }
.picker-note { display: grid; gap: 6px; padding: 0 2px 6px; }
.pk-lock {
  display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; padding: 12px; border-radius: 10px;
  border: 1px solid rgba(242,184,91,.26); background: rgba(242,184,91,.05); font-size: 13px; color: var(--bone-2); line-height: 1.5;
}
.pk-lock .ico { color: var(--gold); margin-top: 2px; }
.pk-lock p { flex: 1; min-width: 200px; }
.pk-lock .btn { margin-left: 26px; }
.pk-paused { border-color: var(--line-strong); background: var(--ink-900); }
.pk-paused .ico { color: var(--bone-2); }
.picker-list { display: grid; gap: 1px; }
.pk-row {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px 10px 11px; border: 0; border-radius: 10px;
  background: transparent; color: inherit; text-align: left; cursor: pointer; transition: background .12s;
}
.pk-row:hover { background: var(--ink-800); }
.pk-row:focus-visible { outline-offset: -2px; background: var(--ink-800); }
.pk-row.is-on { background: rgba(242,184,91,.07); }
.pk-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pk-name { font-size: 14px; font-weight: 500; color: var(--bone); }
.pk-row.is-off .pk-name { color: var(--bone-2); }
.pk-desc { font-size: 12.5px; color: var(--bone-2); line-height: 1.45; }
.pk-row.is-off .pk-desc { color: var(--mute); }
.pk-meta { font: 400 11px/1.4 var(--font-mono); color: var(--faint); margin-top: 3px; }
.pk-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-top: 1px; }
.pk-n { font: 400 11px/1 var(--font-mono); color: var(--faint); white-space: nowrap; }
.pk-n.on { color: var(--meadow); }
.pk-check { width: 16px; height: 16px; fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.picker-foot { font-size: 11.5px; color: var(--faint); line-height: 1.5; padding: 10px 8px 4px; margin-top: 6px; border-top: 1px solid var(--line); }

/* Scroll area */
.thread-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.thread-inner { width: 100%; max-width: 784px; min-height: 100%; margin: 0 auto; padding: 12px 28px 28px; display: flex; flex-direction: column; }

/* Empty state: the sun rises into the gap, once. */
.chat-empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4vh 0 6vh; }
.empty-mark { width: 46px; height: 46px; color: var(--bone-2); overflow: visible; }
.empty-mark .sun { fill: var(--gold); transform-box: fill-box; transform-origin: center; animation: sun-rise 1.1s var(--ease) .1s both; }
.empty-mark.is-ub .sun { fill: none; stroke: var(--gold); stroke-width: 3.2; }
@keyframes sun-rise { from { opacity: 0; transform: translateY(9px) scale(.6); } }
.greet { margin-top: 26px; font-family: var(--font-display); font-weight: 400; font-size: clamp(40px, 4.6vw, 58px); line-height: 1; letter-spacing: -0.02em; color: var(--bone); }
.greet-sub { margin-top: 8px; font-family: var(--font-display); font-style: italic; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.15; color: var(--bone-2); letter-spacing: -0.01em; max-width: 26ch; text-wrap: balance; }
.chips-grid { margin-top: 40px; width: 100%; max-width: 600px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sugg {
  display: grid; gap: 3px; align-content: start; text-align: left; padding: 14px 16px 15px; border-radius: 14px; border: 1px solid var(--line);
  background: transparent; color: inherit; cursor: pointer; transition: background .2s, border-color .2s;
}
.sugg:hover { background: var(--ink-900); border-color: var(--line-strong); }
.sugg-t { font-size: 14px; font-weight: 500; color: var(--bone); }
.sugg-s { font-size: 13.5px; color: var(--mute); }

@media (max-height: 820px) and (min-width: 961px) {
  .chat-empty { padding: 2vh 0 3vh; }
  .empty-mark { width: 40px; height: 40px; }
  .greet { margin-top: 18px; font-size: 46px; }
  .chips-grid { margin-top: 28px; }
}

/* Messages */
.msgs { display: flex; flex-direction: column; gap: 22px; padding-top: 8px; }
.msgs[hidden] { display: none; }
.msg { min-width: 0; }
.msg-user { align-self: flex-end; max-width: min(86%, 620px); display: flex; flex-direction: column; align-items: flex-end; }
.bubble {
  padding: 10px 16px 11px; border-radius: 20px 20px 6px 20px; background: var(--ink-850); border: 1px solid var(--line);
  color: var(--bone); font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-tools { display: flex; gap: 2px; min-height: 30px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools, .msg-ai:last-child .msg-tools { opacity: 1; }
.tool { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--mute); cursor: pointer; transition: background .15s, color .15s; }
.tool:hover { background: var(--ink-850); color: var(--bone); }
.tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tool.is-done { color: var(--meadow); }

.msg-user.is-editing { align-self: stretch; max-width: none; }
.edit-form { width: 100%; padding: 10px 12px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--ink-900); }
.edit-form:focus-within { border-color: #3A4556; }
.edit-input { display: block; width: 100%; min-height: 76px; border: 0; background: transparent; color: var(--bone); font: 400 15px/1.6 var(--font-ui); resize: vertical; outline: none; }
.edit-bar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.msg-ai { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; }
.ai-mark { padding-top: 2px; }
.sun-mark { width: 26px; height: 26px; color: var(--line-strong); overflow: visible; }
.sun-mark .sun { fill: var(--gold); transform-box: fill-box; transform-origin: center; }
.sun-mark.is-ub .sun { fill: none; stroke: var(--gold); stroke-width: 3.4; }
.msg-ai .sun-mark { color: #3A4556; }
.msg-ai.is-pending .sun-mark .sun { animation: sun-breathe 1.6s var(--ease) infinite; }
@keyframes sun-breathe { 50% { opacity: .45; transform: scale(.78); } }
.ai-main { min-width: 0; }
.ai-status { color: var(--mute); font-size: 14.5px; }
.shimmer {
  background: linear-gradient(90deg, var(--mute) 0%, var(--bone) 45%, var(--mute) 90%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2s linear infinite;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.caret { display: inline-block; width: .52em; height: .52em; margin-left: .25em; border-radius: 50%; background: var(--gold); vertical-align: .06em; animation: sun-breathe 1.1s var(--ease) infinite; }
.msg-ai.is-ub .caret { background: none; box-shadow: inset 0 0 0 2px var(--gold); }
.ai-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 30px; flex-wrap: wrap; }
.ai-foot .msg-tools { margin: 0 0 0 auto; order: 2; }
.ai-meta { font: 400 11.5px/1.4 var(--font-mono); color: var(--faint); min-width: 0; }
.ai-meta > span { white-space: nowrap; }
.ai-meta .sep { margin: 0 3px; color: var(--line-strong); }
.ai-meta .meta-stop { color: var(--gold-2); }
.ai-meta:empty { display: none; }
.ai-err { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 13.5px; color: var(--bone-2); }
.ai-err .ico { color: var(--ember); }
.link-btn { border: 0; padding: 0; background: none; color: var(--gold-2); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,216,154,.4); }

/* Reasoning */
.think { margin: 0 0 12px; }
.think summary {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px 0 12px; border-radius: 999px;
  border: 1px solid var(--line); list-style: none; cursor: pointer; font-size: 13px; color: var(--mute); user-select: none; transition: border-color .15s, color .15s;
}
.think summary::-webkit-details-marker { display: none; }
.think summary:hover { border-color: var(--line-strong); color: var(--bone-2); }
.think-l { color: var(--bone-2); font-weight: 500; }
.think-s { font: 400 11.5px/1 var(--font-mono); }
.think.is-live .think-s { background: linear-gradient(90deg, var(--mute) 0%, var(--bone) 45%, var(--mute) 90%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2s linear infinite; }
.think-chev { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.think[open] .think-chev { transform: rotate(180deg); }
.think-body { margin-top: 10px; padding: 2px 0 4px 14px; border-left: 2px solid var(--line-strong); font-size: 14px; line-height: 1.65; color: var(--mute); }
.think-body.md { color: var(--mute); font-size: 14px; }

/* Safe Markdown */
.md { font-size: 15.5px; line-height: 1.7; color: var(--bone); overflow-wrap: anywhere; }
.md > * { margin-top: 0; margin-bottom: 0; }
.md > :not(:first-child) { margin-top: .8em; }
.md h3, .md h4, .md h5, .md h6 { font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.01em; color: var(--bone); line-height: 1.35; }
.md.md > :is(h3, h4, h5, h6):not(:first-child) { margin-top: 1.45em; }
.md.md > :is(h3, h4, h5, h6) + * { margin-top: .45em; }
.md h3 { font-size: 17.5px; }
.md h4 { font-size: 15.5px; }
.md h5, .md h6 { font-size: 14px; color: var(--bone-2); }
.md ul, .md ol { margin: 0; padding-left: 1.35em; }
.md li { padding-left: .2em; }
.md li + li { margin-top: .38em; }
.md li > p { margin: 0; }
.md li > p + * , .md li > ul, .md li > ol { margin-top: .38em; }
.md ul li::marker { color: var(--mute); }
.md ol li::marker { color: var(--mute); font-family: var(--font-mono); font-size: .86em; }
.md li.task { list-style: none; margin-left: -1.2em; }
.md .tick { display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -1px; border-radius: 3px; border: 1.5px solid var(--mute); }
.md .tick.on { background: var(--gold); border-color: var(--gold); }
.md strong { font-weight: 600; color: var(--bone); }
.md em { font-style: italic; }
.md del { color: var(--mute); }
.md a { color: var(--gold-2); text-decoration: underline; text-decoration-color: rgba(255,216,154,.35); text-underline-offset: 3px; }
.md a:hover { text-decoration-color: var(--gold-2); }
.md code { font-family: var(--font-mono); font-size: .86em; padding: .12em .38em; border-radius: 5px; background: var(--ink-850); border: 1px solid var(--line); color: var(--bone); }
.md blockquote { margin-left: 0; margin-right: 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--gold-deep); color: var(--bone-2); }
.md blockquote > * + * { margin-top: .7em; }
.md hr { height: 1px; border: 0; background: var(--line); margin: 1.4em 0; }
.code { border: 1px solid var(--line); border-radius: 12px; background: var(--ink-900); overflow: hidden; }
.code-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 36px; padding: 0 6px 0 14px; border-bottom: 1px solid var(--line); }
.code-lang { font: 400 11.5px/1 var(--font-mono); color: var(--mute); }
.code-copy { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--mute); font: 500 12px/1 var(--font-ui); cursor: pointer; }
.code-copy:hover { background: var(--ink-800); color: var(--bone); }
.code-copy svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.code pre { margin: 0; padding: 14px 16px 15px; border: 0; border-radius: 0; background: transparent; color: var(--bone); font-size: 13px; line-height: 1.65; white-space: pre; overflow-x: auto; tab-size: 4; }
.code pre:focus-visible { outline-offset: -3px; }
.code pre code { padding: 0; border: 0; background: none; font-size: inherit; color: inherit; }
.md-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.md table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.md th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--mute); background: var(--ink-900); }
.md th, .md td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.md tbody tr:last-child td { border-bottom: 0; }
.md .al-r { text-align: right; font-variant-numeric: tabular-nums; }
.md .al-c { text-align: center; }

/* In-thread notices: calm, never alarming */
.msg-note { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; padding: 14px 16px 15px; border-radius: 14px; border: 1px solid var(--line); background: var(--ink-900); }
.note-ico { width: 18px; height: 18px; margin: 2px 0 0 4px; fill: none; stroke: var(--bone-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.note-c { min-width: 0; display: grid; gap: 4px; }
.note-t { font-size: 14px; font-weight: 600; color: var(--bone); }
.note-c p { font-size: 14px; color: var(--bone-2); line-height: 1.55; }
.note-c .note-d { font-size: 13px; color: var(--mute); }
.note-a { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.note-a:empty { display: none; }
.note-error .note-ico { stroke: var(--ember); }
.note-paused { border-color: rgba(242,184,91,.22); }
.note-paused .note-ico { stroke: var(--gold); }

/* The Floor's care reply */
.care { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; padding: 18px 20px; border-radius: 16px; border: 1px solid rgba(142,156,255,.24); background: rgba(142,156,255,.055); }
.care .sun-mark { color: rgba(142,156,255,.5); }
.care-c { min-width: 0; }
.care-body { font-size: 15.5px; }
.care-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.care-foot { font-size: 13px; color: var(--bone-2); }
.care-note { margin-top: 12px; font-size: 12px; color: var(--mute); }

/* ---------- Composer ---------- */
.composer-wrap { position: relative; flex: none; width: 100%; max-width: 784px; margin: 0 auto; padding: 0 28px 12px; }
.jump {
  position: absolute; left: 50%; top: -46px; z-index: 4; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--ink-850);
  color: var(--bone-2); font: 500 12.5px/1 var(--font-ui); cursor: pointer; box-shadow: var(--shadow-lift);
}
.jump svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jump:hover { color: var(--bone); border-color: var(--bone-2); }
.composer {
  display: flex; flex-direction: column; padding: 12px 10px 10px 18px; border-radius: 22px; border: 1px solid var(--line-strong);
  background: var(--ink-900); transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: #3A4556; box-shadow: 0 0 0 4px rgba(242,184,91,.06); }
.thread.is-ub .composer { border-color: rgba(242,184,91,.24); }
.composer-input {
  display: block; width: 100%; min-height: 26px; max-height: 260px; padding: 3px 8px 3px 0; margin: 0; border: 0; outline: none; resize: none;
  background: transparent; color: var(--bone); font: 400 15.5px/1.55 var(--font-ui); overflow-y: hidden;
}
.composer-input::placeholder { color: var(--faint); }
.composer-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.composer-tip { margin-right: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; }
.composer-tip .kbd { font-size: 10px; padding: 2px 4px 1px; }
.tip-sep { width: 3px; height: 3px; margin: 0 4px; border-radius: 50%; background: var(--line-strong); }
.send-btn {
  flex: none; margin-left: auto; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--gold); color: var(--ink-950); cursor: pointer; transition: background .2s, color .2s, transform .15s var(--ease);
}
.send-btn:hover { background: var(--gold-2); }
.send-btn:active { transform: scale(.94); }
.send-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.composer-input:placeholder-shown ~ .composer-bar .send-btn:not(.stop-btn) { background: var(--ink-800); color: var(--mute); }
.send-btn:disabled { background: var(--ink-800) !important; color: var(--faint) !important; cursor: default; }
.stop-btn { background: var(--bone); }
.stop-btn:hover { background: #fff; }
.stop-btn svg { fill: currentColor; stroke: none; width: 15px; height: 15px; }
.composer-note { margin-top: 9px; text-align: center; font-size: 11.5px; line-height: 1.45; color: var(--faint); text-wrap: balance; }
.composer-note.is-demo { color: var(--gold-2); }

/* Wallet access, inline */
.access { margin-bottom: 10px; }
.access-in {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px;
  border-radius: 16px; border: 1px solid rgba(242,184,91,.3); background: rgba(242,184,91,.05);
}
.access-mark .sun-mark { width: 28px; height: 28px; color: var(--bone-2); }
.access-t { font-size: 14.5px; font-weight: 600; color: var(--bone); }
.access-d { margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--bone-2); }
.access-err { display: flex; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--bone-2); }
.access-err .ico { color: var(--ember); margin-top: 2px; }
.access-err strong { color: var(--bone); font-weight: 600; }
.access-a { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.access-alt { font-size: 12px; color: var(--mute); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.access-alt:hover { color: var(--bone-2); }
.nudge { animation: nudge .45s var(--ease); }
@keyframes nudge { 30% { transform: translateY(-3px); box-shadow: 0 0 0 6px rgba(242,184,91,.18); } }

/* Undo snack */
.snack {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translateX(-50%); display: flex; align-items: center; gap: 14px;
  padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--bone); color: var(--ink-950); font-size: 13.5px; font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.6);
}
.snack.in { animation: toast-in .25s var(--ease); }
.snack button { height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--ink-950); color: var(--bone); font: 500 13px/1 var(--font-ui); cursor: pointer; }

/* ---------- Unbound dialog ---------- */
.dialog-ub { width: min(540px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.ub-in { gap: 16px; padding: 28px 28px 24px; }
.ub-mark { display: flex; align-items: center; gap: 12px; }
.ub-mark svg { width: 40px; height: 40px; color: var(--bone); }
.ub-label { font-size: 11px; letter-spacing: .18em; color: var(--gold-2); }
.dialog-ub .dialog-t { font-size: 36px; }
.ub-lede { font-size: 15px; line-height: 1.6; color: var(--bone); }
.ub-floor { display: grid; gap: 8px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--ink-950); font-size: 13.5px; line-height: 1.55; color: var(--bone-2); }
.ub-floor-t { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--bone); }
.ub-floor-t .ico { color: var(--gold); }
.ub-floor ul { margin: 0; padding-left: 1.25em; display: grid; gap: 2px; }
.ub-floor li::marker { color: var(--mute); }
.ub-limit { font-size: 12.5px; color: var(--mute); }
.ub-age { font-size: 13.5px; line-height: 1.55; color: var(--bone-2); }
.ub-age strong { color: var(--gold-2); font-weight: 600; }
.ub-msg summary { cursor: pointer; font-size: 12.5px; color: var(--mute); width: max-content; }
.ub-msg summary:hover { color: var(--bone-2); }
.ub-msg pre { margin: 8px 0 0; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.dialog-ub .pg-error { margin: 0; }

/* ---------- Phone ---------- */
@media (max-width: 960px) {
  html[data-route="chat"] .topbar, html[data-route="chat"] .tabs-m { display: none; }
  html[data-route="chat"] .demo-banner { padding: 7px 14px; font-size: 12.5px; }
  html[data-route="chat"] .demo-banner-link { display: none; }
  .chat, .chat[data-pane="closed"] { grid-template-columns: minmax(0, 1fr); }
  .chat[data-pane="closed"] .chat-pane { visibility: visible; }
  .chat-pane {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(320px, 86vw); border-right: 1px solid var(--line-strong);
    background: var(--ink-900); transform: translateX(-102%); visibility: hidden; box-shadow: 30px 0 60px -30px rgba(0,0,0,.8);
    transition: transform .3s var(--ease), visibility 0s linear .3s; padding-top: env(safe-area-inset-top);
  }
  .chat[data-drawer="open"] .chat-pane { transform: none; visibility: visible; transition: transform .3s var(--ease), visibility 0s; }
  .chat-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(4,5,8,.62); animation: fade-in .25s var(--ease); }
  @keyframes fade-in { from { opacity: 0; } }
  .pane-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 4px 16px; }
  .pane-brand .mark { width: 24px; height: 24px; }
  .pane-brand .wordmark { font-size: 24px; margin-top: -3px; }
  .new-chat { margin-top: 10px; }
  .new-chat .kbd { display: none; }
  .conv-btn { height: 42px; font-size: 14.5px; }
  .conv-tools { top: 7px; }
  .conv-list { padding-bottom: 8px; }
  .pane-foot { padding: 0 0 calc(10px + env(safe-area-inset-bottom)); }
  .pane-app { display: block; }
  .pane-wallet { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .pane-wallet .btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; min-width: 0; }
  .pane-wallet .btn-sm span { overflow: hidden; text-overflow: ellipsis; }
  .pane-links { list-style: none; margin: 0; padding: 8px 8px 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 4px; }
  .pane-links a { display: block; padding: 9px 8px; border-radius: 8px; font-size: 13.5px; color: var(--bone-2); }
  .pane-links a:hover { background: var(--ink-850); color: var(--bone); }
  .pane-note { padding: 6px 16px 0; }

  .thread-head { height: 52px; padding: 0 6px; padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); gap: 2px; }
  .pane-toggle { display: none; }
  .drawer-btn { display: grid; }
  .picker-wrap { flex: 1; display: flex; justify-content: center; position: static; }
  .picker-btn { font-size: 15px; padding: 0 8px 0 10px; }
  .picker-sub { max-width: 34vw; }
  .thread-head .ub-badge { display: none; }
  .thread-head-r { margin-left: 0; }
  .picker {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 84vh; z-index: 70;
    padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; border-bottom: 0;
    box-shadow: 0 0 0 100vmax rgba(4,5,8,.62), 0 -20px 60px -20px rgba(0,0,0,.8); animation: sheet-in .3s var(--ease);
  }
  .picker::before { content: ""; display: block; width: 38px; height: 4px; margin: 0 auto 10px; border-radius: 4px; background: var(--line-strong); }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
  .pk-row { padding: 12px 10px; }

  .thread-inner { padding: 10px 16px 22px; }
  .chat-empty { padding: 2vh 0 3vh; }
  .empty-mark { width: 40px; height: 40px; }
  .greet { margin-top: 20px; font-size: 42px; }
  .greet-sub { font-size: 24px; }
  .chips-grid { margin-top: 28px; gap: 8px; }
  .sugg { padding: 12px 13px 13px; border-radius: 13px; }
  .sugg-t { font-size: 13.5px; }
  .sugg-s { font-size: 13px; line-height: 1.4; }
  .msgs { gap: 22px; }
  .msg-user { max-width: 88%; }
  .bubble { font-size: 16px; }
  .msg-ai { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .ai-mark { padding: 0; }
  .ai-mark .sun-mark { width: 22px; height: 22px; }
  .msg-tools { opacity: 1; }
  .md { font-size: 16px; }
  .code pre { font-size: 12.5px; }
  .composer-wrap { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer { flex-direction: row; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 24px; }
  .composer-input { font-size: 16px; padding: 7px 0; }
  .composer-bar { margin: 0; flex: none; }
  .composer-tip { display: none; }
  .composer-note { font-size: 11px; margin-top: 7px; }
  .access-in { grid-template-columns: 26px minmax(0, 1fr); gap: 12px; padding: 12px 14px; }
  .access-mark .sun-mark { width: 24px; height: 24px; }
  .access-a { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .access-a .btn { flex: 1; max-width: 240px; }
  .msg-note, .care { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px; }
  .note-ico { margin: 0; }
  .care .care-mark { display: none; }
  .ub-in { padding: 24px 20px 20px; }
  .dialog-ub .dialog-t { font-size: 30px; }
  html[data-route="chat"] .toast, .snack { top: calc(64px + env(safe-area-inset-top)); }
}
@media (hover: none) {
  .msg-tools { opacity: 1; }
  .conv.is-active .conv-tools { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .empty-mark .sun, .msg-ai.is-pending .sun-mark .sun, .caret, .conv-live, .shimmer, .think.is-live .think-s { animation: none; }
  .shimmer, .think.is-live .think-s { color: var(--bone-2); background: none; }
  .picker, .chat-scrim, .snack.in { animation: none; }
}
@media (forced-colors: active) {
  .send-btn, .caret, .sun-mark .sun { forced-color-adjust: none; }
}

/* =====================================================================
   v3: guest passes, the Community / Sealed switch, privacy grades on replies, encrypted history
   ===================================================================== */

/* ---------- Composer: privacy pill ---------- */
.priv-wrap { position: relative; flex: none; }
.priv-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 8px 0 9px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--bone-2); font: 500 13px/1 var(--font-ui); cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.priv-btn:hover, .priv-btn[aria-expanded="true"] { border-color: #3A4556; color: var(--bone); background: var(--ink-850); }
.priv-btn:disabled { opacity: .45; cursor: default; }
.priv-ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.priv-chev { width: 12px; height: 12px; fill: none; stroke: var(--mute); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.priv-btn[aria-expanded="true"] .priv-chev { transform: rotate(180deg); }
.priv-btn.is-sealed { border-color: rgba(142,156,255,.42); background: rgba(142,156,255,.08); color: #D5DAFF; }
.priv-btn.is-sealed:hover, .priv-btn.is-sealed[aria-expanded="true"] { border-color: var(--dusk); background: rgba(142,156,255,.13); }
.thread.is-sealed .composer { border-color: rgba(142,156,255,.34); }
.thread.is-sealed .composer:focus-within { border-color: rgba(142,156,255,.55); box-shadow: 0 0 0 4px rgba(142,156,255,.07); }

/* The explainer: two choices, each with the exact wording of its grade. */
.priv-pop {
  position: absolute; left: -9px; bottom: calc(100% + 12px); z-index: 50; width: 432px; max-height: min(620px, calc(var(--app-h, 100vh) - 150px));
  overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px 12px; border-radius: 16px; border: 1px solid var(--line-strong);
  background: var(--ink-850); box-shadow: var(--shadow-lift), 0 24px 60px -18px rgba(0,0,0,.7); animation: pop-up .18s var(--ease);
}
@keyframes pop-up { from { opacity: 0; transform: translateY(4px); } }
.priv-pop:focus { outline: none; }
.pp-t { padding: 0 6px 10px; font-size: 13px; font-weight: 600; color: var(--bone); }
.pp-opts { display: grid; gap: 6px; }
.pp-opt {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) 16px; gap: 12px; align-items: start; width: 100%; padding: 12px 12px 13px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--ink-900); color: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s;
}
.pp-opt:hover { border-color: var(--line-strong); }
.pp-opt:focus-visible { outline-offset: -2px; }
.pp-opt.is-on { border-color: rgba(242,184,91,.5); background: rgba(242,184,91,.05); }
.pp-opt[data-priv="sealed"].is-on { border-color: rgba(142,156,255,.55); background: rgba(142,156,255,.07); }
.pp-ico { width: 22px; height: 22px; margin-top: 1px; fill: none; stroke: var(--bone-2); stroke-width: 1.5; stroke-linecap: round; }
.pp-main { min-width: 0; display: grid; gap: 6px; }
.pp-name { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 14.5px; font-weight: 600; color: var(--bone); }
.pp-price { font: 400 11px/1.3 var(--font-mono); color: var(--mute); white-space: nowrap; }
.pp-text { font-size: 12.5px; line-height: 1.5; color: var(--bone-2); }
.pp-text b { display: block; font-weight: 600; font-size: 11.5px; color: var(--bone); margin-bottom: 1px; }
.pp-check { width: 16px; height: 16px; margin-top: 3px; fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pp-opt[data-priv="sealed"] .pp-check { stroke: var(--dusk); }
.pp-foot { padding: 10px 6px 0; font-size: 12.5px; line-height: 1.5; color: var(--mute); }
.pp-warn { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 9px 10px; border-radius: 9px; border: 1px solid rgba(242,184,91,.26); background: rgba(242,184,91,.05); font-size: 12px; line-height: 1.45; color: var(--bone-2); }
.pp-warn .ico { width: 14px; height: 14px; margin-top: 1px; color: var(--gold); }

/* Note under the composer: the grade in one sentence, then the guest pass or the credit balance. */
.composer-note { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; min-height: 17px; }
.cn-guest { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 0 6px; color: var(--mute); }
.cn-guest .mono { color: var(--bone-2); font-size: 11.5px; }
.cn-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.composer-note .link-btn { font-size: inherit; color: var(--bone-2); text-decoration-color: var(--line-strong); }
.composer-note .link-btn:hover { color: var(--bone); }

/* ---------- Access: guest pass, wallet, upgrade moments ---------- */
.access-a { align-items: stretch; min-width: 196px; }
.access-a .btn, .access-a .btn-gold, .access-a .btn-ghost { width: 100%; }
.access-alt { align-self: center; }
.access-in.is-upgrade { border-color: var(--line-strong); background: var(--ink-900); }
.access-in.is-busy { border-color: var(--line-strong); background: var(--ink-900); outline: none; }
.access-mark.is-live .sun-mark .sun { animation: sun-breathe 1.6s var(--ease) infinite; }
.gp { height: 4px; margin-top: 12px; border-radius: 4px; background: var(--ink-800); overflow: hidden; }
.gp span { display: block; width: 4%; height: 100%; border-radius: 4px; background: var(--gold); transition: width .25s linear; }

/* ---------- Model picker for guests ---------- */
.pk-guest { border-color: var(--line-strong); background: var(--ink-900); }
.pk-guest .ico { color: var(--bone-2); }
.pk-row.is-locked .pk-name { color: var(--bone-2); }
.pk-wallet { display: inline-flex; align-items: center; gap: 5px; color: var(--mute); }
.pk-paid { color: var(--gold-2); }
.pk-wallet svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Privacy grade on a reply ---------- */
.grade {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 6px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--mute); font: 500 11.5px/1 var(--font-ui); cursor: pointer; vertical-align: middle; white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.grade:hover { border-color: var(--line-strong); color: var(--bone-2); }
.grade-ico { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.grade.g-sealed-relay, .grade.g-sealed-e2e { color: #B8C1FF; border-color: rgba(142,156,255,.32); }
.grade.g-sealed-relay:hover, .grade.g-sealed-e2e:hover { border-color: var(--dusk); color: #D5DAFF; }
.grade.is-sim { border-style: dashed; }
.grade.is-sim .grade-ico { stroke-dasharray: 2.4 2.6; }
.grade-sim { font: 500 9.5px/1 var(--font-mono); letter-spacing: .12em; color: var(--gold-2); }
.ai-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0; }

/* In-thread notices that offer a next step (guest limit, credits, no Sealed capacity) */
.note-info .note-ico { stroke: var(--gold); }

/* ---------- Chat list: lock and delete ---------- */
.pane-vault { display: grid; gap: 1px; margin: 0 -6px 8px; }
.pv-btn {
  min-width: 0; display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--mute); font: 400 12.5px/1 var(--font-ui); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s;
}
.pv-btn:hover { background: var(--ink-850); color: var(--bone); }
.pv-btn .ico { width: 14px; height: 14px; }
.pv-btn span { overflow: hidden; text-overflow: ellipsis; }
.pv-danger:hover { color: #FFB3A1; }
.conv-locked { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; }
.conv-locked svg { flex: none; width: 15px; height: 15px; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* ---------- Unlock screen ---------- */
.chat-locked { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4vh 0 6vh; }
.chat-locked[hidden] { display: none; }
.lock-mark { width: 46px; height: 46px; color: var(--bone-2); }
.chat-locked .greet-sub { max-width: 30ch; }
.unlock { margin-top: 32px; width: 100%; max-width: 420px; display: flex; gap: 10px; }
.unlock .input { flex: 1; height: 44px; font-size: 15px; border-radius: 999px; padding: 0 18px; }
.unlock-err { margin-top: 12px; min-height: 20px; font-size: 13.5px; line-height: 20px; color: #FFB3A1; }
.unlock-err[hidden] { display: block; visibility: hidden; }
.locked-foot { margin-top: 22px; max-width: 44ch; font-size: 13px; line-height: 1.55; color: var(--mute); }

/* ---------- Sealed relay question ---------- */
.dialog-relay .dialog-in { gap: 14px; }
.relay-ico { width: 40px; height: 40px; fill: none; stroke: #B8C1FF; stroke-width: 1.3; }
.dialog-relay .dialog-t { font-size: 30px; }
.relay-q { font-size: 15.5px; line-height: 1.55; color: var(--bone); }
.relay-facts div { align-items: flex-start; }
.relay-facts dd { text-align: left; font-size: 12.5px; line-height: 1.5; color: var(--bone-2); max-width: 34ch; }
.dialog .relay-facts dd { justify-content: flex-start; }
.relay-cancel { margin-left: auto; min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--bone-2); font: inherit; font-size: 14px; cursor: pointer; border-radius: 8px; }
.relay-cancel:hover { color: var(--bone); }
.check { position: relative; display: flex; align-items: flex-start; gap: 11px; cursor: pointer; font-size: 13.5px; color: var(--bone); line-height: 20px; }
.check input { position: absolute; left: 0; top: 1px; width: 18px; height: 18px; margin: 0; opacity: 0; cursor: pointer; }
.check-box { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.check input:checked + .check-box { background: var(--gold); border-color: var(--gold); }
.check input:checked + .check-box::after { content: ""; width: 9px; height: 5px; margin-top: -2px; border-left: 2px solid var(--ink-950); border-bottom: 2px solid var(--ink-950); transform: rotate(-45deg); }
.check input:focus-visible + .check-box { outline: 2px solid var(--gold); outline-offset: 3px; }
.check-d { display: block; font-size: 12.5px; line-height: 1.45; color: var(--mute); }

/* ---------- Encrypt saved chats ---------- */
.vault-lede { font-size: 14.5px; line-height: 1.6; color: var(--bone-2); }
.vault-warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid rgba(242,184,91,.3); background: rgba(242,184,91,.05); font-size: 13.5px; line-height: 1.5; color: var(--bone-2); }
.vault-warn .ico { color: var(--gold); margin-top: 2px; }
.vault-warn strong { color: var(--bone); font-weight: 600; }
.vault-form { display: grid; gap: 14px; }
.vault-form .input { height: 44px; font-size: 15px; }
.vault-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.vault-how summary { cursor: pointer; font-size: 12.5px; color: var(--mute); width: max-content; }
.vault-how summary:hover { color: var(--bone-2); }
.vault-how p { margin-top: 8px; font-size: 12.5px; line-height: 1.55; color: var(--mute); }

/* ---------- Phone ---------- */
@media (max-width: 960px) {
  /* Two rows: the message, then privacy on the left and send on the right. */
  .composer { flex-direction: column; align-items: stretch; gap: 0; padding: 8px 8px 8px 14px; border-radius: 22px; }
  .composer-input { padding: 5px 6px 3px 0; }
  .composer-bar { margin: 4px 0 0; flex: none; }
  .priv-wrap { position: static; margin-left: -6px; }
  .priv-btn { height: 34px; font-size: 13.5px; }
  .priv-pop {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 86vh; z-index: 70;
    padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; border-bottom: 0;
    box-shadow: 0 0 0 100vmax rgba(4,5,8,.62), 0 -20px 60px -20px rgba(0,0,0,.8); animation: sheet-in .3s var(--ease);
  }
  .priv-pop::before { content: ""; display: block; width: 38px; height: 4px; margin: 0 auto 12px; border-radius: 4px; background: var(--line-strong); }
  .composer-note { gap: 2px 10px; }
  .access-a { min-width: 0; flex-wrap: wrap; }
  .access-a .btn, .access-a .btn-gold, .access-a .btn-ghost { flex: 1 1 140px; max-width: none; width: auto; }
  .access-alt { flex-basis: 100%; text-align: center; padding-top: 2px; }
  .pane-vault { margin: 0; padding: 6px 8px 0; grid-template-columns: 1fr 1fr; gap: 0 4px; }
  .pv-btn { height: 38px; font-size: 13.5px; color: var(--bone-2); }
  .chat-locked { padding: 2vh 0 3vh; }
  .lock-mark { width: 40px; height: 40px; }
  .unlock { flex-direction: column; margin-top: 26px; }
  .unlock .input { flex: none; font-size: 16px; }
  .dialog-relay .dialog-t { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .priv-pop, .access-mark.is-live .sun-mark .sun { animation: none; }
  .gp span { transition: none; }
}
@media (forced-colors: active) {
  .gp span, .check-box { forced-color-adjust: none; }
}
