/* mmphoto — customer-facing gallery styles */
:root {
  color-scheme: dark;
  --bg: #111213;
  --surface: #1b1c1e;
  --surface-2: #232527;
  --text: #f2f0ec;
  --text-dim: #a8a49c;
  --accent: #d3b06e;
  --accent-dark: #b6934f;
  --danger: #e07a6a;
  --on-accent: #191509;
  --border-faint: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.25);
  --hover: rgba(255, 255, 255, 0.08);
  --overlay: rgba(17, 18, 19, 0.55);
  --overlay-hover: rgba(17, 18, 19, 0.8);
  --status-info: #7ec8ff;
  --status-ok: #8fd694;
  --status-warn: #d8c27a;
  --bulk-bg: rgba(20, 20, 22, 0.97);
  --radius: 10px;
  --shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5);
  --wrap-max: 60rem; /* customer pages; admin widens it (tables, image grids) */
}

/* Light theme — same custom-property set applied twice: system preference
   (unless explicitly overridden to dark) and explicit override. Keep the two
   blocks identical. --overlay stays dark in both themes (sits on photos). */
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #fdfcf9;
    --surface: #ffffff;
    --surface-2: #f1ede5;
    --text: #26241f;
    --text-dim: #6f6a60;
    --accent: #83661f;
    --accent-dark: #6d531d;
    --danger: #b54a38;
    --on-accent: #ffffff;
    --border-faint: rgba(0, 0, 0, 0.08);
    --border: rgba(0, 0, 0, 0.15);
    --border-strong: rgba(0, 0, 0, 0.28);
    --hover: rgba(0, 0, 0, 0.05);
    --status-info: #2f6fa8;
    --status-ok: #3d7d44;
    --status-warn: #8a6d1f;
    --bulk-bg: rgba(255, 255, 255, 0.97);
    --shadow: 0 2px 20px rgba(60, 50, 30, 0.1);
    --shadow-pop: 0 8px 24px rgba(60, 50, 30, 0.15);
  }
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #fdfcf9;
  --surface: #ffffff;
  --surface-2: #f1ede5;
  --text: #26241f;
  --text-dim: #6f6a60;
  --accent: #83661f;
  --accent-dark: #6d531d;
  --danger: #b54a38;
  --on-accent: #ffffff;
  --border-faint: rgba(0, 0, 0, 0.08);
  --border: rgba(0, 0, 0, 0.15);
  --border-strong: rgba(0, 0, 0, 0.28);
  --hover: rgba(0, 0, 0, 0.05);
  --status-info: #2f6fa8;
  --status-ok: #3d7d44;
  --status-warn: #8a6d1f;
  --bulk-bg: rgba(255, 255, 255, 0.97);
  --shadow: 0 2px 20px rgba(60, 50, 30, 0.1);
  --shadow-pop: 0 8px 24px rgba(60, 50, 30, 0.15);
}

* { box-sizing: border-box; }

/* Alpine: hide x-cloak'd elements (lightbox, basket, form) until init —
   without this the fixed lightbox overlay covers the page during load */
[x-cloak] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  line-height: 1.55;
}

.wrap {
  width: min(var(--wrap-max), 100% - 2.5rem);
  margin-inline: auto;
}

/* header / footer */
.site-header {
  padding: 1.1rem 0 1rem;
  border-bottom: 1px solid var(--border-faint);
}
.site-header .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.brand {
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}
.brand em { font-style: normal; color: var(--accent); }

/* theme toggle — icon-only, shows the *current* theme; visibility is pure CSS
   so it is correct before/without JS */
.theme-toggle {
  align-self: center;
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0.2rem;
  color: var(--text-dim);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }
  html:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
}
html[data-theme="light"] .theme-toggle .icon-sun { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }

main.wrap { flex: 1; padding: 2rem 0 3rem; width: min(var(--wrap-max), 100% - 2.5rem); }

