/* TCG Scanner – dunkles, mobile-first Design.
   Kein Build-Schritt, keine externen Schriften oder Bibliotheken. */

:root {
  color-scheme: dark;

  --bg: #0b0f14;
  --bg-elevated: #111821;
  --bg-raised: #18212d;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text: #e8eef7;
  --text-soft: #c3cedd;
  --muted: #94a3b8;

  --accent: #4fd1c5;
  --accent-strong: #2dd4bf;
  --accent-contrast: #04211e;

  --danger: #f87171;
  --danger-soft: #fca5a5;
  --success: #4ade80;
  --warning: #fbbf24;

  --focus: #67e8f9;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --tabbar-height: 62px;

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
  background:
    radial-gradient(1000px 620px at 100% -12%, rgba(79, 209, 197, 0.09), transparent 62%),
    radial-gradient(760px 520px at -18% 18%, rgba(79, 209, 197, 0.045), transparent 58%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p {
  margin: 0;
}

img {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Kopfzeile ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 15, 20, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) var(--space-4) 12px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.015em;
}

.brand-title::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 9px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #99f6e4);
  box-shadow: 0 0 14px rgba(79, 209, 197, 0.65);
  vertical-align: 1px;
}

.health-hint {
  flex: 1 1 220px;
  color: var(--warning);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* ---------- Hauptbereich ---------- */

.app-main {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-4);
}

.view {
  min-width: 0;
}

/* ---------- Untere Navigation ---------- */

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15, 21, 29, 0.95);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.tabbar-inner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 640px;
  margin: 0 auto;
}

.tab-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 58px;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 140ms ease;
}

.tab-link svg {
  display: block;
}

.tab-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
  transform: translateX(-50%);
  transition: width 160ms ease;
}

.tab-link[aria-current="page"] {
  color: var(--accent);
}

.tab-link[aria-current="page"]::before {
  width: 36px;
}

/* ---------- Grundbausteine ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.1;
  text-align: center;
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease;
}

.btn:hover {
  background: #202b3a;
  border-color: var(--border-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-danger {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger-soft);
}

.btn-danger:hover {
  border-color: rgba(248, 113, 113, 0.65);
  background: rgba(248, 113, 113, 0.18);
}

.btn-small {
  min-height: 44px;
  padding: 0 var(--space-3);
  font-size: 0.8rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.field-input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
}

.field-input::placeholder {
  color: #64748b;
}

.field-input:hover {
  border-color: rgba(255, 255, 255, 0.26);
}

select.field-input {
  padding-right: 30px;
}

.notice {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}

.notice-warning {
  border-color: rgba(251, 191, 36, 0.36);
  background: rgba(251, 191, 36, 0.08);
  color: #fde68a;
}

.notice-error {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.09);
  color: var(--danger-soft);
}

.noscript-hint {
  margin: var(--space-4);
}

/* ---------- Suche ---------- */

.search-view {
  display: flex;
  flex-direction: column;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}

.search-row {
  display: flex;
  gap: var(--space-2);
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.search-input::placeholder {
  color: #718096;
}

.search-submit {
  flex: 0 0 auto;
  min-width: 86px;
}

.chips {
  display: flex;
  gap: var(--space-2);
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.chip:hover {
  background: var(--surface-strong);
}

.chip[aria-pressed="true"],
.chip.is-active {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-contrast);
}

.search-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-3);
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.meta-label {
  font-weight: 700;
  color: var(--text-soft);
}

.meta-parts {
  flex: 1 1 160px;
  min-width: 0;
}

.meta-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.meta-badge-ai {
  background: rgba(79, 209, 197, 0.16);
  color: #99f6e4;
}

.meta-badge-fallback {
  background: var(--surface-strong);
  color: var(--muted);
}

.search-warnings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--space-3);
}

.search-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: 28px;
  margin: var(--space-3) 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.search-status-error {
  color: var(--danger-soft);
}

