:root {
  --p-bg: #e8e8e3; --p-surface: #dcdcd6; --p-ink: #181715; --p-muted: #5c5b56;
  --p-accent: #bfb21a; --p-accent-ink: #181715; --p-action: #181715; --p-action-ink: #e8e8e3;
  --p-inv-bg: #181715; --p-inv-surface: #242321; --p-inv-ink: #e8e8e3; --p-inv-muted: #91908d;
  --p-inv-accent: #bfb21a; --p-inv-accent-ink: #181715; --p-inv-action: #bfb21a; --p-inv-action-ink: #181715;
  --font-display: "Zilla Slab", Georgia, serif;
  --font-text: "Rethink Sans", system-ui, sans-serif;
  --display-weight: 400;
  --display-tracking: -0.018em;
  --err: #8a1c12;
}

html { background: var(--p-bg); }
body {
  margin: 0;
  background: var(--p-bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); margin: 0; }
h1 { font-size: var(--t-h1); line-height: 1.02; text-wrap: balance; }
h2 { font-size: var(--t-h2); line-height: 1.1; text-wrap: balance; }
h3 { font-size: var(--t-h3); line-height: 1.2; }
p { margin: 0; }
::placeholder { color: var(--p-muted); opacity: 1; }
a { color: inherit; }
img { max-width: 100%; }
main { padding-top: calc(var(--nav) + env(safe-area-inset-top)); }
main:focus { outline: none; }
.brand-mark { display: inline-block; flex: none; width: 24px; height: 24px; }
.sg-auth__card .brand-mark { width: 40px; height: 40px; }
.nav__logo .brand-mark { width: 24px; height: 24px; }
/* the phone shows the mark alone; the wordmark joins it from 640 */
.nav__wordmark { display: none; }
.nav__logo { gap: 0; }
.nav__logo .brand-mark { width: 28px; height: 28px; }

/* the fixed header rides the notch in a standalone app */
.nav {
  height: calc(var(--nav) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
}
.nav__logo { min-height: 44px; min-width: 44px; }
.nav__link { height: 44px; }
.nav__toggle { transition: background-color 160ms var(--ease), border-color 160ms var(--ease); }
.nav__toggle:hover { background: var(--p-surface); border-color: var(--p-ink); }
.nav__toggle:active { background: var(--line); }
.nav.is-open .nav__links { top: calc(var(--nav) + env(safe-area-inset-top)); }
.nav.is-open .nav__links:focus { outline: none; }

/* the focused skip link sits under the bar: over the logo it hid the brand, and at 320 it
   reached the "Laden hinzufügen" button; below the nav it never covers a control */
.skip-link:focus { top: calc(100% + var(--s-2)); transform: none; }

/* the name in the bar is a link to /wer: the value alone on a desktop, the action named in the sheet */
.nav__name-value { display: inline-block; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.nav__name-edit { display: none; }
.nav__logout { display: none; margin: 0; }
@media (max-width: 1023px) {
  .nav.is-open .nav__actions { grid-template-columns: minmax(0, 1fr); }
  .nav.is-open .nav__links { padding-bottom: calc(var(--btn-h) * 4 + var(--s-8) + env(safe-area-inset-bottom)); }
  .nav.is-open .nav__name { width: 100%; gap: var(--s-2); justify-content: center; white-space: normal; }
  .nav.is-open .nav__name-value { max-width: 55%; white-space: nowrap; }
  .nav.is-open .nav__name-edit { display: inline; color: var(--muted); font-weight: 400; white-space: nowrap; }
  .nav.is-open .nav__name-edit::before { content: "\00b7"; margin-right: var(--s-1); }
  .nav.is-open .nav__logout { display: block; order: 3; }
  .nav.is-open .nav__logout .nav__link { width: 100%; height: var(--btn-h); border: 0; background: none; font: 500 var(--t-body)/1 var(--font-text); justify-content: center; }
}

/* a small laptop (1024-1279) has to fit the wordmark, three words, the name and the button: the
   name yields to 6 characters (the full name stays in its aria-label and on /ich) */
@media (min-width: 1024px) and (max-width: 1279px) {
  .nav__name-value { max-width: 6ch; }
}

.sg-body--map { overflow: hidden; }
/* the map's header sits on the side panel's 24px line, not the page wrap's wider line: the logo and
   the first list row share one left edge */
.sg-body--map .nav .wrap { width: auto; margin-inline: 0; padding-inline: var(--s-5); }
.sg-body--map .skip-link { left: var(--s-5); }
.sg-body--map main { padding-top: calc(var(--nav) + env(safe-area-inset-top)); }

/* ---------------------------------------------------------------- home */
/* the phone: the map over the scrolling list; both share one screen */
.sg-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(180px, 38dvh) minmax(0, 1fr);
  height: calc(100dvh - var(--nav) - env(safe-area-inset-top));
}
.sg-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s-5) var(--gut) calc(var(--s-8) + env(safe-area-inset-bottom));
  background: var(--p-bg);
  scrollbar-width: thin;
}
.sg-side__head h1 { font-size: 30px; }
.sg-side__head p { margin-top: var(--s-2); }
.sg-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); margin-top: var(--s-5); }
.sg-filters select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 40px 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background-color: var(--p-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23181715' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  color: var(--ink);
  font: 500 16px/1 var(--font-text);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 160ms var(--ease);
}
.sg-filters select:hover { border-color: var(--p-ink); }
/* the action and the ink are the same colour, so system.css's primary hover computes the same
   black: step it warm towards the brass instead and keep the press from system.css */
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: color-mix(in oklab, var(--p-action) 86%, var(--p-accent)); }
  .sg-score-field:hover { background: color-mix(in oklab, var(--p-surface) 55%, transparent); }
}
/* "Charlottenburg-Wilmersdorf" is 210px at 16px: the side panel is 430 wide on a desktop too,
   so the two filters take one line each there; the full-width tablet column has room for a pair */
