/* Layout adapters for live controls and authenticated content. */
[hidden] { display:none !important; }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.login { display:grid; min-height:100dvh; place-items:center; padding:16px; }
.pair { display:grid; gap:12px; width:min(340px,100%); background:var(--panel); padding:22px; border-radius:18px; }
.pair input,.details input:not([type=range]),.details textarea,.context-sheet input,.context-sheet textarea {
  border:1px solid var(--line); background:var(--surface); border-radius:10px; padding:8px; color:var(--fg);
}
.topline { min-width:0; }
.topline #account-name { max-width:9ch; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.chat-screen { display:flex; flex-direction:column; overflow:hidden; }
.chat-screen .chat { flex:1; position:relative; min-width:0; width:100%; min-height:0; }
.chathead .ico { color:var(--accent); }
.spaces { padding-top:10px; }
.spaces button:nth-child(1) { color:#c0b0ff; background:#38304f; }
.spaces button:nth-child(2) { color:#83d5c2; background:#233c3a; }
.spaces button:nth-child(3) { color:#f3c28b; background:#40382d; }
.light .spaces button:nth-child(1) { color:#51436d; background:#ece5f9; }
.light .spaces button:nth-child(2) { color:#235e53; background:#dceee9; }
.light .spaces button:nth-child(3) { color:#76502a; background:#f6e8d9; }
.history { position:relative; min-width:0; }
.history summary { margin:0 !important; min-height:36px; display:grid; align-items:center; font-size:12px; padding:5px; }
.history-menu { position:absolute; inset:100% 0 auto auto; z-index:3; width:min(270px,75vw); max-height:65dvh; overflow:auto; background:var(--panel); padding:8px; border-radius:14px; box-shadow:0 10px 35px #0006; }
.history-menu button { display:block; max-width:100%; overflow-wrap:anywhere; text-align:start; }
.chat-search { font-size:12px; }
.notice:not(:empty) { padding:5px 0; color:var(--accent); font-size:.8rem; }
.messages .empty { margin:auto; color:var(--muted); }
.messages { overflow-x:hidden; }
.messages > .bubble { width:fit-content; min-width:66px; padding:10px 12px 7px; background:var(--incoming); border-radius:16px 16px 16px 5px; white-space:pre-wrap; transform:translateX(var(--swipe,0px)); }
.messages > .bubble.own { background:color-mix(in srgb,var(--accent) 25%,#183b59); border-radius:16px 16px 5px 16px; }
.light .messages > .bubble.own { background:color-mix(in srgb,var(--accent) 29%,white); }
.bubble .message-time,.bubble .receipt { display:inline; font-size:11px; color:var(--muted); margin-inline-end:4px; }
.bubble .receipt.is-read { color:var(--accent); }
.bubble .message-more { min-height:27px; padding:1px 5px; color:var(--muted); }
.bubble .quote-link { display:block; text-align:start; border-inline-start:3px solid var(--accent); padding:5px 8px; font-size:.8rem; }
.bubble.swiping { transition:none; }
.bubble.swiping::after { content:"↩"; position:absolute; left:-32px; top:calc(50% - 13px); color:var(--accent); }
.bubble.message-selected { outline:1px solid var(--accent); }
.date-divider { align-self:center; font-size:11px; background:var(--surface); color:var(--muted); padding:4px 11px; border-radius:20px; }
.jump-newest { position:absolute; right:6px; bottom:65px; border-radius:50%; background:var(--control); }
.composer { flex-wrap:wrap; }
.composer .field textarea { flex:1; width:100%; min-width:0; min-height:35px; max-height:110px; background:none; border:none; outline:none; padding:7px 3px; resize:none; }
.composer .field label { display:grid; place-items:center; cursor:pointer; padding:4px; color:var(--muted); min-width:36px; }
.compose-actions { display:flex; align-items:center; gap:4px; }
.compose-actions .space { display:none; }
.icon-button { display:inline-grid; place-items:center; width:38px; min-height:38px; padding:0; color:var(--muted); }
.round.icon-button { width:44px; height:44px; color:#fff; }
.attachment-chip,.reply-preview { flex-basis:100%; display:flex; align-items:center; justify-content:space-between; gap:6px; background:var(--surface); padding:0 7px; }
.attachment-chip span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.markdown { white-space:normal; }
.markdown :is(p,ol,ul,pre,h2,h3,h4,h5,h6) { margin:0 0 .45rem; }
.markdown :last-child { margin-bottom:0; }
.markdown pre,.table-scroll { overflow:auto; max-width:100%; background:var(--surface); padding:5px; }
.markdown td,.markdown th { padding:4px 6px; border-bottom:1px solid var(--line); }
a { color:var(--accent); }
.light a { color:#285788; }
.work-bubble { color:var(--muted); }
.work-status::before { content:"●"; color:var(--accent); margin-inline-end:7px; }
.send-error,[data-task-state="failed"] .task-state { color:#f29898; }
[data-task-state="done"] .task-state { color:#8ad6b6; }
[data-task-state="queued"] .task-state { color:#f3c28b; }
.light [data-task-state="failed"] .task-state { color:#a23546; }
.light [data-task-state="done"] .task-state { color:#21694f; }
.light [data-task-state="queued"] .task-state { color:#76502a; }
.context-sheet { color:var(--fg); border:1px solid var(--line); background:var(--panel); padding:8px; border-radius:16px; max-width:calc(100vw - 16px); }
.context-sheet::backdrop { background:#0006; }
.context-sheet.context { position:fixed; inset:var(--menu-y) auto auto var(--menu-x); margin:0; width:min(204px,calc(100vw - 16px)); }
.context-sheet button { display:block; width:100%; text-align:start; }
.context-sheet .reactions { display:flex; }
.context-sheet .reactions:empty { display:none; }
.reaction-chips { display:flex; gap:5px; }
.reaction-chips button { min-height:26px; border-radius:14px; background:var(--control); padding:2px 6px; }
.reaction-chips [aria-pressed=true] { outline:1px solid var(--accent); }
.action-glyph { color:var(--accent); }
.search-matches { overflow:auto; max-height:50dvh; }
.emoji-row { flex-wrap:wrap; }
.context-sheet .emoji-row button { width:36px; text-align:center; }
.photo-viewer { width:100vw; height:100dvh; max-width:none; max-height:none; margin:0; padding:0; border:0; background:#0b111a; overflow:hidden; }
.photo-viewer::backdrop { background:#0b111a; }
.photo-viewer img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; touch-action:none; }
.photo-toolbar { position:absolute; z-index:1; inset:calc(8px + env(safe-area-inset-top)) 12px auto; display:flex; justify-content:space-between; }
.photo-toolbar :is(a,button) { display:grid; place-items:center; width:44px; height:44px; border-radius:50%; background:#ffffff25; color:white; text-decoration:none; }
.photo-thumbnail { padding:0; }
.audio-message { display:flex; align-items:center; gap:4px; max-width:min(320px,74vw); background:var(--surface); padding:3px; border-radius:12px; }
.audio-message button { width:auto; min-width:28px; min-height:34px; padding:3px; }
.audio-message small { white-space:nowrap; font-size:10px; }
.audio-seek { flex:1; min-width:40px; }
.audio-wave { width:100%; height:22px; display:block; }
.audio-seek input { min-height:20px; }
.details { overflow-wrap:anywhere; }
.details .outline { background:var(--control); margin:3px 4px 3px 0; }
.details pre { white-space:pre-wrap; overflow-wrap:anywhere; }
.details > section { margin-block:8px; }
.details h2 { margin:8px 0; }
.details .settings-menu button { width:100%; display:flex; align-items:center; gap:7px; text-align:start; }
.settings-menu .chevron,.task-state { margin-inline-start:auto; }
.preference-row { display:flex; align-items:center; justify-content:space-between; gap:7px; padding:5px 0; }
.appearance-panel { display:grid; gap:5px; }
.palette-preview { display:grid; gap:3px; background:var(--bg); padding:8px; border-radius:12px; }
.palette-preview span { width:fit-content; background:var(--incoming); padding:5px 9px; border-radius:10px; }
.palette-preview .preview-own { justify-self:end; background:var(--bubble); }
.palette-options { display:flex; flex-wrap:wrap; gap:5px; }
.palette-options button { min-height:32px; width:32px; border-radius:50%; padding:0; background:var(--swatch); color:#17283a; font-size:0; }
.palette-options [aria-pressed=true]::after { content:"✓"; font-size:14px; }
[data-swatch="blue"] { --swatch:#80baff; } [data-swatch="iris"] { --swatch:#c0b0ff; }
[data-swatch="mint"] { --swatch:#83d5c2; } [data-swatch="amber"] { --swatch:#f3c28b; }
[data-swatch="rose"] { --swatch:#eca3d2; } [data-swatch="coral"] { --swatch:#f29898; }
.pc-connection,.audio-controls,.browser-address,.browser-tools { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.pc-connection { justify-content:space-between; color:var(--accent); }
.pc-metrics,.tab-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.tab-row { grid-template-columns:minmax(0,1fr) auto; }
.tab-row button { overflow-wrap:anywhere; text-align:start; }
.tab-row [aria-current] { outline:1px solid var(--accent); }
.pc-metric { display:grid; gap:3px; }
.pc-metric progress { width:100%; height:5px; accent-color:var(--accent); }
.pc-metric[data-metric="ram"] progress { accent-color:#83d5c2; }
.pc-metric[data-metric="gpu"] progress { accent-color:#c0b0ff; }
.pc-metric[data-metric="disk"] progress { accent-color:#f3c28b; }
.audio-controls input[type=range],.browser-address input { flex:1; width:0; min-width:0; }
.task summary { display:flex; align-items:center; gap:8px; }
.task summary svg { flex:none; }
.task summary span { min-width:0; }
.segmented button[aria-pressed=true] { background:var(--control); color:var(--accent); }
.details img { max-width:100%; height:auto; }
.integration-list { display:grid; grid-template-columns:auto 1fr; gap:5px; }
.integration-list dd { margin:0; }
[data-density="comfortable"] #app main { --pad:18px; }
[data-background="plain"] .messages { background:none; }
@media(max-width:759px) { .topline #account-name { display:none; } .navigation button { min-width:0; } }
@media(max-height:520px) and (max-width:759px) { #app:has(#message:focus) > nav { display:none; } }

/* Prototype v3 components bound to live computer and chat data. */
.device-heading { margin:8px 0; gap:5px; }
.device-heading h2 { margin:0; color:var(--fg); font-size:17px; }
.device-overview > .panel:first-child .ico { color:var(--accent); }
.device-overview .pc-connection { justify-content:initial; margin-bottom:12px; }
.device-overview .pc-connection .grow { flex:1; }
.device-detail .panel { min-width:0; }
[data-tint="0"] { --tile-tint:#80baff; }
[data-tint="1"] { --tile-tint:#c0b0ff; }
[data-tint="2"] { --tile-tint:#83d5c2; }
[data-tint="3"] { --tile-tint:#f3c28b; }
[data-tint="4"] { --tile-tint:#f29898; }
[data-tint="5"] { --tile-tint:#b6c8de; }
.tile .ico { color:var(--tile-tint,var(--accent)); background:color-mix(in srgb,var(--tile-tint,var(--accent)) 14%,var(--surface)); }
.device-overview .window-shortcut { width:100%; min-width:0; text-align:start; overflow-wrap:anywhere; }
.window-shortcut small { margin-inline-start:auto; }
.device-detail .window-title { overflow-wrap:anywhere; }
.device-detail .window-title b { min-width:0; }
.device-detail .window-title small { white-space:nowrap; }
.monitor-card { display:grid; justify-items:center; gap:4px; padding:10px; text-align:center; }
.monitor-icon svg { color:var(--accent); }
.monitor-preview { width:100%; min-height:53px; display:grid; place-items:center; border-radius:10px; background:var(--surface); color:var(--accent); }
.screen-preview { align-content:center; gap:7px; overflow:hidden; }
.screen-preview img { width:100%; height:100%; min-height:0; object-fit:contain; }
.screen-preview svg { width:34px; height:34px; }
.screen-download { place-self:center; font-size:12px; }
.pc-prompt { margin:12px 0; }
.device-detail .terminal pre { white-space:pre-wrap; overflow-wrap:anywhere; }
.device-detail .terminal .field { margin-top:12px; background:#142235; color:#d5e6f4; }
.device-detail .terminal .field span { padding-inline-start:10px; white-space:nowrap; }
.device-detail .tab-row { align-items:center; padding:7px; }
.device-detail .tab-row [aria-current] { outline:0; }
.tab-row svg,.window-title > svg,.file-entry > svg { flex:none; }
.browser-tools button { flex:0 1 43px; padding:5px; }
.file-entry { color:inherit; justify-content:space-between; overflow-wrap:anywhere; min-width:0; }
.file-entry > svg:first-child { color:var(--accent); }
.game-gauges { margin:12px 0; text-align:center; }
.game-gauge progress { display:block; width:100%; height:7px; accent-color:var(--tile-tint); }
.power-overview strong { font-size:30px; color:var(--success,#77c7a6); }
.power-grid .panel { margin:0; }
button:disabled { cursor:default; opacity:.5; }
.attachment-chip { align-items:stretch; justify-content:start; overflow-x:auto; padding:5px 0; }
.attachment-card { display:grid; grid-template-columns:37px minmax(0,1fr) 32px; align-items:center; min-width:150px; max-width:190px; min-height:43px; gap:5px; padding:4px; border-radius:12px; background:var(--panel); font-size:12px; }
.attachment-card img { width:37px; height:37px; object-fit:cover; border-radius:7px; }
.attachment-card button { padding:2px; min-width:32px; }
.photo-message { display:flex; flex-direction:column; }
.photo-message .photo-thumbnail { order:-1; display:block; }
.photo-message .photo-thumbnail + .photo-thumbnail { margin-top:3px; }
.photo-message .photo-thumbnail img { width:100%; max-height:310px; object-fit:contain; }
.context-sheet.context { background:transparent; padding:0; box-shadow:none; border:0; overflow:visible; }
.context-sheet.context .message-actions { min-width:0; width:100%; }
.context-sheet.context .reaction-strip { margin-bottom:5px; padding:3px; border-radius:24px; background:var(--panel); box-shadow:0 4px 18px #0004; justify-content:space-around; }
.context-sheet.context .reaction-strip button { width:40px; padding:2px; justify-content:center; }
.audio-wave[hidden] { display:none; }

.context-sheet.context .message-actions button { display:flex; align-items:center; gap:9px; }
.context-sheet.context .message-actions svg { width:17px; height:17px; flex:none; color:var(--accent); }
[data-task-phase]:empty { display:none; }

.topline #device-back { margin-inline-start:-6px; flex:none; }
.details .palette-options button[data-swatch] { background:var(--swatch); }
.appearance-panel .row.preference-choices { flex-wrap:wrap; gap:4px; }
.appearance-panel .preference-choices button { font-size:12px; }
.appearance-panel .palette-preview .preview-own { background:var(--accent); color:#17283a; }
.font-preference { display:grid; gap:3px; }
[data-density="normal"] #app main { --pad:16px; }

.gauge-ring { position:relative; margin:0 auto 4px; width:clamp(43px,13vw,68px); aspect-ratio:1; display:grid; place-items:center; }
.gauge-ring svg { position:absolute; inset:0; width:100%; height:100%; transform:rotate(-90deg); }
.gauge-ring circle { fill:none; stroke-width:2.4; }
.gauge-ring .gauge-track { stroke:var(--line); }
.gauge-ring .gauge-fill { stroke:var(--tile-tint); stroke-linecap:round; }
.gauge-ring strong { font-size:12px; }
.window-shortcut small { white-space:nowrap; flex:none; }

/* Compact interaction states for messages and the computer controls. */
.action-sheet { box-sizing:border-box; width:min(430px,calc(100vw - 24px)); padding:16px; }
.action-sheet h2 { margin:0; color:var(--fg); font-size:17px; }
.action-sheet p { font-size:14px; margin:9px 0 15px; }
.action-sheet .sheet-actions { justify-content:flex-end; gap:8px; margin-top:12px; }
.action-sheet .sheet-actions button { min-height:42px; width:auto; padding:0 12px; white-space:nowrap; }
.action-sheet .sheet-actions .primary { color:white; }
.action-sheet .sheet-actions .destructive { background:#a83f50; color:white; }
.action-sheet[open],.photo-viewer[open] { animation:surface-appear .18s ease-out; }
@keyframes surface-appear { from { opacity:0; translate:0 7px; } to { opacity:1; translate:0; } }
@media(max-width:759px) {
  .action-sheet { inset:auto 0 0; width:100%; max-width:none; margin:0;
    padding:16px 16px max(16px,env(safe-area-inset-bottom)); border-radius:20px 20px 0 0; }
}
.record-strip { flex:1; display:flex; align-items:center; gap:8px; min-height:43px; padding:0 8px 0 3px;
  min-width:0; border-radius:22px; background:var(--panel); font-size:12px; }
.record-dot { flex:none; width:8px; height:8px; border-radius:50%; background:#ef7a87; animation:capture-pulse 1.2s ease-out infinite; }
@keyframes capture-pulse { 50% { opacity:.45; transform:scale(.75); } }
.record-elapsed { color:var(--fg); font-size:14px; font-weight:600; line-height:1.2; font-variant-numeric:tabular-nums; min-width:4ch; }
.record-label { color:var(--muted); }
.composer.is-recording .field,.composer.is-recording .compose-actions #ask-room,
.composer.is-recording .compose-actions button[type=submit] { display:none; }
.composer #voice { flex:none; border-radius:50%; width:44px; height:44px; background:var(--control); }
.composer.is-recording #voice { background:#a83f50; color:#fff; }
.composer:not(.is-recording).has-content #voice,.composer.is-editing #voice { display:none; }
.composer:not(.has-content):not(.is-editing) .compose-actions button[type=submit],
.composer:not(.has-content) #ask-room,.composer.is-editing #ask-room { display:none; }
.composer:not(.has-content) .field { min-width:0; }
.voice-preview-title { justify-content:space-between; }
.voice-preview-title .icon-button { display:grid; width:36px; }
.voice-preview .audio-message { max-width:none; margin:9px 0 0; }
.voice-preview-actions button { display:flex; align-items:center; justify-content:center; gap:7px; }
.audio-message { gap:8px; padding:5px 7px; border-radius:16px; min-width:min(222px,64vw); }
.audio-message .audio-toggle { display:grid; width:40px; height:40px; border-radius:50%; background:var(--accent); color:#17283a; flex:none; }
.audio-message .audio-toggle svg { width:17px; height:17px; }
.audio-message .audio-speed { min-width:32px; min-height:30px; border-radius:12px; padding-inline:4px;
  background:var(--control); color:var(--fg); font-size:11px; font-variant-numeric:tabular-nums; }
.audio-timeline { flex:1; min-width:38px; }
.audio-seek { position:relative; height:24px; }
.audio-seek input { position:absolute; inset:0; width:100%; height:24px; margin:0; cursor:pointer; }
.audio-seek.has-wave input:not(:focus-visible) { opacity:0; }
.audio-wave { height:24px; pointer-events:none; }
.audio-timeline small { display:block; line-height:1.1; color:var(--muted); font-variant-numeric:tabular-nums; }
.attachment-chip { scroll-snap-type:x proximity; }
.attachment-chip .attachment-card { scroll-snap-align:start; flex:none; }
.attachment-card.image-card { position:relative; display:block; width:66px; min-width:66px; height:66px;
  padding:0; overflow:hidden; }
.attachment-card .attachment-thumbnail { display:block; width:100%; height:100%; padding:0; }
.attachment-thumbnail img { width:100%; height:100%; border-radius:inherit; }
.image-card > .icon-button { position:absolute; top:2px; right:2px; width:27px; min-width:27px; min-height:27px;
  border-radius:50%; color:white; background:#0b111abb; }
.image-card > .icon-button svg { width:15px; height:15px; }
.photo-count { color:white; align-self:center; font-size:13px; font-variant-numeric:tabular-nums; }
.photo-viewer :is(.photo-prev,.photo-next) { position:absolute; top:48%; padding:0; color:white; background:#0b111aac; border-radius:50%; }
.photo-prev { left:7px; } .photo-next { right:7px; }
.photo-viewer :is(.photo-prev,.photo-next):disabled { display:none; }
.photo-toolbar a { color:white; }
.messages > .photo-message { max-width:min(82%,340px); padding:3px 3px 5px; gap:3px; }
.photo-message .message-text,.photo-message .markdown { padding:3px 7px; }
.photo-message .photo-thumbnail { overflow:hidden; border-radius:13px; }
.photo-message .photo-thumbnail img { width:auto; max-width:100%; min-width:min(140px,40vw); max-height:290px; }
.bubble .message-more { min-width:28px; min-height:28px; vertical-align:middle; }
.bubble .reaction-chips { margin:4px 0 2px; }
.bubble .reaction-chips button { min-height:29px; font-size:12px; }
.quote-preview-text { flex:1; min-width:0; display:grid; gap:2px; line-height:1.2; }
.quote-preview-text b { font-size:12px; color:var(--accent); }
.quote-preview-text small { font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.reply-preview { min-height:39px; border-radius:10px; border-inline-start:2px solid var(--accent); }
.reply-preview > svg { flex:none; color:var(--accent); width:17px; height:17px; }
.quote-target { outline:2px solid var(--accent); }
.context-sheet.context { width:min(208px,calc(100vw - 16px)); }
.context-sheet.context::backdrop { background:#0003; }
.context-sheet.context .message-actions button { min-height:42px; }
.context-sheet.context .reaction-strip button { width:43px; min-height:41px; font-size:19px; }
.power-grid .panel { min-height:76px; }
.power-grid .panel:nth-child(4) .ico,.power-grid .panel:nth-child(5) .ico { color:#f29898; }
.device-overview .window-shortcut { padding:4px 0; }
.details .settings-menu button { min-height:42px; }
[data-motion=off] :is(.record-dot,.action-sheet,.photo-viewer) { animation:none !important; }

.message-photos { display:grid; }
.message-photos.album { grid-template-columns:repeat(2,minmax(0,1fr)); gap:3px; width:min(65vw,304px); }
.message-photos.album .photo-thumbnail { aspect-ratio:1 / 1; min-height:0; margin:0; }
.message-photos.album .photo-thumbnail img { width:100%; min-width:0; height:100%; object-fit:cover; }
.device-detail .file-entry { text-decoration:none; text-align:start; gap:9px; }
.device-detail .file-entry .grow { min-width:0; }
.task-tabs { margin:10px 0; }
.task-tabs button.space { min-height:54px; color:var(--tile-tint); background:color-mix(in srgb,var(--tile-tint) 13%,var(--panel)); }
.light .task-tabs button.space { color:var(--fg); }
.task-tabs button[aria-pressed=true] { box-shadow:inset 0 0 0 1px currentColor; }
.task-empty { margin:0; padding:2px 0; }
.schedule-section .schedule-form { gap:3px; margin-bottom:12px; }
.schedule-section .schedule-form .round { flex:none; width:39px; height:39px; }
.schedule-section .row small { white-space:normal; }

.settings-account .ico { color:var(--accent); }
.settings-account .account-actions { gap:8px; flex-wrap:wrap; margin-top:10px; }
.settings-account .account-actions button { min-height:38px; padding:4px 11px; }
.settings-account .account-actions + small { display:block; margin-top:6px; }
.settings-category .settings-chevron { color:var(--muted); transition:transform .16s; flex:none; }
details[open] > .settings-category .settings-chevron { transform:rotate(90deg); }

.messages .message-meta { min-height:20px; gap:3px; justify-content:flex-end; padding-inline:4px; }
.messages .message-meta .message-more { min-height:24px; min-width:27px; padding:0 3px; }
.messages .message-meta .receipt,.messages .message-meta time { margin:0; white-space:nowrap; }
.light .appearance-panel .preference-choices button,
.light .settings-account .account-actions button,
.light .device-detail .browser-tools button { background:var(--control); color:var(--fg); }
.light .appearance-panel .preference-choices button.selected {
  color:#253d6c; background:color-mix(in srgb,var(--accent) 25%,white);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 65%,#354e6d);
}
