/* ===== Farben (wie die Checkliste) ===== */
:root {
  --red: #e8443a;
  --red-dark: #b8302a;
  --ink: #1f2128;
  --bg: #f6f2ea;
  --bg-dot: rgba(31, 33, 40, 0.06);
  --surface: #ffffff;
  --surface-2: #f1ede4;
  --text: #1f2128;
  --muted: #646872;
  --line: rgba(31, 33, 40, 0.12);
  --accent: #3a9a48;
  --focus: #3b7fd6;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 18px rgba(0, 0, 0, 0.08);
  --radius: 18px;
  --tabs-h: 62px;
  --font-head: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151a;
    --bg-dot: rgba(255, 255, 255, 0.04);
    --surface: #1e2028;
    --surface-2: #272a34;
    --text: #eceef3;
    --muted: #a0a5b2;
    --line: rgba(255, 255, 255, 0.1);
    --accent: #4cb85b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

/* ===== Basis ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.5px, transparent 1.6px);
  background-size: 22px 22px;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { margin: 4px 2px 10px; font-weight: 700; font-size: 14px; }

/* ===== Kopf (rot, unter der iPhone-Statusleiste) ===== */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  color: #fff;
  background: linear-gradient(160deg, #f0574b 0%, var(--red) 50%, var(--red-dark) 100%);
  border-bottom: 4px solid var(--ink);
}
[data-stage="dev"] .top { background: repeating-linear-gradient(135deg, #4a4f5c 0 14px, #3b3f4a 14px 28px); }
[data-stage="dev"] .top h1::after { content: " · DEV"; }
.top h1 {
  font-size: 24px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.sync-dot {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  background: rgba(0, 0, 0, 0.18);
}
.sync-dot i { width: 9px; height: 9px; border-radius: 50%; background: #c9ccd3; }
.sync-dot[data-state="ok"] i { background: #6ee07c; }
.sync-dot[data-state="pending"] i, .sync-dot[data-state="busy"] i { background: #ffd23f; }
.sync-dot[data-state="error"] i { background: #fff; box-shadow: 0 0 0 2px #ff9a9a; }
.sync-dot[data-state="offline"] i { background: transparent; box-shadow: inset 0 0 0 2px #fff; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom, 0px));
}

/* ===== Leiste unten ===== */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 4px 8px env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tabs-h);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  color: var(--muted);
}
.tabs a[aria-current="page"] { color: var(--red); }
@media (prefers-color-scheme: dark) { .tabs a[aria-current="page"] { color: #ff7a70; } }

/* ===== Bedienelemente ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 99px;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease;
}
@media (prefers-color-scheme: dark) { .btn { background: #eceef3; color: var(--ink); } }
.btn:active { transform: scale(0.97); }
.btn-ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
@media (prefers-color-scheme: dark) { .btn-ghost { background: transparent; color: var(--text); } }
.btn.danger { color: #d6336c; }

.field {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 8px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 16px; /* verhindert Auto-Zoom auf iOS */
  font-weight: 700;
}
.field:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.field:disabled { opacity: 0.5; }
input[type="search"].field { border-radius: 99px; padding-inline: 18px; }
select.field { padding-right: 8px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar > .field:first-child { flex: 1; }
.toolbar select.field { flex: 0 1 auto; width: auto; max-width: 48%; }
.toolbar > select.field:only-child { flex: 1; max-width: none; }
/* Filter + Sortierung: auf schmalen Handys untereinander, damit nichts abgeschnitten wird */
@media (max-width: 479px) {
  .toolbar.split { flex-wrap: wrap; }
  .toolbar.split > * { flex: 1 1 100%; max-width: none; }
}
.toolbar .btn { flex: none; }
.toolbar.tight { margin: 0; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.buttons .btn { flex: 1 1 160px; }

.segmented {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.segmented button {
  min-height: 38px;
  padding: 0 4px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  font-weight: 800;
  font-size: clamp(12.5px, 3.6vw, 14px);
  color: var(--muted);
  cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ===== Kennzahlen ===== */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stats:empty { display: none; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.stat span { font-size: 12px; font-weight: 800; color: var(--muted); }
.stat b { font-family: var(--font-head); font-size: 24px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat small { font-size: 11.5px; color: var(--muted); line-height: 1.25; }

/* ===== Kartenraster ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 12px; }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }

.tile { position: relative; display: flex; flex-direction: column; min-width: 0; }

.tile-art {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 63 / 88;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.25s ease;
}
.tile-art:active { transform: scale(0.97); }
.tile-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s ease, opacity 0.3s ease;
}
/* Nur in Listen (Checklisten) sind fehlende Karten grau */
.grid.checklist .tile:not(.is-owned) .tile-art img { filter: grayscale(0.75) brightness(0.98); opacity: 0.62; }
.tile.is-owned .tile-art { box-shadow: 0 0 0 3px var(--accent), 0 0 18px 1px color-mix(in srgb, var(--accent) 50%, transparent); }

.tile-ph {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: inherit;
}
.no-img img { display: none; }
.no-img .tile-ph { display: flex; }

.tile-check {
  position: absolute;
  right: 4px;
  top: 4px; /* oben rechts auf dem Bild */
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.tile-check svg {
  width: 34px;
  height: 34px;
  padding: 6px;
  border-radius: 50%;
  color: transparent;
  background: rgba(0, 0, 0, 0.35);
  border: 2.5px solid rgba(255, 255, 255, 0.85);
  transition: background 0.2s ease, color 0.2s ease;
}
.tile.is-owned .tile-check svg { color: #fff; background: var(--accent); border-color: #fff; }

.tile-info { display: flex; flex-direction: column; gap: 1px; padding-top: 8px; font-size: 12.5px; color: var(--muted); }
.tile-info b { font-family: var(--font-head); font-size: 16px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; line-height: 1.2; }
.tile-info span { line-height: 1.3; }
.tile-value { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.tile-value:empty { display: none; }

/* ===== Listen & Sets als Zeilen ===== */
.rows { display: grid; gap: 10px; }
@media (min-width: 760px) { .rows { grid-template-columns: repeat(2, 1fr); } }
.row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-head b { font-family: var(--font-head); font-size: 19px; font-weight: 600; }
.row small { color: var(--muted); font-weight: 700; }
.count { flex: none; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 800; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.4s ease; }

.section-title { font-size: 20px; font-weight: 600; margin: 4px 2px 10px; }
.set-row { flex-direction: row; align-items: center; gap: 12px; padding: 10px 14px; }
.set-row b { flex: 1; font-size: 15px; }
.set-row small { flex: none; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; color: var(--muted); text-decoration: none; }
.actions { display: flex; gap: 8px; }
.actions .btn { min-height: 38px; padding: 6px 12px; font-size: 14px; }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}
.empty b { display: block; font-size: 16px; color: var(--text); }
.empty p { margin: 6px auto 0; max-width: 420px; font-size: 14px; }

/* ===== Mehr ===== */
.panel {
  max-width: 640px;
  margin: 0 auto 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel h2 { font-size: 19px; font-weight: 600; margin-bottom: 6px; }
.panel p { margin: 6px 0; font-size: 14px; }
.label { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 13px; font-weight: 800; color: var(--muted); }
.field-note { margin: 6px 2px 0; font-size: 13px; font-weight: 800; color: #d6336c; }
.field-note:empty { display: none; }

/* ===== Kartenansicht ===== */
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 100%;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.sheet::backdrop { background: rgba(10, 10, 14, 0.7); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@media (max-width: 559px) {
  .sheet { max-width: none; max-height: none; height: 100%; border-radius: 0; }
}
.sheet-inner {
  position: relative;
  max-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
}
.sheet-close {
  position: sticky;
  top: 0;
  z-index: 2;
  float: right;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 0 -44px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 2px 8px rgba(0, 0, 0, 0.35); /* auf jedem Kartenbild sichtbar */
  cursor: pointer;
}
.sheet-close svg { width: 22px; height: 22px; }
.sheet-art {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 63 / 88;
  margin: 0 auto 14px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface-2);
}
.sheet-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sheet h2 { font-size: 24px; font-weight: 600; }
.sheet > .sheet-inner > p { margin: 2px 0; font-size: 14px; font-weight: 700; }
.sheet h3 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }

.prices { margin: 12px 0; padding: 12px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.prices p { margin: 4px 0; font-size: 13px; }
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.price-grid div { display: flex; flex-direction: column; }
.price-grid span { font-size: 11.5px; font-weight: 800; color: var(--muted); }
.price-grid b { font-family: var(--font-head); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.btn.cm { width: 100%; margin-top: 8px; font-size: 14px; background: var(--red); color: #fff; }

.sheet-part { margin-top: 16px; padding: 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.stepper { display: flex; align-items: center; gap: 14px; margin: 6px 0 4px; }
.stepper .btn { width: 52px; padding: 0; font-size: 24px; }
.stepper output { min-width: 40px; text-align: center; font-family: var(--font-head); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }

.checks { display: flex; flex-direction: column; gap: 2px; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 700; cursor: pointer; }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); }
.checks form { margin-top: 8px; }

/* ===== Sammlung gruppieren ===== */
.toolbar.wrap { flex-wrap: wrap; }
.toolbar.wrap > .field:first-child { flex: 1 1 100%; }
.toolbar.wrap select.field { flex: 1 1 0; max-width: none; }
.group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 2px 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
  font-size: 19px;
  font-weight: 600;
}
.group-title small { flex: none; font-family: var(--font-body); font-size: 13px; font-weight: 800; color: var(--muted); }
.buttons + .toolbar, .stats + .buttons { margin-top: 0; }
.stats + .buttons { margin-bottom: 14px; }

/* ===== Auswählen / Hinzufügen: ganze Kachel antippen ===== */
.tile[data-pick] { cursor: pointer; }
.tile-pick {
  position: absolute;
  right: 6px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.tile-pick::before { content: "+"; }
.tile.is-picked .tile-pick { background: var(--focus); transform: scale(1.06); }
.tile.is-picked .tile-pick::before { content: "✓"; font-size: 18px; }
.tile.is-picked .tile-art { box-shadow: 0 0 0 3px var(--focus), 0 0 16px 1px color-mix(in srgb, var(--focus) 45%, transparent); }
.grid.checklist .tile.is-picked .tile-art img { filter: none; opacity: 1; }

/* Leiste mit Aktionen über der Navigation */
.action-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px;
  border-radius: 20px;
  color: #fff;
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.action-bar span { flex: 1 1 140px; padding-left: 6px; font-size: 14px; font-weight: 800; }
.action-bar .btn { flex: 1 0 auto; min-height: 42px; padding: 8px 14px; font-size: 14px; color: var(--ink); background: #fff; }
.action-bar .btn.danger { color: #d6336c; }
.action-bar .btn-ghost { color: #fff; background: transparent; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
main.has-action-bar { padding-bottom: calc(var(--tabs-h) + 150px + env(safe-area-inset-bottom, 0px)); }

/* ===== Umsortieren (gedrückt halten und ziehen) ===== */
/* iPhone: kein Kontextmenü, keine Textauswahl, kein Bild-Ziehen beim langen Drücken */
.reorderable, .reorderable * { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.reorderable img { -webkit-user-drag: none; }
.is-dragging {
  transform: scale(1.04) rotate(-1deg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  border-radius: 14px;
  opacity: 0.95;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.row.is-dragging { background: var(--surface); }
.reorder-placeholder {
  border: 2px dashed color-mix(in srgb, var(--focus) 60%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--focus) 8%, transparent);
}

/* ===== Ladebalken ===== */
.progress-bar { position: relative; height: 4px; margin: -6px 2px 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--red); transition: width 0.25s ease; }
.progress-bar.indeterminate i { width: 35%; animation: progress-slide 1s ease-in-out infinite; }
@keyframes progress-slide { from { left: -35%; } to { left: 100%; } }
/* ===== Karten-Scanner (im Dialog) ===== */
.btn-big { min-height: 54px; font-size: 17px; }
.sheet-art.small { width: min(62%, 240px); }
/* großer Knopf bleibt unten in Daumen-Reichweite stehen */
.scan-bar {
  position: sticky;
  bottom: calc(-24px - env(safe-area-inset-bottom, 0px));
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px -16px calc(-24px - env(safe-area-inset-bottom, 0px));
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  box-shadow: 0 -1px 0 var(--line);
}
/* Live-Kamera: Bild füllt den Bildschirm, Rahmen in Kartenform (63 × 88), außen abgedunkelt */
.camera { position: fixed; inset: 0; z-index: 5; overflow: hidden; background: #000; color: #fff; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-frame {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(80vw, calc(64dvh * 63 / 88), 420px);
  aspect-ratio: 63 / 88;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55);
}
.camera-hint { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: 16px; right: 16px; margin: 0; text-align: center; font-weight: 800; font-size: 15px; text-shadow: 0 1px 4px #000; }
.camera-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 12px 16px calc(22px + env(safe-area-inset-bottom, 0px));
}
.camera-side { min-height: 44px; padding: 0 6px; border: 0; background: none; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.camera-side:last-child { justify-self: end; }
.camera-side:first-child { justify-self: start; }
.camera-shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255, 255, 255, 0.85); box-shadow: inset 0 0 0 4px #000; cursor: pointer; transition: transform 0.12s ease; }
.camera-shutter:active { transform: scale(0.92); }
.camera-shutter:disabled { opacity: 0.4; cursor: default; }
button.back { padding: 0; border: 0; background: none; font: inherit; font-weight: 800; color: var(--muted); cursor: pointer; }
.scan-done { padding: 48px 8px 8px; text-align: center; }
.scan-done h2 { margin-top: 12px; }
.scan-done-icon { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; color: #fff; background: var(--accent); }
.scan-done-icon svg { width: 40px; height: 40px; }
.list-head .btn { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ===== Hinweise & Fehler ===== */
.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 6px 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: rise 0.25s var(--ease-out);
}
.toast[hidden] { display: none; }
.toast.leaving { animation: fade-out 0.18s ease-in forwards; }
.toast[data-type="error"] { border-left: 5px solid #ff6b6b; }
.toast[data-type="success"] { border-left: 5px solid #6ee07c; }
.toast-text { flex: 1; }
.toast-action { flex: none; min-height: 36px; padding: 6px 12px; border: 0; border-radius: 99px; font-weight: 800; color: var(--ink); background: #fff; cursor: pointer; }
.toast-close { flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: transparent; cursor: pointer; }
.toast-close svg { width: 18px; height: 18px; }
/* über der Aktionsleiste, wenn eine da ist */
body:has(main.has-action-bar) .toast { bottom: calc(var(--tabs-h) + 96px + env(safe-area-inset-bottom, 0px)); }
.buttons.center { justify-content: center; }
.buttons.center .btn { flex: 0 1 auto; }
.link-button { padding: 0; border: 0; background: none; font: inherit; font-weight: 800; color: var(--focus); text-decoration: underline; cursor: pointer; }

/* ===== Animationen (kurz und dezent; aus bei „Bewegung reduzieren“) ===== */
:root { --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes view-enter { from { opacity: 0; transform: translateY(8px); } }
@keyframes img-in { from { opacity: 0; } }
@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(32px) scale(0.98); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(32px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes pulse { 50% { opacity: 0.35; } }

/* Ansichtswechsel */
main.view-enter > :not(.action-bar) { animation: view-enter 0.22s var(--ease-out); }
/* Kartenbilder blenden ein, sobald sie geladen sind */
.tile-art img.loaded, .sheet-art img.loaded { animation: img-in 0.3s ease; }
/* Haken / Auswahl springen kurz */
.tile.just-changed .tile-check svg, .tile.just-changed .tile-pick { animation: pop 0.35s var(--ease-out); }
/* Kartenansicht fährt von unten herein und wieder hinaus */
.sheet[open] { animation: sheet-in 0.28s var(--ease-out); }
.sheet[open]::backdrop { animation: fade-in 0.25s ease; }
.scan-done-icon { animation: pop 0.4s var(--ease-out); }
.sheet.closing { animation: sheet-out 0.18s ease-in forwards; }
.sheet.closing::backdrop { animation: fade-out 0.18s ease-in forwards; }
/* Aktionsleiste unten, Platzhalter beim Ziehen, Sync läuft */
.action-bar { animation: rise 0.25s var(--ease-out); }
.reorder-placeholder { animation: fade-in 0.15s ease; }
.sync-dot[data-state="busy"] i { animation: pulse 1s ease-in-out infinite; }
/* Antippen fühlt sich an wie ein Knopf */
.row { transition: transform 0.12s ease, box-shadow 0.2s ease; }
.row:active { transform: scale(0.985); }
.tabs a { transition: color 0.2s ease, transform 0.12s ease; }
.tabs a:active { transform: scale(0.92); }
.tabs a svg { transition: transform 0.2s var(--ease-out); }
.tabs a[aria-current="page"] svg { transform: translateY(-1px) scale(1.08); }

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