/* ---- layers.css ---- */
/* Eureka 3 stylesheet. Layer order: base (resets, typography), layout (frame, row grids, modes),
   components (controls, panels, dialogs), theme (tokens, accessible themes, forced colors).
   Hosts override anything by writing unlayered CSS, which always wins over layered rules (08 THEME-02). */
@layer eureka.base, eureka.layout, eureka.components, eureka.theme;

/* GENERATED from spec/data/theme-tokens.json: token defaults (08 THEME-01/02). Hosts override on .eureka-root or any ancestor. */
@layer eureka.theme {
  :where(.eureka-root) {
    --active: #3697cd;
    --active-darker: #297aa7;
    --bg-color: #ececec;
    --color: #081922;
    --light-bg: white;
    --link-color: #1f6aa5;
    --border-width: 1px;
    --border-style: solid;
    --border-color: #e4e4e4;
    --border-shadow-color: #e4e4e4;
    --border-color-dangerous: #b80000;
    --panel-border-color: #dddddd;
    --button-bg: white;
    --button-color: #555555;
    --dangerous: #b80000;
    --subtle: #556c88;
    --very-subtle: #dddddd;
    --very-subtle-icon-opacity: 0.42;
    --media-cell-background: transparent;
    --tree-line-height: 1.6;
    --tree-course-line-height: 2.75;
    --notification-background: #d9edf7;
    --notification-color: #1d6e95;
    --notification-border-color: var(--notification-color);
    --notification-focus-color: #247fad;
    --hint-opacity: 0.65;
  }
  .black-on-white, .black-on-white .eureka-root {
    --panel-border-color: rgb(8,8,8);
    --light-bg: white;
    --border-width: 2px;
    --button-color: rgb(20,20,20);
    --subtle: rgb(20,20,20);
    --border-style: solid;
    --border-color: rgb(8,8,8);
    --very-subtle: rgb(40,40,40);
    --very-subtle-icon-opacity: 1;
  }
  .white-on-black, .white-on-black .eureka-root {
    --bg-color: rgb(8,8,8);
    --color: white;
    --panel-border-color: white;
    --light-bg: rgb(8,8,8);
    --border-width: 2px;
    --button-bg: transparent;
    --button-color: rgb(220,220,220);
    --subtle: rgb(220,220,220);
    --border-style: solid;
    --border-color: white;
    --very-subtle: rgb(120,120,120);
    --active: yellow;
    --dangerous: red;
    --link-color: yellow;
    --very-subtle-icon-opacity: 1;
  }
  @media (forced-colors: active) {
    .eureka-root {
      --color: CanvasText;
      --bg-color: Canvas;
      --light-bg: Canvas;
      --button-bg: ButtonFace;
      --button-color: ButtonText;
      --border-color: ButtonBorder;
      --panel-border-color: CanvasText;
      --active: Highlight;
      --link-color: LinkText;
      --dangerous: CanvasText;
      --subtle: GrayText;
      --very-subtle: GrayText;
      --very-subtle-icon-opacity: 1;
      --border-width: 2px;
    }
  }
}


/* ---- base.css ---- */
@layer eureka.base {
  .eureka-root {
    container: eureka / inline-size;
    box-sizing: border-box;
    font: 400 0.8125rem/1.375 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color);
    background: var(--bg-color);
    accent-color: var(--active);
    padding: 0.5rem;
    min-inline-size: 0;
  }
  .eureka-root *, .eureka-root *::before, .eureka-root *::after { box-sizing: inherit; }
  .eureka :is(h2, h3) { font-size: 1.25em; font-weight: 400; margin: 0 0 0.5rem; color: var(--color); }
  .eureka a { color: var(--link-color); }
  .eureka a[role="presentation"] { color: currentColor; text-decoration: none; }
  .eureka img, .eureka video, .eureka object, .eureka picture { max-inline-size: 100%; block-size: auto; object-fit: contain; }
  .eureka table { border-collapse: collapse; border-spacing: 0; inline-size: 100%; }
  .eureka th { font-weight: 700; }
  .eureka [hidden] { display: none !important; }
  .eureka svg.icon { inline-size: 1em; block-size: 1em; fill: currentColor; vertical-align: -0.125em; }
  .visually-hidden, .eureka .visually-hidden {
    position: absolute !important; inline-size: 1px !important; block-size: 1px !important;
    padding: 0 !important; margin: -1px !important; border: 0 !important;
    overflow: hidden !important; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .eureka :focus-visible { outline: 2px solid var(--active); outline-offset: 2px; }
  .eureka tr:focus-visible, .eureka [role="toolbar"]:focus-visible { outline-offset: -2px; }
  @media (prefers-reduced-motion: reduce) {
    .eureka-root *, .eureka-root *::before, .eureka-root *::after { transition: none !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  }
}

/* ---- frame.css ---- */
@layer eureka.layout {
  /* Wide frame (04 LAY-10..13): the instance fills its container's block size; the listing body scrolls. */
  /* The custom element host is a transparent flex link between .eureka-root and .eureka. */
  eureka-browser { display: flex; flex-direction: column; flex: 1 1 auto; min-block-size: 0; min-inline-size: 0; }
  .eureka { display: flex; flex-direction: column; min-block-size: 0; }
  .eureka:focus { outline: none; } /* the root takes programmatic focus (tabindex=-1) so shortcuts work after a click inside */
  .eureka > .eureka__browse-content { display: flex; flex-direction: column; gap: 0.5rem; min-block-size: 0; flex: 1 1 auto; }
  .eureka__stage { display: flex; flex-direction: column; min-inline-size: 0; min-block-size: 0; flex: 1 1 100%; }
  .eureka__stage__filter-view { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; margin-block-end: 0.5rem; }
  .eureka__stage__filter-view > .eureka__heading { display: flex; align-items: center; gap: 0.5rem; margin-inline-end: auto; }
  .eureka__stage__filter-view h2 { margin: 0; }
  .eureka__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding-block-end: 0.5rem; }
  .eureka__toolbar > .eureka__layout-chooser { margin-inline-start: auto; }
  /* flex-basis auto + min-size 0: fills and scrolls inside a bounded root, grows with content in an unbounded one */
  .eureka__table-wrapper { display: flex; flex-direction: column; min-block-size: 0; flex: 1 1 auto; }

  @container eureka (min-width: 40em) {
    .eureka-root:has(> .eureka), .eureka-root:has(> eureka-browser) { display: flex; flex-direction: column; }
    .eureka { flex: 1 1 auto; min-block-size: 0; }
    .eureka > .eureka__browse-content { flex-direction: row; }
    .eureka__pathbrowser { flex: 0 0 14rem; display: flex; flex-direction: column; min-block-size: 0; }
    .eureka__pathbrowser .eureka__tree { flex: 1 1 0; overflow: auto; min-block-size: 0; }
    .eureka__pathbrowser .eureka__drop-area { flex: 0 1 12rem; }
    .eureka__table-wrapper > .eureka__table { display: flex; flex-direction: column; min-block-size: 0; flex: 1 1 auto; }
    .eureka__table > thead { flex: 0 0 auto; display: block; scrollbar-gutter: stable; }
    .eureka__table > tbody { flex: 1 1 auto; display: block; min-block-size: 0; overflow-y: auto; scrollbar-gutter: stable; overscroll-behavior: contain; }
  }
  /* The wide frame needs a bounded block size to scroll inside; a host gives .eureka-root a height (100vh in the demo). */
  .eureka-root.eureka-root--fill, .eureka-root:fullscreen { block-size: 100vh; block-size: 100dvh; overflow: auto; display: flex; flex-direction: column; }
  .eureka-root:fullscreen { inline-size: 100vw; background: var(--bg-color); }

  /* Narrow frame (LAY-14/15) */
  @container eureka (max-width: 39.99em) {
    .eureka__pathbrowser { margin-block-end: 0.5rem; }
    .eureka__notification-wrapper.eureka__sticky-bar { position: sticky; inset-block-start: 0; z-index: 10; }
    .eureka__toolbar { flex-direction: column; align-items: stretch; }
    .eureka__toolbar > * { inline-size: 100%; }
    .eureka__toolbar label { display: block; margin-block-end: 0.25rem; }
    .eureka__toolbar select, .eureka__toolbar input[type="search"] { inline-size: 100%; }
    .eureka__toolbar > .eureka__layout-chooser { margin-inline-start: 0; }
    .eureka__stage__filter-view > .eureka__heading { flex-basis: 100%; }
  }
}