.site-footer {
  padding: 1.2rem 0 1.6rem;
  border-top: 1px solid var(--border-faint);
  color: var(--text-dim);
  font-size: 0.85rem;
}
.site-footer a { color: var(--text-dim); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.site-footer .wrap { display: flex; gap: 0.6rem; }

/* generic */
h1 { margin-top: 0; font-weight: 500; letter-spacing: 0.02em; }
a { color: var(--accent); }
.gallery-subtitle { margin: -0.5rem 0 1.25rem; font-size: 0.95rem; }
.section-rule {
  margin: 1.6rem 0;
  border: 0;
  border-top: 1px solid var(--border-faint);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.narrow { max-width: 34rem; margin-inline: auto; }
.center { text-align: center; }
.legal { text-align: left; }
.back-link { max-width: 34rem; margin: 0 auto 0.8rem; text-align: left; font-size: 0.95rem; }
.legal h2 { font-size: 1rem; margin-top: 1.6rem; }

.muted { color: var(--text-dim); }

/* forms */
label { display: block; margin-bottom: 0.35rem; color: var(--text-dim); font-size: 0.9rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], textarea, select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.field { margin-bottom: 1.1rem; text-align: left; }

.btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }

.linklike {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}
.linklike.danger { color: var(--danger); }

.error-text { color: var(--danger); margin: 0.6rem 0 0; }

/* honeypot — visually hidden, still focusable-by-bots */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* gallery grid */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0; }
.welcome { max-width: 44rem; margin: -0.4rem 0 1.6rem; }
.welcome p { margin: 0 0 0.6em; }
.welcome p:last-child { margin-bottom: 0; }
.welcome h2, .welcome h3 { font-size: 1.05rem; font-weight: 500; margin: 1em 0 0.4em; }

.filters { margin: 1.2rem 0; }
.filters .chips { margin: 0; }
.chip-row {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin: 0.5rem 0;
}
.chip-row-label {
  flex: 0 0 6.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
@media (max-width: 600px) {
  .chip-row { flex-direction: column; gap: 0.3rem; }
  .chip-row-label { flex-basis: auto; }
}
.dropdown { position: relative; flex: 1; width: 100%; }
.dropdown-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.dropdown-caret { color: var(--text-dim); font-size: 0.8rem; }
.dropdown-list .numsearch-item.active { color: var(--accent); }
.numsearch { position: relative; flex: 1; width: 100%; }
.numsearch input {
  width: 100%;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
}
/* own clear-× on both search inputs: iOS never renders the native one for
   type=search, Android does — hide the native (gallery only) and ship ours */
.numsearch-clearwrap { position: relative; display: block; flex: 1; width: 100%; }
.numsearch-clearwrap input { padding-right: 2.4rem; }
.num-input-clear {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
}
.num-input-clear:hover { color: var(--text); }
nav.filters .numsearch input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.numsearch-list {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 60vh;
  background: var(--bg, #111);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: var(--shadow-pop);
}
/* desktop: content-sized up to the cap — a lone match gets a snug box,
   the full rider list scrolls (gallery only; admin has its own lists) */
nav.filters .numsearch .numsearch-list { max-height: min(60vh, 34rem); }
/* sheet chrome exists in the markup at every width, but only the ≤600px
   media block below turns the lists into sheets */
.filter-backdrop, .filter-sheet-head { display: none; }
.numsearch-empty { margin: 0; padding: 0.6rem 0.9rem; }
body.filter-sheet-open { overflow: hidden; }
/* ≤600px: filter dropdowns become bottom sheets. nav.filters, NOT .filters:
   the admin event page wraps its dropdowns in a div.filters and must keep
   plain dropdowns — only the gallery uses <nav class="filters"> */
@media (max-width: 600px) {
  nav.filters .filter-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 11, 0.55);
    z-index: 44;
  }
  nav.filters .numsearch-list {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    /* --kb lifts the sheet onto the on-screen keyboard (0 while closed);
       fixed bottom:0 would anchor behind it — see gallery.js */
    bottom: var(--kb, 0px);
    z-index: 45;
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow);
    padding-bottom: env(safe-area-inset-bottom);
    animation: filter-sheet-in 0.25s ease;
  }
  /* fixed height (the search sheet must not jump while typing filters the
     list), clamped to the visual viewport: --vvh shrinks with the iOS
     keyboard while dvh does not, and an over-tall sheet gets panned off
     the top of the screen (gallery.js keeps --vvh current) */
  nav.filters .numsearch .numsearch-list {
    height: min(85dvh, calc(var(--vvh, 100dvh) - 1rem));
  }
  nav.filters .filter-sheet-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 0 0 auto;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
  }
  /* the flex child is the clear-button wrapper, the input fills it */
  nav.filters .filter-sheet-head .numsearch-clearwrap { flex: 1; width: auto; }
  .filter-sheet-title { font-weight: 600; }
  nav.filters .filter-sheet-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