@media (min-width: 640px) and (max-width: 899px) {
  .sg-filters { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
}

.sg-list { list-style: none; margin: var(--s-5) 0 0; padding: 0; }
.sg-list li { margin: 0; }
.sg-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: center;
  min-height: 44px;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  transition: background-color 160ms var(--ease), padding 160ms var(--ease);
}
.sg-list li:first-child .sg-card { border-top: 0; }
.sg-card:hover, .sg-card.is-active { background: var(--p-surface); }
.sg-card:hover .sg-card__photo img { transform: scale(1.04); }
.sg-card__photo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  background: var(--p-surface);
}
.sg-card__photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
.sg-card__blank { font-family: var(--font-display); font-size: 30px; color: var(--muted); }
.sg-card__text { display: grid; gap: 2px; min-width: 0; }
.sg-card__text strong { font-weight: 500; font-size: 16px; line-height: 1.25; }
.sg-card__score { font-family: var(--font-display); font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.sg-card__new { font-family: var(--font-text); font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: .02em; }
.sg-empty { display: grid; gap: var(--s-5); justify-items: start; padding: var(--s-7) 0; max-width: 40ch; }
/* under a section heading the empty line follows it, not a second full block of air */
.sg-section .sg-empty { padding-top: var(--s-2); padding-bottom: 0; }
/* a shop with no reviews is short: the empty line ends the section, not a second full block of air */
.sg-section--reviews:has(.sg-empty) { padding-bottom: var(--s-3); }
/* a short phone (320x640) still shows the whole first card under the map */
@media (max-width: 899px) and (max-height: 700px) {
  .sg-home { grid-template-rows: minmax(180px, 34dvh) minmax(0, 1fr); }
}

.sg-map { position: relative; min-height: 0; order: -1; border-bottom: 1px solid var(--line); background: var(--p-surface); isolation: isolate; }
#map { position: absolute; inset: 0; z-index: 0; }
.leaflet-container { background: var(--p-surface); font-family: var(--font-text); }
.leaflet-tile-pane { filter: saturate(.55) contrast(.96); }
.leaflet-control-attribution {
  background: var(--p-bg) !important;
  color: var(--p-ink) !important;
  font-size: 11px !important;
}
.leaflet-control-attribution a { color: var(--p-ink) !important; }
/* a thumb or a mouse: the zoom controls keep a 44px target */
#map .leaflet-bar a { color: var(--p-ink); background: var(--p-bg); border-color: var(--line-strong); width: 44px; height: 44px; line-height: 44px; font-size: 22px; }
#map .leaflet-bar a:hover { background: var(--p-surface); }
.leaflet-bar { border-radius: var(--r-sm); box-shadow: none; border: 1px solid var(--line-strong); }
/* the popup is a piece of the app, not Leaflet's default: flat paper, an ink name and a
   44px close button and link so both are reachable on a phone */
.leaflet-popup-content-wrapper {
  background: var(--p-bg);
  color: var(--p-ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: none;
  padding: 0;
}
.leaflet-popup-content {
  margin: 16px 52px 14px 16px;
  font: 400 var(--t-small)/1.45 var(--font-text);
  text-align: left;
  color: var(--p-muted);
  overflow-wrap: anywhere;
}
.leaflet-popup-content strong { display: block; margin-bottom: 2px; color: var(--p-ink); font: 400 22px/1.15 var(--font-display); letter-spacing: var(--display-tracking); }
.leaflet-popup-content a { display: inline-flex; align-items: center; min-height: 44px; color: var(--p-ink); text-decoration: underline; text-underline-offset: 3px; }
.leaflet-popup-tip { background: var(--p-bg); box-shadow: none; }
/* the bubble is below Leaflet's control layer (its own map pane is a stacking context), so while
   a popup is open the zoom bar steps aside instead of covering the popup's first word on a 320
   map; closing the popup brings it back */
#map:has(.leaflet-popup) .leaflet-control-zoom { visibility: hidden; }
.leaflet-container a.leaflet-popup-close-button {
  top: 0; right: 0; width: 44px; height: 44px;
  font: 400 24px/44px var(--font-text);
  color: var(--p-ink);
}
.leaflet-container a.leaflet-popup-close-button:hover,
.leaflet-container a.leaflet-popup-close-button:focus { color: var(--p-ink); background: var(--p-surface); }

.sg-pin {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--p-ink);
  color: var(--p-bg);
  border: 2px solid var(--p-bg);
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 160ms var(--ease), transform 160ms var(--ease);
}
.sg-pin:hover { transform: translateY(-2px); }
.sg-pin.is-active { background: var(--p-accent); color: var(--p-accent-ink); }
.sg-pin.is-best { background: var(--p-accent); color: var(--p-accent-ink); }
.sg-pin.is-empty { background: var(--p-bg); color: var(--p-ink); border-color: var(--p-ink); font-family: var(--font-text); font-size: 12px; font-weight: 600; letter-spacing: .02em; }

/* ---------------------------------------------------------------- shop */
/* the photograph is a frame of its own: cover, never a squashed width */
.sg-hero { margin: 0; height: clamp(200px, 46vw, 300px); overflow: hidden; background: var(--p-surface); }
.sg-hero img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sg-hero__link { display: block; height: 100%; }
.sg-hero__link img { transition: transform 500ms var(--ease); }
@media (hover: hover) and (pointer: fine) { .sg-hero__link:hover img { transform: scale(1.015); } }

.sg-shop__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
  align-items: start;
  padding-top: var(--s-5);
  padding-bottom: var(--s-4);
}
.sg-shop__head h1 { font-size: 34px; }
.sg-shop__head p { margin-top: var(--s-2); }
.sg-shop__score { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); }
.sg-score { font-family: var(--font-display); font-size: 40px; line-height: .9; font-variant-numeric: tabular-nums; }
.sg-shop__new { font-family: var(--font-display); font-size: 26px; line-height: 1; }
.sg-shop__actions { display: grid; gap: var(--s-2); align-items: center; padding-bottom: var(--s-6); }
.sg-shop__actions .btn { width: 100%; }
/* on the phone the route is a text action under the one filled button, not a second full-width button */
@media (max-width: 639px) {
  .sg-shop__actions .btn--secondary {
    width: auto; height: var(--btn-h); padding: 0; justify-self: start;
    border: 0; background: none; color: var(--ink); font-weight: 500;
    text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-strong);
  }
  .sg-shop__actions .btn--secondary:hover { text-decoration-color: currentColor; }
}
.sg-shop__body { display: block; }
.sg-section { padding: var(--s-7) 0; border-top: 1px solid var(--line); }
.sg-section__head { display: grid; gap: var(--s-2); margin-bottom: var(--s-5); }
.sg-section__head h2 { margin: 0; }
.sg-section__head .link { justify-self: start; min-height: 44px; }
.sg-bars { display: grid; gap: var(--s-3); max-width: 620px; margin-top: var(--s-5); }
.sg-bar { display: grid; grid-template-columns: minmax(0, 96px) minmax(0, 1fr) 36px; gap: var(--s-2); align-items: center; }
.sg-bar__track { position: relative; height: 6px; background: var(--line); }
.sg-bar__fill { position: absolute; inset: 0 auto 0 0; background: var(--p-ink); }
.sg-bar__value { text-align: right; font-family: var(--font-display); font-size: 18px; font-variant-numeric: tabular-nums; }
/* on the phone the label column fits "Salat & Gemüse" and "Preis-Leistung" on one line (117px at 16);
   a 14px label in 116px keeps every bar row the same height */
