/* Kishou – Design „Nachtregal“ (dunkel als Standard, helle Variante über data-theme="light") */

:root, :root[data-theme="dark"] {
  --bg: #0F1115;
  --side: #14171D;
  --card: #1A1E26;
  --raised: #1F2430;
  --input: #12151B;
  --border: #262B35;
  --border-strong: #2E3441;
  --text: #ECEEF2;
  --muted: #9AA1AE;
  --accent: #8B9CFF;
  --accent-ink: #0F1115;
  --accent-soft: #22314A;
  --accent-soft-text: #B8C3FF;
  --nav-active: #222838;
  --read: #3BB58C;
  --wish: #F2B84B;
  --danger: #F06A6A;
  --chip: #232833;
  --track: #2A3040;
  --cover: #232833;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F4F5F8;
  --side: #FFFFFF;
  --card: #FFFFFF;
  --raised: #F7F8FA;
  --input: #FFFFFF;
  --border: #E3E6EC;
  --border-strong: #D3D8E0;
  --text: #14171D;
  --muted: #5B6270;
  --accent: #4F5FD9;
  --accent-ink: #FFFFFF;
  --accent-soft: #E6E9FF;
  --accent-soft-text: #2E3AA8;
  --nav-active: #ECEEFB;
  --read: #1E8C66;
  --wish: #B7791F;
  --danger: #C92A2A;
  --chip: #EEF0F4;
  --track: #E3E6EC;
  --cover: #E3E6EC;
  --shadow: 0 12px 30px rgba(20, 23, 29, 0.12);
  color-scheme: light;
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
/* Handy: kein blauer Tipp-Rahmen, kein versehentliches Markieren beim Tippen – außer in Eingabefeldern */
* { -webkit-tap-highlight-color: transparent; }
@media (pointer: coarse) {
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  input, textarea, select, [contenteditable="true"] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
}
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif; font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: 'Space Grotesk', 'DM Sans', sans-serif; letter-spacing: -0.01em; }
h2 { margin: 0 0 18px; font-size: 28px; line-height: 1.15; }
h3 { margin: 0 0 14px; font-size: 20px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex-shrink: 0; }

/* ---------- App-Gerüst ---------- */
.app { display: flex; min-height: 100vh; }
body:not(.signed-in) .shell { display: none !important; }

.sidebar {
  position: sticky; top: 0; height: 100vh; width: 248px; flex-shrink: 0;
  background: var(--side); border-right: 1px solid var(--border);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 8px; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; }
