/*
 * Mobile-first: base styles target phones, min-width media queries add to them.
 * Baseline: current Chromium/Firefox, Safari 15.4+ (iOS/macOS).
 */

:root {
  --color-bg: #f6f5f2;
  --color-surface: #ffffff;
  --color-text: #1f2328;
  --color-muted: #5f6670;
  --color-accent: #d9480f;
  --color-accent-dark: #b23a0c;
  /* Orange and green as text colour: 4.5:1 on white, page and notice backgrounds (accent alone is 4.3:1). */
  --color-accent-text: #b23a0c;
  --color-on-accent: #ffffff;
  --color-border: #dcd9d3;
  --color-alert-bg: #fff0eb;
  --color-notice: #2f9e44;
  --color-notice-text: #1f7a33;
  --color-notice-bg: #ebfbee;
  --color-danger: #c92a2a;
  --color-shadow: rgb(0 0 0 / 12%);

  --radius: 10px;
  --tap-size: 48px;
  --header-height: 56px;
  --gutter: 1rem;
  --font-size-base: 1rem;
  --font-size-h1: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  /* "In review" has its own colour (violet): orange only means actions and the brand. Used by the
     map, the clock badge, the map swatch and the level bar; plain colour without color-mix. */
  --color-pending: #ae3ec9;
  --color-pending-bg: var(--color-pending);
  --color-pending-border: #862e9c;
  /* Level bar: accepted points orange, points still in review violet. Pair checked for colour
     blindness (orange turns yellowish, violet bluish). */
  --color-level-done: #d9480f;
  --color-level-pending: #862e9c;
}

@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --color-pending-bg: color-mix(in srgb, var(--color-pending) 55%, var(--color-surface));
  }
}

/* Dark colours: from the device unless the account chose light, or always when it chose dark
   (Einstellungen › Darstellung, data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #16181b;
    --color-surface: #1f2226;
    --color-text: #e8e6e3;
    --color-muted: #a3a8af;
    --color-accent: #ff7a3d;
    --color-accent-dark: #ff9361;
    --color-accent-text: #ff7a3d;
    --color-on-accent: #16181b;
    --color-border: #33373d;
    --color-alert-bg: #3a2219;
    --color-notice: #51cf66;
    --color-notice-text: #51cf66;
    --color-notice-bg: #1b2e20;
    --color-danger: #ff6b6b;
    --color-shadow: rgb(0 0 0 / 45%);
    --color-level-done: #e5662b;
    --color-pending: #da77f2;
    --color-pending-border: #e599f7;
    --color-level-pending: #ae3ec9;
  }
}

:root[data-theme="dark"] {
  --color-bg: #16181b;
  --color-surface: #1f2226;
  --color-text: #e8e6e3;
  --color-muted: #a3a8af;
  --color-accent: #ff7a3d;
  --color-accent-dark: #ff9361;
  --color-accent-text: #ff7a3d;
  --color-on-accent: #16181b;
  --color-border: #33373d;
  --color-alert-bg: #3a2219;
  --color-notice: #51cf66;
  --color-notice-text: #51cf66;
  --color-notice-bg: #1b2e20;
  --color-danger: #ff6b6b;
  --color-shadow: rgb(0 0 0 / 45%);
  --color-level-done: #e5662b;
  --color-pending: #da77f2;
  --color-pending-border: #e599f7;
  --color-level-pending: #ae3ec9;
}

:root {
  color-scheme: light dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Stops iOS from enlarging text after rotating to landscape. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Scrolling only: no pinch or double-tap zoom of the page. Maps have touch-action: none and
     zoom with their own gestures (pointer events still reach them). */
  touch-action: pan-x pan-y;
}

/* iPhone/iPad: the root size follows the text size of the device (Settings › Display & Brightness ›
   Text Size, Dynamic Type), so every rem grows with it. Default step is 17px. Only on iOS
   (-webkit-touch-callout exists only there): on the Mac the same keyword would be 13px.
   font-family is set again on body; page zoom stays off. */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html {
    font: -apple-system-body;
  }
}

/* Text cannot be selected or copied (public/js/page-guard.js blocks copying); no long-press menu
   on iOS. Fields stay usable, and coordinates stay selectable where the copy button is missing. */
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Links keep the long-press menu on iOS ("Link kopieren", "Teilen"); the text around stays
   unselectable. Not on pictures inside links: no "Bild sichern" for proof and community photos. */
a[href] {
  -webkit-touch-callout: default;
  /* In the installed iPhone app a long press otherwise lifts the link for drag and drop (nowhere
     to drop it) instead of opening the menu. */
  -webkit-user-drag: none;
}

a[href] img,
a[href] svg {
  -webkit-touch-callout: none;
}

input,
textarea,
select,
[contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* dvh follows the collapsing mobile address bar; 100vh above is the fallback. */
  min-height: 100dvh;
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.5;
  background: var(--color-bg);
  color: var(--color-text);
}

h1 {
  margin: 0 0 1rem;
  font-size: var(--font-size-h1);
  line-height: 1.2;
}

p,
li,
strong {
  /* Long e-mail addresses and usernames must not push the layout sideways. */
  overflow-wrap: anywhere;
}

a {
  color: var(--color-accent-text);
}

a,
button,
summary {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: calc(var(--header-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0
    max(var(--gutter), env(safe-area-inset-left));
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.header-start {
  display: flex;
  align-items: center;
  min-width: 0;
}

/* Pulled into the gutter so the arrow itself lines up with the page edge. */
.back-button {
  flex-shrink: 0;
  margin-left: -0.75rem;
}

.brand {
  min-width: 0;
  overflow: hidden;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Pull to refresh (installed app, public/js/pull-refresh.js) ---------- */

/* Installed app on iPhone/iPad only (class set by the script): the page does not bounce while the
   spinner follows the finger. Never for all installed apps: it would switch off Android's own pull. */
.pull-refresh-on,
.pull-refresh-on body {
  overscroll-behavior-y: contain;
}

/* Hidden above its place until pulled; top is set below the header by the script. */
.pull-refresh {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 9;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.4rem;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.18);
  opacity: 0;
  transform: translate(-50%, -55px);
  pointer-events: none;
}

.pull-refresh.is-returning {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.pull-refresh-spinner {
  display: block;
  width: 100%;
  height: 100%;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
}

.pull-refresh.is-refreshing .pull-refresh-spinner {
  animation: pull-refresh-spin 0.8s linear infinite;
}

@keyframes pull-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Reduced motion: no moving and turning, the spinner only fades in a little below the header. */
@media (prefers-reduced-motion: reduce) {
  .pull-refresh {
    transform: translate(-50%, 0.75rem);
  }
}

/* ---------- Header actions (install button, account menu) ---------- */

/* Components below set display themselves, which would otherwise override [hidden]. */
[hidden] {
  display: none !important;
}

.header-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
  margin-right: -0.5rem;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-size);
  height: var(--tap-size);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--color-text);
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* Safari renders its own disclosure triangle unless it is hidden explicitly. */
.icon-button::-webkit-details-marker {
  display: none;
}

.icon-button:hover,
.menu[open] .icon-button {
  background: var(--color-bg);
}

.menu {
  position: relative;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(16rem, calc(100vw - 2 * var(--gutter)));
  padding: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px var(--color-shadow);
}

.menu-panel form {
  margin: 0;
}

.menu-heading {
  display: block;
  text-decoration: none;
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.25rem;
}

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--tap-size);
  padding: 0 0.75rem;
  border: none;
  border-radius: calc(var(--radius) - 4px);
  background: none;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* Separates the last group (e.g. "Abmelden") from the entries above. */
.menu-section {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--color-border);
}

.menu-item:hover,
.menu-item:active {
  background: var(--color-bg);
}

/* Small entries at the end of a menu (Impressum, Datenschutz). */
.menu-item-small {
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* ---------- Header: settings gear, offline picture ---------- */

.settings-button[aria-current="page"] {
  color: var(--color-accent-text);
}

.offline-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-size);
  height: var(--tap-size);
}

/* ---------- Tab bar (partials/tab-bar.ejs) ---------- */

:root {
  --tab-bar-height: 3.5rem;
}

/* Room for the fixed bar, so the last content and the footer are never covered. */
body:has(.tab-bar) {
  padding-bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom));
}

.tab-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

/* Equal columns, as many as there are tabs; on wide screens centred and not wider than a phone row. */
.tab-list {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.tab-list > li {
  min-width: 0;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  min-height: var(--tab-bar-height);
  padding: 0.25rem 0.125rem;
  color: var(--color-muted);
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  -webkit-touch-callout: none;
}

.tab::-webkit-details-marker {
  display: none;
}

.tab.is-active,
.tab-menu[open] > .tab {
  color: var(--color-accent-text);
}

.tab-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
}

.tab-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-border);
}

.tab.is-active .tab-avatar,
.tab-menu[open] .tab-avatar {
  border: 2px solid var(--color-accent);
}

