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

:root {
  --bg: #FFF8F0;
  --card: #FFFFFF;
  --text: #2B2118;
  --text-soft: #8A7A6B;
  --strom: #FFC94A;
  --gas: #FF8552;
  --wasser: #4FB6E8;
  --success: #06A77D;
  --error: #E25555;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(43, 33, 24, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .brand {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  margin: 0;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 88px; /* Platz für Bottom-Nav */
}

.screen { padding: 24px 20px 8px; }
.hidden { display: none !important; }

/* --- Onboarding --- */
.onboarding {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
  text-align: center;
}

.logo-mark {
  width: 84px;
  height: 84px;
  margin: 0 auto 20px;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--gas), var(--strom));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.logo-mark svg { width: 44px; height: 44px; }

/* --- Maskottchen "Ablo" --- */
.mascot {
  display: block;
  margin: 0 auto 12px;
  width: auto;
  filter: drop-shadow(0 10px 16px rgba(255, 133, 82, 0.25));
}
.mascot-lg { height: 150px; }
.mascot-md { height: 110px; }
.mascot-sm { height: 76px; margin-bottom: 8px; }

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.mascot-bounce { animation: mascot-bounce 1.1s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .mascot-bounce { animation: none; }
}

.onboarding h1 { font-size: 30px; margin-bottom: 8px; }
.onboarding p.subtitle { color: var(--text-soft); margin-bottom: 32px; font-size: 15px; }

.field {
  text-align: left;
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-soft);
}
.field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 2px solid #F0E6D8;
  background: var(--card);
  font-size: 18px;
  letter-spacing: 2px;
  font-family: 'Nunito', sans-serif;
  color: var(--text);
}
.field input:focus { outline: none; border-color: var(--gas); }
.field small { display: block; margin-top: 6px; color: var(--text-soft); font-size: 12px; letter-spacing: 0; }

.btn-primary {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--gas);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 16px;
  box-shadow: var(--shadow);
}
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  margin-top: 12px;
  border: 2px solid #F0E6D8;
}

.link-toggle {
  margin-top: 20px;
  color: var(--text-soft);
  font-size: 14px;
}
.link-toggle button { background: none; color: var(--gas); font-weight: 700; text-decoration: underline; }

.id-reveal {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.id-reveal .big-id {
  font-family: 'Fredoka', sans-serif;
  font-size: 42px;
  letter-spacing: 8px;
  color: var(--gas);
  margin: 12px 0;
}

.callout-warning {
  background: #FFF3E0;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 13px;
  color: #8A5A2B;
  text-align: left;
}

/* --- Header --- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 4px;
}
.top-bar .brand { font-size: 22px; }
.top-bar .brand span { color: var(--gas); }

/* --- Hero capture button --- */
.capture-hero {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  margin: 8px 0 24px;
}
.capture-hero p { color: var(--text-soft); margin: 6px 0 20px; font-size: 14px; }
.capture-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gas), var(--strom));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 10px 28px rgba(255, 133, 82, 0.35);
}
.capture-btn svg { width: 40px; height: 40px; fill: #fff; }
.capture-btn:active { transform: scale(0.96); }

/* --- Meter cards --- */
.section-title {
  font-size: 15px;
  color: var(--text-soft);
  font-weight: 700;
  margin: 20px 0 10px;
  text-transform: none;
}

.meter-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.meter-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.meter-icon svg { width: 24px; height: 24px; }
.meter-icon.strom { background: color-mix(in srgb, var(--strom) 25%, white); }
.meter-icon.gas { background: color-mix(in srgb, var(--gas) 20%, white); }
.meter-icon.wasser { background: color-mix(in srgb, var(--wasser) 20%, white); }

.meter-info { flex: 1; min-width: 0; }
.meter-info .name { font-weight: 700; font-size: 15px; }
.meter-info .meta { color: var(--text-soft); font-size: 13px; }
.meter-value { text-align: right; font-family: 'Fredoka', sans-serif; font-weight: 600; }
.meter-value .unit { font-size: 11px; color: var(--text-soft); font-family: 'Nunito', sans-serif; }

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-soft);
}

.fab-add {
  position: fixed;
  right: 50%;
  transform: translateX(178px);
  bottom: 100px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}
@media (max-width: 460px) {
  .fab-add { right: 20px; transform: none; }
}

/* --- Bottom nav --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -6px 20px rgba(43, 33, 24, 0.08);
  display: flex;
  justify-content: space-around;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
.nav-item {
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 14px;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--gas); background: #FFF3E8; }

/* --- Modal (add meter / confirm reading) --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 33, 24, 0.4);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}
.modal-sheet {
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 28px 28px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
}
.modal-sheet h2 { margin-bottom: 16px; }

select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 2px solid #F0E6D8;
  background: var(--card);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  color: var(--text);
}

.type-picker { display: flex; gap: 10px; margin-bottom: 16px; }
.type-chip {
  flex: 1;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 2px solid #F0E6D8;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
}
.type-chip.selected.strom { border-color: var(--strom); background: color-mix(in srgb, var(--strom) 20%, white); }
.type-chip.selected.gas { border-color: var(--gas); background: color-mix(in srgb, var(--gas) 15%, white); }
.type-chip.selected.wasser { border-color: var(--wasser); background: color-mix(in srgb, var(--wasser) 15%, white); }

.photo-preview {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  max-height: 260px;
  object-fit: cover;
}

.suggested-value {
  text-align: center;
  margin-bottom: 16px;
}
.suggested-value .big-number {
  font-family: 'Fredoka', sans-serif;
  font-size: 40px;
  color: var(--gas);
}
.confidence-note {
  text-align: center;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 16px;
}

/* --- Reports --- */
.report-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.report-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #F5EEE3;
  font-size: 14px;
}
.report-row:last-child { border-bottom: none; }
.report-row .date { color: var(--text-soft); }
.report-row .cost { color: var(--success); font-weight: 700; }

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 100;
}
.toast.error { background: var(--error); }