.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 17px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.side-nav a:hover { color: var(--text); background: var(--raised); }
.side-nav a.active { background: var(--nav-active); color: var(--text); font-weight: 700; }
.side-nav svg, .tabbar svg, .user-card svg, .icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-nav a.active svg { stroke: var(--accent); }
.count { margin-left: auto; font-size: 12px; background: var(--chip); color: var(--text); border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.side-foot { margin-top: auto; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; text-decoration: none;
  background: var(--card); border: 1px solid var(--border);
}
.user-card:hover { color: var(--text); border-color: var(--border-strong); }
.user-card.active { border-color: var(--accent); }
.avatar { width: 34px; height: 34px; border-radius: 999px; background: var(--track); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text small { font-size: 12px; color: var(--muted); }
body[data-sync="offline"] .sync-text, body[data-sync="error"] .sync-text { color: var(--wish); }
.gear { color: var(--muted); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 36px 72px; }
.mobile-top, .tabbar { display: none; }

/* ---------- Bausteine ---------- */
.surface { background: var(--card); border: 1px solid var(--border); border-radius: 18px; }
.meta { color: var(--muted); font-size: 13px; }
.status { color: var(--muted); margin: 16px 0; min-height: 1.2em; }
.status:empty { margin: 0; min-height: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
kbd { font: inherit; font-size: 12px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 6px; }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--border-strong); border-radius: 14px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--raised); border: 1px solid var(--border); font-size: 14px; line-height: 1.5; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 18px; text-decoration: none; color: var(--muted); font-size: 14px; }
section { margin-top: 36px; scroll-margin-top: 16px; }
#view > section:first-of-type, #view > h2 + section, .settings section { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h3 { margin: 0; }
.section-head .meta { text-decoration: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { margin: 0; }

/* Buttons */
button { font: inherit; cursor: pointer; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; font-size: 14px; font-weight: 700; border: 1px solid var(--accent); border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; line-height: 1.2;
}
button:hover:not(:disabled), .btn:hover { filter: brightness(1.08); color: var(--accent-ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border-strong); font-weight: 600; padding: 9px 14px; }
.btn-secondary:hover:not(:disabled) { filter: none; border-color: var(--accent); color: var(--text); }
.btn-secondary.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-small { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; justify-self: start; }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 14px; background: var(--card); border: 1px solid var(--border); color: var(--text); display: grid; place-items: center; text-decoration: none; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* Chips & Segmente */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; background: var(--chip); color: var(--text); border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 500; border: 0; }
button.chip { padding: 7px 14px; font-size: 13px; font-weight: 600; border: 1px solid var(--border-strong); background: transparent; color: var(--text); border-radius: 999px; }
button.chip:hover:not(:disabled) { filter: none; border-color: var(--accent); color: var(--text); }
button.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.accent { background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 700; }
.segmented { display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.segmented button { background: transparent; border: 0; color: var(--muted); padding: 6px 12px; font-size: 13px; font-weight: 600; border-radius: 8px; }
.segmented button:hover:not(:disabled) { filter: none; color: var(--text); }
.segmented button.active { background: var(--track); color: var(--text); }
.segmented.icons button { padding: 6px 9px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-soft-text); }
.badge-small { font-size: 11px; padding: 1px 8px; margin-left: 8px; vertical-align: 1px; }

/* Formulare */
input[type="search"], input[type="text"], input[type="password"], input[type="number"], input[type="date"], textarea, select {
  font: inherit; font-size: 15px; color: var(--text); background: var(--input);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
select { padding: 9px 12px; font-size: 14px; max-width: 100%; }
textarea { width: 100%; min-height: 80px; resize: vertical; line-height: 1.5; }
.field { display: grid; gap: 6px; font-size: 14px; }
.field > span { color: var(--muted); }
.field input, .field select { width: 100%; }
.date-row { display: flex; gap: 8px; align-items: center; }
.date-row input { flex: 1; min-width: 0; }
.date-row button { flex-shrink: 0; }
.form-grid { display: grid; gap: 14px; min-width: min(380px, 80vw); }
.form-error { color: var(--danger); font-size: 14px; min-height: 1.2em; }
.form-error:empty { min-height: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); }
.check small { display: block; color: var(--muted); font-size: 13px; }

/* Suche */
form.searchbar {
  display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 6px 6px 6px 16px;
}
form.searchbar:focus-within { border-color: var(--accent); }
form.searchbar svg { width: 18px; height: 18px; color: var(--muted); }
form.searchbar input[type="search"] { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0; outline: none; }
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.filterbar input[type="search"] { flex: 1 1 200px; padding: 9px 12px; font-size: 14px; }
.more { display: flex; margin: 28px auto 0; }

/* Kacheln mit Cover (Suche, Serien, Neuerscheinungen) */
.grid { display: grid; gap: 22px 16px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card { position: relative; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card img, .card .nocover {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; background: var(--cover);
  border: 1px solid var(--border); transition: transform .15s, box-shadow .15s;
}
a.card:hover { color: var(--text); }
a.card:hover img, a.card:hover .nocover { transform: translateY(-3px); box-shadow: var(--shadow); }
.nocover { display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 8px; }
.info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.title { font-weight: 700; font-size: 14px; line-height: 1.3; }
.card .meta { font-size: 12px; }
.tracked { color: var(--accent); font-size: 12px; font-weight: 700; }
.card-badge { position: absolute; top: 8px; left: 8px; z-index: 1; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--text); }
.card-badge.today { background: var(--accent); color: var(--accent-ink); }
.card-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }

