/* =========================================================
   Müllkalender: Liquid-Glass-Design
   Glasflächen über einem weichen, farbigen Hintergrund.
   ========================================================= */

:root {
  --bg: #eef0f3;
  --ink: #0b0c0e;
  --ink-2: rgb(11 12 14 / 62%);
  --ink-3: rgb(11 12 14 / 40%);
  --hair: rgb(11 12 14 / 8%);

  /* Glas */
  --glass: rgb(255 255 255 / 46%);
  --glass-strong: rgb(255 255 255 / 68%);
  --glass-edge: rgb(255 255 255 / 85%);
  --glass-edge-low: rgb(255 255 255 / 25%);
  --glass-shadow: 0 1px 1px rgb(0 0 0 / 3%), 0 10px 30px -8px rgb(20 30 50 / 18%), 0 30px 60px -30px rgb(20 30 50 / 25%);
  --blur: blur(28px) saturate(190%);

  /* Hintergrundfarben (die erste wird je nächster Tonne getönt) */
  --tint: color-mix(in srgb, var(--tint-src, #5b8def) 42%, #fff);
  --aurora-2: #ffd9c2;
  --aurora-3: #c9f0dc;

  --prominent: #0b0c0e;
  --prominent-ink: #ffffff;

  --warn: #b26a00;
  --r-xl: 34px;
  --r-lg: 26px;
  --r-md: 20px;
  --r-sm: 14px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #050607;
    --ink: #f5f6f8;
    --ink-2: rgb(245 246 248 / 64%);
    --ink-3: rgb(245 246 248 / 40%);
    --hair: rgb(255 255 255 / 9%);

    --glass: rgb(255 255 255 / 7%);
    --glass-strong: rgb(40 42 48 / 72%);
    --glass-edge: rgb(255 255 255 / 30%);
    --glass-edge-low: rgb(255 255 255 / 6%);
    --glass-shadow: 0 1px 1px rgb(0 0 0 / 30%), 0 20px 50px -20px rgb(0 0 0 / 70%);

    --tint: color-mix(in srgb, var(--tint-src, #3a64c8) 55%, #000);
    --aurora-2: #5a2a1c;
    --aurora-3: #0f4a35;

    --prominent: #f5f6f8;
    --prominent-ink: #0b0c0e;
    --warn: #ffbf5c;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
  letter-spacing: -0.011em;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Hintergrund: Aurora ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i {
  position: absolute;
  width: 75vmax;
  height: 75vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.85;
  animation: drift 28s ease-in-out infinite alternate;
}
.aurora i:nth-child(1) { top: -30vmax; left: -25vmax; background: radial-gradient(circle, var(--tint), transparent 65%); }
.aurora i:nth-child(2) { top: 10vmax; right: -35vmax; background: radial-gradient(circle, var(--aurora-2), transparent 65%); animation-duration: 34s; }
.aurora i:nth-child(3) { bottom: -40vmax; left: -10vmax; background: radial-gradient(circle, var(--aurora-3), transparent 65%); animation-duration: 40s; }
@media (prefers-color-scheme: dark) { .aurora i { opacity: 0.6; } }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
}

/* ---------- Glas-Material ---------- */
.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow:
    inset 0 1px 0 0 var(--glass-edge),
    inset 0 -1px 0 0 var(--glass-edge-low),
    var(--glass-shadow);
  isolation: isolate;
}
/* Lichtkante: feiner Verlaufsrahmen wie gebogenes Glas */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, var(--glass-edge) 0%, transparent 35%, transparent 65%, var(--glass-edge-low) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}
/* Spiegelung oben links */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 60% at 15% 0%, rgb(255 255 255 / 35%), transparent 55%);
  pointer-events: none;
  z-index: -1;
}
@media (prefers-color-scheme: dark) {
  .glass::before { background: radial-gradient(120% 60% at 15% 0%, rgb(255 255 255 / 9%), transparent 55%); }
}

main {
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 18px 40px;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { letter-spacing: -0.025em; line-height: 1.1; }
.muted { color: var(--ink-2); }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.06rem; letter-spacing: -0.02em; }
.brand img { border-radius: 9px; box-shadow: 0 4px 12px -4px rgb(0 0 0 / 30%); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.25s var(--ease);
}
.icon-btn:active { transform: scale(0.9); }

/* ---------- Ansichten ---------- */
.view { display: flex; flex-direction: column; gap: 14px; }
.view > * { animation: rise 0.6s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: 40ms; }
.view > *:nth-child(3) { animation-delay: 80ms; }
.view > *:nth-child(4) { animation-delay: 120ms; }
.view > *:nth-child(5) { animation-delay: 160ms; }
.view > *:nth-child(6) { animation-delay: 200ms; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } }

/* Start */
.start { flex: 1; justify-content: space-between; gap: 28px; padding-top: 6px; }
.start-art {
  border-radius: var(--r-xl);
  min-height: 250px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 40px 20px 56px;
  overflow: hidden;
}
.shelf {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  -webkit-box-reflect: below 2px linear-gradient(transparent 60%, rgb(0 0 0 / 20%));
}
.shelf .bin { width: 64px; }
.shelf .bin:nth-child(2) { width: 78px; }
.shelf .bin:nth-child(3) { width: 70px; }
.shelf .bin:nth-child(4) { width: 58px; }