@media (max-width: 639px) {
  .sg-bar { grid-template-columns: 116px minmax(0, 1fr) 40px; gap: var(--s-3); }
  .sg-bar__label { font-size: var(--t-small); }
}

.sg-review { max-width: 780px; padding: var(--s-5) 0; border-top: 1px solid var(--line); }
.sg-review:first-of-type { border-top: 0; }
.sg-review header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); max-width: 64ch; }
.sg-review header > div { min-width: 0; }
.sg-review__score { flex: none; font-family: var(--font-display); font-size: 24px; font-variant-numeric: tabular-nums; }
.sg-review__scores { margin-top: var(--s-2); }
.sg-review__body { margin-top: var(--s-3); white-space: pre-line; max-width: 64ch; overflow-wrap: anywhere; }
.sg-review__own { margin-top: var(--s-3); }
.sg-review__own .link { min-height: 44px; }
.sg-shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); margin-top: var(--s-4); }
/* a pair stays a pair at the 220px a lone photo gets; three or more go three-up on a tablet and
   a desktop instead of auto-fill leaving empty tracks after them */
.sg-shots:has(> .sg-shot:nth-child(2)):not(:has(> .sg-shot:nth-child(3))) { grid-template-columns: repeat(2, minmax(0, 220px)); }
.sg-shot { display: block; overflow: hidden; background: var(--p-surface); }
.sg-shot img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform 500ms var(--ease); }
.sg-shot:hover img { transform: scale(1.03); }
/* the photo opens in a native dialog: no library, no page overlay state */
.sg-gallery {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--p-ink);
  color: var(--p-bg);
}
.sg-gallery::backdrop { background: var(--p-ink); }
.sg-gallery[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; place-items: center; }
.sg-gallery__top {
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: calc(var(--s-4) + env(safe-area-inset-top)) var(--s-4) var(--s-4);
}
.sg-gallery__count { font: 500 var(--t-small)/1 var(--font-text); color: color-mix(in oklab, var(--p-bg) 72%, transparent); }
.sg-gallery__close,
.sg-gallery__nav {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid color-mix(in oklab, var(--p-bg) 55%, transparent);
  background: transparent;
  color: var(--p-bg);
  font: 500 var(--t-small)/1 var(--font-text);
  cursor: pointer;
}
.sg-gallery__close { padding: 0 var(--s-3); }
.sg-gallery__close:hover,
.sg-gallery__nav:hover { background: color-mix(in oklab, var(--p-bg) 14%, transparent); }
.sg-gallery__img {
  grid-row: 2;
  display: block;
  max-width: calc(100vw - var(--s-8));
  max-height: calc(100dvh - 150px);
  object-fit: contain;
}
.sg-gallery__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; padding: 0; font-size: 22px; }
.sg-gallery__prev { left: var(--s-3); }
.sg-gallery__next { right: var(--s-3); }
.sg-gallery__caption {
  grid-row: 3;
  max-width: 70ch;
  padding: var(--s-3) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
  color: color-mix(in oklab, var(--p-bg) 78%, transparent);
  font-size: var(--t-small);
  text-align: center;
}
.sg-shot--pick { display: grid; gap: var(--s-2); }
.sg-shot--pick span { font-size: var(--t-small); }

