/* ════════════════════════════════════════════════════════════
   Bucketlist – Designsystem
   Warm, persönlich, leicht romantisch. Fraunces (Display) +
   Inter (UI) + Caveat (sparsamer Handschrift-Akzent).
   ════════════════════════════════════════════════════════════ */

/* ── Design-Tokens ─────────────────────────────────────────── */
:root {
    /* Farben */
    --bg: #fbf3e7;
    --surface: #fffbf5;
    --surface-2: #f5e8d8;
    --border: #ecdbc3;
    --border-strong: #d9bfa0;
    --text: #3b2e27;
    --text-2: #6b5647;
    --text-3: #9c8874;
    --primary: #a8514b;
    --primary-hover: #8e3f3a;
    --primary-soft: rgba(168, 81, 75, 0.12);
    --on-primary: #fbf3e7;
    --accent: #b5732e;
    --accent-soft: rgba(181, 115, 46, 0.14);
    --danger: #a13c2c;
    --danger-hover: #86311f;
    --on-danger: #faf1ec;

    /* Schatten (bewusst zurückhaltend) */
    --shadow-sm: 0 1px 2px rgba(59, 46, 39, 0.07);
    --shadow-md: 0 8px 26px rgba(59, 46, 39, 0.12);

    /* Radien */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;

    /* Typografie */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: 'Fraunces', Georgia, serif;
    --font-hand: 'Caveat', 'Segoe Script', cursive;

    color-scheme: light;
}

html.dark {
    --bg: #241a1d;
    --surface: #2f2226;
    --surface-2: #3a2b2f;
    --border: #4a383c;
    --border-strong: #5e4750;
    --text: #f3e6d8;
    --text-2: #c7ac9b;
    --text-3: #9c8477;
    --primary: #e0a39c;
    --primary-hover: #e8b4ae;
    --primary-soft: rgba(224, 163, 156, 0.16);
    --on-primary: #2a1a18;
    --accent: #e3b57e;
    --accent-soft: rgba(227, 181, 126, 0.16);
    --danger: #d68a78;
    --danger-hover: #de9686;
    --on-danger: #2e1712;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 26px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
}

