/* ---------- Theme-Variablen (Default = Dark, bläulich) ---------- */
:root {
    --bg-a: #0e1330; --bg-b: #18204a;
    --panel: #181f45; --panel-2: #222a5a;
    --ink: #e9ebf8; --muted: #9aa2c8;
    --line: rgba(255,255,255,.10); --track: rgba(255,255,255,.13);
    --accent: #8b7cf6; --accent2: #f472b6;
    --ok: #34d399; --warn: #fbbf24;
    --card: var(--panel);
    --radius: 18px; --shadow: 0 18px 44px rgba(0,0,0,.45);
    --topbar: rgba(14,19,48,.82);
    --pill-bg: rgba(255,255,255,.09);
    --tint-read: rgba(52,211,153,.12); --tint-read-bd: rgba(52,211,153,.38);
    --tint-reading: rgba(251,191,36,.12); --tint-reading-bd: rgba(251,191,36,.40);
    --flash-bg: rgba(52,211,153,.13); --flash-bd: rgba(52,211,153,.4); --flash-ink: #6ee7b7;
}
html[data-theme="light"] {
    --bg-a: #f5f3ff; --bg-b: #ede9fe;
    --panel: #ffffff; --panel-2: #faf9ff;
    --ink: #1e1b4b; --muted: #6b7280;
    --line: #e5e7eb; --track: #ede9fe;
    --accent: #6d28d9; --accent2: #db2777;
    --ok: #16a34a; --warn: #f59e0b;
    --shadow: 0 18px 44px rgba(30,27,75,.16);
    --topbar: rgba(255,255,255,.85);
    --pill-bg: #f3f0ff;
    --tint-read: #f0fdf4; --tint-read-bd: #bbf7d0;
    --tint-reading: #fff7ed; --tint-reading-bd: #fed7aa;
    --flash-bg: #ecfdf5; --flash-bd: #a7f3d0; --flash-ink: #065f46;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink); -webkit-font-smoothing: antialiased; line-height: 1.5;
    transition: background-color .3s ease, color .3s ease;
}

/* Auth zentriert auf Gradient (themen-unabhängig) */
body.centered {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6 50%, #ec4899);
    padding: 24px; color: #fff;
}
body.centered .card { color: var(--ink); }

/* App-Layout */
body.app { background: linear-gradient(165deg, var(--bg-a), var(--bg-b)); background-attachment: fixed; min-height: 100vh; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 22px; background: var(--topbar); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 19px; text-decoration: none; color: var(--ink); letter-spacing: -.02em; }
.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar nav a { text-decoration: none; color: var(--accent); font-weight: 600; }
.theme-btn {
    background: var(--pill-bg); border: 1px solid var(--line); color: var(--ink);
    width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 17px; line-height: 1;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 26px 18px 40px; }
.wrap > h1 { font-size: 30px; letter-spacing: -.02em; margin-bottom: 16px; }

/* Cards / Panels */
.card {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 28px; text-align: center; max-width: 460px; color: var(--ink);
}
.auth-card { width: 100%; }
.panel {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 22px; margin-bottom: 20px; border: 1px solid var(--line);
}
.panel h2 { font-size: 18px; margin-bottom: 14px; letter-spacing: -.01em; }
.centered-card { margin: 40px auto; }
.logo { font-size: 52px; margin-bottom: 8px; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input[type=text], input[type=password], input[type=number], select {
    padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px;
    font-size: 15px; font-family: inherit; background: var(--panel-2); color: var(--ink);
}
input::placeholder { color: var(--muted); }
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
label { font-size: 14px; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.btn {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff; border: 0; padding: 11px 18px; border-radius: 12px;
    font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.08); } .btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--pill-bg); color: var(--accent); border: 1px solid var(--line); }