/* ---------------------------------------------------------------- forms */
main > .sg-page.sg-page, main > .sg-formpage.sg-formpage {
  height: auto;
  min-height: 0;
  padding-block: var(--s-6) calc(var(--s-8) + env(safe-area-inset-bottom));
}
.sg-page { max-width: none; }
.sg-formpage { max-width: 760px; }
.sg-formpage h1 { margin-top: var(--s-2); }
.sg-formpage > .t-lead { margin-top: var(--s-3); }
.sg-reviewform, .sg-newshop { display: grid; gap: var(--s-5); margin-top: var(--s-6); }
.sg-scores { display: grid; gap: var(--s-2); margin: 0; padding: 0; border: 0; }
.sg-scores legend { padding: 0; margin-bottom: var(--s-2); color: var(--muted); }
.sg-score-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  grid-template-areas: "label output" "range range";
  gap: var(--s-1) var(--s-4);
  align-items: center;
  min-height: 56px;
  padding-block: var(--s-2);
  border-top: 1px solid var(--line);
}
.sg-score-field:last-of-type { border-bottom: 1px solid var(--line); }
.sg-score-field label { grid-area: label; display: grid; gap: 1px; font-weight: 500; }
.sg-score-field label span { font-weight: 400; }
.sg-score-field input { grid-area: range; }
.sg-score-field output { grid-area: output; font-family: var(--font-display); font-size: 26px; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.sg-overall { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); margin-top: var(--s-4); font-weight: 500; }
.sg-overall strong { font-family: var(--font-display); font-size: 40px; font-weight: 400; line-height: 1; }
.sg-meta { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
/* the confirm step: the address takes the wide column and the district the narrow one, so the
   desktop form is not four 760px fields in a row; on a phone the two stack */
.sg-newshop__pair { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
@media (min-width: 640px) {
  .sg-newshop__pair { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
}
.sg-reviewform textarea, .sg-newshop textarea { font: 400 var(--t-body)/1.5 var(--font-text); }
.sg-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s-2); }
.sg-preview { min-width: 0; }
.sg-previews img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.sg-preview--file {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; padding: var(--s-2);
  border: 1px solid var(--line-strong); background: var(--p-surface);
  color: var(--muted); font-size: var(--t-small); line-height: 1.3;
  text-align: center; overflow-wrap: anywhere;
}
.sg-existing { display: grid; gap: var(--s-3); }
.sg-error { color: var(--err); font-weight: 500; }
.sg-hint { margin: 0 0 var(--s-2); }
.sg-reviewform .sg-hint { margin-top: calc(-1 * var(--s-2)); }
.sg-note { margin-top: var(--s-5); max-width: 46ch; }
.sg-back {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  max-width: 100%;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.sg-back__text { min-width: 0; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; overflow-wrap: anywhere; }
.sg-back:hover .sg-back__text { text-decoration-color: currentColor; }
.sg-back__arrow { text-decoration: none; }
.sg-filefield { display: grid; gap: var(--s-2); }
.sg-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  min-height: 44px;
  padding: var(--s-3);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}
.sg-file:hover { background: var(--p-surface); border-color: var(--p-ink); }
.sg-file:active { background: var(--p-surface); }
.sg-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sg-file:focus-within { outline: 2px solid var(--action); outline-offset: 2px; }
/* removing a photo is a 44px row with a 20px drawn box; the native 13px checkbox was the one
   target on the page under the thumb size, and the image above stays inert so tapping it never
   marks the photo for deletion */
.sg-shot--pick .sg-shot__remove { display: flex; align-items: center; gap: var(--s-2); min-height: 44px; font-size: var(--t-small); position: relative; cursor: pointer; }
.sg-shot--pick input[type="checkbox"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sg-shot__check {
  flex: none; display: inline-grid; place-items: center;
  width: 20px; height: 20px;
  border: 1px solid var(--line-strong);
  background: var(--p-bg);
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}
.sg-shot--pick input:checked + .sg-shot__check { background: var(--p-ink); border-color: var(--p-ink); }
.sg-shot--pick input:checked + .sg-shot__check::after {
  content: ""; width: 9px; height: 5px;
  border-left: 2px solid var(--p-bg); border-bottom: 2px solid var(--p-bg);
  transform: rotate(-45deg) translate(1px, -1px);
}
.sg-shot--pick input:focus-visible + .sg-shot__check { outline: 2px solid var(--p-action); outline-offset: 2px; }
.sg-shot__remove:hover .sg-shot__check { border-color: var(--p-ink); }
.sg-shot--pick:has(input:checked) img { opacity: .45; }
.sg-delete { margin-top: var(--s-7); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.sg-delete summary {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 44px; color: var(--err); font-weight: 500; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklab, var(--err) 45%, transparent);
  list-style: none;
}
.sg-delete summary::-webkit-details-marker { display: none; }
.sg-delete summary::after {
  content: ""; width: 7px; height: 7px; flex: none;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
}
.sg-delete[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.sg-delete summary:hover { text-decoration-color: currentColor; }
.sg-delete__confirm {
  display: grid; gap: var(--s-4); max-width: 46ch;
  margin-top: var(--s-3); padding: var(--s-4);
  border: 1px solid var(--line-strong); background: var(--p-surface);
}
.sg-delete__confirm p { font-size: var(--t-small); }
.sg-delete__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); }
.sg-delete__actions .link { display: inline-flex; align-items: center; min-height: 44px; }
.sg-delete__confirm-btn {
  height: var(--btn-h); padding: 0 var(--s-4);
  border: 1px solid var(--err); border-radius: var(--r-sm);
  background: transparent; color: var(--err);
  font: 500 var(--t-body)/1 var(--font-text); cursor: pointer;
  transition: background-color 160ms var(--ease);
}
.sg-delete__confirm-btn:hover { background: color-mix(in oklab, var(--err) 10%, var(--p-bg)); }
.sg-delete__confirm-btn:active { transform: translateY(1px) scale(.985); }
.btn-row .link { min-height: 44px; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; }
.link:hover { text-decoration-thickness: 2px; }
/* inline and utility links carry no arrow: a right arrow means "onward" and belongs only to a real
   forward step (Bearbeiten); back links use .sg-back's left arrow instead */
.link::after { content: none; }
.link--arrow { display: inline-flex; align-items: center; gap: var(--s-2); text-decoration: none; }
.link--arrow .link__text { text-decoration: underline; text-underline-offset: 3px; }
.link--arrow:hover .link__text { text-decoration-thickness: 2px; }
.link--arrow::after { content: "\2192"; display: inline-block; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .link--arrow:hover::after { transform: translateX(3px); } }
/* the date value is a native control: WebKit centres it by default, unlike every other field */
.field input[type="date"] { text-align: left; }
.field input[type="date"]::-webkit-date-and-time-value { text-align: left; }
@media (max-width: 899px) {
  .field input[type="date"] { -webkit-appearance: none; appearance: none; }
  .field input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0; }
}
.field__label { display: block; }