.start-copy h1 { font-size: clamp(2.1rem, 9.4vw, 2.7rem); font-weight: 700; margin: 0 0 12px; letter-spacing: -0.035em; }
.start-copy p { margin: 0; font-size: 1.08rem; line-height: 1.45; }
.start-actions { display: flex; flex-direction: column; gap: 4px; padding-bottom: env(safe-area-inset-bottom); }

/* Laden */
.loading { flex: 1; align-items: center; justify-content: center; text-align: center; min-height: 60dvh; }
.bob { display: flex; gap: 10px; align-items: flex-end; }
.bob .bin { width: 38px; animation: bob 1.2s var(--ease) infinite; }
.bob .bin:nth-child(2) { animation-delay: 0.12s; }
.bob .bin:nth-child(3) { animation-delay: 0.24s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } }

/* ---------- Knöpfe ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  border-radius: 999px;
  padding: 14px 24px;
  min-height: 54px;
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.3s var(--ease);
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: linear-gradient(180deg, rgb(255 255 255 / 16%), transparent 50%), var(--prominent);
  color: var(--prominent-ink);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 25%),
    inset 0 -1px 0 rgb(0 0 0 / 20%),
    0 12px 28px -10px rgb(0 0 0 / 45%);
}
.btn.secondary {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 0 0 1px var(--hair), 0 6px 18px -10px rgb(0 0 0 / 25%);
}
.btn.text { background: transparent; color: var(--ink-2); font-weight: 500; }
.btn.big { min-height: 60px; font-size: 1.08rem; }
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 9px 16px 9px 12px;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 500;
  cursor: pointer;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip svg { flex: none; color: var(--ink-2); }

.notice { border-radius: var(--r-md); padding: 14px 16px; font-size: 0.93rem; color: var(--ink-2); }
.notice strong { color: var(--ink); font-weight: 600; }
.notice.warn strong { color: var(--warn); }

.card { border-radius: var(--r-lg); }

/* ---------- Nächster Termin ---------- */
.hero-card {
  --c: var(--tint);
  border-radius: var(--r-xl);
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 4px 12px;
  overflow: hidden;
}
/* farbiges Leuchten der Tonne hinter dem Glas */
.glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
}
.hero-card .glow {
  right: -40px;
  bottom: -70px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 38%, transparent), transparent 70%);
}
.hero-card .eyebrow { margin: 0; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }
.hero-card .when {
  grid-column: 1;
  margin: 6px 0 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
  font-size: clamp(2.3rem, 10.5vw, 2.9rem);
  letter-spacing: -0.045em;
  line-height: 1;
}
.hero-card .when .num { font-size: clamp(4.6rem, 22vw, 5.8rem); font-weight: 200; letter-spacing: -0.06em; }
.hero-card .when .unit { font-size: 1.35rem; font-weight: 500; letter-spacing: -0.02em; color: var(--ink-2); }
.hero-card .date { grid-column: 1 / -1; margin: 8px 0 0; font-size: 1.05rem; font-weight: 500; color: var(--ink-2); }
.hero-card .types { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero-card .hint { grid-column: 1 / -1; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--hair); font-size: 0.93rem; font-weight: 500; }
.hero-bins { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: flex-end; align-self: end; }
.hero-bins .bin { width: 58px; filter: drop-shadow(0 14px 14px rgb(0 0 0 / 22%)); }
.hero-bins .bin + .bin { margin-left: -18px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px 7px 10px;
  border-radius: 999px;
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 0 0 1px var(--hair);
  font-size: 0.88rem;
  font-weight: 600;
}
.tag::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }

.section-title { margin: 18px 4px 10px; font-size: 1.32rem; font-weight: 700; letter-spacing: -0.03em; }

/* ---------- 14-Tage-Leiste ---------- */
.day-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 54px;
  gap: 8px;
  margin: 0 -18px;
  padding: 4px 18px 16px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 18px;
  scrollbar-width: none;
}
.day-strip::-webkit-scrollbar { display: none; }
.day {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 0 10px;
  border-radius: 999px;
  min-height: 94px;
}
.day .wd { font-size: 0.7rem; font-weight: 600; color: var(--ink-3); }
.day .dn { font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.day .dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 36px; margin-top: 4px; }
.day .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.day.weekend .wd, .day.weekend .dn { opacity: 0.55; }
.day.today {
  background: linear-gradient(180deg, rgb(255 255 255 / 14%), transparent 60%), var(--prominent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 25%), 0 10px 22px -10px rgb(0 0 0 / 50%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.day.today::before, .day.today::after { display: none; }
.day.today .wd, .day.today .dn { color: var(--prominent-ink); opacity: 1; }
.day.today .wd { opacity: 0.7; }

/* ---------- Tonnen ---------- */
.bin-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bin-tile {
  --c: #888;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.bin-tile .glow {
  left: -40px;
  top: -50px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 32%, transparent), transparent 70%);
}
.bin-tile .bin { width: 40px; margin-bottom: 14px; filter: drop-shadow(0 8px 8px rgb(0 0 0 / 18%)); }
.bin-tile .name { font-weight: 600; font-size: 1rem; line-height: 1.2; letter-spacing: -0.02em; }
.bin-tile .next { color: var(--ink-2); font-size: 0.86rem; }
.bin-tile .count {
  position: absolute;
  top: 16px;
  right: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--hair);
  color: var(--ink-2);
}
.bin-tile .count.soon { background: var(--prominent); color: var(--prominent-ink); box-shadow: none; }

