:root {
  /* Flächen / Text */
  --bg:        #11201a;
  --surface:   #1a2e22;
  --surface-2: #233a2c;
  --border:    #2d4334;
  --fg:        #e9ece3;
  --muted:     #8a9a78;
  /* Marke */
  --brand:       #6f8456;
  --brand-light: #8aa06b;
  --brand-dark:  #3d5a3a;
  --accent:      #c89b54;
  --accent-hi:   #d8b06a;
  /* Status */
  --success: #4fae7e;
  --warn:    #e0a93f;
  --danger:  #e5575c;
  /* Typografie */
  --font-sans:    "Inter", system-ui, sans-serif;
  --font-display: "Saira", "Inter", system-ui, sans-serif;
  /* Form */
  --radius: 0.625rem;
  --shadow: 0 18px 40px rgba(0, 0, 0, .38);
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  color: var(--fg);
  background:
    radial-gradient(ellipse at 20% 30%, color-mix(in srgb, var(--brand) 8%, transparent) 0, transparent 55%),
    radial-gradient(ellipse at 80% 70%, color-mix(in srgb, var(--accent) 5%, transparent) 0, transparent 50%),
    var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 48px;
}

::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

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

/* ---------- Kopf (sticky: Logo + Titel immer sichtbar) ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  align-self: stretch;               /* volle Breite in der zentrierten Spalte */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: -24px -20px 0;             /* bis an die Bildschirmränder, deckt Body-Padding ab */
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand-logo { border-radius: 10px; flex: none; }

/* Hamburger-Menü (drei Balken, in Bronze) */
.hamburger {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0 9px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);            /* Bronze */
  transition: transform .2s ease, opacity .2s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

#brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--fg);
}
#brand .brand-light { color: var(--accent); font-weight: 600; }

.intro {
  width: 100%;
  max-width: 520px;
  text-align: center;
  margin: 14px 0 18px;
}
.intro p { color: var(--muted); font-size: .9rem; }

/* Installations-Button (PWA) */
.btn-install {
  margin-top: 12px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent-hi);
  font-family: var(--font-sans);
  font-size: .9rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease;
}
.btn-install:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-install[hidden] { display: none; }

/* iOS-Installationshinweis */
.ios-hint {
  margin-top: 10px;
  font-size: .8rem;
  color: var(--muted);
}
.ios-hint strong { color: var(--accent-hi); }
.ios-hint[hidden] { display: none; }

/* ---------- Statistik ---------- */
.stats {
  width: 100%;
  max-width: 520px;
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  text-align: center;
}
.stat .num { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; color: var(--fg); }
.stat .num.good { color: var(--success); }
.stat .num.bad  { color: var(--danger); }
.stat .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---------- Karte ---------- */
.scene {
  width: 100%;
  max-width: 520px;
  perspective: 1400px;
  margin-bottom: 20px;
}
/* Wisch-Wrapper: wird beim Wischen verschoben/gedreht (wie eine Dating-App) */
.swipe {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  touch-action: pan-y;          /* vertikales Scrollen bleibt, horizontal = wischen */
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}
.swipe img { -webkit-user-drag: none; }
.card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4, .15, .2, 1);
  cursor: pointer;
}
.card.flipped { transform: rotateY(180deg); }

/* Wisch-Feedback-Badges */
.swipe-badge {
  position: absolute;
  top: 18px;
  padding: 8px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .03em;
  border: 3px solid;
  border-radius: 10px;
  background: rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .1s ease;
}
.swipe-badge.like { left: 18px;  color: var(--success); border-color: var(--success); transform: translateZ(2px) rotate(-8deg); }
.swipe-badge.nope { right: 18px; color: var(--danger);  border-color: var(--danger);  transform: translateZ(2px) rotate(8deg); }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

