:root {
  color-scheme: light dark; --page:#fff; --surface:#fafafa; --soft:#f1f2f3; --ink:#242528;
  --muted:#60646b; --line:#dddfe2; --link:#265d91; --focus:#2869aa; --danger:#973744;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; color:var(--ink); background:var(--page);
}
@media(prefers-color-scheme:dark) {
  :root { --page:#1e1f21; --surface:#232426; --soft:#2d2e31; --ink:#ededee; --muted:#b0b2b7;
    --line:#424449; --link:#9fc3ed; --focus:#8bbcf1; --danger:#f6a5a9; }
  body.chat-surface { --page:#171717; --ink:#fff; --muted:#999; --line:#3b3b3b; --link:#298fff; }
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; min-height:100vh; }
button,input,textarea { font:inherit; }
button { cursor:pointer; }
button:disabled { cursor:wait; opacity:.62; }
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible { outline:3px solid var(--focus); outline-offset:3px; }
.top { height:70px; background:var(--surface); padding:0 clamp(18px,3vw,48px); display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--line); }
.brand { display:flex; align-items:center; gap:14px; font-size:23px; font-weight:720; letter-spacing:-.8px; }
.mark { position:relative; width:29px; height:25px; display:inline-block; }
.mark::before,.mark::after { content:""; position:absolute; width:16px; height:12px; border:2.5px solid var(--ink); border-radius:3px; }
.mark::before { left:0; top:1px; } .mark::after { right:0; bottom:1px; }
.connection { font-size:14px; display:flex; align-items:center; gap:9px; }
.connection i { width:10px; height:10px; border-radius:50%; background:#92909d; }
.connection.good i { background:var(--chat-online,#179e58); } .connection.warn i { background:#c18237; }
main { width:min(840px,calc(100% - 48px)); margin:44px auto 80px; }
h1 { margin:14px 0 8px; font-size:clamp(34px,3.45vw,54px); letter-spacing:-.045em; line-height:1.08; overflow-wrap:anywhere; }
h2 { font-size:21px; letter-spacing:-.025em; margin:0 0 14px; }
h3 { margin:0; font-size:16px; }
p { margin:0; line-height:1.5; }
.muted,.crumb,.sub,.hint { color:var(--muted); }
.crumb { font-size:16px; } .sub { font-size:17px; }
.section { border-top:1px solid var(--line); padding:23px 0; }
.intro { margin-bottom:23px; }
.invite-choice { margin:0 0 22px; padding:0; border:0; }
.invite-choice legend { font-weight:650; margin-bottom:8px; }
.invite-choice label { display:inline-flex; align-items:center; gap:5px; margin-right:18px; min-height:30px; cursor:pointer; }
.invite-choice input { margin:0; accent-color:var(--focus); }
.link,.quiet { background:transparent; border:0; color:var(--link); padding:5px 0; font-weight:600; text-align:left; }
.link:hover,.quiet:hover { text-decoration:underline; } .back { margin-bottom:13px; }
.primary,.secondary,.danger { border-radius:8px; border:1px solid transparent; padding:10px 17px; font-weight:650; }
.primary { background:var(--ink); color:var(--page); } .primary:hover { opacity:.85; }
.secondary,.danger { background:var(--page); border-color:var(--line); color:var(--ink); }
.secondary:hover,.danger:hover { border-color:var(--muted); } .danger { color:var(--danger); }
.formrow,.actions { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; }
@media (max-width:480px) {
  #app-choices > button { width:100%; }
}
.field { display:flex; flex-direction:column; gap:7px; color:var(--muted); font-size:14px; font-weight:600; }
.field input,.search,.inviteurl { min-width:0; width:100%; border:1px solid var(--line); border-radius:8px; background:var(--page); padding:11px 13px; color:var(--ink); }
.field { flex:1 1 160px; } .search { margin-bottom:12px; }
.join-name { max-width:25rem; }
.name-dialog { color:var(--ink); background:var(--page); border:1px solid var(--line); border-radius:12px; padding:22px; width:min(26rem,calc(100% - 32px)); }
.name-dialog::backdrop { background:rgb(0 0 0 / .45); }
.name-dialog h2 { font-size:1.2rem; margin:0 0 16px; }
.name-dialog .actions { justify-content:flex-end; margin-top:16px; }
.name-error { color:var(--danger); font-size:.9rem; }
.name-error:empty { display:none; }
button.name-trigger { border:0; background:transparent; color:var(--chat-muted); padding:4px 0; text-align:left; }
button.name-trigger:hover,button.name-trigger:focus-visible { color:var(--chat-ink,var(--ink)); text-decoration:underline; }
.rows { list-style:none; padding:0; margin:0; }
.row { width:100%; display:flex; align-items:center; gap:15px; justify-content:space-between; border:0; border-bottom:1px solid var(--line); background:transparent; padding:15px 3px; color:var(--ink); text-align:left; }
.row:hover { color:var(--ink); background:var(--soft); }
.row strong { font-size:16px; overflow-wrap:anywhere; }
.row small { flex-shrink:0; color:var(--muted); font-size:13px; }
.hint { font-size:14px; margin:8px 0 13px; }
.panel { padding:20px; border:1px solid var(--line); border-radius:12px; background:var(--surface); margin:12px 0; }
.panel .actions { margin-top:14px; }
.inviteurl { margin:0 0 9px; font-family:ui-monospace,monospace; font-size:13px; }
.paircode { font:600 27px ui-monospace,monospace; letter-spacing:.12em; margin:12px 0; }
#notice { position:fixed; z-index:2; bottom:20px; left:50%; transform:translateX(-50%); max-width:min(90vw,620px); color:var(--page); background:var(--ink); padding:10px 15px; border-radius:8px; font-size:14px; }
#notice:empty { display:none; }
.chat-surface { min-height:0; }
.chat-surface .top { height:auto; justify-content:flex-start; padding:9px var(--chat-gutter); }
.chat-surface .top .brand { display:none; }
.chat-surface .connection { gap:6px; font-size:.84em; }
.chat-surface .connection i { width:6px; height:6px; }
.chat-surface #main { flex:1 1 0; display:flex; flex-direction:column; min-height:0; width:100%; margin:0; }
.chat-surface #notice { position:static; transform:none; margin:0 auto; max-width:72ch; color:var(--muted); background:var(--page); font-size:.86em; }
@media(min-width:1100px){
  .top{height:78px}.brand{font-size:27px}.connection{font-size:17px}
  main{width:min(952px,calc(100% - 100px));margin-top:50px}
}
@media(max-width:600px){.top{height:56px}.brand{font-size:19px;gap:9px}.connection{font-size:12px}.mark{transform:scale(.85)}main{width:calc(100% - 36px);margin-top:29px}.sub,.crumb{font-size:15px}.row small{max-width:95px;text-align:right}.panel{padding:15px}.actions{gap:9px}}

/* Browser-only additions to the shared conversation composer. */
.chat-controls .chat-composer-meta { flex:1; }
.add-wrap { position:relative; flex:none; }
.add-toggle {
  display:grid; place-items:center; width:34px; height:34px; padding:0; border:0; border-radius:9px;
  background:transparent; color:var(--ink); font-size:25px; font-weight:400; line-height:1;
}
.add-toggle:hover,.add-toggle[aria-expanded="true"] { background:var(--soft); }
.add-menu {
  position:absolute; z-index:4; inset-inline-start:-5px; bottom:calc(100% + 9px);
  width:min(350px,calc(100vw - 2 * var(--chat-gutter) - 20px)); max-height:min(55dvh,410px);
  overflow:auto; overscroll-behavior:contain; padding:5px; border:1px solid var(--line); border-radius:13px;
  background:var(--surface); color:var(--ink); box-shadow:0 8px 32px rgb(0 0 0 / .16);
}
.add-heading,.add-context { padding:5px 9px; color:var(--muted); font-size:.8rem; line-height:1.45; }
.add-context { margin-top:4px; padding-block:8px 4px; border-top:1px solid var(--line); }
.add-row {
  display:flex; align-items:center; gap:9px; min-height:34px; width:100%; padding:6px 9px; border:none;
  border-radius:7px; background:transparent; color:inherit; font:inherit; font-size:.9rem; line-height:1.25; text-align:start;
}
.add-row:hover,.add-row:focus-visible { outline:0; background:var(--soft); }
.add-glyph { width:16px; flex:none; text-align:center; font-size:1rem; color:var(--muted); }
.add-label { flex:none; }
.add-row small { color:var(--muted); font-size:.78rem; }
.add-search { width:calc(100% - 12px); margin:5px 6px; padding:7px 9px; background:var(--page); color:var(--ink);
  border:1px solid var(--line); border-radius:6px; }
.add-tray { display:flex; flex-wrap:wrap; gap:5px; padding-block:2px 7px; max-height:16dvh; overflow-y:auto; }
.add-chip { display:inline-flex; align-items:center; gap:7px; max-width:100%; padding:3px 8px; border:1px solid var(--line);
  border-radius:7px; background:var(--soft); color:var(--ink); font-size:.8rem; }
.add-chip span:first-child { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.add-chip span:last-child { color:var(--muted); }
.add-dialog { width:min(500px,calc(100vw - 30px)); max-height:86dvh; overflow:auto; border:1px solid var(--line);
  border-radius:14px; background:var(--surface); color:var(--ink); padding:20px; box-shadow:0 12px 50px rgb(0 0 0 / .18); }
.add-dialog::backdrop { background:rgb(0 0 0 / .36); }
.add-dialog h2 { font-size:1.08rem; margin:0 0 14px; }
.add-dialog-actions,.add-record-tools { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.add-dialog-actions { justify-content:flex-end; margin-top:16px; }
.add-dialog button { padding:7px 12px; font-size:.86rem; }
.add-error:not(:empty) { margin-top:8px; color:var(--danger); }
.add-canvas,.add-video { display:block; width:100%; height:auto; border:1px solid var(--line); border-radius:7px; }
.add-canvas { touch-action:none; cursor:crosshair; background:#fff; }
.add-video { margin-top:12px; max-height:36dvh; }
@media (max-height:480px) { .add-menu { max-height:48dvh; } }

.model-permission { display: flex; align-items: baseline; gap: .6em; margin-block: .5em; cursor: pointer; }
.model-permission input { width: auto; margin: 0; }