@keyframes filter-sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.numsearch-item {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.45rem 0.9rem;
  color: var(--text);
  text-decoration: none;
}
/* suggestion entries may be <button>s — strip the UA chrome */
button.numsearch-item {
  width: 100%;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.numsearch-item:hover { background: var(--hover); }
.numsearch-item { align-items: center; }
.numsearch-item mark, .num-selected mark {
  background: none;
  color: var(--accent);
}
.num-badge {
  flex: 0 0 auto;
  min-width: 2.6rem;
  padding: 0.3rem 0.55rem;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 600;
  font-size: 1.05rem;
  text-align: center;
}
.num-badge mark { color: inherit; text-decoration: underline; }
.num-badge.filled { background: var(--accent); color: var(--on-accent); }
.num-badge.small { min-width: 2rem; padding: 0.1rem 0.45rem; font-size: 0.9rem; }
.dropdown-current {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.dropdown-current-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num-lines .num-title {
  color: var(--text);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.num-lines { display: flex; flex-direction: column; min-width: 0; gap: 0.05rem; }
.num-lines > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num-kind {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.num-horse { color: var(--text); }
.num-riders { font-size: 0.85rem; color: var(--text-dim); }
.num-clubs { font-size: 0.8rem; color: var(--text-dim); opacity: 0.75; }
.num-selected {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1;
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: 1rem;
  padding: 0.5rem 0.9rem;
}
.num-selected .num-lines { flex: 1; }
.num-selected.clickable { cursor: pointer; }
.num-clear {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}
.num-clear:hover { border-color: var(--accent); color: var(--accent); }
.chip {
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
}
.chip.active { border-color: var(--accent); color: var(--accent); }
.chip:hover { color: var(--text); }

/* Empty-gallery state: a row of faint ghost tiles marks where the images
   will appear; the message floats centered in front of them */
.gallery-empty {
  position: relative;
  margin: 2rem 0;
}
.ghost-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* tile size ≈ .grid's real photos */
  gap: 10px; /* mirror .grid */
  filter: blur(1.5px);
}
.ghost-tile {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px; /* mirror .tile */
}
/* 6 tiles in the markup: desktop shows 5 (one row), phones show all 6
   (two full rows of 3) — no layout math, just hide/show the sixth */
.ghost-tile:nth-child(6) { display: none; }
.ghost-star {
  position: absolute;
  top: 10px; right: 10px;
  width: 16px; height: 16px;
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 1.4;
  stroke-linejoin: round;
  opacity: 0.45;
}
.gallery-empty p {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(26rem, 92%);
  margin: 0;
  padding: 0.75rem 1.1rem;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.55;
}
@media (max-width: 600px) {
  /* mirror the real .grid's phone sizing: 3 per row, tighter gap */
  .ghost-grid { grid-template-columns: repeat(auto-fill, minmax(31%, 1fr)); gap: 6px; }
  .ghost-tile:nth-child(6) { display: block; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
  padding: 0;
  border: none;
  /* skip layout/paint for offscreen tiles — a 2000-image grid only renders
     the viewport. Geometry comes from the grid column + aspect-ratio, never
     from contents, so no intrinsic-size fallback is needed.
     (spec 2026-08-17-filter-clear-instant-swap-design.md) */
  content-visibility: auto;
}

/* prompt state: no Prüfung chosen yet — the closed dropdown reads as a
   placeholder, not as an implied selection */
.dropdown-placeholder { color: var(--text-dim); }

/* filter-swap busy state: acknowledge the click while a cache-miss fetch
   runs (same spec). Cache hits swap synchronously and never show this. */
.nav-busy nav.filters,
.nav-busy .grid {
  opacity: 0.55;
  cursor: progress;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .star {
  position: absolute;
  top: 8px; right: 8px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  background: var(--overlay);
  color: #fff; /* sits on --overlay, dark in both themes */
  font-size: 1.05rem;
  cursor: pointer;
}
.tile .star svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}
.tile .star.starred { color: #d3b06e; } /* dark-theme gold: on the overlay, not on --bg */
.tile .star.starred svg { fill: currentColor; }
.tile .star:hover { background: var(--overlay-hover); }

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 11, var(--lb-dim, 0.96));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  touch-action: none;
}
.lightbox img {
  max-width: 92vw; max-height: 86vh; object-fit: contain;
  transform-origin: center;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.lightbox img.lb-animating { transition: transform 150ms ease-out; }
.lightbox.zoomed .nav,
.lightbox.zoomed .lb-star { display: none; } /* .close stays visible — always an exit */
body.lightbox-open { overflow: hidden; }
.lightbox .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #fff; font-size: 2.2rem; cursor: pointer;
  padding: 1rem;
  opacity: 0.7;
}
.lightbox .nav:hover { opacity: 1; }
.lightbox .nav.prev { left: 0.5rem; }
.lightbox .nav.next { right: 0.5rem; }
.lightbox .close {
  position: absolute; top: 0.8rem; right: 1rem;
  background: none; border: none; color: #fff; font-size: 1.8rem; cursor: pointer;
  opacity: 0.7;
}
.lightbox .close:hover { opacity: 1; }
.lightbox .lb-star {
  position: absolute; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
}

/* basket bar */
.basket-bar {
  position: fixed;
  left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 0.6rem 0.7rem 0.6rem 1.3rem;
  display: flex; align-items: center; gap: 1rem;
  z-index: 40;
  white-space: nowrap;
}
.basket-bar .bar-discard {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 1.4rem; line-height: 1;
  padding: 0.2rem 0.5rem;
}
.basket-bar .bar-discard:hover { color: var(--text); }

/* in-page confirm dialog (window.confirm is unreliable in webviews) */
.mm-confirm {
  position: fixed; inset: 0;
  background: rgba(10, 10, 11, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;
}
.mm-confirm[hidden] { display: none; }
.mm-confirm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.3rem 1.5rem;
  max-width: 26rem;
  margin: 1rem;
}
.mm-confirm-card p { margin: 0 0 1.1rem; }
.mm-confirm-actions { display: flex; justify-content: flex-end; gap: 0.8rem; }
.mm-confirm-cancel {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font: inherit; font-size: 0.95rem;
  padding: 0.45rem 0.6rem;
}
.mm-confirm-cancel:hover { color: var(--text); }
.mm-confirm-ok {
  background: var(--accent); color: #fff;
  border: none; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 0.95rem;
  padding: 0.45rem 1.1rem;
}
.mm-confirm-ok:hover { filter: brightness(1.08); }

/* basket sheet */
body.sheet-open { overflow: hidden; }
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 10, 11, 0.55);
  z-index: 44;
}
.selection-form.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 90dvh;
  z-index: 45;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow);
}
/* thank-you mode: two lines of text — hug the content instead of 90dvh */
.selection-form.sheet.sheet-slim { height: auto; max-height: 90dvh; }
.sheet-anim { transition: transform 0.25s ease; }
.sheet-down { transform: translateY(100%); }
.sheet-up { transform: translateY(0); }
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.sheet-header h2 { margin: 0; font-size: 1.15rem; }
.sheet-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.7rem; line-height: 1; color: var(--text-dim);
  padding: 0.2rem 0.4rem;
}
.sheet-close:hover { color: var(--text); }

