/* Clockface Online components and site layer. Owner: rebrand foundation.
   Part 1 is the design system's components/bundle.css (cfo- classes) with the preview helpers and bare-element
   rules removed, colour mixing replaced by the precomputed tint helpers in cfo-tokens.css and :has() given fallbacks.
   Part 2 (below) is the site layer: focus ring, reduced motion, modal paper base, close buttons and the tool-window shell.
   Package overrides go in css/cfo-<package>.css, which load after this file. */

/* ---------- Base ---------- */
button, input, select, textarea { font-family: inherit; }
[class*="cfo-"], [class*="cfo-"]::before, [class*="cfo-"]::after { box-sizing: border-box; }
.cfo-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Shared text ---------- */
.cfo-overline { display: block; margin: 0; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-secondary); }
.cfo-caption { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.cfo-link { color: var(--accent-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; border-radius: var(--radius-sm); }
.cfo-link:hover { text-decoration-thickness: 2px; }

/* ---------- Focus: one ring everywhere ---------- */
.cfo-btn:focus-visible,
.cfo-icon-btn:focus-visible,
.cfo-tab:focus-visible,
.cfo-chip:focus-visible,
.cfo-input:focus-visible,
.cfo-toast-action:focus-visible,
.cfo-link:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
/* The custom swatch's real input is invisible, so ring the swatch. :focus-within is the fallback where :has() is missing. */
/* --focus (navy by day) is 1.6:1 on the default canvas, so glass chrome rings in --on-glass. */
/* Inside the inverse toast the ring takes the toast's text colour. */
.cfo-toast { --focus: var(--surface); }

/* ---------- Button ---------- */
.cfo-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 44px; min-width: 44px; padding: 0 var(--space-5); border: 1px solid transparent; border-radius: var(--radius-pill);
  font: inherit; font-size: 15px; line-height: 22px; font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
  background: var(--primary); color: var(--on-primary);
  transition: background-color 150ms cubic-bezier(0.4,0,0.2,1), border-color 150ms cubic-bezier(0.4,0,0.2,1),
              box-shadow 150ms cubic-bezier(0.4,0,0.2,1), transform 150ms cubic-bezier(0.4,0,0.2,1);
}
.cfo-btn svg { font-size: 16px; flex-shrink: 0; }
.cfo-btn:hover { box-shadow: var(--shadow-sm); }
.cfo-btn:active { transform: scale(0.98); }
.cfo-btn-secondary { background: var(--surface-subtle); color: var(--text-primary); }
.cfo-btn-secondary:hover { background: var(--surface-hover); box-shadow: none; }
.cfo-btn-outline { background: transparent; border-color: var(--border-control); color: var(--text-primary); }
.cfo-btn-outline:hover { background: var(--surface-subtle); box-shadow: none; }
.cfo-btn-ghost { background: transparent; color: var(--accent-ink); padding: 0 var(--space-3); }
.cfo-btn-ghost:hover { background: var(--surface-subtle); box-shadow: none; }
.cfo-btn-danger { background: var(--danger-tint); color: var(--danger); }
.cfo-btn-danger:hover { border-color: currentColor; box-shadow: none; }
.cfo-btn-plus { background: var(--gold); color: var(--on-primary); }
.cfo-btn-sm { height: 36px; padding: 0 var(--space-4); }
.cfo-btn-sm.cfo-btn-ghost { padding: 0 var(--space-3); }
.cfo-btn-sm::after { content: ""; position: absolute; inset: -5px 0; }
.cfo-btn-sm svg { font-size: 14px; }
.cfo-btn-block { display: flex; width: 100%; }
.cfo-btn:disabled, .cfo-btn[aria-disabled="true"] { opacity: var(--disabled); cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------- IconButton ---------- */
.cfo-icon-btn {
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-secondary); font: inherit; cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.4,0,0.2,1), color 150ms cubic-bezier(0.4,0,0.2,1);
}
.cfo-icon-btn svg { font-size: 18px; }
.cfo-icon-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.cfo-icon-btn-filled { background: var(--surface-subtle); }
.cfo-icon-btn-sm { width: 36px; height: 36px; }
.cfo-icon-btn-sm svg { font-size: 16px; }
.cfo-icon-btn-sm::after { content: ""; position: absolute; inset: -4px; border-radius: var(--radius-pill); }
.cfo-icon-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-primary); }
.cfo-icon-btn:disabled { opacity: var(--disabled); cursor: not-allowed; background: transparent; }