/* ---------- Terminliste ---------- */
.upcoming { display: flex; flex-direction: column; gap: 18px; }
.month h3 { margin: 0 6px 8px; font-size: 0.82rem; font-weight: 600; color: var(--ink-3); }
.month ul { list-style: none; margin: 0; padding: 6px 0; border-radius: var(--r-lg); }
.event { display: flex; align-items: center; gap: 14px; padding: 9px 18px; position: relative; }
.event + .event::before { content: ""; position: absolute; top: 0; left: 74px; right: 0; height: 1px; background: var(--hair); }
.event .cal { flex: none; display: flex; flex-direction: column; align-items: center; width: 42px; line-height: 1.05; }
.event .cal b { font-size: 1.3rem; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.event .cal small { font-size: 0.66rem; font-weight: 600; color: var(--ink-3); }
.event .what { flex: 1; font-weight: 500; }
.event .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); flex: none; }

.source { margin: 10px 6px 0; font-size: 0.78rem; color: var(--ink-3); }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.form h2 { margin: 0; font-size: 1.32rem; font-weight: 700; }
.form .row { display: flex; gap: 10px; }
.grow { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; font-weight: 500; color: var(--ink-2); min-width: 0; }
.field > span { padding-left: 4px; }
.field em { font-style: normal; color: var(--ink-3); }
.field.narrow { flex: 0 0 96px; }
input {
  font: inherit;
  font-size: 16px; /* verhindert Auto-Zoom auf iOS */
  font-weight: 500;
  color: var(--ink);
  padding: 14px 16px;
  min-height: 52px;
  width: 100%;
  border-radius: var(--r-sm);
  border: 0;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  box-shadow: inset 0 0 0 1px var(--hair);
  transition: box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
input::placeholder { color: var(--ink-3); }
input:focus { outline: none; background: var(--glass-strong); box-shadow: inset 0 0 0 1.5px var(--ink-2); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: s; display: flex; gap: 12px; font-size: 0.95rem; color: var(--ink-2); }
.steps li::before {
  content: counter(s);
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--prominent);
  color: var(--prominent-ink);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Bottom Sheet: schwebende Glasscheibe */
dialog.sheet {
  position: fixed;
  margin: auto 8px calc(8px + env(safe-area-inset-bottom));
  width: calc(100% - 16px);
  max-width: 504px;
  max-height: 90dvh;
  padding: 0;
  border: 0;
  border-radius: 38px;
  background: var(--glass-strong);
  color: var(--ink);
}
@media (min-width: 536px) { dialog.sheet { margin-inline: auto; } }
dialog.sheet[open] { animation: sheet-in 0.5s var(--ease); }
dialog::backdrop { background: rgb(0 0 0 / 22%); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet-handle { width: 38px; height: 5px; border-radius: 99px; background: var(--ink-3); opacity: 0.5; margin: -10px auto 0; }
@keyframes sheet-in { from { transform: translateY(105%); } }

/* ---------- Toast & Fuß ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 13px 20px;
  border-radius: 999px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 18px 40px -12px rgb(0 0 0 / 35%);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
  z-index: 10;
}

.footer { text-align: center; padding: 8px 18px calc(16px + env(safe-area-inset-bottom)); font-size: 0.75rem; color: var(--ink-3); }
.footer a { color: inherit; }

.reveal { animation: rise 0.6s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 120ms); }

/* ---------- Tonnen-Grafik ---------- */
.bin { display: block; height: auto; --c: #888; overflow: visible; }
.bin .b { fill: var(--c); }
.bin .d { fill: color-mix(in srgb, var(--c) 70%, #000); }
.bin .g { fill: url(#gloss); }
.bin .s { fill: url(#shade); }
.bin .r { stroke: color-mix(in srgb, var(--c) 62%, #000); stroke-width: 2.5; stroke-linecap: round; opacity: 0.4; }
.bin .w { fill: #1a1c1f; }
@media (prefers-color-scheme: dark) {
  .bin .b, .bin .d { stroke: rgb(255 255 255 / 18%); stroke-width: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Ohne backdrop-filter: deckendere Flächen */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .btn.secondary, .toast { background: var(--glass-strong); }
}

@media (min-width: 600px) {
  main { padding-top: 16px; }
  .bin-grid { grid-template-columns: repeat(3, 1fr); }
}
