@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --bg:        #f3efe8;
  --surface:   #ffffff;
  --text:      #2c2926;
  --muted:     #7a7166;
  --faint:     #aca49a;
  --border:    #e4ddd5;
  --accent:    #5a7a61;
  --accent-h:  #456050;
  --petal:     #e8b4c4;
  --petal-dim: rgba(232,180,196,0.15);
  --center:    #f0c040;
  --shadow-sm: 0 1px 4px rgba(44,41,38,0.07);
  --shadow-md: 0 4px 16px rgba(44,41,38,0.1);
  --radius:    16px;
  --radius-sm: 10px;
  --nav-h:     86px;
  --col-w:     480px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== LOGIN / GATE / ONBOARDING ===== */
#view-login,
#view-gate,
#view-onboarding {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-container {
  width: 100%;
  max-width: var(--col-w);
}

.app-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.app-subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 32px;
}

.auth-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-box h2 {
  font-size: 1.05rem;
  font-weight: 600;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  resize: none;
}
input:focus, textarea:focus { border-color: var(--accent); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--faint); }

.error-msg { font-size: 0.82rem; color: #b91c1c; text-align: center; }

/* ===== APP SHELL ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: var(--col-w);
  margin: 0 auto;
}

/* ===== TOPBAR ===== */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.app-topbar-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--faint);
  letter-spacing: -0.01em;
}

.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 3px;
  transition: background 0.15s;
}
.topbar-avatar:hover { opacity: 0.85; }
.topbar-avatar.has-initial { font-size: 1rem; padding: 0; }

.btn-link {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover { color: var(--muted); }

.auth-switch {
  text-align: center;
  margin-top: -2px;
}

/* ===== PROFIL ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.profile-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.profile-email {
  font-size: 0.76rem;
  color: var(--muted);
  word-break: break-all;
}

.profile-since {
  font-size: 0.72rem;
  color: var(--faint);
  margin-top: 2px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--faint);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-logout {
  color: #b91c1c;
  border-color: #fecaca;
}

.delete-account-wrap {
  text-align: center;
  margin-top: 4px;
}

.btn-delete-account {
  color: var(--faint);
  font-size: 0.78rem;
}
.btn-delete-account:hover { color: #b91c1c; }

/* ===== VIEWS ===== */
.view { flex: 1; overflow-y: auto; padding-bottom: var(--nav-h); position: relative; z-index: 1; }
.view-inner { padding: 4px 20px 20px; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
#view-archive .view-header { margin-bottom: 4px; }
.archive-subtitle {
  font-size: 0.78rem;
  color: var(--faint);
  margin-bottom: 18px;
}

.view-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-greeting {
  font-size: 1.55rem;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

#heading-ask { display: none; }
#view-ask .view-inner  { padding-top: 52px; }
#view-quiz .view-inner { padding-top: 52px; }

.quiz-done-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--border); color: var(--text); }

.btn-full { width: 100%; }
.btn-sm { font-size: 0.8rem; padding: 6px 14px; }

/* ===== FRAGE STELLEN ===== */
.ask-area { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.ask-area textarea { min-height: 96px; line-height: 1.6; }

/* ===== ANTWORT ===== */
.answer-area { display: flex; flex-direction: column; gap: 12px; }

.card-preview {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-md);
}

.card-question { font-weight: 600; font-size: 1rem; }

.divider { height: 1px; background: var(--border); margin: 14px 0; }

.card-answer { font-size: 0.95rem; line-height: 1.75; white-space: pre-wrap; color: var(--text); }

.answer-actions { display: flex; gap: 10px; }
.answer-actions .btn { flex: 1; }

.adjust-area { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.adjust-area textarea { min-height: 72px; }

/* ===== LOADING ===== */
.loading-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== HINTERGRUND-ANIMATION ===== */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
}
.particle-a { animation: particle-wind-a linear infinite; }
.particle-b { animation: particle-wind-b linear infinite; }

@keyframes particle-wind-a {
  0%   { opacity: 0;   transform: translate(0, 0); }
  12%  { opacity: 1; }
  25%  { transform: translate(calc(var(--tx) * 0.25), -42px); }
  50%  { transform: translate(calc(var(--tx) * 0.5),   22px); }
  75%  { transform: translate(calc(var(--tx) * 0.75), -35px); }
  88%  { opacity: 0.6; }
  100% { opacity: 0;   transform: translate(var(--tx), 12px); }
}
@keyframes particle-wind-b {
  0%   { opacity: 0;   transform: translate(0, 0); }
  12%  { opacity: 1; }
  25%  { transform: translate(calc(var(--tx) * 0.25),  38px); }
  50%  { transform: translate(calc(var(--tx) * 0.5),  -28px); }
  75%  { transform: translate(calc(var(--tx) * 0.75),  44px); }
  88%  { opacity: 0.6; }
  100% { opacity: 0;   transform: translate(var(--tx),            -10px); }
}

/* ===== BADGE ===== */
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--border);
  padding: 2px 9px;
  border-radius: 99px;
}