/* Symbol-only buttons (×, ‹ ›) otherwise render their glyphs in the
   browser's default button font (Arial), not the page font */
.num-input-clear,
.sheet-close,
.basket-bar .bar-discard,
.lightbox .nav,
.lightbox .close { font-family: inherit; }
.sheet-body { flex: 1; overflow-y: auto; padding: 1rem 1.2rem 1.5rem; }

/* basket grid — same tile look as the main grid, smaller */
.basket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin: 0 0 1.4rem;
}
.tile-remove {
  position: absolute;
  top: 6px; right: 6px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  display: grid; place-items: center;
  background: var(--overlay);
  color: #fff;
  font-size: 1.1rem; line-height: 1;
  cursor: pointer;
}
.tile-remove:hover { background: var(--overlay-hover); }

.banner {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.4rem;
}

/* qr page */
.qr-img {
  display: block;
  width: min(320px, 100%);
  margin: 1.4rem auto;
  border-radius: var(--radius);
  background: #fff; /* the quiet zone must stay white in dark theme too */
  box-shadow: var(--shadow);
}
.qr-url {
  display: block;
  margin: 1.6rem 0 1.4rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  user-select: all; /* one tap selects the whole URL */
}

/* downloads page */
.finals-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.final-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.final-card img { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; }
/* stacked: the filename gets the full card width (long names wrapped mid-word
   next to the button), the button sits on its own line below */
.final-card .row { display: flex; flex-direction: column; align-items: stretch; padding: 0.6rem 0.8rem; gap: 0.5rem; }
.final-card .row .btn { align-self: flex-end; }
.final-card .fname { font-size: 0.8rem; color: var(--text-dim); overflow-wrap: anywhere; }
.download-hero { margin: 1.6rem 0 2rem; }
.download-hero .btn { font-size: 1.05rem; padding: 0.85rem 1.6rem; }

@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(31%, 1fr)); gap: 6px; }
  .card { padding: 1.3rem; }
  main.wrap { padding-top: 1.2rem; }
}

/* Filter swaps: quicker cross-fade than the 250ms default (Chrome/Edge/
   Safari — browsers without View Transitions just swap instantly) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 150ms;
}