/* Very small title below the icon; never wraps, cut with an ellipsis when six tabs are narrow. */
.tab-label {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The profile menu opens upwards, above the bar, at its right side (positioned on the tab list,
   so it stays on the screen whichever tab "Profil" is). */
.tab-list {
  position: relative;
}

.tab-menu {
  position: static;
}

.tab-menu-panel {
  top: auto;
  right: 0.5rem;
  bottom: calc(100% + 0.5rem);
}

/* ---------- Install dialog ---------- */

.install-dialog,
.confirm-dialog {
  width: min(28rem, calc(100% - 2 * var(--gutter)));
  max-height: calc(100% - 2 * var(--gutter));
  /* The body carries the padding, so a click on the dialog element itself means "backdrop". */
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 16px 48px var(--color-shadow);
}

.install-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgb(0 0 0 / 50%);
}

.install-dialog-body,
.confirm-dialog-body {
  padding: 1.25rem;
}

.install-dialog h2,
.confirm-dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.install-dialog ol {
  padding-left: 1.25rem;
}

.install-dialog li + li {
  margin-top: 0.5rem;
}

.map-app-choices {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.map-app-choices .button {
  width: 100%;
}

.map-app-cancel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.map-app-cancel .button {
  width: 100%;
}

/* Android: info button right of "Navigation starten", its hint below the link. */
.map-app-info-button {
  display: inline-flex;
  margin-left: 0.25rem;
  vertical-align: middle;
  color: var(--color-muted);
}

.map-app-info-button[hidden],
.map-app-info[hidden] {
  display: none;
}

.map-app-info {
  display: block;
  margin: 0.25rem 0 0.5rem;
}

.map-app-info-line {
  display: block;
}

.map-app-info-line + .map-app-info-line {
  margin-top: 0.25rem;
}

.map-app-info-line[hidden] {
  display: none;
}

/* The apps are the choice; "Abbrechen" is only a plain link below them. */
.install-dialog.map-app-dialog form {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}

.install-dialog.map-app-dialog form .link-button {
  min-height: var(--tap-size);
  color: var(--color-muted);
}

.install-dialog form {
  margin: 1rem 0 0;
}

/* Admin: interim count of the mods on the review page. */
.vote-summary {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.vote-summary h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.vote-summary .hint {
  margin-bottom: 0;
}

.vote-bar {
  display: block;
  width: 100%;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--color-border);
}

.vote-bar .is-approve {
  fill: var(--color-notice);
}

.vote-bar .is-reject {
  fill: var(--color-danger);
}

.vote-bar line {
  stroke: var(--color-text);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.vote-counts {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.vote-counts .is-approve strong {
  color: var(--color-notice-text);
}

.vote-counts .is-reject strong {
  color: var(--color-danger);
}

/* Decision log: the bar under the status of every entry. */
.decision-tally {
  display: block;
  margin-top: 0.5rem;
}

.decision-tally .vote-counts {
  margin-top: 0.25rem;
}

/* Review page: two decisions side by side, the positive one on the right. */
.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Admin: "Zulassen, aber Community-Bild sperren" takes a row of its own below the two decisions. */
.review-actions > :nth-child(n + 4) {
  grid-column: 1 / -1;
}

/* Admin: community photo of a proof in review (list and review page), not the proof. */
.admin-community-photo {
  margin-top: 0.75rem;
}

/* Review page (mods and admin): the proof photo with "Auf dem Nachweis-Foto" right below it, and
   the community photo as a separate block (dashed frame), reviewed with it only for violations. */
.review-photo {
  margin: 0 0 0.75rem;
}

.review-photo figcaption {
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.review-photo .photo-hint {
  margin: 0.5rem 0 0;
}

.review-community-photo {
  margin: 1.25rem 0 0.75rem;
  padding: 0.75rem;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
}

.review-community-photo figcaption {
  color: var(--color-accent-dark);
}

.review-community-photo .hint {
  margin: 0 0 0.5rem;
}

.review-community-photo img {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius);
}

/* Admin: "Auch Nachweise in der Wartezeit zeigen" below the review. */
.wait-filter {
  margin-top: 1rem;
}

.wait-filter .button {
  margin-top: 0.5rem;
}

.community-photo-flag {
  color: var(--color-accent-dark);
  font-size: 0.875rem;
  font-weight: 600;
}

.inline-icon {
  vertical-align: text-bottom;
}

/* ---------- Layout ---------- */

.content {
  flex: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem max(var(--gutter), env(safe-area-inset-right)) 1.5rem
    max(var(--gutter), env(safe-area-inset-left));
}

.card {
  --card-pad: 1.25rem;
  padding: var(--card-pad);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* A card that starts with text instead of a heading: no extra space above it. */
.card > p:first-child {
  margin-top: 0;
}

.hero .button {
  margin-bottom: 0.75rem;
}

.site-footer {
  padding: 0.75rem var(--gutter) max(0.75rem, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--color-muted);
  line-height: 1rem;
}

.site-footer small {
  font-size: 0.7rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 1.5rem;
  font-size: 0.8125rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.5rem;
  color: inherit;
  white-space: nowrap;
}

/* Legal links at the bottom of Einstellungen and the help page: plain links, one per line. */
.legal-links {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.legal-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.settings-logout {
  margin: 1.5rem 0 0;
}

.settings-logout .button {
  width: 100%;
}

.legal-version {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--color-muted);
}

/* ---------- Legal pages ---------- */

/* Text boxes that start with a paragraph (e.g. the mod commitment) instead of a heading. */
.legal > :first-child {
  margin-top: 0;
}

.legal h2 {
  margin-top: 1.75rem;
  font-size: 1.125rem;
}

.legal ul {
  padding-left: 1.25rem;
}

.legal li + li {
  margin-top: 0.375rem;
}

.legal-meta {
  color: var(--color-muted);
}

/* ---------- Quests ---------- */

.breadcrumb {
  margin: 0 0 0.5rem;
  color: var(--color-muted);
}

.breadcrumb a {
  display: inline-block;
  padding: 0.25rem 0;
}

.breadcrumb > * {
  margin: 0 4px;
}

.breadcrumb .breadcrumb-home {
  padding: 0;
}

.breadcrumb-home svg {
  /* Lines the drawn house (2px inset in the 16px box) up with the text baseline. */
  vertical-align: -0.125em;
}

.quest-cards {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quest-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.quest-card:hover,
.quest-card:active {
  border-color: var(--color-accent);
}

/* Two classes, so the later general ".card h2" margin does not win. */
.card.quest-card h2 {
  margin: 0 0 0.5rem;
  color: var(--color-accent-text);
}

/* Same space below the last line as above the heading. */
.card.quest-card > :last-child {
  margin-bottom: 0;
}

/* A card for something that is not available yet: no link, no hover, muted. */
.quest-card.is-disabled h2,
.quest-card.is-disabled {
  color: var(--color-muted);
}

.quest-meta {
  color: var(--color-muted);
}

/* Dailys and Weeklys on the quests page: the box is no link, each task is. */
.task-box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.task-box h2 {
  color: var(--color-accent-text);
}

/* Heading row of a card (Dailys/Weeklys, ranking, first steps): no margin above the heading.
   Two classes, so the later general ".card h2" margin does not win. */
.card .task-box-head h2 {
  margin: 0;
}

.task-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-list a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0;
  border-top: 1px solid var(--color-border);
  color: inherit;
  text-decoration: none;
}

.task-list li:first-child a {
  border-top: none;
}

.task-title {
  flex: 1;
  min-width: 0;
}

.task-list .is-done .task-title {
  color: var(--color-muted);
}

.task-points {
  flex: none;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.task-description {
  font-size: 1.0625rem;
  line-height: 1.5;
}

.photo-hint {
  padding: 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.progress-box {
  margin: 1rem 0;
}

.progress-box p {
  margin: 0 0 0.375rem;
}

.progress-box progress {
  width: 100%;
  height: 0.75rem;
  accent-color: var(--color-accent);
}

.list-tools {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1.25rem 0 0.75rem;
}

.filter-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.filter-row {
  display: flex;
  gap: 0.5rem;
}

.filter-row select {
  flex: 1;
  min-width: 0;
  min-height: var(--tap-size);
  padding: 0 0.75rem;
  font: inherit;
  font-size: max(16px, 1rem);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.filter-row .button {
  width: auto;
}

/* ---------- Admin ---------- */

/* Role filter, search and sorting stacked, each with its label. */
.admin-search {
  gap: 0.25rem;
}

.admin-search label:not(:first-child) {
  margin-top: 0.5rem;
}

/* A search field next to its button (decision log). */
.filter-row .admin-input {
  flex: 1;
  min-width: 0;
}

/* Search fields and selects of the admin lists look like the other form fields. */
.admin-select,
.admin-input {
  min-height: var(--tap-size);
  padding: 0 0.75rem;
  font: inherit;
  font-size: max(16px, 1rem);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.admin-list {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.admin-list > li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
  overflow-wrap: anywhere;
}

.admin-list small {
  color: var(--color-muted);
}

.admin-users .admin-user {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.125rem 0.75rem;
}

.admin-user-link {
  color: inherit;
  text-decoration: none;
}

/* Makes the whole row clickable like before. */
.admin-user-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.admin-user-name {
  font-weight: 600;
}

.admin-user-email {
  font-weight: 400;
  color: var(--color-muted);
}

.admin-user-email a {
  position: relative;
  z-index: 1;
  color: inherit;
}

.admin-user-points {
  font-weight: 700;
  color: var(--color-accent-text);
}

.admin-user-stats {
  grid-column: 1 / -1;
}

/* Reports against the user (only when there are any). */
.admin-user-reports {
  grid-column: 1 / -1;
  color: var(--color-danger);
}

/* "Weitere laden" jumps to the first new row; keep it clear of the sticky header. */
.admin-users .admin-user,
.mod-list > li {
  scroll-margin-top: calc(var(--header-height) + env(safe-area-inset-top) + 0.5rem);
}

.admin-users-more {
  text-align: center;
}

.admin-users-hint {
  color: var(--color-muted);
}

.role-tag {
  padding: 0 0.375rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-muted);
}

.role-tag.is-blocked {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.new-task[open] > summary {
  margin-bottom: 0.75rem;
}

.admin-tasks li {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.admin-tasks .is-inactive {
  opacity: 0.6;
}

.admin-task-hint {
  font-size: 0.875rem;
}

.list-status {
  margin: 0;
  min-height: 1.5em;
  color: var(--color-muted);
}

.landmark-list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.landmark-list li + li {
  border-top: 1px solid var(--color-border);
}

.landmark-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--tap-size);
  padding: 0.625rem 1rem;
  color: var(--color-text);
  text-decoration: none;
}

.landmark-list a:hover,
.landmark-list a:active {
  background: var(--color-bg);
}

.landmark-name small {
  display: block;
  color: var(--color-muted);
}

.landmark-side {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-muted);
}

.landmark-list .is-collected .landmark-name {
  color: var(--color-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--color-notice);
  color: var(--color-surface);
  font-size: 0.875rem;
  font-weight: 700;
}

/* Target in review (own Pionier list): clock on the violet "in review" colour, like on the map. */
.badge.is-pending {
  background: var(--color-pending-bg);
  color: var(--color-text);
}

.status-open {
  color: var(--color-muted);
}

/* XP of a target at the end of its title (Pionier, Postman), the only place they are named. */
.title-xp {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-accent-text);
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid currentColor;
  border-radius: 999px;
}

/* Everything to find a target (road, navigation, map, coordinates) between two lines across the card. */
.target-block {
  margin: 1.5rem calc(-1 * var(--card-pad, 1.25rem));
  padding: 0 var(--card-pad, 1.25rem) 0.75rem;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.card .target-block h2 {
  margin-top: 1rem;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.375rem 1rem;
  /* Labels stay on the line of their value, also next to the taller links. */
  align-items: baseline;
  margin: 0 0 1.25rem;
}

/* Links and the copy button in the target facts (route, point, map, coordinates) lie close
   together: each gets a full tap height, so the right one is easy to hit. */
.facts dd > a,
.facts dd > .link-button {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-size);
}

.facts dt {
  font-weight: 600;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Profile: the home link keeps the line height of the other facts (no tap-height gap above it);
   the state goes on a line of its own below the district. */
.profile-facts dd > a {
  display: inline;
  min-height: 0;
}

.profile-home-place {
  display: block;
}

/* A value below zero, e.g. a mod's review points in the admin view. */
.facts .is-negative {
  color: var(--color-danger);
}

.hint {
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* One tap selects the whole pair where copying is not available. */
.coordinates {
  -webkit-user-select: all;
  user-select: all;
  font-variant-numeric: tabular-nums;
  margin-right: 0.5rem;
}

.link-button.coordinates {
  user-select: none;
}

.card h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.125rem;
}

.proof-photo {
  display: block;
  width: 100%;
  /* Photos are saved square; older, non-square ones are shown cropped to the centre. */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
}

/* Two steps on the proof page: location and photo, each with a status icon. */
/* Stacked, so the status text has the full width; the button sits on the right. */
.capture-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0 0.75rem;
}

.capture-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.capture-step[data-state="ok"] {
  border-color: var(--color-notice);
}

.capture-step[data-state="error"] {
  border-color: var(--color-danger);
}

.capture-step-status {
  flex: 1;
  display: flex;
  gap: 0.375rem;
  align-items: flex-start;
  margin: 0;
  font-size: 0.875rem;
}

.step-icon {
  flex: none;
  display: flex;
}

/* Only the icon of the current state is shown. */
.step-icon svg {
  display: none;
}

.capture-step[data-state="none"] .icon-none,
.capture-step[data-state="pending"] .icon-pending,
.capture-step[data-state="ok"] .icon-ok,
.capture-step[data-state="error"] .icon-error,
.step-icon[data-state="none"] .icon-none,
.step-icon[data-state="pending"] .icon-pending,
.step-icon[data-state="ok"] .icon-ok,
.step-icon[data-state="error"] .icon-error {
  display: block;
}

.icon-none,
.icon-pending {
  color: var(--color-muted);
}

.icon-ok {
  color: var(--color-notice);
}

.icon-error {
  color: var(--color-danger);
}

/* Below the camera button; opening the camera scrolls it to the top, clear of the sticky header. */
.capture-photo-hint {
  margin: 0;
  scroll-margin-top: calc(var(--header-height) + env(safe-area-inset-top) + 0.5rem);
}

.capture-step .button {
  flex: none;
  width: 4.5rem;
  padding: 0.5rem;
}

.capture-frame video,
.capture-frame img {
  display: block;
  /* Square like the saved photo (centre crop, see quest-capture.js); never taller than the screen. */
  width: min(100%, 70vh);
  aspect-ratio: 1 / 1;
  margin: 0.75rem auto;
  object-fit: cover;
  background: #000;
  border-radius: var(--radius);
}

/* Digital zoom (quest-capture.js sets --zoom and --zoom-inset): the picture is enlarged around
   its centre and clipped back to its own square, so the layout does not move. */
.capture-frame video {
  transform: scale(var(--zoom, 1));
  clip-path: inset(var(--zoom-inset, 0%) round calc(var(--radius) / var(--zoom, 1)));
}

.capture-frame video.is-mirrored {
  transform: scaleX(-1) scale(var(--zoom, 1));
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(100%, 70vh);
  min-height: var(--tap-size);
  margin: -0.25rem auto 0;
}

.zoom-control input {
  flex: 1;
  accent-color: var(--color-accent);
}

.zoom-control output {
  min-width: 3ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.capture-actions {
  /* Room below the camera buttons when the page scrolls them into view. */
  scroll-margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.stat strong {
  font-size: 2rem;
  line-height: 1.1;
  color: var(--color-accent-text);
}

.stat span {
  color: var(--color-muted);
}

.recent-count {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.collection-quest {
  margin-bottom: 1rem;
}

/* Offline page: its cards (offline, kept targets, waiting proofs) stand apart. */
.offline-page > .card + .card {
  margin-top: 1rem;
}

/* A settings card followed by more cards or drawers (e.g. mod settings): keep them apart. */
.admin-section {
  margin-bottom: 1.5rem;
}

/* "Mod werden": application box and start page invitation. */
.mod-apply,
.mod-invite {
  margin-bottom: 1rem;
}

/* Start page: the invitation stands apart from the task boxes or the map above it. */
.mod-invite {
  margin-top: 1rem;
}

/* "Mod werden": the rules card and the box below it stand apart. */
.legal + .mod-apply {
  margin-top: 1rem;
}

.mod-apply form {
  margin: 0;
}

/* Rules drawer below the review card or box of the mod tools. */
.mod-rules {
  margin-top: 1rem;
}

.collection-quest > summary {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  /* Room for the open/closed arrow drawn below. */
  padding-right: 2rem;
  position: relative;
  cursor: pointer;
  list-style: none;
}

.collection-quest > summary::-webkit-details-marker {
  display: none;
}

.collection-quest > summary::after {
  content: "";
  position: absolute;
  top: 0.35rem;
  right: 0.25rem;
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.collection-quest[open] > summary::after {
  top: 0.6rem;
  transform: rotate(-135deg);
}

/* Same look as a closed quest drawer, without opening. */
.task-totals {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.collection-quest-title {
  font-size: 1.125rem;
  font-weight: 700;
}

/* Start page: progress per Bundesland/canton and country under the own Pionier map. */
.pionier-progress {
  display: grid;
  gap: 0.625rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.pionier-progress li {
  display: grid;
  gap: 0.25rem;
}

.pionier-progress progress {
  width: 100%;
  height: 0.5rem;
  accent-color: var(--color-accent);
}

.pionier-progress-complete {
  margin: 0.75rem 0 0;
}

.collection-quest progress {
  width: 100%;
  height: 0.75rem;
  accent-color: var(--color-accent);
}

.region-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.region-list li + li {
  border-top: 1px solid var(--color-border);
}

.region-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap-size);
  color: var(--color-text);
  text-decoration: none;
}

.region-list .is-complete {
  font-weight: 600;
}

.region-count {
  color: var(--color-muted);
}

.country-group {
  border-top: 1px solid var(--color-border);
}

.country-group:first-of-type {
  margin-top: 1rem;
}

.country-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: var(--tap-size);
  padding-right: 1.75rem;
  position: relative;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.country-group > summary::-webkit-details-marker {
  display: none;
}

/* Same arrow as on the quest cards. */
.country-group > summary::after {
  content: "";
  position: absolute;
  top: calc(50% - 0.45rem);
  right: 0.3rem;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.country-group[open] > summary::after {
  top: calc(50% - 0.15rem);
  transform: rotate(-135deg);
}

.country-group > .region-list {
  margin: 0 0 0.75rem 1rem;
}

/* ---------- Profile ---------- */

/* Picture large and centred, name below; the edit pencil sits in the top right corner of the card. */
.profile {
  position: relative;
}

.profile-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.profile-head h1 {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
}

.profile-head .avatar {
  width: 10rem;
  height: 10rem;
}

.profile-head .avatar-placeholder {
  font-size: 4rem;
}

.avatar {
  flex: none;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-muted);
}

/* Edit at the top left, share at the top right of the profile card. */
.profile-edit {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  color: var(--color-accent);
}

/* Follows (profile): the button below the name, the lists in their drawers. */
.profile-follow {
  width: min(8rem, 100%);
  margin: -0.5rem auto 1.5rem;
}

/* Half the size of a normal button (Andi 2026-11-19). */
.profile-follow .button {
  display: flex;
  width: 100%;
  min-height: calc(var(--tap-size) / 2);
  padding: 0.125rem 0.5rem;
  font-size: 0.875rem;
}

.profile-follow-hint {
  margin-top: -0.5rem;
  text-align: center;
}

.follow-list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.follow-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.follow-list li + li {
  border-top: 1px solid var(--color-border);
}

.follow-person {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  min-height: var(--tap-size);
  overflow-wrap: anywhere;
}

.follow-avatar {
  width: 2.5rem;
  height: 2.5rem;
}

.follow-avatar.avatar-placeholder {
  font-size: 1.125rem;
}

.follow-person {
  text-decoration: none;
}

.follow-name {
  text-decoration: underline;
}

.follow-since {
  display: block;
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* Profile: the links to the pages "Folge ich" and "Gefolgt von". */
.follow-links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.follow-links li + li {
  border-top: 1px solid var(--color-border);
}

.follow-links a {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: var(--tap-size);
  font-weight: 600;
}

.follow-links .quest-meta {
  margin-left: auto;
}

.follow-links a::after {
  content: "›";
  color: var(--color-muted);
  font-size: 1.25rem;
}

/* Follow dialogs: the action on the left, "Abbrechen" on the right, well apart. */
.follow-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.follow-dialog-actions .button {
  width: auto;
}

.follow-dialog-actions .link-button {
  min-height: var(--tap-size);
  padding: 0 0.5rem;
}

.follow-remove {
  flex: none;
  background: none;
  color: var(--color-muted);
}

.profile-actions {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.25rem;
  color: var(--color-accent);
}

.profile-share-status:empty {
  display: none;
}

.profile-bio {
  /* Keeps the line breaks the user typed. */
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.profile-avatar-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.profile-avatar-edit .hint {
  flex-basis: 100%;
  margin: 0;
}

.profile-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Keeps the file input usable (label click, screen readers) while the label is the visible button. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Suggestion list under the home district search (public/js/home-search.js). */
.combobox {
  position: relative;
}

.combobox-list {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  max-height: 18rem;
  margin: 0;
  padding: 0.25rem 0;
  overflow-y: auto;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.25);
}

.combobox-list li {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--tap-size);
  padding: 0.25rem 0.75rem;
  cursor: pointer;
}

.combobox-list li small {
  color: var(--color-muted);
}

.combobox-list li[aria-selected="true"],
.combobox-list li:hover {
  background: var(--color-bg);
}

/* ---------- Forms & buttons ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form label {
  margin-top: 0.5rem;
  font-weight: 600;
}

.form input,
.form textarea,
.form select {
  width: 100%;
  min-height: var(--tap-size);
  padding: 0.625rem 0.75rem;
  /* Below 16px iOS Safari zooms into the page when an input gets focus. */
  font: inherit;
  font-size: max(16px, 1rem);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  -webkit-appearance: none;
  appearance: none;
}

.form textarea {
  resize: vertical;
}

/* Fields grouped in a block keep the spacing of the form. */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form select {
  padding: 0 0.75rem;
}

.form input:disabled {
  color: var(--color-muted);
}

.form label small {
  font-weight: normal;
  color: var(--color-muted);
}

/* Explanation below the text of a checkbox (e.g. Pionier-Testmodus), not in a column beside it. */
.form .checkbox-hint {
  display: block;
  margin-top: 0.125rem;
}

/* Label wraps the box so the whole text is a tap target; overrides the bold block label. */
.form .checkbox,
.filter-form .checkbox,
.wait-filter .checkbox,
.report-decision .checkbox {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  font-weight: normal;
}

.form .checkbox input,
.filter-form .checkbox input,
.wait-filter .checkbox input,
.report-decision .checkbox input {
  flex: none;
  width: 1.375rem;
  min-height: 0;
  height: 1.375rem;
  margin: 0.125rem 0 0;
  padding: 0;
  accent-color: var(--color-accent);
  -webkit-appearance: auto;
  appearance: auto;
}

.form button {
  margin-top: 1.25rem;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap-size);
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
.button:active {
  background: var(--color-accent-dark);
}

.button-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

/* Actions that close something (e.g. "Mod-Funktion abgeben"). */
.button-danger,
.button-danger:hover,
.button-danger:active {
  background: var(--color-danger);
  color: #fff;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-accent-text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.button-secondary:hover,
.button-secondary:active {
  background: var(--color-bg);
}

/* Clearly grey, so a locked button (e.g. "Einsammeln" before both steps) never looks active. */
.button:disabled {
  background: var(--color-border);
  color: var(--color-muted);
  border-color: var(--color-border);
  cursor: not-allowed;
}

/* Plain text links get a larger tap area without changing how they look. */
.card p a:not(.button),
.hero p a:not(.button) {
  display: inline-block;
  padding: 0.5rem 0;
}

/* ---------- Messages ---------- */

.alert,
.notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}

.alert {
  background: var(--color-alert-bg);
  border-left: 4px solid var(--color-accent);
}

ul.alert {
  padding-left: 2rem;
}

.notice {
  background: var(--color-notice-bg);
  border-left: 4px solid var(--color-notice);
}

.verify-banner {
  margin-bottom: 1rem;
}

.verify-banner p {
  margin: 0 0 0.5rem;
}

/* Start page: the code input folded away ("Account hier aktivieren"). */
.verify-drawer > summary {
  margin: -0.25rem 0;
}

.verify-drawer[open] > summary {
  margin-bottom: 0.5rem;
}

.check-email-address {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.verify-code-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.verify-code-row input {
  width: 100%;
  box-sizing: border-box;
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
}

.verify-resend-form {
  margin-top: 0.25rem;
}

.verify-dialog form[method="dialog"] {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

.verify-dialog form[method="dialog"] .link-button {
  min-height: var(--tap-size);
  color: var(--color-muted);
}

/* ---------- Larger screens ---------- */

@media (min-width: 40rem) {
  :root {
    --gutter: 1.5rem;
  }

  .content {
    padding-top: 2.5rem;
  }

  .card {
    --card-pad: 2rem;
  }

  /* Full-width buttons are a touch convenience; on wide screens they look stretched. */
  .button {
    display: inline-flex;
    width: auto;
  }

  .form .button {
    align-self: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Map (quest Pionier) ---------- */

.map-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1rem;
}

.map-stat {
  margin: 0.25rem 0;
}

/* Big map page: exactly one screen high (no footer); the map takes what is
   left, so the page itself never scrolls (only on very small screens, see min-height below). */
body:has(.map-page) {
  height: 100vh;
  height: 100dvh;
}

body:has(.map-page) .content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0.5rem;
}

.map-page {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.map-page > .map-frame {
  flex: 1;
  height: auto;
  min-height: 12rem;
}

.map-frame {
  position: relative;
  height: calc(100dvh - 12rem);
  min-height: 20rem;
  overflow: hidden;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.map-status {
  margin: 0;
  padding: 1rem;
  color: var(--color-muted);
}

.pionier-map {
  display: block;
  width: 100%;
  height: 100%;
  /* The page must not scroll or zoom itself while the map is being moved. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.pionier-map:active {
  cursor: grabbing;
}

.pionier-map path {
  fill: var(--color-surface);
  stroke: var(--color-muted);
  stroke-opacity: 0.45;
  stroke-width: 0.75px;
  stroke-linejoin: round;
  /* Same line width at every zoom level. */
  vector-effect: non-scaling-stroke;
  transition: fill 0.15s;
}

.pionier-map a:hover path,
.pionier-map a:focus-visible path {
  /* color-mix needs Safari 16.2; older browsers keep the plain colour. */
  fill: var(--color-bg);
  fill: color-mix(in srgb, var(--color-accent) 25%, var(--color-surface));
}

.pionier-map a.is-discovered path {
  fill: var(--color-accent);
  stroke-opacity: 1;
  stroke: var(--color-surface);
  stroke: color-mix(in srgb, var(--color-accent) 70%, #000);
}

.pionier-map a.is-discovered:hover path,
.pionier-map a.is-discovered:focus-visible path {
  fill: color-mix(in srgb, var(--color-accent) 80%, #fff);
}

/* In review (owner and admins only): violet (the legend and the target list say it in words). */
.pionier-map a.is-pending path {
  fill: var(--color-pending-bg);
  stroke-opacity: 1;
  stroke: var(--color-pending-border);
}

.pionier-map a.is-pending:hover path,
.pionier-map a.is-pending:focus-visible path {
  fill: color-mix(in srgb, var(--color-pending) 75%, var(--color-surface));
}

/* Admins on another user's map: areas the user has not discovered open nothing. */
.pionier-map a.is-inert {
  cursor: default;
}

.pionier-map a.is-inert:hover path {
  fill: var(--color-surface);
}

/* Country borders on top, for orientation; taps go through to the areas below. */
.pionier-map .map-borders path {
  fill: none;
  stroke: var(--color-text);
  stroke-opacity: 0.7;
  stroke-width: 1.5px;
  pointer-events: none;
}

/* Borders of the Bundesländer and cantons: thinner than the country borders. */
.pionier-map .map-borders path.region-border {
  stroke-opacity: 0.55;
  stroke-width: 1px;
}

/* Names: hidden when zoomed out, then always the same size on screen (set by pionier-map.js). */
.map-labels {
  display: none;
  pointer-events: none;
}

.pionier-map.show-labels .map-labels {
  display: inline;
}

.map-labels text {
  font-family: inherit;
  font-size: var(--label-size, 1px);
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  fill: var(--color-text);
  /* Light halo, so names stay readable on coloured areas and lines. */
  paint-order: stroke;
  stroke: var(--color-surface);
  stroke-width: calc(var(--label-size, 1px) * 0.25);
  stroke-linejoin: round;
}

.map-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.map-controls[hidden] {
  display: none;
}

.map-controls .icon-button {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px var(--color-shadow);
  color: var(--color-text);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
}

.map-legend .info-button {
  margin-left: -0.5rem;
}

.map-legend + .info-text {
  margin: 0.25rem 0 0;
}

/* Info icon (partials/info-button.ejs) after a word or title; its hint opens below. */
.info-button {
  display: inline-flex;
  vertical-align: middle;
  color: var(--color-muted);
}

/* All info buttons (also the navigation one): coloured only while pressed. Touch screens keep
   :hover after a tap, so the general hover background of .icon-button is switched off here. */
.icon-button.info-button:hover,
.icon-button.map-app-info-button:hover {
  background: none;
}

.icon-button.info-button:active,
.icon-button.map-app-info-button:active {
  background: var(--color-bg);
}

.title-with-info .info-button {
  margin-left: 0.25rem;
}

.info-text[hidden] {
  display: none;
}

/* A checkbox with its info icon on the right (admin panel: Admin-Test-Mode). */
.checkbox-with-info {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}

.checkbox-with-info .checkbox {
  flex: 0 1 auto;
}

/* The icon's tap area is larger than the box: centre the icon on the first line of the text. */
.checkbox-with-info .info-button {
  flex: none;
  margin-top: calc((1.6rem - var(--tap-size)) / 2);
}

.admin-test-switches {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.admin-test-switches .info-text p,
.admin-test-switches .info-text ul {
  margin: 0 0 0.5rem;
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.map-swatch {
  width: 1rem;
  height: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 3px;
}

.map-swatch.is-discovered {
  background: var(--color-accent);
  border-color: var(--color-accent);
  border-color: color-mix(in srgb, var(--color-accent) 70%, #000);
}

/* In review: violet with a dashed edge, like on the map. */
.map-swatch.is-pending {
  background: var(--color-pending-bg);
  border-color: var(--color-pending-border);
  border-style: dashed;
}

/* ---------- Admin: Pionier-Ziele ---------- */

.seed-download {
  margin-bottom: 1.5rem;
}

.seed-download h2 {
  margin-top: 0;
}

.seed-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.seed-downloads .button {
  gap: 0.375rem;
}

.target-map {
  height: min(70vh, 32rem);
  margin-top: 1rem;
  border-radius: var(--radius);
  /* Leaflet's own panes stack up to z-index 1000; keep them below the header and menu. */
  isolation: isolate;
}

.target-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.target-nav .button {
  margin: 0;
}

/* ---------- Start page, ranking, feed ---------- */

.hero-lead {
  font-size: 1.0625rem;
  line-height: 1.5;
}

.intro-section {
  margin-top: 2rem;
}

.intro-section h2,
.section-title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}

.section-title {
  margin-top: 1.5rem;
}

/* Numbered steps with the number in an accent circle. */
.intro-steps {
  display: grid;
  gap: 0.875rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.intro-steps li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  column-gap: 0.75rem;
  counter-increment: step;
}

.intro-steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 700;
}

.intro-steps span {
  color: var(--color-muted);
}

/* Guest start page: quest types to expand next to their number. */
.step-details > summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2rem;
  cursor: pointer;
  list-style: none;
}

.step-details > summary::-webkit-details-marker {
  display: none;
}

/* Open/closed arrow like in the quest list. */
.step-details > summary::after {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: -0.25rem;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.step-details[open] > summary::after {
  margin-top: 0.25rem;
  transform: rotate(-135deg);
}

.step-details > p {
  margin: 0.25rem 0 0;
  color: var(--color-muted);
}

.intro-cards {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.intro-cards h3 {
  margin: 0 0 0.375rem;
  color: var(--color-accent-text);
}

.intro-cards p {
  margin: 0;
}

@media (min-width: 36rem) {
  .intro-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.safety-note {
  margin-top: 2rem;
  border-left: 4px solid var(--color-accent);
}

.safety-note h2 {
  margin: 0 0 0.375rem;
  font-size: 1.125rem;
}

.safety-note p {
  margin: 0;
}

.faq {
  border-top: 1px solid var(--color-border);
}

.faq:last-of-type {
  border-bottom: 1px solid var(--color-border);
}

.faq > summary {
  display: flex;
  align-items: center;
  min-height: var(--tap-size);
  cursor: pointer;
  font-weight: 600;
}

.faq > p,
.faq > ul {
  margin: 0 0 0.875rem;
  color: var(--color-muted);
}

.faq > ul {
  padding-left: 1.25rem;
}

.intro-cta {
  margin-top: 2rem;
}

/* Signed-in start page: cards stacked with even spacing. */
.home-status {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.home-status h1 {
  margin: 0 0 0.125rem;
  font-size: 1.375rem;
}

.home-status p {
  margin: 0;
}

.home-status .mini-avatar {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.5rem;
}

.onboarding,
.ranking,
.feed,
.community-stats {
  margin-top: 1rem;
}

.home-tasks {
  display: grid;
  gap: 1rem;
}

/* "Los geht's": a drawer, open on every visit; the arrow like the other drawers, right of the count. */
.onboarding-drawer > summary {
  position: relative;
  padding-right: 1.75rem;
  cursor: pointer;
  list-style: none;
}

.onboarding-drawer > summary::-webkit-details-marker {
  display: none;
}

.onboarding-drawer > summary::after {
  content: "";
  position: absolute;
  top: calc(50% - 0.45rem);
  right: 0.3rem;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.onboarding-drawer[open] > summary::after {
  top: calc(50% - 0.15rem);
  transform: rotate(-135deg);
}

.onboarding-drawer:not([open]) > summary {
  margin-bottom: 0;
}

.onboarding-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0;
}

.onboarding-info-text {
  margin: -0.25rem 0 0.625rem;
}

.onboarding-info-text p {
  margin: 0 0 0.25rem;
}

/* A step link with an info button on the right (notifications, first Daily/Pionier-Flagge): one row, one line above. */
.onboarding-link-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  border-top: 1px solid var(--color-border);
}

.task-list .onboarding-link-row a {
  flex: 1;
  min-width: 0;
  border-top: none;
}

/* Inside the step list: plain underlined links in the text colour, not the step rows' link style.
   With "p" it wins over ".card p a" (inline-block would add space around a line with a link);
   inline, the padding only enlarges the tap area. */
.task-list .onboarding-info-text p a {
  display: inline;
  padding: 0.5rem 0;
  border: none;
  color: inherit;
  text-decoration: underline;
}

.mini-avatar {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  font-size: 1rem;
}

/* Tabs as a row of links; the current one is filled. */
.segmented {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  padding: 0.25rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.segmented a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 0.375rem;
  border-radius: calc(var(--radius) - 3px);
  color: var(--color-text);
  font-size: 0.9375rem;
  text-align: center;
  text-decoration: none;
}

.segmented a[aria-current="page"] {
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 600;
}

/* Rankings and the activity feed: four areas (district, Bundesland/Kanton, country, DACH) must fit a narrow phone. */
.ranking .segmented a,
.feed-scope a {
  min-width: 0;
  padding: 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.ranking-home {
  margin: 0 0 0.5rem;
}

.ranking-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: var(--tap-size);
  padding: 0.25rem 0.375rem;
  border-top: 1px solid var(--color-border);
}

.ranking-list li:first-child {
  border-top: none;
}

.ranking-list .is-me {
  background: var(--color-alert-bg);
  border-radius: var(--radius);
}

.ranking-rank {
  flex: none;
  width: 2rem;
  font-weight: 700;
  color: var(--color-muted);
  text-align: right;
}

.ranking-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.ranking-score {
  flex: none;
  text-align: right;
}

.ranking-level {
  font-size: 1.125rem;
  font-weight: 700;
}

.ranking-points {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.ranking-own {
  margin: 0.75rem 0 0;
  font-weight: 600;
}

.ranking .hint {
  margin: 0.375rem 0 0;
}

.ranking-more {
  margin: 0.75rem 0 0;
}

.feed h2,
.community-stats h2 {
  margin-top: 0;
}

.feed-list {
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.feed-list li {
  display: flex;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-top: 1px solid var(--color-border);
}

.feed-list li:first-child {
  border-top: none;
}

.feed-list p {
  margin: 0;
}

.feed-user {
  font-weight: 600;
}

/* Only the owner and admins see it: this entry shows "Anonym" to everyone else. */
.feed-anonymous {
  color: var(--color-muted);
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
}

.stat-tiles li {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.25rem;
  background: var(--color-bg);
  border-radius: var(--radius);
}

/* Start page: three community numbers in one row. */
.community-stats .stat-tiles {
  grid-template-columns: repeat(3, 1fr);
}

.stat-tiles strong {
  font-size: 1.5rem;
  color: var(--color-accent-text);
}

.stat-tiles span {
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* "Meine Punkte": points and points in review, as two cards outside a card. */
.points-tiles {
  margin-bottom: 0.5rem;
}

.points-tiles li {
  padding: 1rem 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.points-tiles strong {
  font-size: 2rem;
}

/* "Fortschritt": the boxes below the numbers, all with the same gap (hidden ones take none). */
.level-sections {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.level-sections > * {
  margin: 0;
}

/* "Fortschritt": the points second, below the level. */
.level-card {
  margin-bottom: 0.75rem;
}

.points-tiles-small li {
  padding: 0.625rem 0.25rem;
}

.points-tiles-small strong {
  font-size: 1.25rem;
}

.points-tiles .is-empty strong {
  color: var(--color-muted);
}

/* Mods have a third tile (open votes). */
.points-tiles:has(> li:nth-child(3)) {
  grid-template-columns: repeat(3, 1fr);
}

/* Countdown before a mod can decide (review.js). */
.review-wait {
  margin: 0.5rem 0 0;
  text-align: center;
}

/* Own proofs with status ("Meine erledigten Aufgaben"). */
.proof-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.proof-list li + li {
  border-top: 1px solid var(--color-border);
}

.proof-list a,
.proof-list li > div {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  color: inherit;
  text-decoration: none;
}

.proof-list img {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: calc(var(--radius) - 4px);
  background: var(--color-bg);
}

.proof-list li > * > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.proof-title {
  font-weight: 600;
}

/* Kind of quest next to a proof's title ("Pionier", "Daily", "Postman · Weekly"). */
.quest-kind {
  display: inline-block;
  padding: 0 0.375rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-muted);
  white-space: nowrap;
}

.proof-list small {
  color: var(--color-muted);
}

.proof-status {
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* Admin only: too fast from or to the user's proof before/after it. */
.speed-warning,
.duplicate-warning,
.decision-reported {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-danger);
}

/* Admin only: proof taken without network and sent later. */
.offline-proof {
  display: block;
  font-size: 0.875rem;
  color: var(--color-accent-text);
}

/* Admin only: taken with Standortfreiheit – a framed label, so it is not lost in the admin box or list row. */
.location-free-proof {
  width: fit-content;
  margin-top: 0.375rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--color-danger);
  border-radius: var(--radius);
  background: var(--color-alert-bg);
  color: var(--color-danger);
  font-weight: 600;
}

.proof-list .is-accepted .proof-status {
  color: var(--color-notice-text);
}

.proof-list .is-rejected .proof-status {
  color: var(--color-danger);
}

/* Admin: decision log of the review by mods. */
.decision-log {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.decision-log > li {
  padding: 0.75rem 0;
}

.decision-log > li + li {
  border-top: 1px solid var(--color-border);
}

/* One decision, collapsed to title, user and outcome; same open/closed arrow as the drawers. */
.decision-entry > summary {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding-right: 2rem;
  position: relative;
  cursor: pointer;
  list-style: none;
}

.decision-entry > summary::-webkit-details-marker {
  display: none;
}

.decision-entry > summary::after {
  content: "";
  position: absolute;
  top: 0.35rem;
  right: 0.25rem;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.decision-entry[open] > summary::after {
  top: 0.55rem;
  transform: rotate(-135deg);
}

.decision-entry > summary small {
  color: var(--color-muted);
}

/* The photo uses the full width of the drawer (square, like every proof photo). */
.decision-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  margin: 0.75rem 0 0.25rem;
  border-radius: calc(var(--radius) - 4px);
  background: var(--color-bg);
}

/* Reports of mods on a decided proof, below the votes (decision log). */
.decision-reports {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
}

.decision-reports .is-accepted {
  color: var(--color-notice-text);
}

.decision-reports .is-rejected {
  color: var(--color-danger);
}

.decision-log .is-accepted .proof-status {
  color: var(--color-notice-text);
}

.decision-log .is-pending .proof-status {
  color: var(--color-pending);
}

.decision-log .is-rejected .proof-status {
  color: var(--color-danger);
}

.decision-log .hint {
  margin: 0.375rem 0 0;
}

.decision-votes {
  margin: 0.375rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
}

.decision-votes .is-approve {
  color: var(--color-notice-text);
}

.decision-votes .is-reject {
  color: var(--color-danger);
}

.decision-votes .is-skip {
  color: var(--color-muted);
  font-style: italic;
}

.decision-votes small {
  color: var(--color-muted);
}

/* Admin "Noch zu prüfende Nachweise": the votes so far below a proof, indented to its text. */
.proof-list .decision-votes {
  margin: 0 0 0.5rem calc(3.5rem + 0.75rem);
}

.proof-list .decision-votes li {
  border-top: 0;
}

.proof-list .decision-votes a {
  display: inline;
  padding: 0;
  color: var(--color-accent-text);
  text-decoration: underline;
}

/* Admin: list of mods. */
.mod-list > li {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.mod-list-name {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.mod-list small {
  color: var(--color-muted);
}

/* Radio choice in the profile form, like .form .checkbox. */
.choice-group {
  margin: 0.75rem 0 0;
  padding: 0;
  border: none;
}

.choice-group legend {
  padding: 0;
  font-weight: 600;
}

.choice-group .hint {
  margin: 0.25rem 0 0.5rem;
}

.form .choice {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: var(--tap-size);
  margin: 0;
  font-weight: normal;
}

.form .choice input {
  flex: none;
  width: 1.375rem;
  min-height: 0;
  height: 1.375rem;
  margin: 0;
  padding: 0;
  accent-color: var(--color-accent);
  -webkit-appearance: auto;
  appearance: auto;
}

/* Links inside the sentence of a feed entry stay inline (".card p a" makes them blocks with padding). */
.feed-list p a,
.home-status p a {
  display: inline;
  padding: 0;
}

/* Profile picture instead of the person icon in the header. */
.menu-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-border);
}

/* The home district label lands just below the sticky header when the search field gets focus. */
.form [data-home-label] {
  scroll-margin-top: calc(var(--header-height) + env(safe-area-inset-top) + 0.5rem);
}

/* Home fields while changing is locked (once every 30 days). */
.home-locked .form-label {
  margin-top: 0.5rem;
  font-weight: 600;
}

.home-locked p {
  margin: 0;
}

/* Cards below the profile card: the same gap for all of them (community photos, map, later ones). */
.card.profile ~ .card {
  margin-top: 1rem;
}

/* Own Pionier map on the start page, below the task boxes. */
.home-map {
  margin-top: 1rem;
}

/* Pionier map in the profile: smaller frame, the big one is a page of its own. */

.map-frame.is-compact {
  height: min(60vh, 24rem);
  min-height: 16rem;
}

/* Compact map in a scrolling page: one finger scrolls the page, two move the map (two-finger.js). */
.map-frame.is-compact .pionier-map {
  touch-action: pan-x pan-y;
}

/* "Zum Verschieben zwei Finger verwenden": laid over the map for a moment (two-finger.js). */
.map-gesture-hint {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgb(0 0 0 / 0.5);
  color: #fff;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.map-gesture-hint.is-visible {
  opacity: 1;
}

/* ---------- Postman ---------- */

.postman-rules {
  padding-left: 1.25rem;
}

.postman-rules li + li {
  margin-top: 0.375rem;
}

.postman-start,
.postman-target {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.postman-start h2,
.postman-target h2 {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  margin-top: 0;
}

.postman-start ul {
  padding-left: 1.25rem;
}

.postman-target.is-done {
  border-color: var(--color-notice);
}

/* Postman: where the tour stands, right above the target boxes. */
.tour-status {
  margin: 1rem 0 0;
  padding: 0.5rem 0.75rem;
  font-weight: 700;
  color: var(--color-accent-text);
  background: var(--color-bg);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius);
}

/* Postman: straight-line distance between the two target boxes. */
.postman-gap {
  margin: 0.75rem 0 0;
  text-align: center;
}

.postman-gap + .postman-target {
  margin-top: 0.75rem;
}

.task-box-reroll {
  margin-top: 0.75rem;
}

.postman-howto {
  margin: 1rem 0;
}

.points-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}

.points-legend li {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.legend-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
}

.legend-dot.is-tertiary { background: #d9480f; }
.legend-dot.is-unclassified { background: #1971c2; }
.legend-dot.is-residential { background: #868e96; }

.admin-avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  object-fit: cover;
}

/* Map page of a target: one screen high like the big Pionier map (.map-page), the short info
   (distance, navigation) compact above, the map takes the rest. */
.target-map-title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.target-map-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1rem;
}

.target-map-info p {
  margin: 0.25rem 0;
}

.target-map-info .map-app-info {
  flex-basis: 100%;
}

.map-page > .target-map-page {
  flex: 1;
  height: auto;
  min-height: 12rem;
  margin-top: 0.5rem;
}

.target-map-label {
  font-weight: 700;
}

/* Quiz on the mod rules: questions apart, wrongly answered ones marked. */
.mod-quiz .choice-group + .choice-group {
  margin-top: 1.25rem;
}

.mod-quiz .choice-group.is-wrong legend,
.mod-quiz .quiz-wrong {
  color: var(--color-danger, #b3261e);
}

.mod-quiz > .button {
  margin-top: 1.25rem;
}

/* "Melden" below the review buttons (placeholder until reporting exists). */
.review-report {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin: 1rem 0 0;
}

/* Number of open items on an admin card ("Meldungen"). */
.count-badge {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--color-danger);
  color: var(--color-surface);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
  vertical-align: middle;
}

/* Admin › Meldungen: the report's page. */
.report-info {
  margin-bottom: 1rem;
}

/* The reported photo: red frame (layout as on the review page, .review-photo). */
.report-photo.is-reported img {
  outline: 4px solid var(--color-danger);
  outline-offset: -4px;
}

.report-decision label {
  display: block;
  margin-top: 0.75rem;
  font-weight: 600;
}

.report-decision label.checkbox {
  margin-bottom: 0;
  font-weight: 400;
}

.filter-form .checkbox {
  margin: 0.75rem 0 0.25rem;
}

.report-buttons {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.report-buttons .button small {
  display: block;
  font-weight: 400;
}

.proof-thumb-missing {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: calc(var(--radius) - 4px);
  background: var(--color-bg);
}

.proof-list .is-pending .proof-status {
  color: var(--color-accent-dark);
  font-weight: 600;
}

/* Admin dialog "Nachweis wegen Verstoß verweigern": which photo. */
.violation-photos {
  margin: 0.5rem 0 0;
  padding: 0;
  border: 0;
}

.violation-photos legend {
  padding: 0;
  font-weight: 600;
}

.confirm-dialog .violation-photos label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.4rem;
  font-weight: 400;
}

/* Report dialog (mods) and decision forms (admin): the optional text. */
.confirm-dialog label {
  display: block;
  margin-top: 0.75rem;
  font-weight: 600;
}

.confirm-dialog textarea,
.report-remark {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  resize: vertical;
}

/* Admin mod list: users whose mod tools are blocked. */
.mod-blocked {
  color: var(--color-danger);
  font-weight: 600;
}

/* Start page: mod tools blocked by the admin – red drawer at the very top (collection-quest drawer). */
.mod-block-drawer {
  margin-bottom: 1rem;
  border: 1px solid var(--color-danger);
  background: var(--color-alert-bg);
}

/* Moved to the end of the start page: the cards above space themselves with margin-top only. */
.mod-block-drawer-end {
  margin: 1rem 0 0;
}

.mod-block-title {
  color: var(--color-danger);
}

.mod-block-drawer > summary::after {
  border-color: var(--color-danger);
}

.mod-block-drawer > p:last-child {
  margin-bottom: 0;
}

/* Admin user page: three cards (account, actions, progress). */
.admin-user-page > .card + .card {
  margin-top: 1rem;
}

.admin-user-page > .card > h2:first-child {
  margin-top: 0;
}

.admin-user-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* Admin user page: block and Standortfreiheit, each in its own drawer (country-group look). */
.admin-tools {
  margin: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.admin-tool-drawer > summary h3 {
  flex: none;
  margin: 0;
  font-size: 1rem;
}

/* The state on the right may wrap, the title never does. */
.admin-tool-drawer > summary .recent-count {
  text-align: right;
}

.admin-tool-drawer .recent-count.is-active {
  color: var(--color-danger);
  font-weight: 600;
}

.admin-tool-drawer > .form {
  margin-bottom: 1rem;
}

.mod-block-drawer > .form {
  margin: 0.75rem 0 0;
}

/* ---------- Community photos (feed, profile, proof page) ---------- */

.feed-list li > div {
  min-width: 0;
  flex: 1;
}

.feed-photo {
  margin-top: 0.375rem;
}

.feed-photo > summary,
.verify-drawer > summary {
  min-height: var(--tap-size);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-accent-dark);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.feed-photo > summary::-webkit-details-marker,
.verify-drawer > summary::-webkit-details-marker {
  display: none;
}

/* The same arrow as the other drawers, at the right edge: down when closed, up when open. */
.feed-photo > summary::after,
.verify-drawer > summary::after {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  margin: -0.2rem 0.3rem 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.feed-photo[open] > summary::after,
.verify-drawer[open] > summary::after {
  margin-top: 0.25rem;
  transform: rotate(-135deg);
}

/* Open: the like count next to the title goes, the clickable badge below the photo shows it. */
.feed-photo[open] > summary .heart-count {
  display: none;
}

/* Community photos are not cropped (upright, square or wide): the full photo, as wide as possible,
   but never higher than 75 % of the screen, then narrower. */
.community-photo,
.proof-list .admin-community-photo img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 32rem);
  max-height: 75vh;
  border-radius: var(--radius);
}

.feed-photo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

/* Like badge: right below the photo (report link and hints stay left), flat, but the invisible
   ::before keeps the full tap size. Two signs: not liked = white heart and a thin pale edge,
   liked = red heart and a thick orange edge. The edge is an inset shadow, so the size stays. */
.heart-form {
  order: 2;
  margin: 0 0 0 auto;
}

.heart-button {
  position: relative;
  min-height: 30px;
  padding: 0 0.625rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.heart-button::before {
  content: "";
  position: absolute;
  inset: -9px -4px;
}

.heart-button.is-liked {
  border-color: var(--color-accent);
  box-shadow: inset 0 0 0 1px var(--color-accent);
}

.heart-button .heart-on,
.heart-button.is-liked .heart-off {
  display: none;
}

.heart-button.is-liked .heart-on {
  display: inline;
}

.heart-button:not(.is-liked) [data-heart-count] {
  color: var(--color-muted);
}

.heart-button:disabled {
  opacity: 0.6;
}

.heart-count {
  color: var(--color-muted);
  font-weight: 600;
  white-space: nowrap;
}

.community-delete > summary,
.photo-likers > summary {
  min-height: var(--tap-size);
  display: flex;
  align-items: center;
  color: var(--color-muted);
  cursor: pointer;
}

.community-photo-box {
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
}

.community-pick-step {
  margin-top: 0.75rem;
}

.community-photo-box .is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.profile-photo-list {
  display: grid;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-photo-list > li > p {
  margin: 0.5rem 0 0;
}

.photo-likers ul {
  margin: 0;
  padding-left: 1.25rem;
}

/* ---------- Admin: Log (/admin/log) ---------- */

.action-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.action-log-entry {
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--color-border);
}

.action-log-entry p {
  margin: 0;
}

.action-log-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  font-size: 0.875rem;
}

.action-log-time {
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.action-log-role {
  color: var(--color-muted);
}

.action-log-mode {
  display: inline-block;
  padding: 0 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
  font-size: 0.8em;
  font-weight: normal;
}

.action-log-mode.is-solo {
  background: var(--color-alert-bg);
  color: var(--color-text);
}

.action-log-system {
  color: var(--color-muted);
  font-style: italic;
}

.action-log-what {
  margin-top: 0.125rem;
  overflow-wrap: anywhere;
}

.action-log-details {
  color: var(--color-muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

/* ---------- Level (src/level/) ---------- */

/* Bar to the next level: accepted points, then points in review in a darker orange. */
.level-bar {
  display: flex;
  height: 12px;
  margin: 0.5rem 0;
  overflow: hidden;
  background: var(--color-border);
  border-radius: 6px;
}

.level-bar > span {
  height: 100%;
}

.level-bar-done {
  background: var(--color-level-done);
}

/* 2px surface gap between the two parts. */
.level-bar-pending {
  background: var(--color-level-pending);
  border-left: 2px solid var(--color-surface);
}

.level-bar-pending.is-alone {
  border-left: none;
}

.level-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.level-legend .swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.35rem;
  border-radius: 3px;
  vertical-align: -0.1rem;
}

.level-legend .is-done {
  background: var(--color-level-done);
}

.level-legend .is-pending {
  background: var(--color-level-pending);
}

/* "Level 12" big, the points small below. */
.level-number {
  margin: 0;
  font-size: clamp(2rem, 1.6rem + 2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
}

.level-points {
  margin: 0.25rem 0 0;
  color: var(--color-muted);
}

/* Profile picture with the level badge ("Lvl 5") at the top right and the likes received at the
   bottom right (looks like the heart button of a community photo). */
.avatar-level {
  position: relative;
  display: inline-block;
}

.avatar-level-badge {
  position: absolute;
  top: 2%;
  right: -6%;
  padding: 0.375rem 0.625rem;
  color: var(--color-on-accent);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  background: var(--color-accent);
  border: 2px solid var(--color-surface);
  border-radius: 999px;
}

/* Crown of an admin at the top left (Admin › Sonstige Einstellungen › Admin-Krone). */
.avatar-admin-badge {
  position: absolute;
  top: 2%;
  left: -6%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 0.375rem;
  font: inherit;
  font-size: 1.125rem;
  line-height: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
}

.avatar-likes-badge {
  font-family: inherit;
  cursor: pointer;
  position: absolute;
  right: -6%;
  bottom: 2%;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 0.625rem;
  color: var(--color-text);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

/* Einstellungen › Benachrichtigungen. */
.push-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.notify-rhythm {
  margin: 0 0 1rem 2.125rem;
}

.notify-rhythm input[type='number'],
.notify-rhythm input[type='time'] {
  max-width: 9rem;
}

/* Start page boxes (report decided, violation, photo removed, new level), all closed with the X. */
.report-notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.report-notice p {
  margin: 0;
}

.report-notice p + p {
  margin-top: 0.25rem;
}

.report-notice-proof {
  font-size: 0.875rem;
}

.report-notice-close {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  margin: -0.5rem -0.5rem 0 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

/* Admin › Level: charts drawn as inline SVG. */
.level-chart > h2:first-child {
  margin-top: 0;
}

.level-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-grid {
  stroke: var(--color-border);
  stroke-width: 1;
}

.chart-axis {
  stroke: var(--color-muted);
  stroke-width: 1;
}

.chart-label {
  fill: var(--color-muted);
  font-size: 0.75rem;
}

.chart-bar {
  fill: var(--color-accent);
}

.chart-hit {
  fill: transparent;
}

.chart-column:hover .chart-bar {
  fill: var(--color-accent-dark);
}

.chart-line {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2;
}

.chart-dot {
  fill: var(--color-accent);
  stroke: var(--color-surface);
  stroke-width: 2;
  opacity: 0;
}

.chart-column:hover .chart-dot {
  opacity: 1;
}

.level-table {
  width: 100%;
  margin-bottom: 1rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.level-table th,
.level-table td {
  padding: 0.25rem 0.5rem;
  text-align: right;
  border-bottom: 1px solid var(--color-border);
}

/* ---------- Game mode (src/mode/) ---------- */

/* Header symbol: one rider = single-player, several = multiplayer; tap opens the mode window. */
.mode-button {
  min-width: 44px;
  min-height: 44px;
  /* The symbol in orange, so the mode and the way to switch it are easy to find. */
  color: var(--color-accent);
}

.mode-button:hover,
.mode-menu[open] > .mode-button {
  color: var(--color-accent-dark);
}

/* The symbol is not the rightmost one in the header: the window hangs on the header itself
   (position: sticky), at the right edge, so it never leaves a narrow screen on the left. */
.mode-menu {
  position: static;
}

.mode-panel {
  top: calc(100% + 0.5rem);
  right: max(var(--gutter), env(safe-area-inset-right));
  width: auto;
  max-width: calc(100vw - 2 * var(--gutter));
}

/* The sentence and a small line with the link to Einstellungen, no close button. */
.mode-panel .menu-heading {
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

/* Small line below, the link only recognisable by its underline (not orange). */
.mode-panel-text {
  margin: 0.25rem 0.75rem 0.5rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.mode-panel-text a {
  color: inherit;
  text-decoration: underline;
}

/* Choosing or switching the mode (/spielmodus). */
.mode-choices {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.mode-choice.is-current {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}

.mode-choice-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mode-choice-head h2 {
  margin: 0;
}

.mode-choice-head .mode-icon {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  color: var(--color-accent);
}

.profile-mode {
  text-align: center;
}

/* Einzelspielermodus: proof photos from this device (solo-mode.js). */
.proof-photo-local {
  margin: 0.75rem 0;
}

.proof-photo-local.has-photo figcaption {
  display: none;
}

.proof-thumb-local {
  display: block;
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  overflow: hidden;
  background: var(--color-bg);
  border-radius: var(--radius);
}

.proof-thumb-local img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.solo-backup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.solo-backup .hint,
.solo-backup-card .hint {
  margin: 0;
}

.capture-solo {
  margin-top: 0;
}

/* Pages without network: the game mode played last on this device (offline-account.js). */
.offline-mode {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-accent-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.offline-mode[hidden] {
  display: none;
}

.offline-mode .mode-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.menu-icon {
  display: inline-flex;
}

.menu-icon[hidden] {
  display: none;
}

/* Offline page: no menu button around the picture, so it keeps a distance from the edge. */
.offline-header-actions {
  gap: 0.5rem;
  margin-right: 0;
}

/* ---------- Badges (Abzeichen): page /abzeichen, profile grid, feed ---------- */
:root {
  /* Steps Bronze … Diamant as border colour; the step is always named in the text too. */
  --badge-tier-1: #a8632b;
  --badge-tier-2: #8a939e;
  --badge-tier-3: #d4a017;
  --badge-tier-4: #3fa7a3;
  --badge-tier-5: #6c5ce7;
}

.badge-icon {
  display: inline-flex;
  flex: none;
  border: 3px solid var(--color-border);
  border-radius: 50%;
  padding: 3px;
  background: var(--color-surface);
  vertical-align: middle;
}

.badge-icon img {
  display: block;
  border-radius: 50%;
}

.badge-icon.is-tier-1 { border-color: var(--badge-tier-1); }
.badge-icon.is-tier-2 { border-color: var(--badge-tier-2); }
.badge-icon.is-tier-3 { border-color: var(--badge-tier-3); }
.badge-icon.is-tier-4 { border-color: var(--badge-tier-4); }
.badge-icon.is-tier-5 { border-color: var(--badge-tier-5); }

/* Not earned yet: grey and pale. */
.badge-icon.is-locked img {
  filter: grayscale(1);
  opacity: 0.4;
}

.badge-group {
  margin-top: 1.5rem;
}

.badge-group > h2 {
  margin-bottom: 0.5rem;
}

.badge-card {
  margin-bottom: 0.5rem;
}

.badge-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-card-title {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.badge-card.is-locked .collection-quest-title {
  color: var(--color-muted);
}

.badge-tier {
  font-weight: normal;
  color: var(--color-muted);
}

.badge-steps {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.badge-award {
  margin-top: 0.75rem;
}

.badge-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  color: var(--color-muted);
}

.badge-steps .is-reached {
  color: var(--color-text);
  font-weight: 600;
}

.badge-step-dot {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.375rem;
  border-radius: 50%;
}

.badge-step-dot.is-tier-1 { background: var(--badge-tier-1); }
.badge-step-dot.is-tier-2 { background: var(--badge-tier-2); }
.badge-step-dot.is-tier-3 { background: var(--badge-tier-3); }
.badge-step-dot.is-tier-4 { background: var(--badge-tier-4); }
.badge-step-dot.is-tier-5 { background: var(--badge-tier-5); }

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.75rem 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.badge-grid li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  text-align: center;
}

.badge-grid-name {
  font-size: 0.8125rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.badge-grid small {
  color: var(--color-muted);
}

/* Admin › GPS-Spoofing */
.spoofing-active {
  margin-bottom: 1rem;
}

.spoofing-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.spoofing-user p {
  margin: 0.25rem 0;
}

.spoofing-signals {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
}

.gps-report {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.gps-report .is-info {
  opacity: 0.75;
}

/* Location access of target pages (partials/location-access.ejs) */
.location-explain p,
.location-denied p {
  margin: 0 0 0.5rem;
}

.location-denied ol {
  margin: 0;
  padding-left: 1.25rem;
}

/* "Heartbeat testen" of an admin (public/js/heartbeat.js): a box at the bottom at every beat. */
.heartbeat-test {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  z-index: 1000;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  border-left: 4px solid var(--color-notice);
  box-shadow: 0 4px 16px var(--color-shadow);
}

.heartbeat-test[hidden] {
  display: none;
}

.heartbeat-test p {
  margin: 0.25rem 0;
}

.heartbeat-test .button {
  margin-top: 0.5rem;
}

/* "Beispielbild" in the photo hint (partials/photo-hint.ejs, photo-example.js): an orange link,
   the photo in a dialog as wide as it, "Schließen" below like the other dialogs. */
.photo-example-link {
  color: var(--color-accent);
  font-weight: 600;
}

.photo-example-dialog img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.photo-example-dialog form {
  margin-top: 1rem;
}

/* Fortschritt: "Meine erledigten Aufgaben" reached from "Los geht's" (#erledigte-aufgaben) stays
   below the fixed header. */
#erledigte-aufgaben {
  scroll-margin-top: calc(var(--header-height) + env(safe-area-inset-top) + 0.5rem);
}