/* Fortschritt */
.progress { height: 5px; background: var(--track); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s; }
.progress.read > div { background: var(--read); }
.progress-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.stat b { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

/* Listen */
.list { display: grid; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border); text-decoration: none; color: inherit;
}
a.list-item:hover { border-color: var(--border-strong); color: var(--text); }
.list-item img, .list-item .nocover { width: 42px; height: 63px; object-fit: cover; border-radius: 7px; flex-shrink: 0; background: var(--cover); font-size: 0; }
.list-item .title { overflow-wrap: anywhere; }
.list-item .when { margin-left: auto; text-align: right; white-space: nowrap; }
.list-item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.list-item.done { opacity: .55; }
.upcoming { color: var(--accent); font-weight: 700; }
.sum { font-variant-numeric: tabular-nums; font-weight: 700; }
.title-link { color: inherit; text-decoration: none; display: block; }
.group { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 14px; }
.group + .group { margin-top: 12px; }
.group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.group-head img, .group-head .nocover { width: 34px; height: 51px; object-fit: cover; border-radius: 6px; flex-shrink: 0; font-size: 0; background: var(--cover); }
.group-head a { color: inherit; text-decoration: none; font-weight: 700; }
.group .list-item { background: var(--raised); border-color: transparent; }

/* Listen-Umschalter (Handy) */
.list-switch { display: none; margin-bottom: 16px; }

