/* System appearance only. Photograph pixels and image-aware label colours stay intact. */
:root{color-scheme:light dark;--viewer-surface:rgb(246 247 249 / .96)}
@media(prefers-color-scheme:dark){
  :root{
    color-scheme:dark;
    --app-backdrop:#101316;--surface:#171b20;--sidebar:#1c2229;
    --ink:#edf1f6;--muted:#adb8c6;--line:#35404c;--soft-line:#29323c;
    --accent:#87bcff;--accent-hover:#a8ceff;--accent-soft:#203752;
    --warning:#f0c58c;--warning-bg:#33291e;--error:#ffb7ad;--error-bg:#3b2325;
    --theme-raised:#222a33;--theme-hover:#2c3743;--theme-disabled:#84909e;
    --theme-glass:rgb(27 34 42 / .76);--theme-glass-edge:rgb(199 216 235 / .24);
    --material-glass:var(--theme-glass);--material-glass-edge:var(--theme-glass-edge);
    --viewer-surface:rgb(18 23 29 / .96);
  }
  html{background:var(--app-backdrop)}
  body{color:var(--ink)}
  body:has(>.phone){background:var(--app-backdrop)}
  .phone{border-color:var(--line);box-shadow:0 12px 50px #0005}
  button{background:var(--theme-raised);color:var(--ink);border-color:var(--line)}
  button:not(:disabled):hover{background:var(--theme-hover)}
  button:disabled{background:var(--sidebar);color:var(--theme-disabled)}
  button:focus-visible,a:focus-visible,textarea:focus-visible,summary:focus-visible,[tabindex]:focus-visible{outline-color:var(--accent)}
  a{color:var(--accent)}
  .site-header,.brand,.dialogue{background:var(--surface)}
  .skip-link,.secondary,.latest{background:var(--theme-raised);color:var(--ink)}
  .steps .active{background:var(--theme-raised);color:var(--ink)}
  .steps .active .step-number{background:var(--accent-soft);border-color:var(--line)}
  .step-number,.site-header,.media,.samples button{border-color:var(--line)}
  .media{background:rgb(30 42 53 / .78)}
  .material-upload{color:#d1dae5;border-color:#526a82;background:rgb(31 43 55 / .88)}
  .material-upload:hover,.material-upload.drag-over{background:rgb(40 57 74 / .94);border-color:var(--accent)}
  .preview img,.preview video{background:var(--sidebar)}
  .manual-select,.material-reveal,.media.has-preview .material-upload,.targets button,.viewer-close,.zoom-controls,.region-zoom button{background:var(--theme-glass);color:var(--ink);border-color:var(--theme-glass-edge)}
  .targets button[aria-pressed="true"]{background:var(--accent-soft);color:var(--accent);border-color:var(--accent)}
  .sidebar-note,.turn small,.context-label,.composer-meta{color:var(--muted)}
  .turn.assistant:not(.notice-turn)>small{border-color:var(--line)}
  .turn.user{background:#1c4b7c;color:#f2f7ff}
  .turn.notice-turn{color:var(--warning);border-color:#9b7648}
  .turn.notice-turn small{color:var(--warning)}
  .spinner{border-color:var(--accent-soft);border-top-color:var(--accent)}
  .dialogue,.composer{background:transparent}
  .input-wrap{background:rgb(27 34 43 / .76);border-color:rgb(160 187 219 / .28);box-shadow:inset 0 1px 0 #d4e7ff0d,0 3px 16px #0002}
  .input-wrap:focus-within{border-color:var(--accent);outline-color:var(--accent);box-shadow:0 0 0 1px #87bcff1a}
  textarea{color:var(--ink);caret-color:var(--accent)}
  textarea::placeholder{color:#a2aebd}
  .attach-button,.reveal-button,.turn-actions button{color:var(--accent)}
  .attach-button,.text-button,.turn-actions button{background:transparent}
  .send-button{background:#285b91;color:#f1f7ff;border-color:#709bcd;box-shadow:inset 0 1px 0 #d4e7ff14}
  .send-button:not(:disabled):hover{background:#336fae}
  .send-button:disabled{background:rgb(38 47 58 / .76);color:#8b98a8;border-color:var(--line);box-shadow:inset 0 1px 0 #d4e7ff0a}
  .material-reveal:disabled{color:var(--theme-disabled);background:var(--sidebar);border-color:var(--line)}
  .material-reveal[data-reveal-state="revealed"]{color:var(--muted)}
  .material-reveal.is-armed,.reveal-button.is-armed{color:#ffd1d9;border-color:#b86a7e}
  .material-reveal::before,.reveal-button::before{background:radial-gradient(ellipse,rgba(185,70,103,.55),rgba(133,54,78,.3) 55%,transparent)}
  .reveal-toggle{background:#2b343f;color:var(--ink);border-color:#45515f;box-shadow:0 0 8px #0003}
  .reveal-toggle:hover,.reveal-toggle.is-dragging{background:#3a4755}
  .reveal-sheet:not(.is-open) .reveal-toggle{border-color:#45515f}
  .images img,.app-record-thumbnail{background:var(--sidebar)}
  .app-profile-page{color:var(--ink)}
  .app-profile-menu,.app-record-candidates,.app-record-references{border-color:var(--line)}
  .app-profile-menu{color:var(--ink);background:transparent}
  .app-profile-menu:not(:disabled):hover{background:var(--sidebar)}
  .app-profile-menu>svg,.app-profile-menu>svg:last-child,.app-history-note,.app-record-candidate small,.app-about p{color:var(--muted)}
  .app-navigation-status{color:var(--warning)}
  .app-navigation-toast{background:rgb(52 41 29 / .96);color:var(--warning);box-shadow:0 3px 16px #0004}
  .app-profile-page button:focus-visible{outline-color:var(--accent)}
  .app-about-avatar{background:transparent}
  body :is(#photo-viewer,#reference-photo-viewer,.region-editor){background:var(--viewer-surface);color:var(--ink)}
  body :is(#photo-viewer,#reference-photo-viewer,.region-editor)::backdrop{background:rgb(10 15 21 / .78)}
  body #video-frame-editor{background:rgb(18 23 29 / .7);color:var(--ink)}
  body #video-frame-editor::backdrop{background:rgb(10 15 21 / .86)}
  body #video-frame-editor .video-frame-editor-toolbar{background:rgb(27 34 43 / .84)}
  body #video-frame-editor>.viewer-close,body #video-frame-editor .video-frame-editor-zoom .icon-button{background:var(--theme-glass);color:var(--ink);border-color:var(--theme-glass-edge)}
  body #video-frame-editor .video-frame-editor-zoom>button[aria-pressed="true"]{color:var(--accent);border-color:var(--accent)}
  .region-actions #region-confirm,.clip-actions .clip-confirm,body #video-frame-editor-confirm:not(:disabled){background:#285b91;border-color:#709bcd;color:#f1f7ff}
  .region-actions #region-confirm:disabled{background:var(--sidebar);border-color:var(--line);color:var(--theme-disabled)}
  .clip-editor{box-shadow:0 20px 80px #0008}
  .clip-editor::backdrop,.video-frame-viewer::backdrop,.video-player-viewer::backdrop{background:rgb(7 11 16 / .72)}
  .video-expand,.video-player-close,.has-video .media-content>.clip-edit{background:var(--theme-glass);color:var(--ink);border-color:var(--theme-glass-edge)}
  .video-frame-card img{background:var(--sidebar)}
  .video-frame-card[data-detection="empty"] img{background:#39252e}
  .app-shell .workspace.material-surface{--material-glass:var(--theme-glass);--material-glass-edge:var(--theme-glass-edge)}
  .app-shell .material-surface.material-intro .media .material-upload{background:rgb(32 46 58 / .86);color:#d9e4ee}
  .app-shell .material-surface .media.has-preview .material-upload,.app-shell .material-surface #manual-region,.app-shell .material-surface #material-reveal,.app-shell .material-surface .targets button,.app-shell .material-surface.has-video .media-content>#edit-video,.app-shell .material-surface .send-button,.app-shell .material-surface .latest,body.material-fusion-ready dialog :is(button,.icon-button){color:#e0e8f2;background:var(--theme-glass);border-color:var(--theme-glass-edge);box-shadow:0 2px 8px #0002}
  .app-shell .material-surface .targets button[aria-pressed="true"]{color:var(--accent);border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
  .app-shell .material-surface .send-button:not(:disabled){color:var(--accent);border-color:#6288b6}
  .app-shell .material-surface .send-button:disabled,.app-shell .material-surface #material-reveal:disabled{color:#9ba9ba}
  .app-shell .material-surface #material-reveal.is-armed{color:#ffd1d9;border-color:#b86a7e}
  body.material-fusion-ready .clip-actions .clip-confirm,body.material-fusion-ready #region-confirm:not(:disabled),body.material-fusion-ready #video-frame-editor-confirm:not(:disabled){background:#285b91;color:#f1f7ff;border-color:#709bcd}
}