/* ---------- Drawer (customise drawer) and accordion ---------- */
.cfo-drawer {
  display: flex; flex-direction: column; width: 380px; max-width: 100%; height: 100%; overflow: hidden;
  background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-modal);
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}

/* ---------- SegmentedTabs ---------- */
.cfo-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--space-1); padding: var(--space-1); border-radius: var(--radius-md); background: var(--surface-subtle); }
.cfo-tab {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-width: 0; height: 36px; padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-secondary);
  font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color 200ms cubic-bezier(0.4,0,0.2,1), color 200ms cubic-bezier(0.4,0,0.2,1), box-shadow 200ms cubic-bezier(0.4,0,0.2,1);
}
.cfo-tab::after { content: ""; position: absolute; inset: -4px 0; }
.cfo-tab svg { font-size: 14px; }
.cfo-tab:hover { background: var(--surface-hover); color: var(--text-primary); }
.cfo-tab[aria-selected="true"] { background: var(--accent); color: var(--on-primary); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ---------- Chip ---------- */
.cfo-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cfo-chip {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-3);
  border: 1px solid var(--border-control); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-primary);
  font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.4,0,0.2,1), border-color 150ms cubic-bezier(0.4,0,0.2,1);
}
.cfo-chip::after { content: ""; position: absolute; inset: -5px 0; }
.cfo-chip svg { font-size: 13px; }
.cfo-chip:hover { background: var(--surface-hover); }
.cfo-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-primary); font-weight: 600; }
.cfo-chip:disabled { opacity: var(--disabled); cursor: not-allowed; background: var(--surface); }

/* ---------- ToolTile ---------- */
.cfo-tool-icon {
  position: relative; isolation: isolate;
  display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: var(--radius-md);
  background: transparent; color: var(--ink);
}
/* The tool colour at --tile-tint, drawn as a layer so any --tool works without colour mixing. */
.cfo-tool-icon::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--tool, var(--accent)); opacity: var(--tile-tint); }
.cfo-tool-icon svg { font-size: 20px; }