/* ---------- Startseite ---------- */
.home-top { display: flex; flex-direction: column; gap: 20px; }
.hero-row { display: flex; flex-wrap: wrap; gap: 16px; }
.continue {
  flex: 2 1 420px; display: flex; gap: 20px; align-items: center; padding: 20px;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px; min-width: 0;
}
.continue .cover-wrap { flex: 0 0 112px; }
.continue .cover-wrap img, .continue .cover-wrap .nocover { width: 112px; height: 168px; object-fit: cover; border-radius: 12px; background: var(--cover); display: grid; }
.continue-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.continue h1 { margin: 0; font-size: 26px; line-height: 1.15; }
.continue .row { margin-top: 4px; }
.hero-stats { flex: 1 1 280px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero-stats .stat { display: flex; flex-direction: column; justify-content: center; }
.week-day { margin-bottom: 18px; }
.week-day h4 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; font-family: 'DM Sans', sans-serif; }
.week-day.today h4 { color: var(--accent); }
.scroller { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.scroller .card { width: 138px; flex-shrink: 0; scroll-snap-align: start; }

/* ---------- Serien-Detail ---------- */
.detail-hero { display: flex; flex-wrap: wrap; gap: 28px; padding: 26px; background: var(--card); border: 1px solid var(--border); border-radius: 22px; }
.hero-cover img, .hero-cover .nocover { width: 200px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 14px; background: var(--cover); display: grid; box-shadow: var(--shadow); }
.hero-body { flex: 999 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.hero-body h2 { margin: 0; font-size: 40px; line-height: 1.05; }
.hero-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 600px; }
.mini-stat { background: var(--bg); border-radius: 12px; padding: 10px 14px; min-width: 0; }
.mini-stat small { display: block; font-size: 12px; color: var(--muted); }
.mini-stat b { font-family: 'Space Grotesk', sans-serif; font-size: 21px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stat .progress { margin-top: 6px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stars { display: inline-flex; gap: 0; }
.stars button { background: none; border: 0; color: var(--track); padding: 3px; font-size: 22px; line-height: 1; }
.stars button:hover:not(:disabled) { filter: none; color: var(--wish); }
.stars button.on { color: var(--wish); }
.note-wrap { position: relative; }
.note-wrap textarea { min-height: 64px; }
.saved-hint { position: absolute; right: 10px; bottom: 8px; color: var(--read); font-size: 12px; opacity: 0; transition: opacity .3s; }
.saved-hint.show { opacity: 1; }
details.facts { border-top: 1px solid var(--border); padding-top: 12px; }
details.facts summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
details.facts[open] summary { margin-bottom: 12px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 14px; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.description { line-height: 1.65; white-space: pre-line; font-size: 14px; color: var(--muted); }

.vol-panel { margin-top: 20px; background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 6px 0 10px; }
.vol-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 20px; }
.vol-toolbar .spacer { min-width: 8px; }
.vol-hint { padding: 0 20px 10px; margin: 0; }
.vol-empty { margin: 8px 20px; }

/* Liste */
.vrow-head, .vrow { display: grid; grid-template-columns: 48px minmax(0, 1fr) 112px 84px 284px 34px; gap: 14px; align-items: center; padding: 8px 20px; }
.vrow-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--border); padding-top: 6px; padding-bottom: 8px; }
.vrow { border-bottom: 1px solid var(--border); }
.vrow:last-child { border-bottom: 0; }
.vrow .vcover img, .vrow .vcover .nocover { width: 40px; height: 60px; object-fit: cover; border-radius: 7px; background: var(--cover); font-size: 0; display: block; }
.vrow .vtitle { font-weight: 700; font-size: 14px; }
.vrow .vsub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow .vdate { font-size: 14px; }
.vrow .vprice { font-size: 14px; font-variant-numeric: tabular-nums; }
.vdate.future { color: var(--accent); font-weight: 600; }
.vdate.cancel { color: var(--danger); }
.toggles { display: flex; gap: 6px; align-items: center; }
.tog {
  padding: 6px 10px; font-size: 12px; font-weight: 700; border-radius: 8px;
  background: transparent; border: 1px solid var(--border-strong); color: var(--muted);
}
.tog:hover:not(:disabled) { filter: none; color: var(--text); border-color: var(--muted); }
.tog svg { width: 15px; height: 15px; }
.tog.own.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tog.read.on { background: var(--read); border-color: var(--read); color: #0F1115; }
.tog.wish.on { background: var(--wish); border-color: var(--wish); color: #0F1115; }
.tog.edit { padding: 6px 8px; }
.tog.edit.off { visibility: hidden; }
.vsec-title { padding: 14px 20px 6px; margin: 0; font-size: 15px; color: var(--muted); font-family: 'DM Sans', sans-serif; font-weight: 700; }

/* Kacheln */
.vtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 16px; padding: 8px 20px 12px; }
.vtile { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vtile .vcover { position: relative; }
.vtile .vcover img, .vtile .vcover .nocover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; background: var(--cover); border: 1px solid var(--border); display: block; }
.vtile.not-owned .vcover img { opacity: .55; filter: grayscale(.6); }
.vnum { position: absolute; left: 8px; bottom: 8px; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 13px; padding: 2px 9px; border-radius: 999px; background: rgba(15, 17, 21, .85); color: #ECEEF2; }
.vflag { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.vflag svg { width: 15px; height: 15px; stroke-width: 3; }
.vflag.wish { background: var(--wish); color: #0F1115; }
.vtile .toggles { gap: 4px; }
.vtile .tog { flex: 1; padding: 7px 0; min-width: 0; }
.cover-edit { position: absolute; top: 8px; left: 8px; width: 30px; height: 30px; padding: 0 !important; border-radius: 999px; background: rgba(15, 17, 21, .85); border-color: transparent; color: #ECEEF2; }
.cover-edit:hover:not(:disabled) { color: #FFFFFF; border-color: var(--accent); }

/* ---------- Kalender ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-head h2 { margin: 0 6px 0 0; min-width: 200px; }
.cal-nav { display: flex; gap: 6px; }
a.nav-btn { text-decoration: none; min-width: 42px; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal-day { min-height: 98px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day.other { opacity: .35; }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day .num { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-day.today .num { color: var(--accent); }
.cal-entry {
  display: block; font-size: 11.5px; line-height: 1.3; padding: 3px 6px; border-radius: 6px; background: var(--accent-soft);
  color: var(--accent-soft-text); text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600;
}
.cal-entry.owned { background: color-mix(in srgb, var(--read) 22%, transparent); color: var(--text); }
.cal-entry.special { background: color-mix(in srgb, var(--wish) 24%, transparent); color: var(--text); }
.cal-entry:hover { color: var(--text); filter: brightness(1.15); }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Statistik ---------- */
.charts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.chart-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 18px; min-width: 0; }
.chart-card h4 { margin: 0 0 2px; font-size: 16px; }
.chart-card .meta { margin-bottom: 14px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: 'DM Sans', sans-serif; }
.chart .gridline { stroke: var(--border); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart .bar { fill: var(--accent); }
.chart .bar.alt { fill: var(--read); }
.chart svg { touch-action: pan-y; }
.chart .bar, .chart .axis, .chart .gridline, .chart .baseline { pointer-events: none; }
.chart .bar.hover { opacity: .75; }
.tooltip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12px; padding: 6px 9px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; box-shadow: var(--shadow); z-index: 2; }
.hbars { display: grid; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 10px; background: var(--track); border-radius: 999px; overflow: hidden; }
.hbar .track > div { height: 100%; background: var(--accent); border-radius: 999px; }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 2ch; text-align: right; }
details.table-view { margin-top: 10px; font-size: 13px; }
details.table-view summary { cursor: pointer; color: var(--muted); }
details.table-view table { border-collapse: collapse; margin-top: 8px; width: 100%; }
details.table-view td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
details.table-view td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Scanner ---------- */
.scanner { position: relative; background: #000; border-radius: 18px; overflow: hidden; aspect-ratio: 4 / 3; max-width: 560px; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; left: 5%; right: 5%; top: 18%; bottom: 18%; border: 2px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.28); }
.scanner-hint { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; color: #FFFFFF; font-size: 13px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.scan-form { max-width: 560px; margin-top: 16px; }
.scan-item .actions .meta { margin-right: 4px; }
.scan-queries { margin-top: 6px; font-size: 12px; }
.scan-queries summary { cursor: pointer; color: var(--muted); }
.scan-queries ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.scan-queries a { color: var(--accent); overflow-wrap: anywhere; }
.scan-item > .nocover { width: 42px; height: 63px; border-radius: 7px; }
.scan-result { margin-top: 16px; max-width: 560px; }
.scan-result .list-item { align-items: flex-start; }
.scan-result .list-item img, .scan-result .list-item .nocover { width: 64px; height: 96px; }

/* ---------- Dialog, Einstellungen, Anmeldung ---------- */
dialog.dialog { border: 1px solid var(--border); border-radius: 18px; background: var(--card); color: var(--text); padding: 22px; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
dialog.dialog:focus { outline: none; }
dialog.dialog { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
html.scroll-locked, html.scroll-locked body { overflow: hidden; overscroll-behavior: none; }
dialog.dialog::backdrop { background: rgba(0,0,0,.55); }
dialog.dialog h3 { margin: 0 0 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.settings { display: grid; gap: 16px; max-width: 820px; }
.setting-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 20px; display: grid; gap: 14px; }
.setting-card h3 { margin: 0; }
.setting-card > button, .setting-card > .segmented { justify-self: start; }
.subhead { margin: 6px 0 0; font-size: 15px; font-family: 'DM Sans', sans-serif; }
.danger-zone summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.danger-zone[open] { display: grid; gap: 10px; }
.auth { max-width: 400px; margin: 8vh auto 0; background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; margin-bottom: 20px; }
.auth h2 { margin: 18px 0 16px; font-size: 26px; }
.auth .notice { margin-bottom: 14px; }
.auth .form-grid { min-width: 0; }
.auth-tabs { display: inline-flex; }
.auth form button[type="submit"] { width: 100%; padding: 12px; }

/* ---------- Sonstiges ---------- */
#to-top { position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px; padding: 0; border-radius: 14px; font-size: 18px; box-shadow: var(--shadow); z-index: 5; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s;
  max-width: calc(100% - 32px); z-index: 20; box-shadow: var(--shadow);
}
#toast.show { opacity: 1; }

/* ---------- Handy & Tablet ---------- */
@media (max-width: 860px) {
  /* Feste Kopfzeile und Tableiste dürfen angesprungene Elemente nicht verdecken */
  html { scroll-padding-top: 80px; scroll-padding-bottom: 100px; }
  .sidebar { display: none; }
  .mobile-top {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 10; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-top .brand { padding: 0; font-size: 19px; }
  .mobile-top-actions { display: flex; gap: 8px; }
  .avatar-btn { font-weight: 700; background: var(--track); border-color: transparent; }
  .avatar-btn.active { background: var(--accent); color: var(--accent-ink); }
  .content { padding: 18px 16px calc(112px + env(safe-area-inset-bottom)); }
  body:not(.signed-in) .content { padding-bottom: 40px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 15;
    height: 64px; padding: 0 6px; border-radius: 22px; background: var(--raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  }
  .tabbar a { position: relative; justify-self: center; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; min-width: 52px; border-radius: 14px; color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 600; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.active { background: var(--accent); color: var(--accent-ink); }
  .tabbar .dot { position: absolute; top: 4px; right: 12px; width: 8px; height: 8px; border-radius: 999px; background: var(--wish); font-size: 0; }
  #to-top { bottom: calc(92px + env(safe-area-inset-bottom)); right: 16px; }
  #toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .list-switch { display: flex; }

  h2 { font-size: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 12px; }
  .card .meta, .card .tracked { font-size: 11px; }
  .scroller .card { width: 112px; }
  .continue { padding: 14px; gap: 14px; }
  .continue .cover-wrap { flex-basis: 76px; }
  .continue .cover-wrap img, .continue .cover-wrap .nocover { width: 76px; height: 114px; }
  .continue h1 { font-size: 19px; }
  .hero-stats .stat { padding: 12px 14px; }
  .hero-stats .stat b { font-size: 22px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .detail-hero { padding: 16px; gap: 16px; border-radius: 18px; }
  .hero-cover img, .hero-cover .nocover { width: 96px; }
  .hero-body h2 { font-size: 24px; }
  .hero-sub { font-size: 13px; }
  .mini-stats { gap: 8px; }
  .mini-stat { padding: 8px 10px; }
  .mini-stat b { font-size: 16px; }
  .vol-panel { border-radius: 18px; }
  .vol-toolbar { padding: 12px 14px; }
  .vol-hint { padding: 0 14px 10px; }
  .vrow-head { display: none; }
  .vrow {
    grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "cover info edit" "cover info price" "cover tog tog";
    gap: 6px 12px; padding: 10px 14px;
  }
  .vrow .vcover { grid-area: cover; align-self: start; }
  .vrow .vinfo { grid-area: info; }
  .vrow .vdate { display: none; }
  .vrow .vprice { grid-area: price; font-size: 13px; color: var(--muted); align-self: start; text-align: right; }
  .vrow .toggles { grid-area: tog; min-width: 0; }
  .vrow .tog { flex: 1 1 0; min-width: 0; padding: 7px 4px; }
  .vrow .vedit { grid-area: edit; justify-self: end; align-self: start; flex: none; width: 34px; padding: 6px 0; }
  .vol-toolbar .chips { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; width: calc(100% + 28px); }
  .vol-toolbar .chips::-webkit-scrollbar { display: none; }
  .vol-toolbar .chips button { flex-shrink: 0; }
  .vol-toolbar .segmented:first-child { max-width: 100%; overflow-x: auto; }
  .detail-hero { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: start; }
  .hero-cover { grid-row: span 2; }
  .hero-body { display: contents; }
  .hero-body > * { grid-column: 1 / -1; }
  .hero-body > .chips, .hero-body > .hero-titlebox { grid-column: 2; }
  .hero-body > .chips { align-self: end; }
  .vrow .vsub.mobile-date { display: block; }
  .vtiles { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px 10px; padding: 8px 14px 12px; }
  .vtile .tog { padding: 8px 0; }
  .vtile .tog span { display: none; }

  .cal-head h2 { min-width: 0; flex: 1 1 auto; }
  .calendar { gap: 3px; }
  .cal-day { min-height: 52px; padding: 4px; border-radius: 9px; }
  .cal-entry { font-size: 0; padding: 0; height: 5px; border-radius: 999px; background: var(--accent); }
  .cal-entry.owned { background: var(--read); }
  .cal-entry.special { background: var(--wish); }
  .cal-more { font-size: 10px; }
  .list-item { flex-wrap: wrap; }
  .list-item .actions { width: 100%; justify-content: flex-start; padding-left: 56px; }
  .auth { margin-top: 4vh; padding: 22px; }
}
@media (min-width: 861px) {
  .vsub.mobile-date { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