/* ===== ARCHIV ===== */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.archive-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.archive-card:hover { box-shadow: var(--shadow-md); }
.archive-card .card-question { margin-bottom: 4px; }
.archive-card .card-date { font-size: 0.78rem; color: var(--faint); margin-top: 2px; }
.archive-discovery-label { font-size: 0.72rem; color: var(--accent); margin: 3px 0 1px; }
.archive-card.open .archive-answer { display: block; }
.archive-answer {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.75;
  white-space: pre-wrap;
  color: var(--muted);
}

.archive-group { margin-bottom: 4px; }
.archive-group-header {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}
.archive-group-date { flex: 1; }
.archive-group-count {
  background: var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--faint);
}
.archive-group-arrow { font-size: 1rem; transition: transform 0.2s; display: inline-block; }
.archive-group.open .archive-group-arrow { transform: rotate(90deg); }
.archive-group-cards { display: none; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.archive-group.open .archive-group-cards { display: flex; }

.empty-msg { text-align: center; color: var(--faint); padding: 56px 0; font-size: 0.92rem; }

/* ===== EIGENE PFLANZE (Startseite) ===== */
.home-plant-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0 40px;
}

#home-plant-svg svg { display: block; }

.home-plant-label {
  font-size: 0.75rem;
  color: var(--faint);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ===== ENTDECKUNG DES TAGES ===== */
.discovery-section { margin-top: 16px; }

.discovery-card-top {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  background: var(--petal-dim, rgba(122,176,48,0.12));
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.discovery-label {
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--petal, var(--accent));
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.btn-text {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--faint);
  font-size: 1.05rem;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: inherit;
  transition: color 0.15s;
}
.btn-text:hover { color: var(--muted); }

.discovery-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0;
  border: 1px solid var(--border);
  overflow: hidden;
}

.discovery-question {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 16px 16px 0;
}
#discovery-answer-wrap { padding: 0 16px; }

.discovery-actions {
  margin-top: 12px;
  padding: 0 16px 16px;
}
.discovery-actions .btn { font-size: 0.88rem; }

.discovery-card.saved .discovery-question,
.discovery-card.saved #discovery-answer-wrap,
.discovery-card.saved .discovery-actions { display: none; }

.discovery-next {
  font-size: 0.75rem;
  color: var(--faint);
  text-align: center;
  padding: 10px 0;
}

.discovery-badge {
  font-size: 0.7rem;
  color: var(--petal, var(--accent));
  opacity: 0.7;
  margin-left: 4px;
  vertical-align: middle;
}

.discovery-loading {
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

/* ===== BLUME ===== */
.flower-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0 40px;
}

.flower-svg { width: 110px; height: 110px; }

.flower-petal {
  fill: var(--border);
  transition: fill 0.4s ease;
}
.flower-petal.bloomed { fill: var(--accent); }
.flower-petal.bloomed.just-bloomed { animation: petalPop 0.55s ease; }

@keyframes petalPop {
  0%   { opacity: 0.1; filter: brightness(2.5); }
  50%  { opacity: 1;   filter: brightness(1.6); }
  100% { opacity: 1;   filter: brightness(1); }
}

.flower-center-circle { fill: var(--center); }
.flower-stem { stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; fill: none; }

