/* Anti-Smoky — mobile-first, Referenz iPhone 11 (375×812, safe areas) */
:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-light: #ccfbf1;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #f4f7f6;
  --card: #ffffff;
  --line: #e5e7eb;
  --radius: 16px;
}

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

/* hidden-Attribut muss auch gegen Klassen mit eigenem display gewinnen (z. B. .banner) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
}

#app { max-width: 480px; margin: 0 auto; }

/* Breite Viewports (Desktop, Tablets, „Desktop-Modus" am Handy):
   Oberfläche hochskalieren, statt winzig in der Mitte zu schweben */
@media (min-width: 640px) {
  #app, .login-card { zoom: 1.3; }
}
@media (min-width: 900px) {
  #app, .login-card { zoom: 1.5; }
}

.view {
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 92px);
  animation: fadein 0.18s ease;
}
@keyframes fadein { from { opacity: 0.4; } to { opacity: 1; } }

.loading { text-align: center; color: var(--muted); padding: 48px 0; }

h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; margin-bottom: 8px; }
h3 { font-size: 0.95rem; }

.screen-title { margin-bottom: 14px; }
.screen-title .sub { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

/* Karten */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.card.hero {
  background: linear-gradient(150deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  text-align: center;
  padding: 22px 16px;
}
.card.hero .label { opacity: 0.85; font-size: 0.85rem; }
.timer { font-size: 2rem; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.timer small { font-size: 1.1rem; font-weight: 500; }

.stat-row { display: flex; gap: 12px; }
.stat-row .card { flex: 1; margin-bottom: 14px; text-align: center; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--teal-dark); }
.stat-label { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* Buttons */
.btn {
  display: block; width: 100%;
  padding: 13px 16px;
  border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 600;
  background: #e5e7eb; color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn + .btn { margin-top: 10px; }
.btn.primary { background: var(--teal); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.danger-ghost { background: transparent; border: 1.5px solid #fecaca; color: var(--red); }
.btn:active { transform: scale(0.985); }
.btn.small { width: auto; display: inline-block; padding: 8px 14px; font-size: 0.85rem; }

/* Formulare */
label { display: block; font-size: 0.85rem; font-weight: 600; margin: 12px 0 5px; }
input, select {
  width: 100%; padding: 12px;
  border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 1rem; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--teal); }
.check-row { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.check-row input { width: 22px; height: 22px; accent-color: var(--teal); }
.check-row label { margin: 0; font-weight: 500; }
.error { color: var(--red); font-size: 0.85rem; margin-top: 10px; }
.hint { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #ecfeff, #f0fdf4); }
.login-card { position: relative; width: 100%; max-width: 360px; background: #fff; border-radius: 20px; padding: 28px 22px; box-shadow: 0 10px 30px rgba(15, 118, 110, 0.12); text-align: center; }
.login-card .logo { font-size: 2.6rem; }
.login-card h1 { margin: 6px 0 2px; }
.login-card .subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.login-card .app-description { font-size: 0.85rem; color: var(--ink); background: var(--teal-light); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; text-align: left; }
.login-card form { text-align: left; }
.login-card .btn { margin-top: 14px; }
.subtle-link { color: var(--muted); font-size: 0.85rem; text-decoration: underline; }
.lang-switch { position: absolute; top: 12px; right: 12px; }
.lang-switch button {
  border: 1.5px solid var(--line); background: #fff; color: var(--muted);
  font-size: 0.72rem; font-weight: 700; padding: 4px 8px; cursor: pointer;
}
.lang-switch button:first-child { border-radius: 8px 0 0 8px; }
.lang-switch button:last-child { border-radius: 0 8px 8px 0; margin-left: -1.5px; }
.lang-switch button.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.lang-row { display: flex; gap: 10px; }
.lang-row .btn { flex: 1; margin-top: 0; }
.lang-row .btn.active { background: var(--teal); color: #fff; }

/* Tab-Bar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  display: flex;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
}
.tab {
  flex: 1; border: none; background: none;
  font-size: 0.68rem; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tab .tab-icon { font-size: 1.25rem; }
.tab.active { color: var(--teal-dark); }
.tab .badge-dot { position: relative; }
.tab.has-badge .tab-icon::after {
  content: ""; position: absolute; margin-left: 2px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
}

/* Banner */
.banner {
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
  font-size: 0.9rem; display: flex; gap: 10px; align-items: flex-start;
}
.banner.info { background: var(--teal-light); color: var(--teal-dark); }
.banner.warn { background: #fef3c7; color: #92400e; }
.banner .btn { margin-top: 8px; }

/* Plan */
.stage-strength { font-size: 2.4rem; font-weight: 800; color: var(--teal-dark); }
.stage-strength small { font-size: 1rem; font-weight: 600; color: var(--muted); }
.progressbar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 10px 0 4px; }
.progressbar > div { height: 100%; background: var(--teal); border-radius: 4px; transition: width 0.4s; }
.stage-list { list-style: none; }
.stage-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.stage-list li:last-child { border-bottom: none; }
.stage-list .dot {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--line); font-weight: 700; font-size: 0.8rem; color: var(--muted);
}
.stage-list li.done .dot { background: var(--green); color: #fff; }
.stage-list li.current .dot { background: var(--teal); color: #fff; }
.stage-list .meta { font-size: 0.78rem; color: var(--muted); }
.tips { list-style: none; }
.tips li { padding: 6px 0 6px 24px; position: relative; font-size: 0.88rem; }
.tips li::before { content: "💡"; position: absolute; left: 0; font-size: 0.8rem; }
.nf-share { display: inline-block; background: var(--teal-light); color: var(--teal-dark); border-radius: 8px; padding: 2px 8px; font-size: 0.75rem; font-weight: 700; }

/* Check-in */
.choice-grid { display: grid; gap: 10px; margin-top: 10px; }
.choice {
  border: 2px solid var(--line); border-radius: 14px; background: #fff;
  padding: 14px; font-size: 0.95rem; font-weight: 600; text-align: left;
  cursor: pointer; display: flex; align-items: center; gap: 12px;
  -webkit-tap-highlight-color: transparent;
}
.choice .emoji { font-size: 1.4rem; }
.choice.selected { border-color: var(--teal); background: var(--teal-light); }
.history-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 10px; }
.history-dots .day { text-align: center; font-size: 0.65rem; color: var(--muted); }
.history-dots .day .d {
  width: 26px; height: 26px; border-radius: 50%; margin: 0 auto 3px;
  background: var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
}
.day .d.ok { background: #bbf7d0; }
.day .d.more { background: #fde68a; }
.day .d.less { background: #99f6e4; }
.day .d.smoked { box-shadow: 0 0 0 2px var(--red); }

/* Gesundheit */
.ring-wrap { display: flex; justify-content: center; padding: 6px 0 2px; }
.milestone-list { list-style: none; }
.milestone-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.milestone-list li:last-child { border-bottom: none; }
.milestone-list .ico { font-size: 1.2rem; flex-shrink: 0; }
.milestone-list .t { font-weight: 600; font-size: 0.9rem; }
.milestone-list .x { font-size: 0.82rem; color: var(--muted); }
.milestone-list li.locked { opacity: 0.55; }
.chart-card svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 0.75rem; color: var(--muted); margin-top: 6px; }
.legend span::before { content: "●"; margin-right: 4px; }
.legend .l-past::before { color: var(--teal); }
.legend .l-future::before { color: #99b8b4; }

/* Käufe / Mehr */
.purchase-list { list-style: none; }
.purchase-list li { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.purchase-list li:last-child { border-bottom: none; }
.purchase-list .del { background: none; border: none; color: var(--red); font-size: 1rem; cursor: pointer; padding: 4px 8px; }
.tag { font-size: 0.7rem; background: var(--teal-light); color: var(--teal-dark); border-radius: 6px; padding: 1px 6px; margin-left: 6px; font-weight: 700; }

.sources { font-size: 0.78rem; color: var(--muted); }
.sources a { color: var(--teal-dark); word-break: break-all; }
.sources li { margin-bottom: 6px; }
.disclaimer { font-size: 0.78rem; color: var(--muted); }

.success-flash {
  position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 0.85rem; z-index: 50; animation: flash 2.2s forwards;
}
@keyframes flash { 0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