input[type="range"] {
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: var(--line-strong); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -10.5px;
  background: var(--p-ink);
  border: 2px solid var(--p-bg);
  border-radius: 2px;
}
input[type="range"]::-moz-range-track { height: 3px; background: var(--line-strong); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; background: var(--p-ink); border: 2px solid var(--p-bg); border-radius: 2px; }

/* ---------------------------------------------------------------- pages */
.sg-page h1 { margin-bottom: var(--s-2); }
/* two blocks share the page: a small section label names each one, so the category winners
   never read as rows of the overall table */
.sg-blockhead {
  margin: var(--s-6) 0 var(--s-3);
  color: var(--muted);
  font-family: var(--font-text);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sg-leaders { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); margin: 0 0 var(--s-7); }
.sg-leader {
  display: grid;
  gap: var(--s-1);
  min-height: 44px;
  padding: var(--s-4);
  background: var(--p-surface);
  text-decoration: none;
  transition: background-color 160ms var(--ease);
}
.sg-leader:hover { background: var(--line); }
.sg-leader:hover .t-label { color: var(--ink); }
.sg-leader strong { font-weight: 500; font-size: 17px; line-height: 1.25; }
.sg-leader__score { font-family: var(--font-display); font-size: 26px; line-height: 1; }
/* the phone: five leader cards stacked read as five near-identical blocks; one surface block with five
   rows says the same in half the height */