/* Kategoriefarben – gedämpft, aber deutlich unterscheidbar */
[data-cat="reisen"]    { --cat: #5f86a0; }
[data-cat="abenteuer"] { --cat: #bc7440; }
[data-cat="kulinarik"] { --cat: #8c4a3e; }
[data-cat="kultur"]    { --cat: #7c6a9c; }
[data-cat="sport"]     { --cat: #96742a; }
[data-cat="natur"]     { --cat: #5c7f56; }
[data-cat="sonstiges"] { --cat: #8f8574; }
html.dark [data-cat="reisen"]    { --cat: #8fb4cc; }
html.dark [data-cat="abenteuer"] { --cat: #d9a06e; }
html.dark [data-cat="kulinarik"] { --cat: #c98a7c; }
html.dark [data-cat="kultur"]    { --cat: #a99bc7; }
html.dark [data-cat="sport"]     { --cat: #cdb06a; }
html.dark [data-cat="natur"]     { --cat: #96bb94; }
html.dark [data-cat="sonstiges"] { --cat: #b3a897; }

/* ── Basis ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    width: 100%; max-width: 100%;
    overflow-x: hidden; overflow-x: clip;
    overscroll-behavior-x: none;
    -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}

body {
    margin: 0;
    width: 100%; max-width: 100%; min-width: 0;
    overflow-x: hidden; overflow-x: clip;
    overscroll-behavior-x: none;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

html.modal-open { overflow: hidden; }
body.modal-open {
    position: fixed; left: 0; right: 0;
    width: 100%; overflow: hidden;
    overscroll-behavior: none;
}

h1, h2, h3 { margin: 0; font-family: var(--font-serif); font-weight: 600; line-height: 1.2; }
p { margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }

.wrap { width: 100%; max-width: 1060px; min-width: 0; margin: 0 auto; padding: 0 20px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; min-height: 42px;
    border: 1px solid transparent; border-radius: var(--r-md);
    font-size: 0.9375rem; font-weight: 500; text-decoration: none;
    cursor: pointer; white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 7px 12px; min-height: 36px; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0;
    background: transparent; border: none; border-radius: var(--r-md);
    color: var(--text-2); cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-sm { width: 32px; height: 32px; border-radius: var(--r-sm); }

.badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: var(--primary); color: var(--on-primary);
    font-size: 0.6875rem; font-weight: 600;
}

/* ── Formulare ─────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label {
    font-size: 0.8125rem; font-weight: 600; color: var(--text-2);
}
.label-note { font-weight: 400; color: var(--text-3); }

input[type="text"], input[type="password"], input[type="date"], input[type="number"],
input[type="search"], select, textarea {
    width: 100%; padding: 10px 12px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--r-md);
    font: inherit; font-size: 0.9375rem;
    transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}
textarea { resize: vertical; min-height: 72px; }
select { cursor: pointer; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

#edit-done-wrap { display: flex; flex-direction: column; gap: 16px; }

.check {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 0.9375rem; cursor: pointer; padding: 2px 0;
}
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.check small { display: block; margin-top: 2px; font-size: 0.8125rem; color: var(--text-3); line-height: 1.45; }
.check-block {
    padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--bg);
}

.form-error { font-size: 0.875rem; font-weight: 500; color: var(--danger); margin: 10px 0; }

.disclosure {
    display: inline-flex; align-items: center; gap: 6px;
    align-self: flex-start; padding: 4px 2px;
    background: none; border: none; cursor: pointer;
    font-size: 0.875rem; font-weight: 500; color: var(--text-2);
}
.disclosure:hover { color: var(--text); }
.disclosure svg { transition: transform 0.15s ease; }
.disclosure[aria-expanded="true"] svg { transform: rotate(180deg); }
.optional { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 2px; }

.location-field {
    display: flex; flex-direction: column; gap: 9px;
    padding: 14px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--r-md);
}
.location-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.location-status { font-size: 0.8125rem; color: var(--text-3); }
.location-status[data-kind="selected"] { color: var(--primary); font-weight: 500; }
.location-status[data-kind="error"] { color: var(--danger); font-weight: 500; }
.location-results {
    display: flex; flex-direction: column; gap: 4px;
    padding: 5px; max-height: 220px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
}
.location-results button {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    width: 100%; padding: 9px 10px; text-align: left;
    background: transparent; border: none; border-radius: var(--r-sm); cursor: pointer;
}
.location-results button:hover, .location-results button:focus-visible { background: var(--surface-2); }
.location-results strong { font-size: 0.875rem; font-weight: 600; }
.location-results span { font-size: 0.75rem; color: var(--text-3); }
.location-manual summary {
    width: fit-content; cursor: pointer; color: var(--text-2);
    font-size: 0.8125rem; font-weight: 500;
}
.location-manual[open] summary { margin-bottom: 10px; }

.upload {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-md);
    color: var(--text-2); font-size: 0.875rem; font-weight: 500; cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.upload:hover { border-color: var(--primary); color: var(--text); }
.upload:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Anmeldung ─────────────────────────────────────────────── */
.login-main { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
    width: min(100%, 400px);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
    padding: 36px 32px;
}
.login-title { font-size: 1.75rem; }
.login-sub { margin: 8px 0 24px; font-size: 0.9375rem; color: var(--text-2); }
.login-card .btn { margin-top: 18px; }

/* ── Header ────────────────────────────────────────────────── */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: var(--bg); border-bottom: 1px solid var(--border);
}
.site-header-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-serif); font-size: 1.125rem; font-weight: 600;
    color: var(--text); text-decoration: none;
}
.brand-mark { color: var(--primary); flex-shrink: 0; }
.brand-label-short { display: none; }
.site-header-actions { display: flex; gap: 4px; }
html.dark .ic-sun { display: block; }
html.dark .ic-moon { display: none; }
.ic-sun { display: none; }
.ic-moon { display: block; }

/* ── Seitenkopf ────────────────────────────────────────────── */
.main { padding: 36px 20px 96px; }
.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
}
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.4rem); }
.page-tagline {
    margin-top: 4px; font-family: var(--font-hand); font-size: 1.375rem; font-weight: 600;
    color: var(--text-2); line-height: 1.2;
}
.page-summary { margin-top: 10px; font-size: 0.9375rem; color: var(--text-2); }

/* Fortschritt als dezente Reiseroute statt Business-Balken */
.route { position: relative; height: 22px; max-width: 380px; margin-top: 16px; }
.route-line {
    position: absolute; left: 2px; right: 2px; top: 50%; height: 0;
    border-top: 2px dashed var(--border-strong); transform: translateY(-50%);
}
.route-fill {
    position: absolute; left: 2px; top: 50%; height: 0; width: 0;
    border-top: 2px solid var(--primary); transform: translateY(-50%);
    transition: width 0.5s ease;
}
.route-marker {
    position: absolute; top: 50%; left: 0;
    width: 20px; height: 20px; margin: -10px 0 0 -10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary); color: var(--on-primary); border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: left 0.5s ease;
}
.page-budget { margin-top: 12px; font-size: 0.8125rem; color: var(--text-3); }
.page-head-action { padding-top: 6px; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: 24px; margin-top: 36px; border-bottom: 1px solid var(--border); }
.tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 2px; margin-bottom: -1px;
    background: none; border: none; border-bottom: 2px solid transparent;
    font-size: 0.9375rem; font-weight: 500; color: var(--text-3); cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.tab:hover { color: var(--text-2); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.tab-count {
    padding: 1px 8px; border-radius: 999px;
    background: var(--surface-2); color: var(--text-2);
    font-size: 0.75rem; font-weight: 600;
}

/* ── Toolbar ───────────────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 22px 0; }
.search { position: relative; flex: 1 1 220px; max-width: 340px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { padding-left: 36px; }

.toolbar-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.view-toggle { flex-shrink: 0; }

.segmented {
    display: inline-flex; padding: 3px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
}
.segmented button {
    padding: 6px 13px; border: none; border-radius: calc(var(--r-md) - 4px);
    background: none; font-size: 0.875rem; font-weight: 500; color: var(--text-2); cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.select-wrap select { width: auto; padding: 8px 12px; font-size: 0.875rem; }
.filter-check {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 38px; padding: 7px 10px;
    border: 1px solid var(--border-strong); border-radius: var(--r-md);
    background: var(--surface); color: var(--text-2);
    font-size: 0.8125rem; font-weight: 500; cursor: pointer;
}
.filter-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.active-filter {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 36px; padding: 6px 10px;
    border: 1px solid var(--primary); border-radius: var(--r-md);
    background: var(--primary-soft); color: var(--primary);
    font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
.active-filter:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.toolbar-random { margin-left: auto; }
.filter-toggle { display: none; }

/* ── Karten (Träume) ───────────────────────────────────────── */
.grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.card {
    position: relative; display: flex; flex-direction: column; gap: 10px;
    padding: 18px 20px 16px 22px;
    background: linear-gradient(175deg, var(--surface) 0%, var(--surface) 78%, var(--surface-2) 145%);
    border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card::before {
    content: ""; position: absolute; left: -1px; top: 16px; bottom: 16px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--cat, var(--border-strong));
}

.card-head { display: flex; align-items: center; gap: 8px; }
.card-cat {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.8125rem; font-weight: 500; color: var(--text-2);
}
.cat-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%;
    background: color-mix(in srgb, var(--cat, var(--text-3)) 16%, transparent);
    color: var(--cat, var(--text-3)); transform: rotate(-5deg);
}
.card-head-spacer { flex: 1; }

.heart-btn { color: var(--text-3); }
.heart-btn[aria-pressed="true"] { color: var(--primary); }
.heart-btn[aria-pressed="true"] svg { fill: currentColor; }

.menu-anchor { position: relative; }
.menu {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
    min-width: 190px; padding: 5px;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--r-md); box-shadow: var(--shadow-md);
}
.menu button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border: none; border-radius: var(--r-sm);
    background: none; text-align: left; font-size: 0.875rem; font-weight: 500;
    color: var(--text); cursor: pointer;
}
.menu button:hover { background: var(--surface-2); }
.menu button svg { color: var(--text-3); flex-shrink: 0; }
.menu .menu-danger, .menu .menu-danger svg { color: var(--danger); }

.card-title { font-size: 1.35rem; margin-top: 2px; }
.card-title button {
    all: unset; cursor: pointer; display: block;
    font: inherit; color: inherit; line-height: 1.3;
}
.card-title button:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.card-title button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }

.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 14px; font-size: 0.8125rem; color: var(--text-3); }
.card-meta .meta-overdue { color: var(--accent); font-weight: 500; }
.card-meta .meta-done { color: var(--primary); font-weight: 500; }
.card-meta .meta-heart { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 500; }
.card-meta .meta-someday { font-family: var(--font-hand); font-size: 1.0625rem; color: var(--text-3); }

/* Planungs-Vorschau in der Karte – eine ruhige Zeile statt Tabelle */
.plan-line {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
    font-size: 0.875rem; color: var(--text-2);
}
.plan-line .dot-sep { color: var(--text-3); }
.plan-line .link-btn { white-space: nowrap; }

.link-btn {
    background: none; border: none; padding: 0; cursor: pointer;
    font-size: inherit; font-weight: 500; color: var(--primary);
    text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link-btn:hover { color: var(--primary-hover); }

.research-state {
    display: flex; align-items: center; gap: 9px;
    font-size: 0.875rem; color: var(--text-2);
}
.research-state.is-error { color: var(--danger); }
.research-state .link-btn { color: inherit; }

.spinner {
    width: 15px; height: 15px; flex-shrink: 0;
    border: 2px solid var(--border-strong); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; }
.btn-fulfil {
    background: var(--primary-soft); color: var(--primary); border-color: transparent;
}
.btn-fulfil:hover { background: color-mix(in srgb, var(--primary) 22%, transparent); }

/* ── Interaktive Kartenansicht ─────────────────────────────── */
.map-region { display: flex; flex-direction: column; gap: 10px; }
.map-meta {
    display: flex; align-items: baseline; justify-content: space-between;
    flex-wrap: wrap; gap: 6px 18px;
    color: var(--text-2); font-size: 0.875rem;
}
.map-notices { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.map-invalid { color: var(--danger); font-size: 0.8125rem; }
.map-shell {
    position: relative; height: 620px; overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.map-canvas { width: 100%; height: 100%; }
.map-canvas:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }

.map-state {
    position: absolute; inset: 0; z-index: 8;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 28px; text-align: center;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.map-state h3 { font-size: 1.25rem; }
.map-state p { max-width: 420px; color: var(--text-2); font-size: 0.875rem; }
.map-state .btn { margin-top: 8px; }
.map-state[data-kind="error"] h3,
.map-state[data-kind="error"] p { color: var(--danger); }

.map-marker {
    position: relative; display: grid; place-items: center;
    width: 44px; height: 44px; padding: 0;
    background: transparent; border: none; cursor: pointer;
}
.map-marker:focus-visible {
    outline: 3px solid var(--text); outline-offset: 2px; border-radius: 50%;
}
.map-pin-shape {
    position: relative; display: block; width: 26px; height: 26px;
    background: var(--primary); border: 3px solid var(--surface);
    border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    box-shadow: var(--shadow-sm);
}
.map-pin-shape::after {
    content: ""; position: absolute; left: 50%; top: 50%;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--on-primary); transform: translate(-50%, -50%);
}
.map-pin:hover .map-pin-shape { background: var(--primary-hover); }
.map-pin.is-selected .map-pin-shape {
    outline: 3px solid var(--text); outline-offset: 2px;
}
.map-pin-priority {
    position: absolute; right: 5px; top: 3px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--surface);
}
.map-cluster {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--surface); color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-sm); font-size: 0.8125rem; font-weight: 700;
}
.map-cluster:hover { background: var(--primary-soft); }

.map-preview {
    position: absolute; top: 16px; right: 16px; z-index: 9;
    width: min(300px, calc(100% - 32px)); padding: 20px;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.map-preview-close { position: absolute; top: 6px; right: 6px; }
.map-preview-category {
    padding-right: 34px; color: var(--cat, var(--text-3));
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.map-preview h3 { margin-top: 5px; padding-right: 24px; font-size: 1.3rem; }
.map-preview-location {
    margin-top: 8px; color: var(--text-2); font-size: 0.875rem;
}
.map-preview-facts {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border);
}
.map-preview-facts dt {
    font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--text-3);
}
.map-preview-facts dd { margin: 2px 0 0; font-size: 0.875rem; font-weight: 500; }
.map-preview-priority {
    display: flex; align-items: center; gap: 6px;
    margin-top: 12px; color: var(--primary); font-size: 0.8125rem; font-weight: 600;
}
.map-preview .btn { margin-top: 16px; width: 100%; }

.map-shell .maplibregl-ctrl-group {
    overflow: hidden; background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
}
.map-shell .maplibregl-ctrl-group button {
    width: 44px; height: 44px; background-color: var(--surface);
}
.map-shell .maplibregl-ctrl-group button:hover { background-color: var(--surface-2); }
.map-shell .maplibregl-ctrl-group button + button { border-top-color: var(--border); }
html.dark .map-shell .maplibregl-ctrl-icon { filter: invert(88%) sepia(12%) saturate(300%); }
.map-shell .maplibregl-ctrl-attrib {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    color: var(--text-2);
}
.map-shell .maplibregl-ctrl-attrib a { color: var(--text-2); }
.map-shell .maplibregl-cooperative-gesture-screen {
    background: color-mix(in srgb, var(--text) 76%, transparent);
}

/* ── Erinnerungen (Journal) ────────────────────────────────── */
.memories { display: flex; flex-direction: column; gap: 20px; max-width: 720px; margin: 22px auto 0; }
.memory {
    position: relative; display: flex; flex-direction: column; gap: 10px;
    padding: 22px 24px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}
.memory-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.memory-date {
    font-family: var(--font-hand); font-size: 1.25rem; font-weight: 600;
    color: var(--accent);
}
.memory-title { font-size: 1.45rem; }
.memory-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--text-2); }
.memory-cat .cat-badge { width: 22px; height: 22px; }
.memory-note {
    padding-left: 14px; border-left: 2px solid var(--border-strong);
    font-size: 0.9375rem; color: var(--text-2); font-style: italic;
}

