:root {
  --cyan: #00ffff;
  --cyan-ink: #00b8d4;
  --cyan-deep: #00a3bd;
  --ink: #24292d;
  --muted: #6b7280;
  --line: #e2e6eb;
  --bg: #ffffff;
  --soft: #f5f7fa;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-weight: 600; font-size: 15px; text-decoration: none; color: var(--ink);
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover:not(:disabled) { border-color: var(--cyan-ink); box-shadow: 0 0 0 4px rgba(0, 200, 220, .12); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible { outline: 3px solid rgba(0, 184, 212, .45); outline-offset: 2px; }
.btn--primary {
  background: var(--cyan-ink); border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px rgba(0, 184, 212, .35), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn--primary:hover:not(:disabled) { background: var(--cyan-deep); box-shadow: 0 10px 30px rgba(0, 184, 212, .45), 0 0 0 4px rgba(0, 255, 255, .18); }
.btn--ghost { background: rgba(255,255,255,.8); }
.btn--xl { height: 56px; padding: 0 28px; font-size: 17px; }
.btn--google { height: 52px; padding: 0 26px; font-size: 16px; box-shadow: var(--shadow); }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--muted);
  transition: background .2s, color .2s, border-color .2s;
}
.icon-btn:hover { background: var(--soft); color: var(--ink); border-color: var(--line); }
.icon-btn.is-busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.chip {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px;
  border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 500;
  white-space: nowrap;
}

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0, 255, 255, .10), transparent 60%),
    linear-gradient(#fff, #fbfcfd);
}
.login::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(#eef1f4 1px, transparent 1px), linear-gradient(90deg, #eef1f4 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.login__bg { position: absolute; width: min(1100px, 120vw); opacity: .05; pointer-events: none; }
.login__card {
  position: relative; width: min(440px, 100%); padding: 40px 32px; text-align: center;
  background: rgba(255,255,255,.88); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow);
}
.login__logo { width: 150px; height: auto; margin-bottom: 18px; }
.login h1 { margin: 0 0 10px; font-size: 30px; letter-spacing: -.02em; }
.login h1 span { color: var(--cyan-ink); }
.login p { margin: 0 0 26px; color: var(--muted); line-height: 1.55; }
.login__error { margin: 18px 0 0 !important; padding: 10px 14px; border-radius: 12px; background: #fef2f2; color: #b91c1c !important; font-size: 14px; }
.login__hint { margin: 18px 0 0 !important; font-size: 13px; }

/* ---------- App ---------- */
.stage { position: fixed; inset: 0; }
.stage canvas { display: block; touch-action: none; }

.nav {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 10;
  display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 10px 0 18px;
  background: rgba(255,255,255,.78); backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(226, 230, 235, .9); border-radius: 20px; box-shadow: var(--shadow);
}
.nav__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.nav__brand img { height: 30px; width: auto; }
.nav__divider { width: 1px; height: 24px; background: var(--line); }
.nav__title { font-weight: 500; font-size: 15px; }
.nav__title b { color: var(--cyan-ink); font-weight: 700; }

.nav__search { position: relative; flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; color: var(--muted); }
.nav__search svg { position: absolute; left: 14px; pointer-events: none; }
.nav__search input {
  width: 100%; height: 42px; padding: 0 16px 0 42px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--soft); font: inherit; font-size: 15px; color: var(--ink);
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.nav__search input:focus { outline: none; background: #fff; border-color: var(--cyan-ink); box-shadow: 0 0 0 4px rgba(0, 200, 220, .12); }
.search-results {
  position: absolute; top: 50px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  max-height: 60vh; overflow: auto;
}
.search-results li button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 0; border-radius: 10px; background: transparent; text-align: left; font-size: 14px;
}
.search-results li button:hover, .search-results li button.is-active { background: var(--soft); }
.search-results .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.search-results .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.search-results .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.search-results .empty { padding: 12px; color: var(--muted); font-size: 14px; }

.nav__actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.user { position: relative; margin-left: 6px; }
.user__btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: var(--soft); overflow: hidden; }
.user__btn:hover { border-color: var(--cyan-ink); }
.user__btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user__menu {
  position: absolute; right: 0; top: 50px; width: 260px; padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.user__menu span { color: var(--muted); font-size: 13px; margin-bottom: 12px; overflow-wrap: anywhere; }

/* Hero mit Start-Button */
.hero {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 9;
  width: min(640px, calc(100% - 32px)); padding: 30px 32px 24px; text-align: center;
  background: rgba(255,255,255,.86); backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow);
  transition: opacity .35s ease, transform .35s ease;
}
.hero.is-hidden { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
.hero__eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan-ink); }
.hero h1 { margin: 0 0 10px; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.02em; }
.hero__status { margin: 0 0 12px; color: var(--muted); font-size: 15px; min-height: 22px; }
.progress { height: 4px; border-radius: 4px; background: var(--soft); overflow: hidden; margin: 0 auto 22px; max-width: 360px; }
.progress__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan-ink), var(--cyan)); transition: width .4s ease; }
.progress.is-done { opacity: 0; }
.hero__buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero__hint { margin: 14px 0 0; color: var(--muted); font-size: 13px; min-height: 18px; }
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin: 16px 0 0; padding: 16px 0 0; list-style: none; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.controls kbd { font: inherit; font-weight: 600; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-right: 4px; }

.fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 9;
  display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 22px;
  border: 0; border-radius: 999px; background: var(--cyan-ink); color: #fff; font-weight: 600; font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 184, 212, .4);
}
.fab:hover { background: var(--cyan-deep); }
.fab:disabled { opacity: .5; cursor: not-allowed; }

.legend {
  position: fixed; left: 20px; bottom: 20px; z-index: 8;
  display: flex; flex-wrap: wrap; gap: 8px; max-width: min(720px, calc(100% - 220px));
}
.legend button {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px 0 10px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(8px);
  font-size: 13px; font-weight: 500; transition: opacity .2s, border-color .2s;
}
.legend button .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.legend button[aria-pressed="false"] { opacity: .45; }
.legend button[aria-pressed="false"] .dot { box-shadow: none; }
.legend button:hover { border-color: currentColor; }

@media (max-width: 760px) {
  .nav { gap: 8px; padding: 0 8px 0 12px; }
  .nav__divider, .nav__title, #stats, #btn-reset { display: none; }
  .nav__brand img { height: 24px; }
  .hero { bottom: 16px; padding: 22px 18px 18px; }
  .controls { display: none; }
  .legend { display: none; }
  .fab { right: 16px; bottom: 16px; }
}

/* ---------- Modus-Umschalter und Erinnerungen ---------- */
.mode-switch { display: flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); flex-shrink: 0; }
.mode-switch button { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; font-size: 14px; font-weight: 500; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; }
.mode-switch button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(15,23,42,.12); }
.mode-switch button[aria-selected="true"]::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--cyan-ink); box-shadow: 0 0 8px var(--cyan); vertical-align: 1px; }

.seg { display: flex; padding: 3px; border-radius: 12px; background: var(--soft); }
.seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.12); }

@media (max-width: 1100px) { .nav__search { max-width: 280px; } #stats { display: none; } }
@media (max-width: 760px) {
  .mode-switch button { padding: 0 10px; font-size: 13px; }
  .mode-switch button::before { display: none !important; }
  .nav__search { display: none; }
}

/* ---------- Filter-Menü oben rechts (Erinnerungen) ---------- */
.filter { position: fixed; top: 84px; right: 12px; z-index: 11; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.filter__toggle {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
}
.filter__toggle:hover, .filter__toggle[aria-expanded="true"] { border-color: var(--cyan-ink); }
.badge:not(:empty) { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--cyan-ink); color: #fff; font-size: 12px; }
.filter__panel {
  width: min(340px, calc(100vw - 24px)); padding: 16px; display: flex; flex-direction: column; gap: 14px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  max-height: calc(100vh - 160px); overflow: auto;
}
.filter__group { display: flex; flex-direction: column; gap: 6px; }
.filter__group > span { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.filter__group .seg { width: 100%; }
.filter__group .seg button { flex: 1; }
.filter__panel .btn { width: 100%; }
.filter__hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 500; }
.chips button[aria-pressed="false"] { opacity: .45; }
.chips .dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- Großansicht und Diashow ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: rgba(255,255,255,.97); backdrop-filter: blur(6px); }
.lightbox img { flex: 1; min-height: 0; width: 100%; object-fit: contain; padding: 24px 24px 8px; }
.lightbox__progress { height: 3px; margin: 0 24px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.lightbox__progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan-ink), var(--cyan)); transition: width .1s linear; }
.lightbox__bar { display: flex; align-items: center; gap: 16px; padding: 14px 24px 20px; }
.lightbox__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lightbox__info strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox__info span { font-size: 13px; color: var(--muted); }
.lightbox__ctrl { display: flex; align-items: center; gap: 8px; }
.lightbox__ctrl span { min-width: 64px; text-align: center; font-size: 13px; color: var(--muted); }
.lightbox button { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 22px; line-height: 1; }
.lightbox button:hover { border-color: var(--cyan-ink); }
.lightbox button.is-primary { background: var(--cyan-ink); border-color: transparent; color: #fff; font-size: 16px; }
@media (max-width: 760px) {
  .filter { top: 80px; }
  .lightbox__bar { flex-wrap: wrap; }
  .lightbox__info { flex-basis: 100%; }
}
