:root {
    --pink: #ff2d87;
    --pink-soft: #ff6fae;
    --purple: #8a2be2;
    --bg: #f6f6f8;
    --card: #ffffff;
    --text: #1c1c1e;
    --muted: #8a8a8e;
    --green: #34c759;
    --red: #ff3b30;
    --radius: 18px;
    --shadow: 0 4px 16px rgba(0,0,0,.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app {
    max-width: 560px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 76px;
}

.content { flex: 1; padding: 16px; }

/* Flash */
.flash {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--pink);
    color: #fff;
    padding: 12px 16px;
    font-weight: 600;
    text-align: center;
}

/* Tabbar */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0,0,0,.08);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tab {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--muted);
    font-size: 11px;
    position: relative;
    padding: 4px 0;
}
.tab.active { color: var(--pink); }
.tab-icon { display: block; font-size: 20px; }
.badge {
    position: absolute;
    top: 0;
    left: 56%;
    background: var(--pink);
    color: #fff;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 8px;
    padding: 0 4px;
}

/* Home */
.home-hero {
    background: linear-gradient(135deg, var(--pink), var(--purple));
    border-radius: var(--radius);
    padding: 24px 18px 28px;
    color: #fff;
    text-align: center;
    box-shadow: var(--shadow);
}
.level { font-size: 22px; font-weight: 800; margin: 4px 0 12px; text-shadow: 0 2px 6px rgba(0,0,0,.25); }
.streak-pill {
    display: inline-block;
    background: rgba(255,255,255,.18);
    color: #ffe14d;
    font-weight: 600;
    font-size: 14px;
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.daily-banner {
    background: rgba(255,255,255,.95);
    color: var(--text);
    border-radius: var(--radius);
    padding: 14px;
    margin: 6px 0 18px;
    box-shadow: var(--shadow);
}
.daily-title { font-weight: 700; margin-bottom: 4px; }
.progress-block { text-align: left; margin: 12px 0 20px; }
.progress-row { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.progress-track { height: 14px; background: rgba(255,255,255,.3); border-radius: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: #fff; border-radius: 8px; transition: width .4s ease; }
.apptitle { font-size: 26px; font-weight: 800; margin: 8px 0 18px; text-shadow: 0 2px 6px rgba(0,0,0,.25); }
.big-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.4);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 14px;
}
.info-pill {
    display: inline-block;
    text-decoration: none;
    color: #fff;
    background: rgba(255,255,255,.18);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    margin-bottom: 16px;
}
.reset-button {
    width: 100%;
    background: rgba(0,0,0,.25);
    color: rgba(255,255,255,.9);
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    margin-top: 8px;
}

/* Titles */
.page-title { font-size: 22px; font-weight: 800; margin: 4px 0 16px; }

/* Filters */
.filters { margin-bottom: 16px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; align-items: center; }
.filter-label { font-size: 14px; color: var(--muted); flex: none; }
.chip {
    flex: none;
    text-decoration: none;
    font-size: 14px;
    color: var(--text);
    background: var(--card);
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 999px;
    padding: 6px 12px;
    white-space: nowrap;
}
.chip.active { background: var(--pink); color: #fff; border-color: var(--pink); }
.chip.reset { color: var(--pink); border: none; background: none; }

/* Lists & cards */
.list { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-title { font-weight: 700; font-size: 16px; }
.card-desc { color: var(--muted); font-size: 14px; margin: 6px 0; }
.card-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); align-items: center; }
.points { color: var(--pink); font-weight: 700; }
.adopted { color: var(--green); font-weight: 700; margin-top: 10px; font-size: 14px; }

.fav { background: none; border: none; font-size: 18px; cursor: pointer; padding: 0; }

.inline { display: inline; }
.right { text-align: right; margin-bottom: 10px; }

.card-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.complete-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.media-input { font-size: 12px; max-width: 170px; }

/* Buttons */
.adopt-btn, .complete-btn, .primary-btn {
    background: var(--pink);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.complete-btn { background: var(--green); }
.adopt-btn { margin-top: 10px; }
.ghost-btn {
    background: #eee;
    color: var(--text);
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.ghost-btn.danger { color: var(--red); }
.link-danger { background: none; border: none; color: var(--red); font-size: 15px; cursor: pointer; }

/* Empty */
.empty { text-align: center; color: var(--muted); padding: 40px 16px; font-style: italic; }

/* Stats */
.stat-section { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.stat-head { font-weight: 700; margin-bottom: 8px; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid rgba(0,0,0,.06); }
.stat-row:first-of-type { border-top: none; }
.stat-value { color: var(--pink); font-weight: 600; }
.milestone { display: flex; align-items: center; gap: 12px; padding: 8px 0; opacity: .45; }
.milestone.earned { opacity: 1; }
.m-emoji { font-size: 24px; }
.m-body { display: flex; flex-direction: column; flex: 1; }
.m-title { font-weight: 600; }
.m-sub { font-size: 12px; color: var(--muted); }
.m-check { color: var(--pink); }

/* Editor */
.editor-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.file-label { cursor: pointer; }
.search-form { margin-bottom: 16px; }
.search-input, .task-form input[type=text], .task-form textarea, .task-form select {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    background: var(--card);
}
.media-link { display: inline-block; margin-top: 8px; color: var(--pink); font-size: 14px; }

/* Form */
.task-form { display: flex; flex-direction: column; gap: 14px; background: var(--card); padding: 18px; border-radius: var(--radius); box-shadow: var(--shadow); }
.task-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.task-form label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.task-form input[type=range] { width: 100%; accent-color: var(--pink); }
.form-actions { display: flex; justify-content: space-between; margin-top: 6px; }

/* ===== Mehrbenutzer-Erweiterungen ===== */

/* Topbar */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    background: var(--card); border-bottom: 1px solid rgba(0,0,0,.06);
    position: sticky; top: 0; z-index: 15;
}
.hello { font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.top-actions a { text-decoration: none; font-size: 20px; }
.iconbtn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }

/* Login */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--pink), var(--purple)); padding: 20px;
}
.login-card {
    background: #fff; border-radius: var(--radius); padding: 32px 24px; width: 100%; max-width: 360px;
    box-shadow: 0 12px 40px rgba(0,0,0,.25); text-align: center;
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.login-sub { color: var(--muted); margin: 0 0 20px; }
.login-card input {
    width: 100%; padding: 14px; margin-bottom: 12px; border: 1px solid rgba(0,0,0,.15);
    border-radius: 12px; font-size: 16px;
}
.login-error { background: #ffe5e5; color: var(--red); border-radius: 10px; padding: 10px; margin-bottom: 14px; font-size: 14px; }
.primary-btn.full { width: 100%; }

/* Section headings */
.section-title { margin: 24px 0 12px; font-size: 17px; font-weight: 700; }

/* Status tags */
.status-tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.status-tag.open { background: #fff0d6; color: #b26a00; }
.status-tag.accepted { background: #e3f6e8; color: #1f8f3a; }

/* Assign-from-library inline */
.assign-inline { display: inline-flex; align-items: center; gap: 6px; }
.mini-select { padding: 8px; border-radius: 10px; border: 1px solid rgba(0,0,0,.15); font-size: 13px; }
.primary-btn.small, .complete-btn.small { padding: 8px 12px; font-size: 13px; }

/* Filter bar (Tagebuch) */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.filter-bar select { padding: 8px; border-radius: 10px; border: 1px solid rgba(0,0,0,.15); font-size: 14px; }

/* Form grid */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }

/* User row */
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* Foto/Video-Pflichthinweis im Eingang */
.media-hint { display: block; font-size: 12px; font-weight: 600; color: var(--pink); margin-bottom: 4px; width: 100%; }
.complete-form { flex-direction: column; align-items: flex-start; }

/* ===== Feature-Erweiterungen ===== */

/* Topbar Glocke/News */
.bell { position: relative; }
.bell .dot {
    position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff;
    font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; padding: 0 4px; text-align: center;
}

/* Fälligkeit */
.due { color: #b26a00; font-weight: 600; }
.due.over { color: var(--red); }

/* Medien-Vorschau */
.media-preview { margin-top: 10px; }
.media-preview img, .media-preview video { width: 100%; max-height: 320px; object-fit: cover; border-radius: 12px; display: block; }

/* Reaktionen */
.reactions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.react-btn { background: var(--bg); border: 1px solid rgba(0,0,0,.1); border-radius: 999px; font-size: 16px; padding: 3px 8px; cursor: pointer; }
.react-chip { background: var(--bg); border-radius: 999px; font-size: 12px; padding: 3px 8px; color: var(--muted); }

/* Kommentare */
.comments { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.comment { font-size: 14px; }
.comment-form { display: flex; gap: 6px; margin-top: 8px; }
.comment-input { flex: 1; padding: 8px 10px; border: 1px solid rgba(0,0,0,.15); border-radius: 10px; font-size: 14px; }

/* News */
.news-item { display: flex; gap: 12px; align-items: flex-start; }
.news-item.unseen { border-left: 3px solid var(--pink); }
.news-icon { font-size: 20px; }
.news-body { display: flex; flex-direction: column; }
.news-time { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Belohnungen */
.points-banner { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 16px; text-align: center; }

/* Paar-Vergleich */
.versus { display: flex; gap: 12px; }
.versus-col { flex: 1; text-align: center; padding: 10px; border-radius: 12px; background: var(--bg); }
.versus-col.me { outline: 2px solid var(--pink); }
.versus-name { font-weight: 700; }
.versus-points { font-size: 22px; font-weight: 800; color: var(--pink); margin: 4px 0; }
.versus-sub { font-size: 12px; color: var(--muted); }

/* Push-Box */
.push-box { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-top: 12px; }
.push-status { margin-left: 8px; font-size: 13px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* ===== Dark Mode ===== */
html[data-theme="dark"] {
    --bg: #14101a;
    --card: #211a2b;
    --text: #f3eef8;
    --muted: #a99fb5;
    --shadow: 0 4px 16px rgba(0,0,0,.4);
}
html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] .topbar { background: var(--card); border-bottom-color: rgba(255,255,255,.08); }
html[data-theme="dark"] .tabbar { background: rgba(33,26,43,.96); border-top-color: rgba(255,255,255,.08); }
html[data-theme="dark"] .iconbtn, html[data-theme="dark"] .top-actions a { color: var(--text); }
html[data-theme="dark"] .chip, html[data-theme="dark"] .search-input,
html[data-theme="dark"] .task-form input, html[data-theme="dark"] .task-form textarea,
html[data-theme="dark"] .task-form select, html[data-theme="dark"] .comment-input,
html[data-theme="dark"] .mini-select, html[data-theme="dark"] .filter-bar select {
    background: var(--card); color: var(--text); border-color: rgba(255,255,255,.15);
}
html[data-theme="dark"] .ghost-btn { background: #2e2540; color: var(--text); }
html[data-theme="dark"] .react-btn, html[data-theme="dark"] .react-chip,
html[data-theme="dark"] .versus-col { background: #2e2540; border-color: rgba(255,255,255,.1); }

/* Medien-Aktionen (Speichern/Löschen) */
.media-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* News als anklickbarer Link */
a.news-item { text-decoration: none; color: inherit; }
a.news-item:hover { background: rgba(255,45,135,.05); }

/* Hervorgehobener Tagebuch-Eintrag (Glocken-Sprung) */
.card.focused { outline: 3px solid var(--pink); animation: pulse 1s ease 2; }
@keyframes pulse { 0%,100% { outline-color: var(--pink); } 50% { outline-color: transparent; } }

/* Stimmungen-Editor */
.mood-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mood-edit { display: flex; align-items: center; gap: 8px; flex: 1; }
.mood-emoji { width: 64px; text-align: center; padding: 10px; border: 1px solid rgba(0,0,0,.15); border-radius: 10px; font-size: 18px; }
.mood-label { flex: 1; min-width: 120px; padding: 10px; border: 1px solid rgba(0,0,0,.15); border-radius: 10px; font-size: 15px; }
html[data-theme="dark"] .mood-emoji, html[data-theme="dark"] .mood-label { background: var(--card); color: var(--text); border-color: rgba(255,255,255,.15); }

/* Medien-Lightbox (Vollbild in der App) */
.media-thumb { cursor: pointer; }
.lightbox {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.92);
    display: flex; flex-direction: column;
    padding: calc(env(safe-area-inset-top) + 8px) 12px calc(env(safe-area-inset-bottom) + 8px);
}
.lb-bar { display: flex; justify-content: space-between; gap: 10px; }
.lb-btn {
    background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3);
    border-radius: 12px; padding: 10px 16px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; margin: 10px 0; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; border-radius: 12px; }
.lb-hint { color: rgba(255,255,255,.85); font-size: 13px; text-align: center; }

/* Home: Pillen-Reihe, Bonus-Banner, gemeinsames Ziel */
.pill-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.bonus-banner {
    background: linear-gradient(90deg, #ffd23f, #ff6fae); color: #3a1020;
    border-radius: 14px; padding: 10px 14px; margin: 0 0 14px; font-size: 14px; font-weight: 600;
}
.goal-block { background: rgba(255,255,255,.15); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; text-align: left; }
.goal-reward { font-size: 13px; margin-top: 6px; color: rgba(255,255,255,.95); }