/* ---------- TextField ---------- */
.cfo-field { display: grid; gap: var(--space-2); }
.cfo-field + .cfo-field { margin-top: var(--space-2); }
.cfo-input {
  width: 100%; height: 44px; padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius-md);
  background: var(--surface-subtle); color: var(--text-primary); font: inherit; font-size: 14px; line-height: 20px;
  transition: border-color 150ms cubic-bezier(0.4,0,0.2,1), background-color 150ms cubic-bezier(0.4,0,0.2,1);
}
textarea.cfo-input { height: auto; min-height: 88px; padding: var(--space-3); resize: vertical; }
.cfo-input::placeholder { color: var(--text-tertiary); opacity: 1; }
.cfo-input:hover { border-color: var(--text-secondary); }
.cfo-input:focus { background: var(--surface); }
.cfo-input[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.cfo-input:disabled { opacity: var(--disabled); cursor: not-allowed; border-color: var(--border-control); }
.cfo-field-help { display: flex; align-items: center; gap: var(--space-1); margin: 0; font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.cfo-field-help svg { font-size: 12px; flex-shrink: 0; }
.cfo-field-error { color: var(--danger); }
.cfo-field-inline { display: flex; gap: var(--space-2); }
.cfo-field-inline .cfo-input { flex: 1; min-width: 0; }

/* ---------- Card ---------- */
.cfo-card { display: grid; align-content: start; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-primary); }
.cfo-card-subtle { background: var(--surface-subtle); border-color: transparent; }
.cfo-card-text { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.cfo-card-stat { display: flex; align-items: baseline; gap: var(--space-2); font-size: 32px; line-height: 40px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.cfo-card-stat small { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--text-secondary); }

/* ---------- Modal ---------- */
/* Previews: the scrim fills its scene and grows with the modal instead of covering the viewport. */
.cfo-modal {
  position: relative; display: grid; gap: var(--space-4); width: 100%; max-width: 400px; max-height: calc(100vh - var(--space-8)); overflow-y: auto;
  padding: var(--space-8) var(--space-6) var(--space-6); border-radius: var(--radius-xl);
  background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-modal);
}
.cfo-modal-title { margin: 0; font-size: 22px; line-height: 30px; font-weight: 700; color: var(--ink); }
.cfo-modal-text { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.cfo-or { display: flex; align-items: center; gap: var(--space-3); font-size: 12px; line-height: 16px; color: var(--text-tertiary); }
.cfo-or::before, .cfo-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Toast (inverse snackbar) ---------- */
.cfo-toast {
  display: inline-flex; align-items: center; gap: var(--space-3); max-width: 100%; min-height: 48px;
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4); border-radius: var(--radius-pill);
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-float);
  font-size: 14px; line-height: 20px; font-weight: 500;
}
/* Without an action the toast pads right; with one (.cfo-toast-has-action, or :has() where supported) the action sits flush. */
.cfo-toast { padding-right: var(--space-5); }
.cfo-toast:has(.cfo-toast-action) { padding-right: var(--space-1); }
.cfo-toast-icon { display: grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; border-radius: var(--radius-pill); }
.cfo-toast-icon svg { font-size: 16px; }
.cfo-toast-icon-success { background: var(--primary); color: var(--on-primary); }
.cfo-toast-icon-success svg { font-size: 12px; }
.cfo-toast-text { flex: 1; min-width: 0; }
.cfo-toast-action {
  position: relative; flex-shrink: 0; height: 40px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-pill);
  background: var(--surface-14); color: var(--surface);
  font: inherit; font-size: 14px; line-height: 20px; font-weight: 600; cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.4,0,0.2,1);
}
.cfo-toast-action::after { content: ""; position: absolute; inset: -2px 0; }
.cfo-toast-action:hover { background: var(--surface-24); }

/* ---------- Badge ---------- */
.cfo-badge {
  display: inline-flex; align-items: center; gap: var(--space-1); height: 20px; padding: 0 var(--space-2); border-radius: var(--radius-sm);
  background: var(--surface-subtle); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border);
  font-family: var(--font-sans); font-size: 10px; line-height: 14px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; vertical-align: middle;
}
.cfo-badge svg { font-size: 10px; }
.cfo-badge-beta { background: var(--surface-subtle); color: var(--text-secondary); }
.cfo-badge-plus { background: var(--gold); color: var(--on-primary); box-shadow: none; }
.cfo-badge-new { background: var(--info-tint); color: var(--info); box-shadow: none; }
.cfo-badge-done { background: var(--primary-tint); color: var(--primary-ink); box-shadow: none; }

/* ---------- Notice ---------- */
.cfo-notice {
  --notice: var(--info); --notice-ink: var(--info); --notice-bg: var(--info-tint); --notice-line: var(--info-line);
  display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--notice-line); border-radius: var(--radius-md);
  background: var(--notice-bg); color: var(--text-primary);
  font-size: 14px; line-height: 20px;
}
.cfo-notice-success { --notice: var(--primary); --notice-ink: var(--primary-ink); --notice-bg: var(--primary-tint); --notice-line: var(--primary-line); }
.cfo-notice-danger { --notice: var(--danger); --notice-ink: var(--danger); --notice-bg: var(--danger-tint); --notice-line: var(--danger-line); }
.cfo-notice-warning { --notice: var(--warning); --notice-ink: var(--text-primary); --notice-bg: var(--warning-tint); --notice-line: var(--warning-line); }
.cfo-notice-icon { display: grid; place-items: center; flex-shrink: 0; width: 20px; height: 20px; color: var(--notice-ink); }
.cfo-notice-icon svg { font-size: 16px; }
.cfo-notice-warning .cfo-notice-icon { border-radius: var(--radius-pill); background: var(--warning); color: var(--on-primary); }
.cfo-notice-warning .cfo-notice-icon svg { font-size: 11px; }
.cfo-notice-body { flex: 1; min-width: 0; margin: 0; }
.cfo-notice-title { display: block; font-weight: 600; color: var(--notice-ink); }
.cfo-notice .cfo-icon-btn { margin: calc(var(--space-2) * -1) calc(var(--space-2) * -1) calc(var(--space-2) * -1) 0; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  [class*="cfo-"], [class*="cfo-"]::before, [class*="cfo-"]::after { transition: none !important; animation: none !important; }
  .cfo-btn:active { transform: none; }
}