/* ---- listing.css ---- */
@layer eureka.layout {
  /* Rows as grids (04 §3). Cells map to named areas by class; a cell with no area in the current template is hidden. */
  .eureka__table > thead > tr, .eureka__table > tbody > tr { display: grid; gap: 0; align-items: center; }
  .eureka__table > tbody > tr.eureka__empty-row { display: block; }
  .eureka__table > tbody.empty { display: flex; justify-content: center; align-items: center; text-align: center; min-block-size: 8rem; }
  .eureka__table > tbody.empty td { display: block; }

  .eureka__table .eureka__choose, .eureka__table th.eureka__choose { grid-area: choose; }
  .eureka__table .eureka__select, .eureka__table th.eureka__select { grid-area: radio; }
  .eureka__table .eureka__td-media, .eureka__table .eureka__th-media { grid-area: media; }
  .eureka__table .eureka__td-filename, .eureka__table .eureka__th-filename { grid-area: name; }
  .eureka__table .eureka__context-row { grid-area: actions; }
  .eureka__table .eureka__th-actions { grid-area: none; }
  .eureka__table .eureka__dimensions, .eureka__table .eureka__th-dimensions { grid-area: dimensions; }
  .eureka__table .eureka__file-size, .eureka__table .eureka__th-file-size { grid-area: file-size; }
  .eureka__table .eureka__edited-on, .eureka__table .eureka__th-edited-on { grid-area: edited-on; }

  .eureka__table td, .eureka__table th { padding: 0.25rem 0.5rem; min-inline-size: 0; overflow-wrap: anywhere; }
  .eureka__table td.eureka__td-media { display: flex; align-items: center; gap: 0.5rem; min-block-size: 2rem; background: var(--media-cell-background); }
  .eureka__table tbody > tr { border-block-end: var(--border-width) var(--border-style) var(--border-color); content-visibility: auto; contain-intrinsic-block-size: auto 4rem; }
  .eureka__table tbody > tr:focus-within .eureka__td-filename, .eureka__focused-media-item .eureka__td-filename { font-weight: 700; }
  .eureka__table tbody > tr:target .eureka__td-media > * { outline: 3px solid #32ab9a; }

  /* Table and list modes: wide (LAY-20) */
  @container eureka (min-width: 40em) {
    .eureka:is([data-view="table"], [data-view="list"]) .eureka__table > :is(thead, tbody) > tr {
      grid-template-columns: minmax(0, 5fr) minmax(0, 3fr) var(--eureka-col-dimensions, 6.5rem) var(--eureka-col-size, 6rem) var(--eureka-col-date, 6rem);
      grid-template-areas: "media name dimensions file-size edited-on";
    }
    .eureka:is([data-view="table"], [data-view="list"]) .eureka__table > tbody > tr {
      grid-template-areas: "media name dimensions file-size edited-on" "actions actions actions actions actions";
    }
    .eureka:is([data-view="table"], [data-view="list"])[data-choose="multiple"] .eureka__table > :is(thead, tbody) > tr {
      grid-template-columns: 2rem minmax(0, 5fr) minmax(0, 3fr) var(--eureka-col-dimensions, 6.5rem) var(--eureka-col-size, 6rem) var(--eureka-col-date, 6rem);
      grid-template-areas: "choose media name dimensions file-size edited-on";
    }
    .eureka:is([data-view="table"], [data-view="list"])[data-choose="multiple"] .eureka__table > tbody > tr {
      grid-template-areas: "choose media name dimensions file-size edited-on" "actions actions actions actions actions actions";
    }
    .eureka:is([data-view="table"], [data-view="list"])[data-choose="single"] .eureka__table > :is(thead, tbody) > tr {
      grid-template-columns: 2.25rem minmax(0, 5fr) minmax(0, 3fr) var(--eureka-col-dimensions, 6.5rem) var(--eureka-col-size, 6rem) var(--eureka-col-date, 6rem);
      grid-template-areas: "radio media name dimensions file-size edited-on";
    }
    .eureka:is([data-view="table"], [data-view="list"])[data-choose="single"] .eureka__table > tbody > tr {
      grid-template-areas: "radio media name dimensions file-size edited-on" "actions actions actions actions actions actions";
    }
    .eureka:is([data-view="table"], [data-view="list"]) .eureka__table :is(td, th):not(.eureka__td-media, .eureka__th-media, .eureka__choose, .eureka__select, .eureka__context-row) { text-align: end; }
    .eureka[data-view="table"] .eureka__table .eureka__td-media img, .eureka[data-view="table"] .eureka__table .eureka__td-media picture { max-block-size: 20vh; }
    .eureka[data-view="table"].eureka__enlarge-focused-rows .eureka__table tr:focus-within .eureka__td-media img { max-block-size: 30vh; }
  }
  /* Table and list modes: narrow (LAY-23) */
  @container eureka (max-width: 39.99em) {
    .eureka:is([data-view="table"], [data-view="list"]) .eureka__table > thead {
      position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); margin: -1px;
    }
    .eureka[data-view="table"] .eureka__table > tbody > tr { grid-template-areas: "media" "name" "actions"; grid-template-columns: 1fr; }
    .eureka[data-view="list"] .eureka__table > tbody > tr { grid-template-areas: "name" "actions"; grid-template-columns: 1fr; }
    .eureka:is([data-view="table"], [data-view="list"])[data-choose="multiple"] .eureka__table > tbody > tr { grid-template-areas: "choose media" "name name" "actions actions"; grid-template-columns: 2.25rem 1fr; }
    .eureka:is([data-view="table"], [data-view="list"])[data-choose="single"] .eureka__table > tbody > tr { grid-template-areas: "radio media" "name name" "actions actions"; grid-template-columns: 2.25rem 1fr; }
    .eureka[data-view="list"] .eureka__table .eureka__td-media { display: none; }
    .eureka:is([data-view="table"], [data-view="list"]) .eureka__table :is(.eureka__dimensions, .eureka__file-size, .eureka__edited-on) { display: none; }
    .eureka:is([data-view="table"], [data-view="list"]) .eureka__table .eureka__td-media { justify-content: center; }
    .eureka:is([data-view="table"], [data-view="list"]) .eureka__table .eureka__td-filename { text-align: center; }
  }

  /* Actions row (LAY-21): shown for the row that has focus within. */
  .eureka__table .eureka__context-row { display: none; padding-block: 0.5rem; }
  .eureka__table tbody > tr:focus-within > .eureka__context-row, .eureka__table tbody > tr.eureka__focused-media-item > .eureka__context-row { display: block; }
  .eureka__table .eureka__context-row .eureka__context-buttons { inline-size: 100%; display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: space-between; }
}