@media (max-width: 639px) {
  .sg-leaders { grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0 0 var(--s-7); background: var(--p-surface); }
  .sg-leader {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label score" "name score";
    gap: 2px var(--s-3);
    padding: var(--s-3) var(--s-4);
    background: none;
    border-top: 1px solid var(--line);
  }
  .sg-leader:first-child { border-top: 0; }
  .sg-leader .t-label { grid-area: label; }
  .sg-leader strong { grid-area: name; font-size: 16px; }
  .sg-leader__score { grid-area: score; align-self: center; font-size: 24px; }
  .sg-leader:hover { background: var(--line); }
.sg-leader:hover .t-label { color: var(--ink); }
}
.sg-rank { list-style: none; margin: 0; padding: 0; }
.sg-rank__row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 48px;
  gap: var(--s-3);
  align-items: center;
  min-height: 44px;
  padding: var(--s-4) 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  transition: background-color 160ms var(--ease);
}
.sg-rank li:first-child .sg-rank__row { border-top: 0; }
.sg-rank__row:hover { background: var(--p-surface); }
.sg-rank__place { font-family: var(--font-display); font-size: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sg-rank__name { display: grid; gap: 1px; min-width: 0; }
.sg-rank__name strong { font-weight: 500; font-size: 16px; }
.sg-rank__cats { display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* a category and its score are one token: the line may wrap between categories, never between
   "Preis-Leistung" and its number (a hyphen is a break opportunity too) */
.sg-rank__cats .sg-cat, .sg-review__scores .sg-cat { white-space: nowrap; }
.sg-rank__score { font-family: var(--font-display); font-size: 24px; text-align: right; font-variant-numeric: tabular-nums; }
.sg-mine { list-style: none; margin: var(--s-6) 0 0; padding: 0; }
.sg-mine li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: var(--s-2) var(--s-4);
  align-items: baseline;
  padding: var(--s-4) 0;
  border-top: 1px solid var(--line);
}
.sg-mine li > .link { grid-column: 1 / -1; justify-self: start; min-height: 44px; }
.sg-mine .link { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.sg-mine__score { font-family: var(--font-display); font-size: 24px; text-align: right; font-variant-numeric: tabular-nums; }

/* long shop names, districts, authors and pasted URLs wrap instead of pushing the page sideways */
.sg-shop__head h1, .sg-shop__head p,
.sg-card__text, .sg-leader strong, .sg-rank__name strong, .sg-rank__name span,
.sg-review header strong, .sg-review__scores,
.sg-mine li > div, .sg-mine li p, .sg-shot--pick span { overflow-wrap: anywhere; }
.sg-mine li p { max-width: 72ch; }

/* a short page still fills the viewport, so the paper does not end mid-screen */
.sg-body--page, .sg-body--form, .sg-body--shop { display: flex; flex-direction: column; min-height: 100dvh; }
.sg-body--page main, .sg-body--form main, .sg-body--shop main { flex: 1 0 auto; }

/* ---------------------------------------------------------------- auth */
/* one screen, centred: no extra 100svh section under a padded main */
.sg-body--center { display: block; min-height: 100dvh; }
.sg-body--center main {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: calc(var(--nav) + var(--s-5)) var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom));
}
.sg-body--center main > .sg-auth { height: auto; min-height: 0; padding: 0; display: grid; place-items: center; width: 100%; }
.sg-body--bare main { padding-top: calc(var(--s-5) + env(safe-area-inset-top)); }
.sg-auth { display: grid; place-items: center; width: 100%; }
.sg-auth__card { display: grid; gap: var(--s-5); width: min(420px, 100%); padding-top: var(--s-6); border-top: 2px solid var(--p-ink); }
.sg-auth__card h1 { font-size: clamp(30px, 8vw, 48px); }
.sg-auth__card .mark { font-size: 20px; }
.sg-auth .btn-row { display: flex; }
.sg-auth .btn { width: 100%; }
.sg-auth .link { min-height: 44px; }
.sg-auth__data { display: grid; gap: var(--s-2); margin-top: var(--s-2); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.sg-auth__data .btn { width: 100%; }
.sg-auth__data p { margin: 0; }

/* ---------------------------------------------------------------- tablet */
@media (min-width: 640px) {
  .nav__wordmark { display: inline; }
  .nav__logo { gap: var(--s-2); }
  .nav__logo .brand-mark { width: 24px; height: 24px; }
  .sg-home {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 44dvh minmax(0, 1fr);
  }
  .sg-side__head h1 { font-size: clamp(30px, 2.2vw, 40px); }
  .sg-card { grid-template-columns: 88px minmax(0, 1fr) auto; gap: var(--s-4); }
  .sg-card__photo { width: 88px; height: 88px; }
  .sg-card__text strong { font-size: 17px; }
  .sg-card__score { font-size: 30px; }

  .sg-hero { height: clamp(280px, 38vw, 420px); }
  .sg-shop__head { grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-6); align-items: end; padding-top: var(--s-7); padding-bottom: var(--s-5); }
  .sg-shop__head h1 { font-size: clamp(34px, 3.2vw, 54px); }
  .sg-shop__score { display: grid; gap: var(--s-2); justify-items: end; }
  .sg-score { font-size: clamp(40px, 3.6vw, 52px); }
  .sg-shop__actions { display: flex; flex-wrap: wrap; gap: var(--s-4); }
  .sg-shop__actions .btn { width: auto; }
  .sg-section { padding: var(--s-8) 0; }
  .sg-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); }
  .sg-bar { grid-template-columns: 150px minmax(0, 1fr) 48px; gap: var(--s-4); }
  .sg-review { padding: var(--s-6) 0; }
  .sg-review header { gap: var(--s-4); }
  .sg-review__score { font-size: 26px; }
  .sg-shots { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 640px; }

  main > .sg-page.sg-page, main > .sg-formpage.sg-formpage { padding-block: var(--s-8) calc(var(--s-10) + env(safe-area-inset-bottom)); }
  .sg-reviewform, .sg-newshop { margin-top: var(--s-7); }
  .sg-score-field {
    grid-template-columns: minmax(0, 1fr) minmax(160px, 1.2fr) 48px;
    grid-template-areas: none;
    gap: var(--s-4);
    align-items: center;
    padding-block: 0;
  }
  .sg-score-field label { grid-area: auto; }
  .sg-score-field input { grid-area: auto; }
  .sg-score-field output { grid-area: auto; }
  .sg-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-leaders { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 var(--s-8); }
  .sg-rank__row { grid-template-columns: 40px minmax(0, 1fr) 56px; gap: var(--s-4); }
  .sg-rank__place { font-size: 22px; }
  .sg-rank__score { font-size: 28px; }
  .sg-mine li { grid-template-columns: minmax(0, 1fr) 64px auto; gap: var(--s-4); }
  .sg-mine li > .link { grid-column: auto; justify-self: auto; }
  .sg-auth__card h1 { font-size: clamp(34px, 6vw, 48px); }
}

