/*
 * 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;
  --color-on-accent: #ffffff;
  --color-border: #dcd9d3;
  --color-alert-bg: #fff0eb;
  --color-notice: #2f9e44;
  --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);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #16181b;
    --color-surface: #1f2226;
    --color-text: #e8e6e3;
    --color-muted: #a3a8af;
    --color-accent: #ff7a3d;
    --color-accent-dark: #ff9361;
    --color-on-accent: #16181b;
    --color-border: #33373d;
    --color-alert-bg: #3a2219;
    --color-notice: #51cf66;
    --color-notice-bg: #1b2e20;
    --color-danger: #ff6b6b;
    --color-shadow: rgb(0 0 0 / 45%);
  }
}

/* ---------- 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;
}

/* 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;
}

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);
}

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;
}

/* ---------- 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);
}

/* ---------- 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;
}

.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);
}

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

/* 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;
}

.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 {
  padding: 1.25rem;
  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;
  margin-bottom: 0.25rem;
  font-size: 0.7rem;
}

.footer-links a {
  display: inline-block;
  padding: 0.375rem 0.25rem;
  color: inherit;
  white-space: nowrap;
}

/* Bullet between links; on narrow screens the row wraps and the bullets stay inline. */
.footer-links a + a::before {
  content: "·";
  display: inline-block;
  margin-right: 0.5rem;
  color: var(--color-muted);
  text-decoration: none;
}

/* ---------- 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);
}

/* 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);
}

/* 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);
}

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

/* "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);
}

.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 in a paler orange, like on the map. */
.badge.is-pending {
  background: color-mix(in srgb, var(--color-accent) 55%, var(--color-surface));
  color: var(--color-text);
}

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

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.375rem 1rem;
  margin: 0 0 1.25rem;
}

.facts dt {
  font-weight: 600;
}

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

.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;
}

.copy-hint {
  margin: 0;
}

.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);
}

.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);
}

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

/* One row, newest first on the left; swipe sideways for older ones. Each entry takes 40% of
   the row (on phones nearly the screen width), so a third one always peeks in on the right. */
.recent-list {
  display: flex;
  gap: 0.75rem;
  margin: 0.75rem 0 0;
  padding: 0 0 0.5rem;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
}

.recent-list > li {
  flex: 0 0 40%;
  min-width: 0;
  scroll-snap-align: start;
}

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

.recent-list a {
  display: block;
  color: var(--color-text);
  text-decoration: none;
}

.recent-list img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--color-border);
  border-radius: var(--radius);
}

.recent-list span {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

.recent-list small {
  display: block;
  color: var(--color-muted);
}

.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;
}

.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;
}

.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;
}

/* Drawers in the admin user detail: country-group look, with an h2 as the title. */
.admin-drawer:first-of-type {
  margin-top: 1.5rem;
}

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

/* The drawer's top line separates it; no second line from the list right above. */
.admin-list:has(+ .admin-drawer) > li:last-child {
  border-bottom: none;
}

.admin-drawer > summary h2 {
  margin: 0;
  font-size: 1.125rem;
}

.admin-drawer .admin-list {
  margin-bottom: 0.75rem;
}

/* ---------- 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);
}

.profile-edit {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: var(--color-accent);
}

.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);
}

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

.form .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);
  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,
.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);
}

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

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

  .content {
    padding-top: 2.5rem;
  }

  .card {
    padding: 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;
}

/* Fills most of the screen, so there is room to zoom without scrolling the page. */
.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): a paler orange than discovered areas. */
.pionier-map a.is-pending path {
  fill: var(--color-accent);
  fill: color-mix(in srgb, var(--color-accent) 55%, var(--color-surface));
  stroke-opacity: 1;
  stroke: color-mix(in srgb, var(--color-accent) 70%, #000);
}

.pionier-map a.is-pending:hover path,
.pionier-map a.is-pending:focus-visible path {
  fill: color-mix(in srgb, var(--color-accent) 70%, 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;
}

/* 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 .hint {
  flex-basis: 100%;
  margin: 0;
}

.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: the same orange, paler (between open and discovered). */
.map-swatch.is-pending {
  background: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 55%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-accent) 70%, #000);
  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);
}

.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;
}

.onboarding-question {
  display: flex;
  gap: 0.625rem;
  padding: 0.625rem 0;
}

.onboarding-question p {
  margin: 0 0 0.5rem;
}

.onboarding-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.onboarding-choice .button {
  width: auto;
  flex: 1 1 10rem;
}

.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;
}

.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-points {
  flex: none;
  color: var(--color-muted);
}

.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);
}

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

.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;
}

.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;
}

.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 {
  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);
}

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

.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);
}

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

.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);
}

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

.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-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;
}

/* Pionier map in the profile: smaller frame, the big one is a page of its own. */
.profile-map {
  margin-top: 1rem;
}

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

/* ---------- 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);
}

.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: as large as the screen allows. */
.target-map-page {
  height: min(72vh, 40rem);
  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;
}

/* 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);
}

.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: 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: 0.75rem;
}

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