.flower-score {
  font-size: 0.78rem;
  color: var(--faint);
  margin-top: 8px;
  font-weight: 500;
}

/* ===== QUIZ INTRO ===== */
.quiz-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 0 20px;
  gap: 20px;
}
.quiz-intro-title {
  margin-bottom: 0 !important;
}
.quiz-intro-desc { font-size: 0.9rem; color: var(--muted); line-height: 1.65; max-width: 300px; }
.quiz-intro-count {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(90,122,97,0.1);
  padding: 7px 18px;
  border-radius: 99px;
}
.quiz-intro .btn { margin-top: 2px; width: 100%; }

/* ===== QUIZ LEER / FERTIG ===== */
.quiz-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 0 48px;
  gap: 8px;
}
.quiz-done-icon { font-size: 2.2rem; margin-bottom: 6px; color: var(--accent); }
.quiz-done-text { font-size: 1.05rem; font-weight: 600; }
.quiz-done-sub { color: var(--faint); font-size: 0.9rem; }

/* ===== QUIZ KARTE ===== */
.quiz-card { display: flex; flex-direction: column; gap: 14px; }
.quiz-progress { font-size: 0.8rem; color: var(--faint); text-align: right; }

.card-flip {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: var(--shadow-md);
}
.card-flip .card-question { font-size: 1.05rem; }

.quiz-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.btn-quiz {
  width: 100%;
  padding: 13px 20px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-quiz:active { transform: scale(0.97); }
.btn-no     { background: #fde8e8; color: #b91c1c; }
.btn-almost { background: #fef6d0; color: #92400e; }
.btn-yes    { background: #d8f0de; color: #166534; }
.btn-no:hover     { background: #fbd5d5; }
.btn-almost:hover { background: #fdedb0; }
.btn-yes:hover    { background: #c2e8cb; }

/* ===== FLOATING PILL NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: calc(var(--col-w) - 40px);
  height: 58px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: 0 4px 24px rgba(44,41,38,0.14);
  display: flex;
  align-items: stretch;
  z-index: 100;
  overflow: hidden;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--faint);
  font-family: inherit;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn.active { color: var(--accent); }
.nav-icon { font-size: 1.15rem; line-height: 1; }
.nav-label { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.02em; }

@media (min-width: 640px) {
  .quiz-buttons { flex-direction: row; }
  .answer-actions .btn { flex: none; min-width: 140px; }
}

/* ===== SAMEN-AUSWAHL (Registrierung) ===== */
.seed-selection { margin: 2px 0 4px; }

.seed-selection-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

.seed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.seed-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.18s, background 0.18s, transform 0.12s, box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.seed-option:hover { transform: translateY(-2px); }
.seed-option.selected {
  transform: translateY(-1px);
  box-shadow: 0 3px 14px rgba(0,0,0,0.12);
}
.seed-option svg { display: block; }
.seed-name {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}

/* ===== PFLANZEN-PROFIL ===== */
.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.profile-avatar svg { display: block; }

.profile-plant-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 0 18px;
  text-align: center;
}
.profile-plant-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.profile-plant-stage {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  background: var(--border);
  padding: 2px 10px;
  border-radius: 99px;
}
.profile-plant-progress {
  width: 160px;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.profile-plant-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.profile-plant-next {
  font-size: 0.72rem;
  color: var(--faint);
}

/* ===== PFLANZEN-EVOLUTION ===== */
.evo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  animation: evo-fade-in 0.25s ease;
}
.evo-overlay.evo-out { animation: evo-fade-out 0.35s ease forwards; }
.evo-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  max-width: 280px;
  width: 88%;
  animation: evo-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.evo-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--petal, var(--accent));
  margin-bottom: 16px;
}
.evo-plant {
  margin: 0 auto 16px;
  animation: evo-plant-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}
.evo-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 3px;
}
.evo-stage {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 22px;
}
.evo-close { width: 100%; }

@keyframes evo-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes evo-fade-out { to   { opacity: 0; } }
@keyframes evo-pop {
  from { transform: scale(0.78); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
@keyframes evo-plant-pop {
  from { transform: scale(0.3) translateY(16px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}