/* ---------------------------------------------------------------- desktop home split */
/* a tablet and a small laptop: five leader cards in an auto grid leave a ragged 3+2 row; two columns
   and a full-width fifth card fill the row */
@media (min-width: 640px) and (max-width: 1199px) {
  .sg-leader:last-child:nth-child(odd) { grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s-4); }
  .sg-leader:last-child:nth-child(odd) strong { font-size: 18px; }
}

@media (min-width: 900px) {
  .sg-home {
    grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    height: calc(100dvh - var(--nav) - env(safe-area-inset-top));
  }
  .sg-side {
    border-right: 1px solid var(--line);
    padding: var(--s-6) var(--s-5) var(--s-8);
  }
  .sg-side__head h1 { font-size: clamp(30px, 2.2vw, 40px); }
  .sg-map { order: 0; border-bottom: 0; }
  .sg-rank__row { grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1.35fr) 64px; }
  .sg-rank__cats { display: block; white-space: normal; overflow: visible; text-overflow: clip; }
}

@media (min-width: 1024px) {
  .sg-hero { height: clamp(360px, 36vw, 560px); }
}

/* the shop's lower body: the reviews on the reading column, the points as a sidebar; a shop with no
   reviews keeps the single column. At 1024 the place gutter leaves only a 784px wrap (348 + 96 +
   340), which wraps the review to 40 characters; the split waits for the 960px wrap of 1200 */
@media (min-width: 1200px) {
  .sg-shop__body:has(.sg-section--points) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    column-gap: var(--s-9);
    align-items: start;
  }
  .sg-shop__body:has(.sg-section--points) .sg-section--reviews { grid-column: 1; grid-row: 1; }
  .sg-shop__body:has(.sg-section--points) .sg-section--points { grid-column: 2; grid-row: 1; }
  .sg-section--points .sg-bar { grid-template-columns: 124px minmax(0, 1fr) 44px; gap: var(--s-3); }
  .sg-section--points .sg-bar__value { font-size: 18px; }
}

@media (min-width: 1200px) {
  .sg-leaders { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* one photograph is a frame, not a postage stamp: cap its column so it grows to a readable square */
.sg-shots:has(> .sg-shot:only-child) { grid-template-columns: minmax(0, 220px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
