:root {
  color-scheme: light dark;
  --bg: #faf7f2; --surface: #fffdf9; --text: #2b2620; --muted: #71675c;
  --border: #dcd4c8; --accent: #835333; --soft: #eee5da; --danger: #a42b2b;
  font-family: var(--font-body, system-ui, sans-serif); font-size: 16px;
}
@media (prefers-color-scheme: dark) { :root { --bg: #1c1a17; --surface: #262320; --text: #efe9e0; --muted: #b9aea0; --border: #464039; --accent: #e2b38c; --soft: #332b24; --danger: #ffaaaa; } }
:root[data-theme="light"] { color-scheme: light; --bg: #faf7f2; --surface: #fffdf9; --text: #2b2620; --muted: #71675c; --border: #dcd4c8; --accent: #835333; --soft: #eee5da; --danger: #a42b2b; }
:root[data-theme="dark"] { color-scheme: dark; --bg: #1c1a17; --surface: #262320; --text: #efe9e0; --muted: #b9aea0; --border: #464039; --accent: #e2b38c; --soft: #332b24; --danger: #ffaaaa; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
main { max-width: 1220px; margin: auto; padding: clamp(16px, 4vw, 44px); }
h1,h2 { font-family: var(--font-heading, Georgia, serif); font-weight: 400; line-height: 1.25; }
h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); margin: 0; }
h2 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
p { margin: 0 0 12px; }
header, .toolbar, .library-heading, .preview-heading, .preview-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
header { margin: 26px 0 22px; }
.eyebrow { color: var(--accent); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.intro { margin: 8px 0 0; color: var(--muted); }
button,input,select { font: inherit; font-family: var(--font-ui, system-ui, sans-serif); border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface); min-height: 44px; padding: 9px 12px; }
button { cursor: pointer; box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 5%, transparent), 0 1px 2px #0000000d; }
button:hover { border-color: var(--accent); background: var(--soft); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input,select { display: block; width: 100%; margin-top: 5px; font-size: .9rem; }
.counts { display: flex; flex-wrap: wrap; gap: 28px; border-block: 1px solid var(--border); padding: 16px 0; margin: 24px 0; }
.counts div { display: flex; align-items: baseline; gap: 10px; }
dt { color: var(--muted); font-size: .85rem; } dd { margin: 0; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.filters label { flex: 1 1 120px; min-width: 0; color: var(--muted); font-size: .8rem; }
.filters label:first-child { flex: 2 1 210px; }
.muted, #status, footer, #updated { color: var(--muted); font-size: .85rem; }
.toolbar { margin-bottom: 16px; flex-wrap: wrap; }
.toolbar p { margin: 0; }
.view-choices { display: inline-flex; gap: 4px; padding: 4px; background: var(--soft); border: 1px solid var(--border); border-radius: 6px; }
.view-choices button { font-size: .85rem; }
.view-choices [aria-pressed="true"] { border-color: var(--accent); background: var(--soft); color: var(--accent); box-shadow: inset 0 1px 3px #0002; }
#gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); list-style: none; gap: 20px; margin: 0; padding: 0; }
#gallery li { min-width: 0; }
svg { width: 36px; height: 36px; stroke: currentColor; stroke-width: 1.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
#gallery[data-view="list"] { grid-template-columns: 1fr; gap: 8px; }
#show-more { display: block; margin: 24px auto; }
.empty { padding: 40px 20px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface); }
.empty p { margin: 12px 0 0; color: var(--muted); }
#error,#preview-error { color: var(--danger); overflow-wrap: anywhere; }
.notice,[data-gezel-demo-banner] { padding: 12px 16px; background: var(--soft); border-radius: 6px; font-size: .85rem; }
[data-gezel-demo-banner] { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
footer { margin-top: 32px; }
dialog { width: min(1040px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 20px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px; }
dialog::backdrop { background: #000b; }
.preview-heading { align-items: flex-start; }
.preview-heading > div { min-width: 0; }
#preview-path { overflow-wrap: anywhere; margin: 6px 0 0; }
#preview-media { min-height: 160px; max-height: 62dvh; display: flex; align-items: center; justify-content: center; margin: 20px 0 12px; background: var(--soft); border-radius: 6px; overflow: hidden; }
#preview-media img,#preview-media video { display: block; max-width: 100%; max-height: 62dvh; object-fit: contain; }
#preview-media audio { width: min(600px, 100%); }
.preview-actions { flex-wrap: wrap; }
.navigation { display: flex; align-items: center; gap: 12px; }
#position { font-size: .8rem; color: var(--muted); }
@media (max-width: 480px) {
  #gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .counts { gap: 20px; }
  header { align-items: flex-start; }
  .library-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  dialog { padding: 14px; }
  .preview-heading { flex-wrap: wrap; }
  .navigation { flex-wrap: wrap; gap: 8px; }
  [data-gezel-demo-banner] { align-items: flex-start; flex-direction: column; }
}

/* Shared components own file presentation; the page owns its layout. */
#add-files { margin: 20px 0; }
