:root {
  --bg: #101913;
  --bg-alt: #16221a;
  --card: #1c2b21;
  --card-hover: #24382b;
  --text: #eef2ea;
  --text-dim: #a9baa9;
  --accent: #e0a458;
  --accent-2: #7fbf6b;
  --border: #2c3f31;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #16241a 0%, #0d1610 60%, #090f0b 100%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(16, 25, 19, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand span { color: var(--accent-2); }

.tabs { display: flex; gap: 8px; }

.tab-btn, .mode-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}
.tab-btn:hover, .mode-btn:hover { border-color: var(--accent-2); color: var(--text); }
.tab-btn.active, .mode-btn.active {
  background: var(--accent-2);
  color: #0d1610;
  border-color: var(--accent-2);
  font-weight: 600;
}

main { max-width: 1200px; margin: 0 auto; padding: 20px 24px 60px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadein 0.25s ease; }

@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.potd {
  display: flex;
  gap: 20px;
  background: linear-gradient(135deg, #23331f, #16241c);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  align-items: center;
}
.potd.hidden { display: none; }
.potd img { width: 130px; height: 130px; object-fit: cover; border-radius: 10px; flex-shrink: 0; cursor: pointer; }
.potd-label { color: var(--accent); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.potd-name { font-size: 1.4rem; font-weight: 700; }
.potd-lat { font-style: italic; color: var(--text-dim); margin-bottom: 8px; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.controls input[type=search], .controls select {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
}
#search { flex: 1; min-width: 220px; }
.checkbox { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 0.9rem; }

.result-count { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-4px); background: var(--card-hover); box-shadow: var(--shadow); }
.card .thumb-wrap { width: 100%; aspect-ratio: 1 / 1; background: #0d1610; overflow: hidden; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .no-img { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2rem; opacity: 0.4; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.card-name { font-weight: 600; font-size: 0.95rem; line-height: 1.25; }
.card-lat { font-size: 0.78rem; color: var(--text-dim); font-style: italic; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  width: fit-content;
}

.empty { text-align: center; color: var(--text-dim); padding: 60px 0; font-size: 1.1rem; }
.hidden { display: none !important; }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(5,8,6,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-content {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,0.4); border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1rem; z-index: 5;
}
.modal-body { display: flex; gap: 24px; padding: 24px; flex-wrap: wrap; }
.modal-gallery { flex: 1 1 320px; min-width: 280px; }
.modal-gallery img { width: 100%; border-radius: 10px; max-height: 420px; object-fit: cover; background: #0d1610; }
.modal-thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.modal-thumbs img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: 0.6; border: 2px solid transparent; }
.modal-thumbs img.active { opacity: 1; border-color: var(--accent-2); }
.modal-info { flex: 1 1 320px; min-width: 280px; }
.modal-info h2 { margin: 0 0 4px; }
.modal-lat { font-style: italic; color: var(--text-dim); margin-bottom: 10px; }
.modal-fields dt { color: var(--accent); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 14px; }
.modal-fields dd { margin: 4px 0 0; line-height: 1.5; color: var(--text); }
.modal-fields { margin-top: 6px; }

/* Quiz */
.quiz-wrap { max-width: 640px; margin: 0 auto; text-align: center; }
.quiz-mode-select { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 14px; }
.quiz-diff-select { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-bottom: 18px; }
.quiz-diff-label { color: var(--text-dim); font-size: 0.85rem; margin-right: 2px; }
.diff-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s ease;
}
.diff-btn:hover { border-color: var(--accent); color: var(--text); }
.diff-btn.active { background: var(--accent); color: #241705; border-color: var(--accent); font-weight: 700; }

.quiz-hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.quiz-lives { font-size: 1.1rem; letter-spacing: 2px; }
.quiz-score { color: var(--text-dim); font-size: 0.9rem; }
.quiz-score span { color: var(--accent); font-weight: 700; }

.timer-track { background: var(--bg-alt); border-radius: 999px; height: 8px; overflow: hidden; margin-bottom: 16px; border: 1px solid var(--border); }
.timer-fill { height: 100%; background: var(--accent-2); width: 100%; transition: width 0.1s linear, background 0.2s ease; border-radius: 999px; }
.timer-fill.timer-low { background: #c93838; }

.quiz-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
#quiz-img { width: 100%; max-height: 340px; object-fit: cover; border-radius: 10px; margin-bottom: 16px; background: #0d1610; }
#quiz-img.hidden { display: none; }
.quiz-text {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  line-height: 1.6;
  font-size: 0.98rem;
  text-align: left;
  min-height: 90px;
}
.quiz-prompt { margin-bottom: 14px; font-size: 1rem; color: var(--text-dim); line-height: 1.5; }
.quiz-prompt strong { color: var(--text); }
.quiz-prompt em { color: var(--accent-2); font-style: italic; }
.quiz-caption { margin: 12px 0 4px; font-size: 1.05rem; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz-options button {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}
.quiz-options button:hover:not(:disabled) { border-color: var(--accent-2); }
.quiz-options button.correct { background: #2f9e44; border-color: #2f9e44; color: #fff; }
.quiz-options button.wrong { background: #c93838; border-color: #c93838; color: #fff; }
.quiz-options button:disabled { cursor: default; opacity: 0.85; }
.quiz-options button.eliminated { opacity: 0.3; text-decoration: line-through; }

.quiz-hint-row { margin-top: 14px; }
.btn-hint {
  background: transparent;
  border: 1px dashed var(--accent);
  color: var(--accent);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-hint:hover:not(:disabled) { background: rgba(224, 164, 88, 0.1); }
.btn-hint:disabled { opacity: 0.4; cursor: default; border-style: solid; }
.quiz-hint-text {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--accent);
  background: rgba(224, 164, 88, 0.08);
  border: 1px solid rgba(224, 164, 88, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: left;
}

.btn-next {
  margin-top: 18px;
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #241705;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-next:hover { filter: brightness(1.08); }

.quiz-gameover {
  background: var(--card);
  border: 1px solid #7a1220;
  border-radius: var(--radius);
  padding: 32px 20px;
  box-shadow: var(--shadow);
}
.gameover-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 14px; }
.gameover-stats { color: var(--text-dim); line-height: 1.7; margin-bottom: 20px; font-size: 1rem; }
.gameover-stats strong { color: var(--accent); font-size: 1.3rem; }

.intro {
  color: var(--text-dim);
  max-width: 760px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.intro strong { color: var(--accent); }

/* Wizard */
.wizard-warnung {
  background: linear-gradient(135deg, #4a1414, #2b1010);
  border: 1px solid #7a1220;
  color: #ffd9d9;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  line-height: 1.5;
}
.wizard-warnung strong { color: #ff8a8a; }
.wizard-warnung.hidden { display: none; }

.wizard-layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.wizard-panel {
  position: sticky;
  top: 90px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.wizard-freitext { margin-bottom: 16px; }
.wizard-freitext input {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
}
.wizard-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.wizard-step-title { font-weight: 600; margin-bottom: 8px; font-size: 0.9rem; }
.wizard-results { min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--accent-2); }
.chip.active { background: var(--accent-2); color: #0d1610; border-color: var(--accent-2); font-weight: 600; }
.wizard-actions { margin: 4px 0 0; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 18px;
  width: 100%;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent-2); }

.grid-wizard .thumb-wrap { position: relative; }
.score-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(13, 22, 16, 0.85);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--accent);
}
.matched-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.matched-chip {
  font-size: 0.68rem;
  color: var(--accent-2);
  background: rgba(127, 191, 107, 0.12);
  border: 1px solid rgba(127, 191, 107, 0.35);
  padding: 1px 7px;
  border-radius: 999px;
}

@media (max-width: 900px) {
  .wizard-layout { grid-template-columns: 1fr; }
  .wizard-panel { position: static; max-height: none; }
}

/* Generator */
.generator-actions { margin-bottom: 22px; }
.gen-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 680px;
  box-shadow: var(--shadow);
}
.gen-header h2 { margin: 0 0 4px; }
.gen-header .badge-outline { background: transparent; border: 1px solid var(--border); color: var(--text-dim); margin-left: 8px; }

/* Statistik */
.stats-wrap { max-width: 760px; }
.stats-wrap h3 { margin-top: 28px; margin-bottom: 10px; color: var(--accent); }
.stat-summary { display: flex; gap: 16px; margin-bottom: 8px; }
.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 26px;
  text-align: center;
}
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--accent-2); }
.stat-label { color: var(--text-dim); font-size: 0.85rem; }

.barchart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 40px; align-items: center; gap: 10px; }
.bar-label { font-size: 0.85rem; color: var(--text-dim); text-align: right; }
.bar-track { background: var(--bg-alt); border-radius: 6px; overflow: hidden; height: 14px; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.3s ease; }
.bar-value { font-size: 0.82rem; color: var(--text-dim); }

@media (max-width: 600px) {
  .quiz-options { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 10px; align-items: flex-start; }
  .bar-row { grid-template-columns: 90px 1fr 30px; }
}
