/* Fakten des Tages – Wissenskarte
   Palette: Petrol/Türkis (#0e7490) + Senfgelb-Akzent */

:root {
  --teal-900: #134e4a;
  --teal-700: #0e7490;
  --teal-600: #0891b2;
  --teal-500: #06b6d4;
  --teal-100: #cffafe;
  --mustard: #e0a92e;
  --mustard-soft: #f5d77a;

  --bg: #eef6f7;
  --bg-grad-a: #e6f4f6;
  --bg-grad-b: #d6eef0;
  --surface: #ffffff;
  --surface-2: #f4fbfc;
  --text: #0c2a30;
  --text-soft: #4a6a70;
  --text-faint: #7d979c;
  --border: #d3e6e9;
  --border-strong: #bcd9dd;
  --accent: var(--teal-700);
  --accent-ink: #ffffff;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --shadow: 0 8px 28px rgba(14, 116, 144, 0.14);
  --shadow-sm: 0 2px 10px rgba(14, 116, 144, 0.10);
  --radius: 18px;
  --radius-sm: 12px;
  --focus: 0 0 0 3px rgba(8, 145, 178, 0.45);
}

[data-theme="dark"] {
  --bg: #07191c;
  --bg-grad-a: #0a2024;
  --bg-grad-b: #061417;
  --surface: #0f2a2f;
  --surface-2: #133337;
  --text: #e6f6f7;
  --text-soft: #a6c8cd;
  --text-faint: #6f9197;
  --border: #1d4046;
  --border-strong: #2a565d;
  --accent: var(--teal-500);
  --accent-ink: #04181c;
  --danger: #ff7a6e;
  --danger-bg: #3a1714;
  --mustard: #f3c14f;
  --mustard-soft: #6a5320;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.4);
  --focus: 0 0 0 3px rgba(6, 182, 212, 0.5);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-grad-a), transparent 70%),
    linear-gradient(180deg, var(--bg-grad-b), var(--bg));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus { left: 12px; }

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px clamp(14px, 4vw, 28px);
  max-width: 880px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--teal-600), var(--teal-900));
  color: #fff;
  box-shadow: var(--shadow-sm);
  flex: none;
}
.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand-sub {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  transition: background .15s, transform .1s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.95); }

.theme-icon { width: 20px; height: 20px; display: block; position: relative; }
.theme-icon::before {
  content: "☀";
  font-size: 1.15rem;
  line-height: 1;
}
[data-theme="dark"] .theme-icon::before { content: "☾"; }

/* Main */
.app-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 4px clamp(14px, 4vw, 28px) 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* Hero / Karte des Tages */
.hero {
  background: linear-gradient(155deg, var(--teal-700), var(--teal-900));
  border-radius: var(--radius);
  padding: clamp(16px, 4vw, 26px);
  color: #fff;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -50px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(224,169,46,0.35), transparent 70%);
  pointer-events: none;
}
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}
.hero-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mustard-soft);
}
[data-theme="dark"] .hero-label { color: var(--mustard); }
.hero-date {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.82);
  font-weight: 600;
}

.card {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--radius-sm);
  padding: clamp(16px, 4vw, 24px);
  position: relative;
  z-index: 1;
  outline: none;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.card:focus-visible { box-shadow: var(--focus); }
.card-inner { display: flex; flex-direction: column; gap: 10px; }
.card-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mustard-soft);
}
[data-theme="dark"] .card-title { color: var(--mustard); }
.card-title:empty { display: none; }
.card-body {
  margin: 0;
  font-size: clamp(1.15rem, 4.4vw, 1.55rem);
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card-tags:empty { display: none; }
.tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(224,169,46,0.22);
  color: var(--mustard-soft);
  border: 1px solid rgba(224,169,46,0.4);
}
[data-theme="dark"] .tag { color: var(--mustard); }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}
.card-meta { font-size: 0.74rem; color: rgba(255,255,255,0.7); }
.known-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--mustard);
  color: #2a2003;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}
.nav-group { display: flex; gap: 10px; flex: 1; min-width: 200px; }
.nav-group .btn { flex: 1; }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .1s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-ic { font-weight: 800; }

.btn-primary { background: var(--mustard); color: #2a2003; border-color: transparent; }
.btn-primary:hover { background: var(--mustard-soft); }
[data-theme="dark"] .btn-primary { color: #221a02; }

.btn-known {
  background: rgba(255,255,255,0.16);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
  flex: 1;
  min-width: 200px;
}
.btn-known:hover { background: rgba(255,255,255,0.26); }
.btn-known.is-active { background: var(--mustard); color: #2a2003; border-color: transparent; }

.btn-soft {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.24);
}
.btn-soft:hover { background: rgba(255,255,255,0.2); }

/* Soft buttons inside light areas (modal) */
.modal .btn-soft {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.modal .btn-soft:hover { background: var(--bg); border-color: var(--border-strong); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }

/* Collection */
.collection { display: flex; flex-direction: column; gap: 14px; }
.coll-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.coll-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.count-badge {
  font-size: 0.82rem;
  font-weight: 800;
  background: var(--teal-100);
  color: var(--teal-700);
  padding: 2px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
}
[data-theme="dark"] .count-badge { background: var(--surface-2); color: var(--teal-500); }

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.search-wrap { flex: 1; min-width: 180px; }
.search {
  width: 100%;
  font: inherit;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.search::placeholder { color: var(--text-faint); }
.search:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus); }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-soft);
  padding: 9px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
}
.filter-chip input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* Card list */
.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal-600);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .1s;
}
.list-card.is-known { border-left-color: var(--mustard); opacity: 0.86; }
.list-card-main { flex: 1; min-width: 0; }
.list-card-title {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0 0 3px;
}
.list-card-title:empty { display: none; }
.list-card-body {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.list-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.list-card-tags:empty { display: none; }
.list-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.list-card-meta {
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: 6px;
}
.list-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.mini-btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.mini-btn:hover { background: var(--bg); border-color: var(--border-strong); color: var(--text); }
.mini-btn.is-on { background: var(--mustard); color: #2a2003; border-color: transparent; }
.mini-btn.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

.empty-state {
  text-align: center;
  color: var(--text-faint);
  padding: 30px 10px;
  font-weight: 600;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

/* Footer */
.app-footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 8px clamp(14px, 4vw, 28px) 28px;
  text-align: center;
}
.app-footer p { margin: 0; font-size: 0.78rem; color: var(--text-faint); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 30, 35, 0.55);
  backdrop-filter: blur(3px);
  animation: fade .18s ease;
}
.modal-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  animation: pop .2s ease;
}
.modal-sm { max-width: 380px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 20px 6px;
}
.modal-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; }
.modal-body { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.84rem; font-weight: 700; color: var(--text-soft); }
.field-label .opt { font-weight: 500; color: var(--text-faint); }
.field-label .req { color: var(--danger); }
.field-input {
  font: inherit;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field-input::placeholder { color: var(--text-faint); }
.field-input:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.field-area { resize: vertical; min-height: 90px; line-height: 1.5; }
.field-error { font-size: 0.8rem; color: var(--danger); font-weight: 600; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.confirm-text { margin: 0 0 4px; color: var(--text-soft); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  background: var(--teal-900);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-theme="dark"] .toast { background: var(--teal-600); color: #04181c; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

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

@media (max-width: 460px) {
  .btn-known, .nav-group { min-width: 100%; }
  .list-card { flex-direction: column; }
  .list-actions { flex-direction: row; flex-wrap: wrap; }
}
