/* Local preview only: compact controls, a bounded subject chooser and a real reading viewport. */
@media screen {
  body.cinema-ui #reaction-panel-dialog.record-panel-dialog {
    width:min(1120px,calc(100vw - 40px));
    height:min(880px,calc(100dvh - 40px));
    max-height:calc(100dvh - 40px);
    padding:0;
    overflow:hidden;
  }
  body.cinema-ui #reaction-panel-dialog[open] { display:flex;flex-direction:column; }
  body.cinema-ui #reaction-panel-dialog > #reaction-panel-content {
    display:block;
    flex:1 1 auto;
    min-height:0;
    min-width:0;
    overflow:auto;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
    scroll-padding-block:16px;
    padding:18px 24px 30px;
    overflow-wrap:anywhere;
  }
  body.cinema-ui :is(#reaction-panel-dialog,#record-panel-dialog,#reading-space-dialog) > .museum-reader-header {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:start;
    gap:8px 18px;
    flex:0 0 auto;
    min-width:0;
    padding:14px 22px 12px;
    position:relative;
    top:auto;
    background:linear-gradient(120deg,rgba(244,253,249,.97),rgba(234,248,246,.96) 65%,rgba(255,246,230,.97)) !important;
  }
  body.cinema-ui .museum-reader-header::before { display:none; }
  body.cinema-ui .museum-reader-header > .museum-reader-labels {
    grid-area:1 / 1;
    display:block;
    min-width:0;
    flex:initial;
  }
  body.cinema-ui .museum-reader-labels > .eyebrow { font-size:9px;line-height:1.3;letter-spacing:.1em;margin:0 0 3px; }
  body.cinema-ui .museum-reader-labels > :is(#reaction-panel-title,#record-panel-title,#reading-space-title) {
    margin:0;
    font:500 clamp(19px,2.2vw,25px)/1.25 var(--font,system-ui,sans-serif);
    letter-spacing:-.035em;
    overflow-wrap:anywhere;
  }
  body.cinema-ui #reaction-panel-dialog .museum-reader-labels > p {
    margin:5px 0 0;
    font-size:11px;
    line-height:1.4;
    max-width:760px;
  }
  body.cinema-ui #reaction-panel-dialog.museum-subject-mode .museum-reader-labels > p { display:none; }
  body.cinema-ui .museum-reader-header > .museum-reader-close {
    grid-area:1 / 2;
    order:0;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    align-self:start;
    position:static;
    width:auto;
    height:auto;
    min-width:76px;
    min-height:40px;
    padding:8px 12px;
    margin:0;
    border-radius:12px;
    font:550 12px/1.3 var(--font,system-ui,sans-serif);
    white-space:nowrap;
  }
  body.cinema-ui .museum-reader-header > .museum-reader-actions {
    grid-column:1 / -1;
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:7px 12px;
    min-width:0;
    padding:0;
  }
  body.cinema-ui .museum-reader-actions > :is(.evidence-export-tools,.evidence-print-tools) { margin:0;padding:0; }
  body.cinema-ui .museum-reader-actions :is(button,summary) { min-height:34px;font-size:11px; }
  body.cinema-ui .museum-reader-actions .museum-reader-secondary {
    position:relative;
    margin:0;
    padding:0;
    border:0;
    border-radius:0;
    background:none !important;
    box-shadow:none;
  }
  body.cinema-ui .museum-reader-secondary > summary {
    display:inline-flex;
    align-items:center;
    gap:9px;
    padding:5px 8px;
    color:#204c60;
    cursor:pointer;
    list-style:none;
  }
  .museum-reader-secondary > summary::-webkit-details-marker { display:none; }
  .museum-reader-secondary > summary::after { content:'+';font-size:17px;line-height:1; }
  .museum-reader-secondary[open] > summary::after { content:'−'; }
  body.cinema-ui .museum-reader-secondary-controls {
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:6px 14px;
    padding:8px 10px;
    border:1px solid rgba(35,83,99,.14);
    border-radius:12px;
    background:rgba(250,255,252,.96);
  }
  body.cinema-ui .museum-reader-secondary-controls > .record-dialog-context { margin:0;padding:4px 0;font-size:11px; }
  body.cinema-ui .museum-reader-secondary-controls > .evidence-share-tools { margin:0;padding:0; }
  body.cinema-ui #reaction-panel-content .reaction-stage-topic-space { display:block;min-width:0; }
  body.cinema-ui #reaction-panel-content .museum-subject-chooser {
    position:relative;
    min-width:0;
    margin:0 0 16px;
    padding:0;
    color:#173e50;
    background:linear-gradient(115deg,rgba(247,255,251,.96),rgba(231,248,245,.95),rgba(255,245,226,.97)) !important;
    border:1px solid rgba(255,255,255,.9);
    border-radius:14px;
    box-shadow:0 4px 16px rgba(9,48,66,.06),inset 0 1px #fff;
  }
  body.cinema-ui .museum-subject-chooser > summary {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    min-width:0;
    min-height:44px;
    padding:10px 14px;
    cursor:pointer;
    list-style:none;
    font:550 12px/1.45 var(--font,system-ui,sans-serif);
  }
  .museum-subject-chooser > summary::-webkit-details-marker { display:none; }
  .museum-subject-selection { min-width:0;overflow-wrap:anywhere; }
  .museum-subject-action { flex:none;font-size:11px;font-weight:500;white-space:nowrap; }
  .museum-subject-action::after { content:' +';font-size:16px; }
  .museum-subject-chooser[open] .museum-subject-action::after { content:' −'; }
  body.cinema-ui #reaction-panel-content .museum-subject-chooser > #reaction-topics {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr));
    align-content:start;
    gap:7px;
    max-height:min(300px,32dvh);
    margin:0;
    padding:4px 10px 12px;
    overflow:auto;
    overscroll-behavior:contain;
    scroll-padding:10px;
    scrollbar-width:thin;
  }
  body.cinema-ui #reaction-topics .reaction-topic {
    min-width:0;
    min-height:44px;
    margin:0;
    padding:9px 12px;
    font-size:12px;
    line-height:1.4;
    white-space:normal;
    overflow-wrap:anywhere;
    text-align:left;
  }
  body.cinema-ui #reaction-panel-content #reaction-subject-reading {
    width:100%;
    min-width:0;
    max-width:920px;
    margin:0 auto;
    padding:20px clamp(16px,3vw,30px) 26px;
    scroll-margin-top:12px;
    background:rgba(250,255,252,.97) !important;
    border-color:rgba(255,255,255,.96) !important;
  }
  body.cinema-ui #reaction-subject-reading > .reaction-subject-return { display:none; }
  body.cinema-ui #reaction-subject-reading > #reaction-topic-title {
    margin:0 0 8px;
    font:450 clamp(24px,3vw,34px)/1.22 Georgia,'Times New Roman',serif;
    color:#153e50;
    letter-spacing:-.035em;
    overflow-wrap:anywhere;
  }
  body.cinema-ui #reaction-subject-reading .reaction-topic-count { margin:0 0 18px;font-size:11px;line-height:1.5; }
  body.cinema-ui #reaction-subject-reading :is(.reaction-points,.reaction-quote) { min-width:0;max-width:100%; }
  body.cinema-ui #reaction-subject-reading .reaction-quote { margin:0 0 16px;padding:18px 20px; }
  body.cinema-ui #reaction-subject-reading :is(blockquote,pre) {
    white-space:pre-wrap;
    overflow-wrap:anywhere;
    word-break:normal;
    max-width:100%;
    font-size:clamp(15px,1.5vw,17px);
    line-height:1.8;
  }
  body.cinema-ui #reaction-panel-dialog :is(svg,img,video,canvas) { max-width:100%; }
  body.cinema-ui #reaction-sources-dialog { max-width:min(980px,calc(100vw - 28px));max-height:calc(100dvh - 28px);overflow:auto;overscroll-behavior:contain; }
  body.cinema-ui .museum-reader-header :is(button,a,summary):focus-visible,
  body.cinema-ui .museum-subject-chooser :is(button,summary):focus-visible { outline:3px solid #145671;outline-offset:3px; }
  @media(max-width:600px) {
    body.cinema-ui #reaction-panel-dialog.record-panel-dialog { width:calc(100vw - 12px);height:calc(100dvh - 12px);max-height:calc(100dvh - 12px);border-radius:17px; }
    body.cinema-ui #reaction-panel-dialog > #reaction-panel-content { padding:12px 10px 24px;scrollbar-gutter:auto; }
    body.cinema-ui :is(#reaction-panel-dialog,#record-panel-dialog,#reading-space-dialog) > .museum-reader-header { padding:11px 13px 10px;gap:6px 10px; }
    body.cinema-ui .museum-reader-header > .museum-reader-close { min-width:72px;min-height:40px;padding:8px 10px; }
    body.cinema-ui .museum-reader-header > .museum-reader-actions { gap:5px 8px; }
    body.cinema-ui #reaction-panel-content .museum-subject-chooser { margin-bottom:12px; }
    body.cinema-ui .museum-subject-chooser > summary { padding:9px 11px;gap:10px; }
    body.cinema-ui #reaction-panel-content .museum-subject-chooser > #reaction-topics { grid-template-columns:1fr;max-height:32dvh; }
    body.cinema-ui #reaction-panel-content #reaction-subject-reading { padding:17px 13px 22px;border-radius:14px; }
    body.cinema-ui #reaction-subject-reading .reaction-quote { padding:15px 13px; }
    body.cinema-ui #reaction-subject-reading :is(blockquote,pre) { font-size:15px;line-height:1.75; }
  }
  @media(prefers-reduced-motion:reduce) {
    body.cinema-ui #reaction-panel-dialog,
    body.cinema-ui #reaction-panel-content { animation:none !important;scroll-behavior:auto !important; }
  }
  @media(prefers-reduced-transparency:reduce) {
    body.cinema-ui .museum-reader-header,
    body.cinema-ui .museum-subject-chooser,
    body.cinema-ui #reaction-panel-content #reaction-subject-reading { background:#f6fcf8 !important;backdrop-filter:none; }
  }
}
@media print {
  .museum-subject-chooser,.museum-reader-actions,.museum-reader-close { display:none !important; }
  #reaction-panel-dialog,#reaction-panel-content,#reaction-subject-reading { height:auto !important;max-height:none !important;overflow:visible !important; }
}
