:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #dedbd4;
  --accent: #0b4f8a;
  --accent-text: #ffffff;
  --badge-today: #c2410c;
  --badge-archive: #4b5563;
  --shadow: 0 1px 2px rgb(0 0 0 / 8%), 0 4px 12px rgb(0 0 0 / 6%);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --surface: #1f1f23;
    --text: #ececef;
    --muted: #9a9aa2;
    --line: #2e2e34;
    --accent: #5aa2e6;
    --accent-text: #0b1520;
    --badge-today: #f97316;
    --badge-archive: #6b7280;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* Kopfzeile */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--accent); color: var(--accent-text);
}
.bar h1 { margin: 0; font: 700 1.25rem/1.2 Georgia, "Times New Roman", serif; flex: 1; }
.bar .title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar a, .bar button {
  color: inherit; background: none; border: 0; font: inherit; cursor: pointer;
  text-decoration: none; padding: 6px 4px; border-radius: 6px;
}
.bar a:focus-visible, .bar button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.bar form { margin: 0; }

/* Uebersicht */
main { max-width: 1200px; margin: 0 auto; padding: 8px 16px 32px; }
h2 {
  margin: 24px 0 10px; font: 600 0.95rem/1.2 system-ui, sans-serif;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (max-width: 380px) { .grid { gap: 10px; grid-template-columns: repeat(2, 1fr); } }
.tile {
  position: relative; display: block; color: inherit; text-decoration: none;
  background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.tile:hover { transform: translateY(-2px); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile img {
  display: block; width: 100%; height: auto; aspect-ratio: 5 / 7; object-fit: cover; object-position: top;
  background: var(--line);
}
.tile img.broken { visibility: hidden; }
.tile .cap { display: block; padding: 8px 10px; font-size: 0.9rem; font-weight: 600; }
.badge {
  position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; color: #fff; background: var(--badge-archive);
}
.badge.today { background: var(--badge-today); }
.status { text-align: center; color: var(--muted); min-height: 1.5em; padding: 0 16px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }

/* Reader */
body.reader { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.reader iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }

/* Login */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
}
.login form {
  width: 100%; max-width: 360px; background: var(--surface); padding: 28px 24px;
  border-radius: 14px; box-shadow: var(--shadow);
}
.login img { display: block; width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 14px; }
.login h1 { text-align: center; margin: 0 0 20px; font: 700 1.5rem/1.2 Georgia, "Times New Roman", serif; }
.login label { display: block; font-size: 0.9rem; font-weight: 600; margin: 14px 0 6px; }
.login input {
  width: 100%; padding: 11px 12px; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
.login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login button {
  width: 100%; margin-top: 22px; padding: 12px; font: 600 1rem/1 inherit; cursor: pointer;
  color: var(--accent-text); background: var(--accent); border: 0; border-radius: 8px;
}
.login .error {
  margin: 0 0 8px; padding: 10px 12px; border-radius: 8px;
  background: color-mix(in srgb, var(--badge-today) 15%, transparent); color: var(--text);
}