/* =====================================================================
   SITE LAYER (rebrand foundation)
   ===================================================================== */

/* ---------- Focus: one ring everywhere ----------
   !important stays while inline outline:none remains in the markup. To recolour the ring in a context,
   set --focus on the container instead of outline-color. */
:focus-visible { outline: 2px solid var(--focus) !important; outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
/* Over glass (the person's canvas) the navy ring disappears, so ring in on-glass white. */
.glass-nav, .top-brand, .bottom-app-dock, #pinnedDesktopQuote, #classroomExamBanner { --focus: var(--on-glass); }
/* Switches whose real input is visually hidden: ring the visible track. */
.theme-switch input:focus-visible + .theme-slider,
.strict-switch-compact input:focus-visible + .strict-slider { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Touch ----------
   Double-tap no longer zooms (it fought the dblclick fullscreen handler); pinch zoom stays allowed. */
body { touch-action: manipulation; }

/* ---------- Range inputs (Firefox; WebKit lives in style.css) ---------- */
input[type=range]::-moz-range-track { height: 6px; background: var(--border); border-radius: 3px; border: 0; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-control); cursor: pointer; }

/* ---------- Shared controls stay compact inside admin overlays ---------- */
#adminAnnounceModal .action-btn,
#masterAdminModal .action-btn,
#adminEditUserModal .action-btn,
#adminConfirmDeleteUserModal .action-btn,
#adminGrantSubModal .action-btn,
#adminGrantEmailPreviewModal .action-btn { min-height: 0; border-radius: 8px; font-weight: 500; }
#adminAnnounceModal .custom-input,
#masterAdminModal .custom-input,
#adminEditUserModal .custom-input,
#adminConfirmDeleteUserModal .custom-input,
#adminGrantSubModal .custom-input,
#adminGrantEmailPreviewModal .custom-input { min-height: 0; }

/* ---------- Modal paper base (index.php only) ----------
   Wrapped in :where() so it has zero specificity: a package overrides it with
   "#someModal .community-modal-content { ... !important }" in its own cfo-<package>.css.
   Excluded: the dark profile cards, the exam rules board, Friends (.fh-card), Logo Studio and the admin overlays. */
:where(body#body .community-modal-overlay:not(#userProfileModal):not(#shareProfileModal):not(#invigilatorRulesBoardModal):not(#adminAnnounceModal):not(#masterAdminModal):not(#adminEditUserModal):not(#adminConfirmDeleteUserModal):not(#adminGrantSubModal):not(#adminGrantEmailPreviewModal) > .community-modal-content:not(.fh-card):not(.logo-studio)),
:where(body#body .community-modal-content.cfo-paper) {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-modal) !important;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}

/* Phones: the same modals become bottom sheets. */
@media (max-width: 600px) {
    :where(body#body .community-modal-overlay:not(#userProfileModal):not(#shareProfileModal):not(#invigilatorRulesBoardModal):not(#adminAnnounceModal):not(#masterAdminModal):not(#adminEditUserModal):not(#adminConfirmDeleteUserModal):not(#adminGrantSubModal):not(#adminGrantEmailPreviewModal):not(#friendsHubModal):not(#logoStudioModal)) { align-items: flex-end !important; }
    :where(body#body .community-modal-overlay:not(#userProfileModal):not(#shareProfileModal):not(#invigilatorRulesBoardModal):not(#adminAnnounceModal):not(#masterAdminModal):not(#adminEditUserModal):not(#adminConfirmDeleteUserModal):not(#adminGrantSubModal):not(#adminGrantEmailPreviewModal):not(#friendsHubModal):not(#logoStudioModal) > .community-modal-content:not(.fh-card):not(.logo-studio)),
    :where(body#body .community-modal-content.cfo-paper) {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        margin: 0 !important;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
        border-bottom: 0 !important;
        transform: translateY(24px) !important;
    }
    :where(body#body .community-modal-overlay:not(#userProfileModal):not(#shareProfileModal):not(#invigilatorRulesBoardModal):not(#adminAnnounceModal):not(#masterAdminModal):not(#adminEditUserModal):not(#adminConfirmDeleteUserModal):not(#adminGrantSubModal):not(#adminGrantEmailPreviewModal):not(#friendsHubModal):not(#logoStudioModal).show-modal > .community-modal-content:not(.fh-card):not(.logo-studio)),
    :where(body#body .community-modal-overlay.show-modal > .community-modal-content.cfo-paper) { transform: translateY(0) !important; }
}

/* ---------- Close buttons (modals and tool windows) ---------- */
.community-modal-content .close-modal,
.close-window {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: var(--radius-pill) !important;
    background: none !important;
    color: var(--text-secondary) !important;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.community-modal-content .close-modal:hover,
.close-window:hover { background: var(--surface-hover) !important; color: var(--text-primary) !important; }
.community-modal-content > .close-modal { position: absolute !important; top: var(--space-2) !important; right: var(--space-2) !important; z-index: 2; }
.community-modal-content .community-header .close-modal,
.community-modal-content .notif-modal-header .close-modal { position: static !important; }
/* Keep the 44px target without making the window header taller. */
.window-header .close-window { margin: -8px -8px -8px 0; }

/* ---------- Tool-window shell ----------
   Legacy .draggable-window:not(.cfo-paper) keeps its dark glass (a dark island, see cfo-tokens.css).
   A package adds .cfo-paper to a window root once that whole window is converted. */
.draggable-window.cfo-paper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    color: var(--text-primary);
}
.draggable-window.cfo-paper .window-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--ink);
    font-weight: 600;
}
.draggable-window.cfo-paper .action-icon { color: var(--text-secondary); }
.draggable-window.cfo-paper .action-icon:not(i):not(svg) {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: -8px 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: none;
    font: inherit;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.draggable-window.cfo-paper .action-icon:hover { background: var(--surface-hover); color: var(--text-primary); }
@media (max-width: 768px) {
    .draggable-window.cfo-paper {
        border: none !important;
        border-top: 1px solid var(--border) !important;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
        box-shadow: var(--shadow-modal) !important;
    }
    .draggable-window.cfo-paper .window-header { border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important; }
    .draggable-window.cfo-paper .window-header::before { background: var(--border-control) !important; }
}

/* ---------- Status tints ---------- */
.cfo-tint-success { background: var(--primary-tint); color: var(--primary-ink); }
.cfo-tint-gold { background: var(--gold-tint); color: var(--gold-ink); }

/* ---------- Loader logo when Auto follows a dark OS without JS ---------- */
@media (prefers-color-scheme: dark) {
    body.theme-auto .loader-logo { filter: brightness(0) invert(1); }
}

/* ---------- Reduced motion: movement stops, only fades remain ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .draggable-window, .draggable-window.show-window, .draggable-window:not(.show-window) { transition-duration: .01ms !important; animation: none !important; }
    .preset-timer-btn { transition: none !important; }
    .live-bg-aurora::before { animation: none !important; }
    body.fade { animation-duration: 240s !important; animation-iteration-count: infinite !important; animation-play-state: paused !important; }
    .loader-logo, .loader-spinner { animation: none !important; }
    :where(body#body .community-modal-overlay:not(#userProfileModal):not(#shareProfileModal):not(#invigilatorRulesBoardModal):not(#adminAnnounceModal):not(#masterAdminModal):not(#adminEditUserModal):not(#adminConfirmDeleteUserModal):not(#adminGrantSubModal):not(#adminGrantEmailPreviewModal) > .community-modal-content:not(.fh-card):not(.logo-studio)),
    :where(body#body .community-modal-content.cfo-paper) { transform: none !important; }
}

/* Touch screens: 16px text fields so iOS doesn't zoom in on focus. Pinch zoom stays allowed; inline larger sizes still win. */
@media (pointer: coarse) {
    input.custom-input, select.custom-input, textarea.custom-input,
    input.cfo-input, select.cfo-input, textarea.cfo-input { font-size: 16px; }
}