.icon-btn {
    background: var(--pill-bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px;
    cursor: pointer; font-size: 14px; color: var(--accent);
}
.icon-btn.danger { color: #f87171; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.mini { width: 110px; } .mini-btn { padding: 9px 12px; font-size: 14px; }
.error { color: #f87171; font-weight: 600; margin-bottom: 10px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
a { color: var(--accent); }
.flash {
    background: var(--flash-bg); border: 1px solid var(--flash-bd); color: var(--flash-ink);
    padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600;
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: center; }
.stat .num { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat .lbl { font-size: 12.5px; color: var(--muted); }

/* Badges */
.badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge-chip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.badge-chip.earned { background: linear-gradient(135deg,#f59e0b,#fbbf24); color: #3b2606; }
.badge-chip.locked { background: var(--pill-bg); color: var(--muted); }
.badge-chip .bi { font-size: 17px; }

/* Add-Book preview */
.preview { display: flex; gap: 14px; padding: 12px; background: var(--panel-2); border-radius: 12px; }
.preview.hidden { display: none; }
.preview img { width: 64px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--track); }
.pv-fields { display: flex; flex-direction: column; gap: 8px; flex: 1; }

/* Book list */
.book-list { display: flex; flex-direction: column; gap: 14px; }
.book-row { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.book-row.status-read { background: var(--tint-read); border-color: var(--tint-read-bd); }
.book-row.status-reading { background: var(--tint-reading); border-color: var(--tint-reading-bd); }
.cover-wrap { flex: 0 0 auto; }
.cover { width: 60px; height: 90px; object-fit: cover; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,.25); }
.cover.ph { display: flex; align-items: center; justify-content: center; font-size: 28px; background: var(--track); }
.book-main { flex: 1; min-width: 0; }
.book-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.pill-to_read { background: #e0e7ff; color: #3730a3; }
.pill-reading { background: #ffedd5; color: #9a3412; }
.pill-read { background: #dcfce7; color: #166534; }
.progress { height: 8px; background: var(--track); border-radius: 999px; margin: 8px 0 4px; overflow: hidden; }
.progress .bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; }
.book-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.inline { display: inline-flex; gap: 6px; align-items: center; }

/* Hero */
.home-wrap { max-width: 1000px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.hero h1 { font-size: 28px; letter-spacing: -.02em; }
.hero .sub { color: var(--muted); margin-top: 4px; font-size: 16px; }
.goal-ring {
    --p: 0; width: 104px; height: 104px; border-radius: 50%; flex: 0 0 auto;
    background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--track) 0);
    display: flex; align-items: center; justify-content: center;
}
.goal-inner { width: 80px; height: 80px; border-radius: 50%; background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--line); }
.goal-inner span { font-weight: 800; font-size: 20px; }
.goal-inner small { font-size: 11px; color: var(--muted); }

/* Board / Wegstrecke */
.board { position: relative; width: 100%; }
.board svg { display: block; width: 100%; height: auto; overflow: visible; }
.lj-figure {
    position: absolute; font-size: 34px; transform: translate(-50%, -86%) scaleX(-1);
    transition: left .9s cubic-bezier(.34,1.2,.64,1), top .9s cubic-bezier(.34,1.2,.64,1);
    filter: drop-shadow(0 6px 6px rgba(0,0,0,.4)); z-index: 6; pointer-events: none;
}
.milestone { position: absolute; transform: translate(-50%, -50%); text-align: center; width: 92px; }
.milestone .ms-cover {
    width: 64px; height: 96px; margin: 0 auto; border-radius: 10px; overflow: hidden;
    box-shadow: 0 8px 18px rgba(0,0,0,.4); border: 3px solid #fff; background: var(--track);
    display: flex; align-items: center; justify-content: center; font-size: 30px;
    transition: transform .18s ease, box-shadow .18s ease;
}
.milestone .ms-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.milestone.done .ms-cover { outline: 3px solid var(--ok); }
.milestone.current .ms-cover { outline: 3px solid var(--warn); animation: pulse 1.6s ease-in-out infinite; }
.milestone.upcoming { opacity: .72; }
/* Platzhalter-Stationen (bis zum Jahresziel) */
.milestone.placeholder .ms-cover {
    background: transparent; border: 3px dashed var(--line); box-shadow: none;
    color: var(--muted); font-size: 30px; font-weight: 700;
}
/* Hover-Zoom (Desktop): Cover groß zeigen */
@media (hover: hover) {
    .milestone:not(.placeholder) { cursor: pointer; }
    .milestone:not(.placeholder):hover { z-index: 9; }
    .milestone:not(.placeholder):hover .ms-cover { transform: scale(1.7); box-shadow: 0 16px 34px rgba(0,0,0,.55); }
}

/* Lightbox */
.lj-lightbox {
    position: fixed; inset: 0; background: rgba(8,10,30,.8); backdrop-filter: blur(5px);
    display: none; align-items: center; justify-content: center; z-index: 60; padding: 24px;
}
.lj-lightbox.open { display: flex; }
.lb-card { background: var(--panel); border-radius: 18px; padding: 22px; max-width: 300px; text-align: center; box-shadow: var(--shadow); }
.lb-card img { width: 190px; max-width: 62vw; border-radius: 10px; box-shadow: 0 14px 34px rgba(0,0,0,.5); }
.lb-ph { font-size: 96px; }
.lb-card h3 { margin: 14px 0 4px; font-size: 18px; }
.lb-card p { color: var(--muted); margin-bottom: 12px; }
.lb-bar { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.lb-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.lb-card small { color: var(--muted); }
.milestone .ms-title { font-size: 11.5px; font-weight: 600; margin-top: 6px; line-height: 1.25; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.milestone .ms-check { position: absolute; top: -8px; right: 14px; background: var(--ok); color: #fff;
    border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 13px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.ms-start, .ms-finish { position: absolute; transform: translate(-50%,-50%); font-size: 30px; z-index: 4; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }

/* Legal-Seiten */
.legal h2 { font-size: 16px; margin: 22px 0 8px; }
.legal h2:first-child { margin-top: 0; }
.legal p, .legal ul { color: var(--ink); margin-bottom: 8px; }
.legal ul { padding-left: 22px; } .legal li { margin-bottom: 6px; }
.legal code { background: var(--pill-bg); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.legal a { word-break: break-word; }

/* Footer */
.site-footer { text-align: center; padding: 30px 18px 50px; color: var(--muted); font-size: 14px; }
.site-footer a { color: var(--accent); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* Confetti */
#confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; display: none; }

@media (max-width: 560px) {
    .stats { grid-template-columns: repeat(2,1fr); }
    .wrap > h1, .hero h1 { font-size: 23px; }
    .milestone { width: 74px; }
    .milestone .ms-cover { width: 52px; height: 78px; }
}