.search-status-ok {
  color: var(--text-soft);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(79, 209, 197, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Kartenraster ---------- */

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.card-result {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-elevated), #0e141c);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(79, 209, 197, 0.12), transparent 65%),
    #0a0f15;
}

.card-media img,
.item-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  color: #64748b;
  font-size: 0.72rem;
  text-align: center;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
}

.card-name {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.card-name-en {
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.card-meta,
.card-rarity {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.card-rarity {
  color: var(--text-soft);
}

.card-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 7px;
  margin-top: 2px;
}

.price-label {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.card-price {
  color: var(--accent);
  font-size: 1.16rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.badge-estimated {
  padding: 2px 6px;
  border: 1px solid rgba(251, 191, 36, 0.38);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.11);
  color: #fcd34d;
  font-size: 0.62rem;
  font-weight: 750;
  white-space: nowrap;
}

.variant-select {
  min-height: 44px;
  margin-top: 2px;
  padding: 7px 26px 7px 9px;
  font-size: 0.78rem;
}

.card-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
}

.card-link:hover {
  background: rgba(79, 209, 197, 0.08);
  text-decoration: underline;
}

.card-add {
  width: 100%;
  margin-top: 2px;
  padding: 0 8px;
  font-size: 0.82rem;
}

/* Ladezustand */

.card-skeleton {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.skeleton-media {
  width: 100%;
  aspect-ratio: 63 / 88;
  background: var(--surface);
}

.skeleton-line {
  height: 10px;
  margin: 10px 10px 0;
  border-radius: 5px;
  background: var(--surface-strong);
  animation: pulse 1200ms ease-in-out infinite;
}

.skeleton-line-wide {
  width: 72%;
}

.skeleton-line-short {
  width: 45%;
  margin-bottom: 12px;
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

.empty-state {
  grid-column: 1 / -1;
  padding: var(--space-6) var(--space-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.empty-title {
  color: var(--text-soft);
  font-size: 1rem;
  font-weight: 700;
}

.empty-hint {
  max-width: 42ch;
  margin: 6px auto 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Sammlung ---------- */

.collection-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.collection-summary {
  padding: var(--space-5) var(--space-4);
  border: 1px solid rgba(79, 209, 197, 0.24);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(130% 150% at 100% 0%, rgba(79, 209, 197, 0.16), transparent 55%),
    linear-gradient(160deg, #131c25, #0d131a);
  box-shadow: var(--shadow);
}

.summary-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-value {
  margin: 2px 0 10px;
  color: var(--text);
  font-size: 2.3rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.summary-stat {
  min-width: 0;
  overflow-wrap: anywhere;
}

.summary-stat.gain.positive,
.stat.change.positive .stat-value {
  color: var(--success);
}

.summary-stat.gain.negative,
.stat.change.negative .stat-value {
  color: var(--danger);
}

.summary-stat.gain.neutral {
  color: var(--muted);
}

.game-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.breakdown-item {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.breakdown-label,
.breakdown-count {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.breakdown-value {
  display: block;
  margin: 1px 0;
  color: var(--text);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.collection-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.collection-toolbar .field-group {
  flex: 1 1 136px;
}

.toolbar-actions {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.toolbar-actions .btn {
  flex: 1 1 auto;
  padding: 0 10px;
  font-size: 0.82rem;
}

.update-progress {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.progress-text {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.progress-track {
  height: 8px;
  margin-top: var(--space-2);
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #99f6e4);
  transition: width 180ms ease;
}

.update-errors {
  max-height: 180px;
  margin: var(--space-2) 0 0;
  padding-left: 20px;
  overflow-y: auto;
  color: var(--danger-soft);
  font-size: 0.78rem;
}

.update-errors li + li {
  margin-top: 4px;
}

.list-info {
  color: var(--muted);
  font-size: 0.78rem;
}

.collection-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.collection-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-elevated), #0e141c);
}

.item-media {
  position: relative;
  width: 64px;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  border-radius: 8px;
  background: #0a0f15;
}

.item-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.item-name {
  min-width: 0;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.item-meta {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.66rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.tag-game {
  flex: 0 0 auto;
  border-color: rgba(79, 209, 197, 0.28);
  background: rgba(79, 209, 197, 0.08);
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.item-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 2px;
}

.stat {
  min-width: 0;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.3;
}

.stat-value {
  display: block;
  color: var(--text);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: 2px;
}

.qty-control {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.qty-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}

.qty-btn:hover {
  background: var(--surface-strong);
}

.qty-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.qty-value {
  min-width: 32px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sparkline-wrap {
  order: 3;
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  justify-content: flex-end;
  min-height: 32px;
  color: var(--muted);
}

.sparkline-wrap.positive {
  color: var(--success);
}

.sparkline-wrap.negative {
  color: var(--danger);
}

.sparkline-wrap.neutral {
  color: var(--muted);
}

.sparkline {
  display: block;
  width: 90px;
  height: 32px;
}

.btn-delete {
  order: 2;
  min-height: 44px;
  margin-left: auto;
  padding: 0 12px;
  font-size: 0.8rem;
}

.muted {
  color: var(--muted);
}

/* ---------- Dialoge ---------- */

.dialog {
  width: min(92vw, 440px);
  max-height: min(90dvh, 720px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6);
}

.dialog::backdrop {
  background: rgba(2, 6, 10, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
}

.dialog-title {
  font-size: 1.16rem;
  font-weight: 800;
}

.dialog-subtitle {
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.dialog-subtitle strong {
  color: var(--text-soft);
}

.dialog-text {
  color: var(--text-soft);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.dialog-actions-wrap {
  flex-wrap: wrap;
}

.dialog-actions .btn {
  padding: 0 13px;
}

.form-error {
  padding: 8px 10px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 8px;
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger-soft);
  font-size: 0.82rem;
}

/* ---------- Toasts ---------- */

.toast-region {
  position: fixed;
  bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(92vw, 430px);
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: #1a2431;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
  animation: toast-in 160ms ease-out;
}

.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--accent); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Breitere Bildschirme ---------- */

@media (min-width: 768px) {
  .header-inner {
    padding: 14px var(--space-5);
  }

  .brand-title {
    font-size: 1.28rem;
  }

  .health-hint {
    flex: 0 1 auto;
    margin-left: auto;
    text-align: right;
  }

  .app-main {
    padding: var(--space-5);
  }

  .search-form {
    padding: var(--space-5);
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
    gap: 18px;
  }

  .card-body {
    padding: 12px;
  }

  .card-name {
    font-size: 1rem;
  }

  .collection-summary {
    padding: var(--space-5);
  }

  .summary-value {
    font-size: 3rem;
  }

  .collection-toolbar .field-group {
    flex: 0 1 180px;
  }

  .toolbar-actions {
    flex: 1 1 auto;
    flex-wrap: nowrap;
  }

  .toolbar-actions .btn {
    flex: 0 0 auto;
  }

  .collection-item {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-3);
  }

  .item-media {
    width: 72px;
  }

  .item-actions {
    flex-wrap: nowrap;
  }

  .sparkline-wrap {
    order: 2;
    flex: 0 0 auto;
    min-height: 44px;
    margin-left: auto;
  }

  .btn-delete {
    order: 3;
    margin-left: 0;
  }

  .sparkline {
    width: 104px;
    height: 34px;
  }

  .dialog-form {
    padding: var(--space-5);
  }
}

@media (min-width: 1100px) {
  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }
}

/* ---------- Bewegungen reduzieren ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .spinner {
    animation: none;
    border-color: var(--accent);
  }
}

/* Fusszeile: Betreiber, Rechtliches, Quellen */
.site-footer {
  margin: var(--space-6) 0 var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.site-footer p { margin: 0 0 var(--space-2); }
.site-footer a { color: var(--text-soft); }