/* ---- modes.css ---- */
@layer eureka.layout {
  /* Thumb, grid and masonry (04 LAY-30..34): only the media (and choose) cells show; rows flow as items. */
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__table > thead { display: none !important; }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__table td:not(.eureka__td-media, .eureka__choose, .eureka__select, [colspan]) { display: none; }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__table > tbody:not(.empty) { display: flex !important; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 0.5rem; padding: 0.25rem; }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__table > tbody > tr { display: block; border: 0; flex: 0 1 auto; position: relative; padding: 0.25rem; } /* room for the rings: content-visibility: auto clips paint to the row (06 A11Y-56) */
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__table td.eureka__td-media { display: flex; justify-content: center; inline-size: 100%; padding: 0; }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__table td.eureka__choose { display: block; position: absolute; inset-block-start: 0.25rem; inset-inline-start: 0.25rem; z-index: 1; padding: 0; }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__table .eureka__td-media > * { inline-size: 100%; }

  .eureka[data-view="thumb"] .eureka__table > tbody > tr { flex-basis: 42cqi; max-inline-size: 42cqi; }
  .eureka[data-view="grid"] .eureka__table > tbody > tr { flex-basis: 100%; max-inline-size: 100%; }
  @container eureka (min-width: 40em) {
    .eureka[data-view="thumb"] .eureka__table > tbody > tr { flex-basis: 16cqi; max-inline-size: 16cqi; }
    .eureka[data-view="grid"] .eureka__table > tbody > tr { flex-basis: 25cqi; max-inline-size: 25cqi; }
  }

  /* Masonry tier 2 (LAY-34): CSS multi-column layout. Items keep their aspect ratio and pack down each column;
     DOM order (sort order, arrow-key order) runs down a column, then the next. */
  .eureka[data-view="masonry"] .eureka__table > tbody:not(.empty) { display: block !important; columns: 2; column-gap: 0.5rem; padding: 0.25rem; }
  .eureka[data-view="masonry"] .eureka__table > tbody > tr { display: block; inline-size: 100%; max-inline-size: none; break-inside: avoid; margin-block-end: 0.5rem; }
  .eureka[data-view="masonry"] .eureka__table .eureka__td-media > * { inline-size: 100%; block-size: auto; }
  @container eureka (min-width: 40em) {
    .eureka[data-view="masonry"] .eureka__table > tbody:not(.empty) { columns: 10rem; }
  }
  /* Masonry tier 1: native, either syntax. */
  @supports (grid-template-rows: masonry) {
    @container eureka (min-width: 40em) {
      .eureka[data-view="masonry"] .eureka__table > tbody:not(.empty) { display: grid !important; columns: auto; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); grid-template-rows: masonry; grid-auto-rows: auto; gap: 0.5rem; }
      .eureka[data-view="masonry"] .eureka__table > tbody > tr { margin-block-end: 0; }
    }
  }
  @supports (display: masonry) {
    @container eureka (min-width: 40em) {
      .eureka[data-view="masonry"] .eureka__table > tbody:not(.empty) { display: masonry !important; columns: auto; masonry-template-tracks: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.5rem; }
      .eureka[data-view="masonry"] .eureka__table > tbody > tr { margin-block-end: 0; }
    }
  }

  /* List mode media size (LAY-22) */
  .eureka[data-view="list"] .eureka__table .eureka__td-media :is(img, video, picture) { max-inline-size: 10vh; max-block-size: 10vh; }
  .eureka[data-view="list"] .eureka__table > tbody > tr { padding-block: 0.25rem; }
}