/* Vorderseite */
.front { background: var(--surface); }
.front .img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c1611;
  overflow: hidden;
}
.front .img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.front .emoji-fallback { font-size: 7rem; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .4)); }
.front .hint {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* Rückseite */
.back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  gap: 14px;
}
.back .label {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  color: var(--accent);
}
.back .name {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.cat-badge {
  margin-top: 4px;
  font-size: .9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg);
  background: var(--surface);
}
/* Kategorie-Akzente (aus der HUNTRA-Palette) */
.cat-badge.fed,   .filter-btn.fed.active   { background: color-mix(in srgb, var(--accent) 22%, transparent);      border-color: var(--accent);      color: var(--accent-hi); }
.cat-badge.sing,  .filter-btn.sing.active  { background: color-mix(in srgb, var(--brand-light) 22%, transparent); border-color: var(--brand-light); color: var(--brand-light); }
.cat-badge.haar,  .filter-btn.haar.active  { background: color-mix(in srgb, var(--success) 22%, transparent);     border-color: var(--success);     color: var(--success); }
.cat-badge.troph, .filter-btn.troph.active { background: color-mix(in srgb, var(--muted) 22%, transparent);       border-color: var(--muted);       color: var(--muted); }
.cat-badge.ei,    .filter-btn.ei.active    { background: color-mix(in srgb, var(--warn) 22%, transparent);        border-color: var(--warn);        color: var(--warn); }
.back-hint {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
}

/* ---------- Anleitung / Hilfe ---------- */
.help-toggle {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.help-toggle:hover { background: var(--surface-2); color: var(--fg); }

/* Anleitung als Popup (überlagert den Inhalt, kein Platz im Layout) */
.help-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .5);
}
.help-backdrop[hidden] { display: none; }
.help {
  width: 100%;
  max-width: 420px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.help-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 10px;
}
.help-steps { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.help-steps li { font-size: .9rem; color: var(--fg); display: flex; gap: 10px; align-items: baseline; }
.help-steps .he { font-size: 1.1rem; flex: none; }
.help-steps strong { color: var(--accent-hi); }
.help-close {
  margin-top: 14px;
  width: 100%;
  padding: 10px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: .9rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
}
.help-close:hover { background: var(--accent-hi); }

/* ---------- Filter-Leiste (ein-/ausklappbar) ---------- */
.filter-panel {
  width: 100%;
  max-width: 520px;
  margin-bottom: 14px;
}
.filter-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-sans);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s ease;
}
.filter-toggle:hover { background: var(--surface-2); }
.ft-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ft-title { font-weight: 600; font-size: .95rem; }
.ft-summary {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ft-chevron {
  flex: none;
  font-size: .9rem;
  color: var(--muted);
  transition: transform .2s ease;
}
.filter-panel:not(.collapsed) .ft-chevron { transform: rotate(180deg); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  overflow: hidden;
  max-height: 600px;
  opacity: 1;
  transition: max-height .28s ease, opacity .2s ease, margin-top .28s ease;
}
.filter-panel.collapsed .filters {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}
.filter-btn {
  flex: 1 1 auto;
  min-width: 88px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.filter-btn:hover { background: var(--surface-2); color: var(--fg); }
.filter-btn.active { color: var(--fg); background: var(--surface-2); border-color: var(--brand); }
.filter-btn .cnt { display: inline-block; margin-left: 4px; font-size: .72rem; opacity: .7; }

/* ---------- Buttons ---------- */
.actions {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.know-row { display: flex; gap: 12px; }
.btn {
  flex: 1;
  padding: 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn.know     { background: var(--accent); color: var(--bg); }
.btn.know:hover { background: var(--accent-hi); }
.btn.dontknow {
  background: transparent;
  border-color: var(--border);
  color: var(--fg);
}
.btn.dontknow:hover { background: var(--surface-2); }

/* ---------- Abschluss ---------- */
.done {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  display: none;
}
.done h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; margin-bottom: 8px; }
.done p  { color: var(--muted); margin-bottom: 20px; }
.done .btn-restart {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 13px 28px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.done .btn-restart:hover { background: var(--accent-hi); }

/* ---------- Menü (Drawer) ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(360px, 86vw);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform .28s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.drawer-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--fg);
}
.drawer-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
}
.drawer-close:hover { background: var(--surface-2); }
.drawer-body { display: flex; flex-direction: column; gap: 16px; }
.drawer-body .filter-panel { max-width: none; margin-bottom: 0; }

.hidden { display: none !important; }