/* Polaroid-Anmutung für Erinnerungsfotos */
.memory-photos { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 6px; padding-top: 2px; }
.photo-thumb {
    position: relative; padding: 8px 8px 22px; border: none; border-radius: 3px;
    cursor: zoom-in; background: var(--surface); box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.photo-thumb:nth-of-type(3n+1) { transform: rotate(-2.5deg); }
.photo-thumb:nth-of-type(3n+2) { transform: rotate(1.5deg); }
.photo-thumb:nth-of-type(3n+3) { transform: rotate(-1deg); }
.photo-thumb:first-of-type::before {
    content: ""; position: absolute; top: -8px; left: 50%; width: 44px; height: 16px;
    margin-left: -22px; background: var(--accent-soft); border: 1px solid var(--accent);
    opacity: 0.55; transform: rotate(-3deg);
}
.photo-thumb img { display: block; width: 108px; height: 108px; object-fit: cover; border-radius: 1px; }
.photo-thumb:hover, .photo-thumb:focus-visible { transform: rotate(0deg) scale(1.03); box-shadow: var(--shadow-md); z-index: 1; }
.photo-thumb-sm img { width: 72px; height: 72px; }
.memory-actions { display: flex; gap: 6px; margin-top: 4px; }

/* ── Leere Zustände / Skeleton ─────────────────────────────── */
.empty {
    grid-column: 1 / -1;
    padding: 56px 24px; text-align: center;
    border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
    color: var(--text-2);
}
.empty h3 { font-size: 1.3rem; color: var(--text); margin-bottom: 8px; }
.empty p { font-size: 0.9375rem; max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 18px; }

.skel-card {
    display: flex; flex-direction: column; gap: 12px;
    padding: 18px 20px; min-height: 180px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.skel { background: var(--surface-2); border-radius: var(--r-sm); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Modals ────────────────────────────────────────────────── */
.modal {
    position: fixed; inset: 0; z-index: 60;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    overflow: hidden; overscroll-behavior: contain;
}
.modal-overlay {
    position: absolute; inset: 0;
    background: rgba(30, 28, 22, 0.82);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.modal-panel {
    position: relative; z-index: 1;
    display: flex; flex-direction: column;
    width: min(100%, 480px); max-height: min(88vh, 88dvh); overflow: hidden;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.modal-panel-sm { width: min(100%, 420px); }
.modal-panel-lg { width: min(100%, 640px); }
.modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 20px 22px 0;
}
.modal-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.35rem; }
.modal-head-icon { color: var(--primary); font-size: 1.1rem; line-height: 1; }
.icon-heart-inline { color: var(--primary); font-size: 0.85em; }
.modal-body {
    display: flex; flex-direction: column; gap: 16px;
    min-height: 0; padding: 16px 22px 22px;
    overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.modal-context { font-size: 0.9375rem; color: var(--text-2); }
.modal-note { font-size: 0.8125rem; color: var(--text-3); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }

.random-title { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 600; line-height: 1.25; }

/* ── Detailansicht ─────────────────────────────────────────── */
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.875rem; color: var(--text-2); }
.detail-meta .detail-cat { display: inline-flex; align-items: center; gap: 6px; }
.detail-meta .detail-cat svg { color: var(--cat, var(--text-3)); }
.detail-meta .detail-mustdo { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 500; }

.detail-section { border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.detail-section > h3 { font-family: var(--font-sans); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.detail-summary { font-size: 0.9375rem; color: var(--text); line-height: 1.6; }

.place-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.place-list li { display: flex; gap: 10px; font-size: 0.9375rem; }
.place-list svg { flex-shrink: 0; margin-top: 3px; color: var(--text-3); }
.place-list .place-country { color: var(--text-3); }
.place-list .place-reason { display: block; font-size: 0.875rem; color: var(--text-2); margin-top: 1px; }

.detail-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; margin: 0; }
.detail-facts dt { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.detail-facts dd { margin: 3px 0 0; font-size: 0.9375rem; font-weight: 500; }
.detail-facts .fact-note { font-weight: 400; font-size: 0.8125rem; color: var(--text-3); margin-top: 2px; }

.detail-tip {
    padding: 12px 14px; background: var(--bg);
    border: 1px solid var(--border); border-left: 3px solid var(--accent);
    border-radius: var(--r-md); font-size: 0.9375rem; color: var(--text-2);
}
.detail-tip strong { color: var(--text); }

.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--border); padding-top: 16px; }

/* ── Lightbox ──────────────────────────────────────────────── */
.lightbox-panel { position: relative; z-index: 1; margin: 0; max-width: 92vw; max-height: 88vh; }
.lightbox-panel img {
    max-width: 92vw; max-height: 88vh;
    border-radius: var(--r-md); box-shadow: var(--shadow-md);
}
.lightbox-close {
    position: absolute; top: -46px; right: 0;
    color: #f0ede4; background: rgba(30, 28, 22, 0.4);
}
.lightbox-close:hover { background: rgba(30, 28, 22, 0.7); color: #fff; }

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    z-index: 80; display: flex; align-items: center; gap: 9px;
    max-width: min(92vw, 480px); padding: 11px 16px;
    background: var(--text); color: var(--bg);
    border-radius: var(--r-md); box-shadow: var(--shadow-md);
    font-size: 0.875rem; font-weight: 500;
}
.toast svg { flex-shrink: 0; }
.toast.is-ok svg { color: #9cc3b0; }
.toast.is-err svg { color: #e2a08e; }
.toast.is-celebrate svg { color: var(--accent); animation: sparkle 0.6s ease; }
@keyframes sparkle {
    0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
    55% { transform: scale(1.25) rotate(6deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 759px) {
    .filter-toggle { display: inline-flex; }
    .toolbar-filters { display: none; flex-basis: 100%; }
    .toolbar-filters.is-open { display: flex; }
    .toolbar-random { margin-left: 0; }
    .search { max-width: none; }
    .map-shell { height: 560px; }
}

@media (max-width: 639px) {
    .main { padding: 28px 16px 80px; }
    .wrap { padding: 0 16px; }
    .login-main { padding: 16px; }
    .login-card { padding: 28px 22px; }
    .login-title { font-size: 1.6rem; }
    .brand-label-full { display: none; }
    .brand-label-short { display: inline; }
    .page-head, .page-head-text { min-width: 0; width: 100%; }
    .page-head-action { width: 100%; padding-top: 0; }
    .page-head-action .btn { width: 100%; }
    .page-tagline, .page-summary, .card, .memory, .modal-body { overflow-wrap: anywhere; }
    .route { width: calc(100% - 10px); }

    .tabs { width: 100%; gap: 8px; margin-top: 28px; }
    .tab {
        flex: 1 1 0; min-width: 0; justify-content: center; gap: 6px;
        padding-inline: 0; font-size: 0.875rem;
    }
    .tab-count { flex-shrink: 0; padding-inline: 6px; }

    .toolbar { align-items: stretch; }
    .search { flex: 1 1 100%; width: 100%; min-width: 0; }
    .view-toggle { flex: 1 1 auto; min-width: 0; }
    .view-toggle button { flex: 1 1 0; }
    .filter-toggle { flex: 0 0 auto; }
    .toolbar-filters.is-open {
        display: grid; grid-template-columns: minmax(0, 1fr);
        width: 100%; padding: 12px;
        background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--r-md);
    }
    .toolbar-filters .segmented {
        display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }
    .toolbar-filters .segmented button { min-width: 0; padding-inline: 6px; }
    .toolbar-filters .select-wrap,
    .toolbar-filters .select-wrap select,
    .toolbar-filters .filter-check,
    .toolbar-filters .active-filter,
    .toolbar-filters .toolbar-random,
    .toolbar-filters #filter-reset { width: 100%; }
    .toolbar-filters .filter-check,
    .toolbar-filters .active-filter { justify-content: flex-start; }

    input[type="text"], input[type="password"], input[type="date"], input[type="number"],
    input[type="search"], select, textarea { font-size: 16px; }
    .field-row { grid-template-columns: 1fr; }
    .btn { min-height: 44px; }
    .icon-btn { width: 44px; height: 44px; }
    .icon-btn-sm { width: 40px; height: 40px; }
    .view-toggle { order: 2; }
    .filter-toggle { order: 3; }
    .toolbar-filters { order: 4; }
    .grid { grid-template-columns: minmax(0, 1fr); }
    .card, .memory, .map-region, .map-shell { min-width: 0; max-width: 100%; }
    .memory { padding: 18px; }
    .memory-photos { gap: 10px; }
    .photo-thumb img { width: 92px; height: 92px; }

    .map-shell { height: clamp(420px, 68dvh, 560px); border-radius: var(--r-md); }
    .map-preview {
        top: auto; right: 0; bottom: 0; left: 0;
        width: 100%; max-height: min(54dvh, 420px); overflow-y: auto;
        padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
        border-right: none; border-bottom: none; border-left: none;
        border-radius: var(--r-lg) var(--r-lg) 0 0;
    }
    .map-state { padding: 22px; }
    .map-meta { align-items: flex-start; }
    .map-notices { flex-direction: column; align-items: flex-start; }

    /* Modals als Bottom Sheet */
    .modal { padding: 0; align-items: flex-end; }
    .modal-overlay {
        background: var(--bg);
        -webkit-backdrop-filter: none; backdrop-filter: none;
    }
    .modal-panel {
        width: 100%; max-width: none; max-height: calc(100dvh - env(safe-area-inset-top));
        border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: none;
    }
    .modal-head { flex: 0 0 auto; padding: 18px 18px 0; }
    .modal-body { padding: 14px 18px max(18px, env(safe-area-inset-bottom)); }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }
    .lightbox { align-items: center; padding: 16px; }
    .lightbox .modal-overlay { background: rgba(20, 16, 15, 0.94); }
    .toast {
        bottom: max(12px, env(safe-area-inset-bottom));
        width: calc(100% - 24px); max-width: none;
    }
}

/* ── Reduzierte Bewegung ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