/* ---- components.css ---- */
@layer eureka.components {
  /* Buttons and controls */
  .eureka :is(button, .button, input[type="file"]::file-selector-button), .eureka label[for*="upload"] {
    font: inherit; background: var(--button-bg); color: var(--button-color); border: 0; border-radius: 3px;
    box-shadow: 0 0 0 var(--border-width) var(--border-color); padding: 0.5em 0.75em; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.2;
    min-block-size: 24px; min-inline-size: 24px;
  }
  .eureka :is(button, .button):hover { background: var(--active-darker); color: #fff; box-shadow: 0 0 0 var(--border-width) var(--active-darker); }
  .eureka :is(button, .button):disabled { opacity: 0.5; cursor: not-allowed; background: var(--button-bg); color: var(--button-color); }
  .eureka :is(button, .button).eureka__primary { background: var(--active-darker); color: #fff; box-shadow: 0 0 0 var(--border-width) var(--active-darker); }
  .eureka :is(button, .button).eureka__primary:hover { background: color-mix(in srgb, var(--active-darker), black 18%); }
  .eureka :is(button, .button).dangerous { color: var(--dangerous); }
  .eureka :is(button, .button).dangerous:hover { background: var(--dangerous); color: #fff; box-shadow: 0 0 0 var(--border-width) var(--border-color-dangerous); }
  .eureka :where(select, input[type="text"], input[type="search"], input[type="number"], textarea) { /* :where, so a plain `.eureka select` (and a host) can override these without matching the attribute selector's specificity */
    font: inherit; color: var(--color); background: var(--light-bg); border: var(--border-width) var(--border-style) var(--border-color); border-radius: 3px; padding: 0.4em 0.5em; min-block-size: 24px;
  }
  /* Our own caret on selects: the native one hugs the edge and no padding moves it. Two gradient strokes form a chevron in currentColor, so every theme keeps its text colour. */
  .eureka select { --select-caret: 0.35em; appearance: none; padding-inline-end: calc(1em + 2 * var(--select-caret)); background-repeat: no-repeat; background-size: var(--select-caret) var(--select-caret);
    background-image: linear-gradient(45deg, transparent calc(50% - 0.75px), currentColor calc(50% - 0.75px) calc(50% + 0.75px), transparent calc(50% + 0.75px)), linear-gradient(-45deg, transparent calc(50% - 0.75px), currentColor calc(50% - 0.75px) calc(50% + 0.75px), transparent calc(50% + 0.75px));
    background-position: right calc(0.5em + var(--select-caret) - 1px) center, right 0.5em center; } /* the boxes overlap by a pixel so the two strokes meet in a point instead of two clipped ends */
  .eureka select:dir(rtl) { background-position: left 0.5em center, left calc(0.5em + var(--select-caret) - 1px) center; }
  @media (forced-colors: active) { .eureka select { appearance: auto; background-image: none; padding-inline-end: 0.5em; } } /* the system caret, in system colours */
  .eureka input[type="file"] { max-inline-size: 100%; }
  .eureka label { cursor: pointer; }
  @media (pointer: coarse) { .eureka :is(button, .button, select, input, .eureka__tree-link, summary) { min-block-size: 44px; } .eureka__tree { --tree-line-height: var(--tree-course-line-height); } }

  /* Button bars */
  .eureka__button-bar, .flex-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
  .eureka__choose-bar { justify-content: flex-end; margin-block-start: 0.5rem; }
  .eureka__choose-bar > .dangerous { margin-inline-end: auto; }
  .eureka__bulk-form { display: contents; }
  .eureka__choose-radio { display: inline-flex; gap: 0.25rem 0.5rem; align-items: center; border: 0; padding: 0; margin: 0; }
  .eureka__choose-radio legend { float: inline-start; padding: 0; margin-inline-end: 0.5rem; }
  .eureka__search-bar { display: inline-flex; gap: 0.5rem; align-items: center; }
  .eureka__sort-select { display: inline-flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
  .eureka__layout-chooser fieldset { border: 0; padding: 0; margin: 0; }
  .eureka__icon-radio-btns { display: inline-flex; gap: 0.25rem; }
  .eureka__icon-radio-btns input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; pointer-events: none; }
  .eureka__icon-radio-btns label { display: inline-grid; place-items: center; inline-size: 2.25rem; block-size: 2.25rem; border-radius: 3px; color: var(--subtle); font-size: 1.25rem; }
  .eureka__icon-radio-btns input:checked + label { color: var(--active); box-shadow: inset 0 0 0 2px var(--active); }
  .eureka__icon-radio-btns input:focus-visible + label { outline: 2px solid var(--active); outline-offset: 2px; }
  .eureka__upload-form form { display: inline-flex; align-items: center; gap: 0.5rem; }
  .eureka__upload-form input[type="file"]:not([disabled]) { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; }
  .eureka[data-level="0"] .eureka__upload-form input[type="file"] { position: static; opacity: 1; inline-size: auto; block-size: auto; }
  .eureka__upload-form input[type="file"]:focus-visible + label { outline: 2px solid var(--active); outline-offset: 2px; }

  /* Panels */
  .eureka__pathbrowser, .eureka__table-wrapper > .eureka__table, .eureka__pathbar, .eureka__notification { background: var(--light-bg); border: var(--border-width) var(--border-style) var(--panel-border-color); border-radius: 0.25rem; }
  .eureka__pathbrowser { padding: 0.5rem; gap: 0.5rem; display: flex; flex-direction: column; }
  .eureka__media-source-selector select { inline-size: 100%; }
  /* The list rhythm of native Mac file browsers (Transmit, Finder: 12px text, 16px folder icons, 7px from icon to name) on rows that never drop below the 24px target floor of WCAG 2.5.8; their 20px row pitch would (06 A11Y-40). */
  .eureka__tree { --tree-row-size: max(24px, calc(var(--tree-line-height) * 1em)); font-size: calc(12em / 13); line-height: var(--tree-line-height); color: var(--subtle); }
  .eureka__tree-row { display: flex; align-items: center; gap: 0.25rem; min-inline-size: 0; min-block-size: var(--tree-row-size); }
  .eureka__tree .icon { inline-size: calc(16em / 12); block-size: calc(16em / 12); }
  .eureka__tree-toggle, .eureka__tree-leaf { flex: none; display: inline-flex; align-items: center; }
  .eureka__tree-leaf { padding-inline-start: calc(0.45em + 0.5rem); } /* the width of a disclosure marker, so leaves line up */
  .eureka__tree summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.25rem; min-block-size: var(--tree-row-size); }
  .eureka__tree summary::-webkit-details-marker { display: none; }
  .eureka__tree summary::before { content: ""; inline-size: 0.45em; block-size: 0.45em; border-inline-end: 1.5px solid currentColor; border-block-end: 1.5px solid currentColor; transform: translateY(-15%) rotate(-45deg); margin-inline-end: 0.25rem; flex: none; transition: transform 120ms; } /* a small chevron; the 24px/44px target comes from the summary */
  .eureka__tree details[open] > summary::before { transform: translateY(-25%) rotate(45deg); }
  .eureka__tree details:not([open]) > summary .eureka__icon-open, .eureka__tree details[open] > summary .eureka__icon-closed { display: none; }
  /* children follow the open state of their disclosure (the store mirrors it in tree.open) */
  .eureka__tree-node:has(> .eureka__tree-row > details:not([open])) > .eureka__tree-children { display: none; }
  .eureka__tree-children { padding-inline-start: 1rem; }
  .eureka .eureka__tree-link { background: none; border: 0; box-shadow: none; padding: 0 0.25em; color: inherit; font: inherit; min-block-size: var(--tree-row-size); min-inline-size: 24px; text-align: start; overflow-wrap: anywhere; } /* the row, its disclosure and its link share --tree-row-size: max(24px, --tree-line-height × 1em), 44px under coarse pointers (KEY-C1, WCAG 2.5.8) */
  @media (pointer: coarse) { .eureka__tree { --tree-row-size: max(44px, calc(var(--tree-line-height) * 1em)); } }
  .eureka .eureka__tree-link:hover { color: var(--link-color); background: none; box-shadow: none; }
  .eureka .eureka__tree-link[aria-current="page"] { color: var(--link-color); font-weight: 700; } /* link colour: AA on the panel background in every theme */
  .eureka button.eureka__drop-area { border: 2px dashed var(--very-subtle); border-radius: 0.25rem; display: grid; place-items: center; min-block-size: 6rem; font-size: 3rem; color: var(--very-subtle); background: transparent; box-shadow: none; padding: 0.5rem; inline-size: 100%; }
  .eureka button.eureka__drop-area:hover { background: transparent; color: var(--active); border-color: var(--active); }
  .eureka__drop-area .icon { opacity: var(--very-subtle-icon-opacity); }
  .eureka .eureka__drop-area.eureka__drop-area--active, .eureka .eureka__drop-area:focus-visible { border-color: var(--active); color: var(--active); }
  .eureka.eureka__dragover .eureka__table-wrapper > .eureka__table { outline: 2px dashed var(--active); outline-offset: -2px; }
  .eureka__tree-bar { justify-content: space-between; }
  .eureka__tree-bar > * { flex: 1 1 0; text-align: center; }

  /* Path bar */
  .eureka__pathbar { padding: 0.5rem; margin-block-start: 0.5rem; }
  .eureka__pathbar textarea { inline-size: 100%; resize: none; margin-block-start: 0.5rem; }
  .eureka__pathbar__preview :is(img, video, picture, object) { max-block-size: 30vh; }
  @container eureka (min-width: 40em) { .eureka__hide-for-mobile-up { display: none; } }

  /* Notifications */
  .eureka__notification-wrapper { display: grid; gap: 0.5rem; }
  .eureka__notification-wrapper:not(:has(.eureka__notification)) { display: none; }
  .eureka__notifications { display: grid; gap: 0.5rem; }
  .eureka__notification { position: relative; padding: 0.5rem 2.5rem; text-align: center; background: var(--notification-background); color: var(--notification-color); border-color: var(--notification-border-color); margin-block-end: 0.5rem; }
  .eureka__notification p { margin: 0; }
  .eureka__notification a { color: currentColor; }
  /* The dismiss button is bare: no fill, no ring, just the glyph; its padding and the 24px minimum keep the hit area. `.eureka` is needed to outrank the generic button rule. */
  .eureka .eureka__notification button { position: absolute; inset-block-start: 0.25rem; inset-inline-end: 0.25rem; background: transparent; box-shadow: none; color: currentColor; padding: 0.25rem; }
  .eureka .eureka__notification button:hover, .eureka .eureka__notification button:focus-visible { color: var(--notification-focus-color); background: transparent; box-shadow: none; }
  .eureka__notification.eureka__dangerous { --notification-background: #f7a2a2; --notification-color: #911912; --notification-border-color: #911912; --notification-focus-color: #911912; }

  /* Empty state and spinner */
  .eureka__notice { padding: 1rem; color: var(--subtle); }
  @keyframes eureka-spin { to { transform: rotate(360deg); } }
  .eureka .spinner .icon { animation: eureka-spin 1s linear infinite; }

  /* Dialogs */
  .eureka__modal { border: var(--border-width) var(--border-style) var(--panel-border-color); border-radius: 0.25rem; padding: 0; color: var(--color); background: var(--light-bg); inline-size: min(32rem, 90vw); }
  .eureka__modal::backdrop { background: rgb(0 0 0 / 0.4); }
  .eureka__modal.eureka__greedy { inline-size: min(64rem, 95vw); }
  .eureka__modal-panel { padding: 1rem; display: grid; gap: 0.75rem; }
  .eureka__modal-panel form { display: grid; gap: 0.5rem; }
  .eureka__modal-panel input[type="text"] { inline-size: 100%; }
  .eureka__modal-panel .flex-bar > .growable { flex: 1 1 0; }
  .eureka__modal label.dangerous { color: var(--dangerous); }
  /* shortcuts reference (05 KEY-A5) */
  .eureka__modal.eureka__shortcuts-modal { inline-size: min(40rem, 92vw); max-block-size: 90vh; }
  .eureka__shortcuts-modal .eureka__modal-panel { max-block-size: calc(90vh - 2 * var(--border-width, 1px)); overflow: auto; box-sizing: border-box; }
  .eureka__shortcuts { inline-size: 100%; border-collapse: collapse; font-size: 0.9375em; }
  .eureka__shortcuts caption { text-align: start; font-weight: 700; padding-block: 0.5rem 0.25rem; }
  .eureka__shortcuts th, .eureka__shortcuts td { text-align: start; padding: 0.3rem 0.5rem 0.3rem 0; border-block-end: 1px solid var(--very-subtle); vertical-align: top; font-weight: 400; }
  .eureka__shortcuts td { white-space: nowrap; text-align: end; padding-inline-end: 0; }
  .eureka kbd { display: inline-block; font: 0.875em ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.4; padding: 0 0.35em; border: 1px solid var(--subtle); border-block-end-width: 2px; border-radius: 0.25em; background: var(--button-bg, transparent); color: inherit; }
  .eureka .eureka__help-button { min-inline-size: 24px; min-block-size: 24px; padding: 0 0.4rem; display: inline-flex; align-items: center; }
  .eureka .eureka__help-button .icon { inline-size: 1.25em; block-size: 1.25em; }
  /* Keyboard hint knock-back (06 A11Y-55): resting opacity stays at or above 3:1 for the icon against the button (WCAG 1.4.11);
     full opacity as soon as the keyboard is used (the element sets data-keyboard on the root), on hover and on focus. */
  .eureka .eureka__help-button { opacity: var(--hint-opacity, 0.65); transition: opacity 300ms ease; }
  .eureka[data-keyboard="true"] .eureka__help-button, .eureka .eureka__help-button:hover, .eureka .eureka__help-button:focus-visible, .eureka:has(dialog.eureka__shortcuts-modal) .eureka__help-button { opacity: 1; }
  .black-on-white .eureka__help-button, .white-on-black .eureka__help-button { opacity: 1; }
  @media (forced-colors: active) { .eureka .eureka__help-button { opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { .eureka .eureka__help-button { transition: none; } }
  /* Text thumbnails (02 HTML-66c): a rendered page of the file; it follows the colour scheme from inside the SVG. */
  .eureka :is(.eureka__media-text, .eureka__media-preview) { display: block; inline-size: 100%; block-size: auto; background: var(--light-bg); border: 1px solid var(--very-subtle); border-radius: 0.25rem; object-fit: cover; object-position: top; }
  .eureka:is([data-view="table"], [data-view="list"]) :is(.eureka__media-text, .eureka__media-preview) { max-block-size: 10rem; inline-size: auto; aspect-ratio: 4 / 5; }

  /* Animated media (02 HTML-66b): still until played. Nothing here moves by itself; motion comes from the file, which should gate
     its own animation on prefers-reduced-motion, and from the user's explicit play. */
  .eureka__table td.eureka__td-media { position: relative; }
  /* Item states (02 HTML-63, 06 A11Y-56): focus is a ring (tiles) or a leading edge (rows); selection is the row's native
     control, a radio in single mode and a checkbox in multiple, so the browser draws it. */
  .eureka .eureka__table :is(td.eureka__choose, td.eureka__select) input { margin: 0; inline-size: 1.5rem; block-size: 1.5rem; cursor: pointer; accent-color: var(--active); }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__table :is(td.eureka__choose, td.eureka__select) { display: block; position: absolute; inset-block-start: 0.5rem; inset-inline-start: 0.5rem; z-index: 1; padding: 0.2rem; border-radius: 50%; background: color-mix(in srgb, var(--bg-color) 75%, transparent); line-height: 0; }
  .eureka .eureka__table > tbody > tr.eureka__row { transition: background-color 120ms, box-shadow 120ms; }
  .eureka .eureka__row.eureka__focused-media-item { box-shadow: inset 3px 0 0 var(--active); }
  .eureka .eureka__row:focus-visible { outline: 2px solid var(--active); outline-offset: -2px; }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row.eureka__focused-media-item { box-shadow: none; }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row > .eureka__td-media { border-radius: 0.25rem; transition: box-shadow 120ms, background-color 120ms; }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row:hover > .eureka__td-media { box-shadow: 0 0 0 2px var(--subtle); }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row.eureka__focused-media-item > .eureka__td-media { box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 4px var(--active); } /* fits the row's 0.25rem padding */
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row:focus-visible { outline: none; } /* the ring on the tile is the focus indicator */
  /* Single mode in the thumbnail modes (06 A11Y-56): the selected tile carries an inset ring and the radio leaves the artwork. It stays in
     the tree (clipped, not display:none) for assistive tech; Level 0 keeps it visible, being the only way to select without script. */
  .eureka[data-level="1"][data-choose="single"]:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__table td.eureka__select { inline-size: 1px; block-size: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; background: none; }
  .eureka[data-choose="single"]:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row[aria-selected="true"] > .eureka__td-media { box-shadow: inset 0 0 0 3px var(--active); }
  .eureka[data-choose="single"]:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row[aria-selected="true"].eureka__focused-media-item > .eureka__td-media { box-shadow: inset 0 0 0 3px var(--active), 0 0 0 2px var(--bg-color), 0 0 0 4px var(--active); }
  /* The tile menu (02 HTML-71a): the one extra tab stop of a focused tile in the thumbnail modes, opening the row menu.
     Table and list have the toolbar instead. */
  .eureka .eureka__tile-menu { display: none; position: absolute; inset-block-start: 0.25rem; inset-inline-end: 0.25rem; z-index: 1; inline-size: 2rem; block-size: 2rem; padding: 0; border: 1px solid var(--very-subtle); border-radius: 50%; background: color-mix(in srgb, var(--bg-color) 80%, transparent); color: var(--color); cursor: pointer; }
  .eureka .eureka__tile-menu .icon { inline-size: 1rem; block-size: 1rem; }
  .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row:is(:hover, :focus-within, .eureka__focused-media-item) .eureka__tile-menu { display: inline-flex; align-items: center; justify-content: center; }
  .eureka .eureka__tile-menu:is(:hover, :focus-visible) { background: var(--button-bg); border-color: var(--active); }
  @media (forced-colors: active) {
    .eureka .eureka__tile-menu { border-color: ButtonText; }
    .eureka .eureka__row.eureka__focused-media-item { box-shadow: inset 3px 0 0 Highlight; }
    /* forced colors drop box-shadow, so the tile rings become outlines: focus outside, selection inside, a double line for both */
    .eureka:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row.eureka__focused-media-item > .eureka__td-media { box-shadow: none; outline: 3px solid Highlight; outline-offset: 1px; }
    .eureka[data-choose="single"]:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row[aria-selected="true"] > .eureka__td-media { box-shadow: none; outline: 3px solid Highlight; outline-offset: -3px; }
    .eureka[data-choose="single"]:is([data-view="thumb"], [data-view="grid"], [data-view="masonry"]) .eureka__row[aria-selected="true"].eureka__focused-media-item > .eureka__td-media { outline: 6px double Highlight; outline-offset: -2px; }
  }
  @media (prefers-reduced-motion: reduce) { .eureka .eureka__table > tbody > tr.eureka__row, .eureka .eureka__row > .eureka__td-media { transition: none; } }
  /* a subfolder as an item (02 HTML-62): the folder icon fills the media cell and opens the folder */
  .eureka .eureka__folder-tile { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; justify-content: center; inline-size: 100%; aspect-ratio: 4 / 3; min-block-size: 3rem; padding: 0.5rem; border: 1px solid var(--very-subtle); border-radius: 0.25rem; background: var(--light-bg); color: var(--color); font: inherit; cursor: pointer; }
  .eureka .eureka__folder-tile__name { max-inline-size: 100%; overflow-wrap: anywhere; text-align: center; font-size: 0.9em; line-height: 1.25; }
  .eureka:is([data-view="table"], [data-view="list"]) .eureka__folder-tile__name { display: none; } /* the name column shows it there */
  .eureka .eureka__folder-tile .icon { inline-size: 40%; block-size: 40%; max-inline-size: 4rem; max-block-size: 4rem; opacity: 0.8; }
  .eureka:is([data-view="table"], [data-view="list"]) .eureka__folder-tile { inline-size: 4rem; aspect-ratio: 1; min-block-size: 0; padding: 0; gap: 0; }
  /* Interest strengthens, never weakens (06 A11Y-57): the surface and text colour stay exactly as at rest (the generic button hover would
     turn the text white and a lifted surface costs contrast in the dark scheme), the border turns active and the icon comes to full
     opacity. The old --subtle fill put the name at 2:1 in the dark scheme. */
  .eureka .eureka__folder-tile:is(:hover, :focus-visible) { background: var(--light-bg); border-color: var(--active); color: var(--color); }
  .eureka .eureka__folder-tile:is(:hover, :focus-visible) .icon { opacity: 1; }
  @media (forced-colors: active) { .eureka .eureka__folder-tile:is(:hover, :focus-visible) { outline: 2px solid Highlight; outline-offset: -2px; } }
  /* Reserved media space (04 LAY-51): the box keeps its shape before the picture arrives. width/height attributes give the ratio; without them
     a 4:3 box at the mode's media height. A quiet tone fills the box until the image paints; the element marks painted images, Level 0 keeps the tone. */
  .eureka .eureka__td-media img:not(.eureka__loaded, .eureka__media-text, .eureka__media-preview) { background: var(--media-skeleton-background, color-mix(in srgb, var(--color) 7%, transparent)); }
  .eureka .eureka__td-media img:not([width], .eureka__media-text, .eureka__media-preview) { aspect-ratio: auto 4 / 3; inline-size: 100%; }
  .eureka[data-view="table"] .eureka__td-media img:not([width], .eureka__media-text, .eureka__media-preview) { inline-size: auto; block-size: 20vh; max-inline-size: 100%; }
  .eureka[data-view="list"] .eureka__td-media img:not([width], .eureka__media-text, .eureka__media-preview) { inline-size: auto; block-size: 10vh; max-inline-size: 100%; }
  /* An image no browser can show (02 HTML-66e): a tile in the item's own proportions with the type icon; the name column repeats the name in table and list. */
  .eureka .eureka__media-skeleton { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; justify-content: center; inline-size: 100%; max-inline-size: 100%; aspect-ratio: var(--eureka-media-ratio, 4 / 3); min-block-size: 3rem; margin: 0; padding: 0.5rem; border-radius: 0.25rem; background: var(--media-skeleton-background, color-mix(in srgb, var(--color) 7%, transparent)); color: var(--subtle); }
  .eureka .eureka__media-skeleton .icon { font-size: 1em; inline-size: 40%; block-size: 40%; max-inline-size: 4rem; max-block-size: 4rem; opacity: 0.8; }
  .eureka .eureka__media-skeleton__name { max-inline-size: 100%; overflow-wrap: anywhere; text-align: center; font-size: 0.9em; line-height: 1.25; }
  .eureka:is([data-view="table"], [data-view="list"]) .eureka__media-skeleton { inline-size: auto; block-size: 4rem; min-block-size: 0; padding: 0; gap: 0; }
  .eureka:is([data-view="table"], [data-view="list"]) .eureka__media-skeleton__name { display: none; }
  .eureka .eureka__badge--animated { position: absolute; inset-block-end: 0.35rem; inset-inline-end: 0.35rem; display: inline-flex; align-items: center; justify-content: center; inline-size: 1.75rem; block-size: 1.75rem; min-inline-size: 24px; min-block-size: 24px; padding: 0; border-radius: 999px; background: var(--light-bg); color: var(--color); border: 1px solid var(--subtle); box-shadow: none; font: inherit; }
  .eureka span.eureka__badge--animated { pointer-events: none; } /* Level 0: a marker only */
  .eureka button.eureka__badge--animated { cursor: pointer; }
  .eureka button.eureka__badge--animated:is(:hover, :focus-visible) { background: var(--button-bg); border-color: var(--active); }
  .eureka button.eureka__badge--animated[aria-pressed="true"] { border-color: var(--active); }
  .eureka .eureka__badge--animated .icon { inline-size: 0.9em; block-size: 0.9em; }
  .eureka .eureka__media-object { display: block; pointer-events: none; inline-size: 100%; block-size: auto; }
  .eureka .eureka__media-animated { position: relative; display: block; inline-size: 100%; }
  .eureka .eureka__media-animated > img { display: block; inline-size: 100%; block-size: auto; }
  .eureka .eureka__media-animated[data-playing="false"] > img { position: absolute; inset: 0; opacity: 0; pointer-events: none; } /* keeps loading so the still can be drawn */
  .eureka .eureka__media-still { display: block; inline-size: 100%; block-size: auto; }

  /* Row context menu (02 HTML-71): a manual popover anchored to its row. */
  .eureka__context-anchor { anchor-name: --eureka-context-row; }
  .eureka .eureka__context-menu { margin: 0; padding: 0.25rem; inline-size: max-content; min-inline-size: 12rem; max-inline-size: min(20rem, 90vw); border: var(--border-width) var(--border-style) var(--panel-border-color); border-radius: 0.375rem; background: var(--light-bg); color: var(--color); box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); opacity: 1; transition: opacity 150ms ease, display 150ms allow-discrete, overlay 150ms allow-discrete; }
  .eureka .eureka__context-menu:not(:popover-open) { display: none; opacity: 0; }
  @supports (anchor-name: --a) {
    .eureka .eureka__context-menu { position-anchor: --eureka-context-row; position-area: block-end span-inline-end; position-try-fallbacks: flip-block, flip-inline; margin-block-start: 0.25rem; margin-inline-start: 1rem; }
    .eureka .eureka__context-menu--placed { position-anchor: none; position-area: none; position-try-fallbacks: none; margin: 0; } /* opened by pointer: the element sets left/top */
  }
  .eureka .eureka__context-menu--placed { position: fixed; inset: auto; margin: 0; }
  .eureka .eureka__context-menu .eureka__menuitem { display: flex; align-items: center; justify-content: space-between; gap: 1rem; inline-size: 100%; box-sizing: border-box; text-align: start; background: none; border: 0; box-shadow: none; border-radius: 0.25rem; padding: 0.4rem 0.6rem; color: inherit; font: inherit; text-decoration: none; min-block-size: 24px; cursor: default; }
  .eureka .eureka__context-menu .eureka__menuitem:is(:hover, :focus-visible) { background: var(--button-bg); outline: 2px solid var(--active); outline-offset: -2px; }
  .eureka .eureka__context-menu .eureka__menuitem.dangerous { color: var(--dangerous); }
  @media (forced-colors: active) { .eureka .eureka__context-menu { border: 1px solid CanvasText; } .eureka .eureka__context-menu .eureka__menuitem:is(:hover, :focus-visible) { outline-color: Highlight; } }
  @media (prefers-reduced-motion: reduce) { .eureka .eureka__context-menu { transition: none; } }
  @starting-style { .eureka .eureka__context-menu:popover-open { opacity: 0; } } /* after the visible-state rule: starting styles cascade like any other */

  /* <kbd> shortcut hints on controls (02 HTML-96): text, so the resting level keeps 4.5:1 (WCAG 1.4.3); its own colours, body text on the panel background. */
  .eureka kbd.eureka__kbd { display: inline-block; font-size: 0.8em; line-height: 1.3; padding: 0 0.3em; margin-inline-start: 0.5em; vertical-align: 0.1em; color: var(--color); background: var(--light-bg); border-color: var(--subtle); opacity: var(--hint-opacity, 0.65); transition: opacity 300ms ease; } /* its own colours (body text on the panel background), so the resting contrast does not depend on the control's text colour */
  /* The same treatment as the Keyboard Shortcuts button above: a hint always occupies its space and rests at --hint-opacity (the dark
     scheme's 0.55 is the floor for text, 4.5:1 blended over the control, 06 A11Y-55), coming to full opacity with keyboard use, on
     hover or visible focus of its own control, and while the shortcuts dialog is open. Nothing is gated on focus elsewhere, so a
     pointer click on a select beside it changes nothing: a hint that once appeared there widened the control, slid the select from
     under the pointer and closed its open list. */
  .eureka[data-keyboard="true"] kbd.eureka__kbd, .eureka :is(button, .button, label):is(:hover, :focus-visible) > kbd.eureka__kbd, .eureka:has(dialog.eureka__shortcuts-modal) kbd.eureka__kbd { opacity: 1; }
  .eureka .eureka__context-menu[role="menu"] kbd.eureka__kbd { opacity: 1; margin-inline-start: auto; } /* a keyboard surface: its hints are always shown (after the gating rule, which ties on specificity) */
  .black-on-white kbd.eureka__kbd, .white-on-black kbd.eureka__kbd { opacity: 1; }
  @media (forced-colors: active) { .eureka kbd.eureka__kbd { opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { .eureka kbd.eureka__kbd { transition: none; } }
  @container eureka (max-width: 40em) { .eureka kbd.eureka__kbd { display: none; } } /* no room, and rarely a keyboard, on narrow layouts */
  .eureka[data-hints="false"] kbd.eureka__kbd { display: none; } /* the user unticked "Show keyboard hints" in the welcome banner: gone everywhere, menus included, until ticked again (02 HTML-96) */
  .eureka__hints-toggle { cursor: pointer; } /* inline, so its text shares the sentence's baseline; an inline-flex label took its baseline from the checkbox and sat the text 2px high */
  .eureka__hints-toggle input { vertical-align: -0.125em; margin: 0 0.35em 0 0.25em; }
  .eureka__crop-stage { min-block-size: 40vh; background: #222; display: grid; place-items: center; }
  .eureka__crop-stage img { max-block-size: 60vh; }

  /* Sortable column headers (HTML-61): plain buttons that keep their label on one line */
  .eureka .eureka__sort-button { background: none; box-shadow: none; border: 0; padding: 0.25em 0.35em; color: inherit; font: inherit; font-weight: 700; white-space: nowrap; min-block-size: 0; }
  .eureka .eureka__sort-button:hover { color: var(--link-color); background: none; box-shadow: none; }
  .eureka .eureka__sort-button[aria-pressed="true"] { color: var(--link-color); }

  /* Filename placeholders for non-image media */
  .eureka__file-placeholder { margin: 0; display: inline-flex; gap: 0.5rem; align-items: center; min-inline-size: 0; }
  .eureka__file-placeholder .icon { font-size: 1.5em; flex: none; }
  .eureka__file-placeholder span { overflow-wrap: anywhere; }
}

/* ---- themes.css ---- */
@layer eureka.theme {
  /* Dark scheme defaults (08 THEME-05). Hosts override these the same way as the light set. */
  @media (prefers-color-scheme: dark) {
    :where(.eureka-root:not(.black-on-white, .white-on-black, .black-on-white *, .white-on-black *)) {
      --bg-color: #1b1f23; --color: #e6e8ea; --light-bg: #24292e; --panel-border-color: #3a4048; --border-color: #3a4048; --border-shadow-color: #3a4048;
      --button-bg: #2d333b; --button-color: #d7dde3; --subtle: #9aa4ae; --very-subtle: #4b535c; --link-color: #6cb6ff; --active: #4aa3e0; --active-darker: #1f6aa5;
      --hint-opacity: 0.55; /* one level for the hint icon (3.9:1, needs 3:1) and the <kbd> hint text (4.7:1, needs 4.5:1; 0.535 is its floor) (06 A11Y-55) */
      --dangerous: #ff8a80; --border-color-dangerous: #ff8a80;
      --media-cell-background: #1f2428; --notification-background: #1d3a4f; --notification-color: #bfe3ff; --notification-border-color: #2a5a7a; --notification-focus-color: #e6f4ff;
    }
  }
  /* Forced colors (08 THEME-04): keep borders, use system highlight for focus and selection. */
  @media (forced-colors: active) {
    .eureka :is(button, .button, select, input, textarea, .eureka__pathbrowser, .eureka__table, .eureka__pathbar, .eureka__notification, .eureka__modal) { border: 1px solid; forced-color-adjust: none; }
    .eureka :focus-visible { outline: 3px solid Highlight; }
    .eureka__icon-radio-btns input:checked + label { outline: 2px solid Highlight; box-shadow: none; }
    .eureka__tree summary.active { outline: 1px solid Highlight; }
    .eureka :is(button, .button):hover { background: Highlight; color: HighlightText; }
  }
}
