.page-tools{position:fixed;right:18px;bottom:max(26px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:8px;z-index:800}
.page-tools button{width:44px;height:44px;display:grid;place-items:center;padding:0;border-radius:12px;background:#fff;color:#456254;border:1px solid #d8e1da;box-shadow:0 3px 14px #22392e14}
.page-tools button:hover{background:#edf3ed;border-color:#91ad9b}.page-tools button:active{transform:translateY(1px)}
@media(max-width:760px){.page-tools{right:12px;bottom:max(18px,env(safe-area-inset-bottom))}}
:root[data-theme=dark]{color-scheme:dark;background:#000;--ink:#e2e5e3;--muted:#a0a6a2;--green:#aac8b5;--line:#303532;--night-bg:#000000;--night-surface:#101312;--night-raised:#202522;--night-soft:#191e1b}
[data-theme=dark] body{background:var(--night-bg);color:var(--ink)}
[data-theme=dark] :is(header,.filters,.coursegroup,.grouphead,.empty,dialog,.teacher-panel,.unified-dropdown,#audioReport .dialoghead,#editor .dialoghead){background:var(--night-surface);color:var(--ink);border-color:var(--line)}
[data-theme=dark] :is(button,input,select,textarea,.teacher-picker summary,select:not([multiple]),.searchbar input,form input,form select,form textarea,.teacher-picker .teacher-panel input[type=search],.detailbuttons a,.import,.audio-report-button,.audio-report-toolbar button,.audio-view-controls button){background-color:var(--night-soft);color:var(--ink);border-color:var(--line)}
[data-theme=dark] :is(button:hover,.chip:hover,.teacher-option:hover,.unified-dropdown-option:hover,.unified-dropdown-option:focus-visible,.stage-picker .teacher-panel>label:hover,.audio-report-button:hover){background-color:var(--night-raised);color:var(--ink)}
[data-theme=dark] :is(.period,.copybox,.actionmodule,.snapshot-box,.audio-check-summary,.filter-summary,.active-filter,.teacher-abc button){background:var(--night-soft);color:var(--ink);border-color:var(--line)}
[data-theme=dark] :is(.chip,.teacher-option,.teacher-picker .teacher-option,.teacher-picker .teacher-abc button){background:var(--night-soft);color:#c5cdc7;border-color:transparent}
[data-theme=dark] :is(.chip.selected,#mathTypes .chip.selected,.teacher-option.selected,.teacher-picker .teacher-option.selected,.unified-dropdown-option[aria-selected=true],.stage-picker .teacher-panel>label:has(input:checked)){background:#30483a;color:#e4ede7;border-color:#60776a}
[data-theme=dark] :is(.groupmeta .termchip,.groupmeta .teacher-chip,.groupmeta .tag,.groupmeta .campus-chip,.groupmeta .schedule-chip,.groupmeta .duration-chip,.tag,.campus-chip,.schedule-chip,.duration-chip,.termchip,.priority){background:#242b26;color:#c9d2cc}
[data-theme=dark] :is(.marker,.marker.hl-subject,.marker.hl-weekday,.marker.hl-tag,.marker.hl-tier,.marker.hl-period,.termchip .marker.hl-period){color:#fff0a3;background:linear-gradient(transparent 8%,#6a5d25 8%,#6a5d25 94%,transparent 94%)}
[data-theme=dark] :is(th,.groupmore){background:#121613;color:#abb7ae;border-color:var(--line)}

[data-theme=dark] :is(td,th,.grouphead,.filterfoot,.dialoghead,.audio-report-intervals>div,.audio-check-details){border-color:var(--line)}
[data-theme=dark] :is(.rowactions a,.rowactions button,.rowactions .actionmodule .replay-action,.rowactions .actionmodule .intro-action,.rowactions .actionmodule .link-action){background:var(--night-raised);color:#cfdbd2;border-color:#38443b}
[data-theme=dark] :is(.primary,.rowactions .actionmodule .link-action){background:#496e57;color:#f1f6f1;border-color:#668c72}
[data-theme=dark] :is(.period-select,.period-current>span,.filterrow strong,.filterfoot,.filterfoot small,.note,.weekday,.detailmeta,.detailbody small,form label,legend,.bottomnote,.resultbar span,.lesson-schedule,.sync-time,.audio-report-meta,.audio-report-note,.audio-report-stats,.audio-legend,.audio-view-controls,.audio-empty p,.audio-check-summary small,.audio-check-grid span,.snapshot-box small,.teacher-options strong,.teacher-panel small,.unified-dropdown-group,.unified-dropdown-empty){color:var(--muted)}
[data-theme=dark] :is(.period h2,.period-current h2,.audio-report-stats b,.audio-check-grid b,.audio-check-summary.passed strong,.sound-check.passed){color:#b4d4bd}
[data-theme=dark] :is(.sound-check.failed,.sync-time.sync-failed,.audio-check-summary.failed strong,.warning){color:#f3a5a5}
[data-theme=dark] .audio-check-summary.failed{background:#3b2929;border-color:#865653}
[data-theme=dark] .audio-chart svg rect[fill="#fff"]{fill:var(--night-surface)}
[data-theme=dark] .audio-chart svg rect[fill="#e9ece8"]{fill:#1d2520}
[data-theme=dark] .audio-chart svg rect[fill="#f4f8f3"]{fill:#1a241d}
[data-theme=dark] .audio-chart svg text{fill:#b2bfb6}
[data-theme=dark] .audio-chart svg path[stroke="#587b6b"]{stroke:#a7d3b7}
[data-theme=dark] .audio-chart svg line[stroke="#dfe5df"]{stroke:#36423a}
[data-theme=dark] .page-tools button{background:#181e1a;color:#d0dbd3;border-color:#3a483e;box-shadow:0 3px 14px #0004}
[data-theme=dark] .page-tools button:hover{background:#27362c}
[data-theme=dark] input::placeholder,[data-theme=dark] textarea::placeholder{color:#93a397}

/* Keep the main copy action distinct from the quiet OLED surfaces. */
[data-theme=dark] .rowactions .actionmodule button.link-action:not(:disabled),[data-theme=dark] #detailCopy:not(:disabled){background:#52785f;border-color:#70937b;color:#fff;box-shadow:inset 0 1px 0 #ffffff12}
[data-theme=dark] .rowactions .actionmodule button.link-action:not(:disabled):hover,[data-theme=dark] #detailCopy:not(:disabled):hover{background:#577e63;border-color:#86a58f;color:#fff}
[data-theme=dark] .rowactions .actionmodule button.link-action:disabled,[data-theme=dark] #detailCopy:disabled{background:#232825;border-color:#363e38;color:#858e87;box-shadow:none}

/* Short, local feedback; no continuously running animations. */
@media(prefers-reduced-motion:no-preference){
 button,.teacher-picker summary,a.replay-action,.detailbuttons a{transition:background-color .18s ease,color .18s ease,border-color .18s ease,transform .14s ease}
 button:not(:disabled):active,a.replay-action:active,.detailbuttons a:active{transform:scale(.97)}
 .page-tools button:active{transform:scale(.93)}
 .page-tools button:not([hidden]){animation:tool-arrive .2s ease-out}
 .page-tools svg{transform-origin:center}
 dialog[open]{animation:dialog-arrive .2s cubic-bezier(.2,.7,.2,1)}
 .unified-dropdown:popover-open,.teacher-panel:popover-open{animation:menu-arrive .16s ease-out}
}
@media(hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference){
 button:not(:disabled):hover,.detailbuttons a:hover{transform:translateY(-1px)}
 button:not(:disabled):active,.detailbuttons a:active{transform:translateY(0) scale(.97)}
 .rowactions .actionmodule button.link-action:not(:disabled):hover{box-shadow:0 3px 10px #0002}
}
@keyframes tool-arrive{from{opacity:0;transform:translateY(7px) scale(.95)}to{opacity:1;transform:none}}
@keyframes dialog-arrive{from{opacity:0;transform:translateY(8px) scale(.99)}to{opacity:1;transform:none}}
@keyframes menu-arrive{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){
 html{scroll-behavior:auto}
 button,input,select,textarea,.teacher-picker summary,.coursegroup,.page-tools button,dialog[open],.unified-dropdown,.teacher-panel{animation:none!important;transition:none!important}
 .page-tools button:active{transform:none}
}

/* Change the palette once; only the viewport snapshot fades on the compositor. */
html.theme-changing *,html.theme-changing *::before,html.theme-changing *::after{transition:none!important;animation:none!important}
::view-transition{pointer-events:none}
::view-transition-group(root){animation-duration:.22s}
::view-transition-old(root){animation:none;mix-blend-mode:normal}
::view-transition-new(root){animation:theme-reveal .22s ease-out both;mix-blend-mode:normal}
@keyframes theme-reveal{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){::view-transition-group(root),::view-transition-old(root),::view-transition-new(root){animation:none!important}}

/* Quiet local interactions: no polling, page-wide listeners or idle animation. */
.rowactions .replay-action,.detailbuttons a{position:relative}
.rowactions .replay-action::after,.detailbuttons a::after{content:'';position:absolute;height:1px;left:12px;right:12px;bottom:6px;background:currentColor;opacity:.55;transform:scaleX(0);transform-origin:left;pointer-events:none}
.teacher-picker summary{border-color:#d8e1da}
.teacher-picker[open]>summary,select[aria-expanded=true]{border-color:#8ba597;box-shadow:0 0 0 2px #91ad9b18}
.teacher-picker[open]>summary::after{transform:translateY(-25%) rotate(225deg)}
.searchbar input:focus,.teacher-panel input[type=search]:focus,form input:focus,form textarea:focus{border-color:#91ad9b;outline:2px solid #91ad9b26;outline-offset:1px}
[data-theme=dark] .teacher-picker[open]>summary,[data-theme=dark] select[aria-expanded=true]{border-color:#658b71;box-shadow:0 0 0 2px #86a58f18}
@media(prefers-reduced-motion:no-preference){
 .rowactions .replay-action::after,.detailbuttons a::after{transition:transform .18s cubic-bezier(.22,.61,.36,1)}
 .teacher-picker summary::after{transition:transform .18s ease-out,border-color .18s ease-out}
 .searchbar input,.teacher-panel input[type=search],form input,form textarea{transition:border-color .18s ease-out,outline-color .18s ease-out}
 .rowactions .actionmodule .link-action svg,.rowactions .replay-action>span[aria-hidden]{transition:transform .16s ease-out,opacity .16s ease-out}
}
@media(hover:hover) and (pointer:fine){
 .rowactions .replay-action:hover::after,.detailbuttons a:hover::after{transform:scaleX(1)}
 .chip:not(.selected):hover,.teacher-option:not(.selected):hover{border-color:#b6c8bb}
 .groupmore:hover{color:var(--green);background:#edf3ed}
 [data-theme=dark] .groupmore:hover{background:#1b251f;color:#c5ddcd}
 [data-theme=dark] .chip:not(.selected):hover,[data-theme=dark] .teacher-option:not(.selected):hover{border-color:#526c5b}
}
@media(hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference){
 .rowactions .actionmodule .link-action:not(:disabled):hover svg{transform:translateY(-2px)}
 .rowactions .replay-action:hover>span[aria-hidden]{transform:translateX(2px)}
 .unified-dropdown-option:hover,.teacher-option:hover,.chip:hover{transform:none}
 .unified-dropdown-option:active,.teacher-option:active,.chip:active{transform:scale(.99)}
}
.rowactions .replay-action:focus-visible::after,.detailbuttons a:focus-visible::after{transform:scaleX(1)}
@media(prefers-reduced-motion:reduce){
 .rowactions .replay-action::after,.detailbuttons a::after,.teacher-picker summary::after{transition:none!important}
}
