/* ---------- Farben: hell / dunkel, Akzent je Bereich ---------- */
:root {
  --page: #F3F6F8; --card: #FFFFFF; --line: #DCE3E9; --text: #17202A; --muted: #5A6672; --muted2: #3F4A55; --track: #E3E9EE;
  --water: #D6E5EC; --land: #ECEFF1; --land-line: #FFFFFF; --de: #FFFFFF; --de-line: #DDE4E9; --de-outline: #A3B3BF; --river: #BDD5DF;
  --hint: rgba(255,255,255,.85); --link: #1F6F8B; --on-accent: #FFFFFF; --ghost: #8FA2B0; --shadow: rgba(23,32,42,.18);
  --t0: #D9E7EE; --t1: #E8DCCB; --t2: #D6E4D3; --t3: #E4D6E2; --t4: #DDE0EA; --t5: #EAD9CF;
  --accent: #1F6F8B; --soft: #E1EEF3; --ink: #164F63;
  color-scheme: light;
}
[data-theme="dark"] {
  --page: #0F1519; --card: #18212A; --line: #2A3641; --text: #E6EDF2; --muted: #9AA9B5; --muted2: #B5C2CC; --track: #26323D;
  --water: #0B1820; --land: #1E2932; --land-line: #0C1A22; --de: #2A3743; --de-line: #3A4A57; --de-outline: #5E7485; --river: #1D3A4A;
  --hint: rgba(24,33,42,.88); --link: #7CC4DD; --on-accent: #0F1519; --ghost: #6E8292; --shadow: rgba(0,0,0,.45);
  --t0: #22343D; --t1: #3A3226; --t2: #253427; --t3: #352838; --t4: #2A2E3B; --t5: #3B2B24;
  --accent: #4FA8C7; --soft: #16323C; --ink: #9FD6E8;
  color-scheme: dark;
}
body[data-area="kumpels"] { --accent: #B5501A; --soft: #F6E4D8; --ink: #7A3510; }
[data-theme="dark"] body[data-area="kumpels"] { --accent: #E8854A; --soft: #3A2418; --ink: #F3B48A; }

/* ---------- Grundlayout ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--page); color: var(--text); }
a { color: var(--link); }
.page { max-width: min(1800px, 94vw); margin: 0 auto; padding: 32px 40px 56px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 700px) { .page { padding: 20px 16px 40px; gap: 18px; } }
h1 { margin: 0; font-size: clamp(30px, 5vw, 46px); line-height: 1.05; }
h2 { margin: 0; font-size: 21px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
section.card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.columns { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.columns > .map-card { flex: 3 1 640px; min-width: 0; }
.columns > .trip-list, .columns > .side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.mode { display: inline-flex; align-items: center; gap: 6px; }
.accent-ink { color: var(--ink); }

/* Kopf */
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; text-decoration: none; }
.trip-head { display: flex; flex-direction: column; gap: 10px; }
.trip-head p { margin: 0; font-size: 17px; }
.badge { align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: var(--soft); color: var(--ink); font-size: 13px; font-weight: 600; }

/* Knöpfe */
button { font: inherit; color: inherit; }
.round { width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.icon-btn { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.segmented { display: flex; gap: 4px; padding: 4px; background: var(--track); border-radius: 999px; }
.segmented button { min-height: 44px; padding: 0 22px; border: 0; border-radius: 999px; background: transparent; color: var(--muted2); font-weight: 600; font-size: 15px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Kennzahlen */
.stats { display: flex; flex-wrap: wrap; gap: 16px; }
.stat, .fact { flex: 1 1 190px; padding: 18px 22px; display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 34px; color: var(--accent); }
.stat span { font-size: 14px; color: var(--muted); }
.fact .label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fact b { font-size: 22px; }

/* Reiseliste */
.trip-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.trip { display: flex; align-items: center; gap: 16px; padding: 16px; text-decoration: none; color: var(--text); }
.trip:hover, .trip.hl { border-color: var(--accent); }
.trip > svg { color: var(--muted); flex: none; }
.date { width: 62px; flex: none; padding: 10px 0; border-radius: 12px; background: var(--soft); color: var(--ink); text-align: center; font-size: 13px; font-weight: 600; text-transform: uppercase; }
.date b { display: block; font-size: 19px; }
.trip .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.trip .body strong { font-size: 17px; }
.trip .km { flex: none; text-align: right; font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.people-row { display: flex; align-items: center; gap: 12px; }
.avatars { display: flex; }
.avatar { width: 28px; height: 28px; margin-right: -6px; border-radius: 50%; border: 2px solid var(--card); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 520px) { .trip .km { display: none; } }

/* Legende */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 26px; height: 0; border-top: 3px solid var(--accent); }
.lg.zug { border-top: 5px solid var(--accent); position: relative; }
.lg.zug::after { content: ""; position: absolute; left: 0; right: 0; top: -3px; border-top: 1.5px dashed var(--card); }
.lg.flug { border-top: 3px dotted var(--accent); }

/* ---------- Karte ---------- */
/* Große Bildschirme: Höhe am Fenster ausrichten statt festem Seitenverhältnis */
.map-host.wide .map,
.map-host.square .map { aspect-ratio: auto; height: clamp(420px, 72vh, 900px); }
/* Editor-Vorschau in der schmalen Seitenleiste bleibt quadratisch */
.ed-map .map-host.square .map { height: auto; aspect-ratio: 1 / 1; }
/* Handy: quadratisch wie bisher */
@media (max-width: 700px) {
  .map-host.wide .map,
  .map-host.square .map { height: auto; aspect-ratio: 1 / 1; }
}
.map { position: relative; background: var(--water); border-radius: 12px; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.map.dragging { cursor: grabbing; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-svg path { vector-effect: non-scaling-stroke; }
.land { fill: var(--land); stroke: var(--land-line); stroke-width: 1.2; stroke-linejoin: round; }
.state { fill: var(--de); stroke: var(--de-line); stroke-width: 1; stroke-linejoin: round; }
.de-outline { fill: none; stroke: var(--de-outline); stroke-width: 1.4; stroke-linejoin: round; }
.lake { fill: var(--water); }
.river { fill: none; stroke: var(--river); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }

.route { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; transition: stroke-width .15s; }
.route.auto { stroke-width: 3; }
.route.zug { stroke-width: 4.5; stroke-linecap: butt; }
.route.ties { stroke: var(--card); stroke-width: 1.8; stroke-dasharray: 4 4; stroke-linecap: butt; }
.route.flug { stroke-width: 3.5; stroke-dasharray: .5 7; }
.route.hover.auto, .route.sel.auto { stroke-width: 5; }
.route.hover.zug, .route.sel.zug { stroke-width: 6.5; }
.route.hover.flug, .route.sel.flug { stroke-width: 5; }
.route.ghost { stroke: var(--ghost); opacity: .7; }
.route.ghost.zug { stroke-width: 3; }
.route.ghost.ties { stroke: var(--card); }
.route.progress.auto { stroke-width: 5; }
.route.progress.zug { stroke-width: 6; }
.route.progress.ties { stroke-width: 2.2; stroke-dasharray: 5 5; }
.route.progress.flug { stroke-width: 4.5; stroke-dasharray: .5 9; }
.hit { fill: none; stroke: transparent; stroke-width: 18; cursor: pointer; pointer-events: stroke; }

.overlay { position: absolute; inset: 0; pointer-events: none; }
.ov { position: absolute; }
.marker { display: flex; align-items: center; gap: 2px; transform: translate(-16px, -16px); }
.marker.flip { flex-direction: row-reverse; transform: translate(calc(-100% + 16px), -16px); }
.marker .label { font-size: 12px; font-weight: 600; background: var(--card); color: var(--text); padding: 2px 6px; border-radius: 6px; white-space: nowrap; box-shadow: 0 1px 3px var(--shadow); }
.marker .dot { pointer-events: auto; width: 32px; height: 32px; padding: 0; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.marker .dot::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-sizing: border-box; box-shadow: 0 0 0 1px var(--shadow); transition: transform .15s; }
.marker.sel .dot::before { transform: scale(1.35); }
.home-marker { transform: translate(-7px, -7px); gap: 6px; }
.home-marker.flip { transform: translate(calc(-100% + 7px), -7px); }
.home { width: 14px; height: 14px; border-radius: 3px; background: var(--text); border: 2px solid var(--card); }
.stop-marker { transform: translate(-7px, -7px); gap: 6px; }
.stop-marker.flip { transform: translate(calc(-100% + 7px), -7px); }
.stop { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--ghost); background: var(--card); box-sizing: border-box; }
.stop-marker.reached .stop { border-color: var(--accent); background: var(--accent); }
.vehicle-anchor { transform: translate(-50%, -50%); }
.vehicle { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--on-accent); border: 3px solid #fff; box-shadow: 0 2px 8px var(--shadow); display: flex; align-items: center; justify-content: center; }

.popup-anchor { z-index: 3; transform: translate(-50%, calc(-100% - 24px)); }
.popup-anchor.below { transform: translate(-50%, 24px); }
.popup-anchor.to-right { transform: translate(-20px, calc(-100% - 24px)); }
.popup-anchor.to-right.below { transform: translate(-20px, 24px); }
.popup-anchor.to-left { transform: translate(calc(-100% + 20px), calc(-100% - 24px)); }
.popup-anchor.to-left.below { transform: translate(calc(-100% + 20px), 24px); }
.popup { pointer-events: auto; width: 250px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 6px 20px var(--shadow); cursor: default; }
.popup-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.popup .close { margin: -6px -8px 0 0; flex: none; }
.popup .btn { align-self: flex-start; min-height: 40px; font-size: 14px; margin-top: 4px; }

.map-controls { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 4; }
.map-controls button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--card); color: var(--text); box-shadow: 0 1px 4px var(--shadow); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.map-hint { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: var(--muted2); background: var(--hint); padding: 3px 8px; border-radius: 6px; pointer-events: none; }
@media (max-width: 700px) { .map-hint { display: none; } }

/* Detail: Kilometerzähler, Personen, Stationen */
.map-wrap { position: relative; }
.odometer { position: absolute; left: 14px; bottom: 14px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 170px; box-shadow: 0 2px 8px var(--shadow); pointer-events: none; }
.odometer b { font-size: 28px; color: var(--ink); }
.bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--accent); }
.people { display: flex; flex-wrap: wrap; gap: 20px; }
.person { width: 72px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; text-align: center; }
.pic { width: 56px; height: 56px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; }
.stops { list-style: none; margin: 0; padding: 0; }
.stops li { display: flex; gap: 14px; position: relative; padding-bottom: 16px; }
.stops li > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.dotline { width: 16px; flex: none; position: relative; }
.dotline::before { content: ""; position: absolute; top: 2px; left: 0; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--ghost); background: var(--card); box-sizing: border-box; }
.dotline::after { content: ""; position: absolute; top: 20px; bottom: -18px; left: 7px; width: 2px; background: var(--line); }
.stops li:last-child .dotline::after { display: none; }
.stops li.reached .dotline::before { border-color: var(--accent); background: var(--accent); }
.stops li.reached .dotline::after { background: var(--accent); }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo { aspect-ratio: 4 / 3; border: 0; border-radius: 12px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; color: var(--text); font-size: 13px; font-weight: 600; text-align: left; background-size: cover; background-position: center; }
.photo[style] span { background: var(--card); padding: 2px 6px; border-radius: 6px; }
.tint0 { background-color: var(--t0); } .tint1 { background-color: var(--t1); } .tint2 { background-color: var(--t2); }
.tint3 { background-color: var(--t3); } .tint4 { background-color: var(--t4); } .tint5 { background-color: var(--t5); }
#lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(5, 8, 12, .88); display: flex; align-items: center; justify-content: center; padding: 24px; }
#lightbox[hidden] { display: none; }
.lb-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 100%; }
.lb-inner img { max-width: 100%; max-height: 78vh; border-radius: 10px; }
.lb-inner .ph { width: min(720px, 88vw); aspect-ratio: 4 / 3; border-radius: 10px; color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-weight: 600; }
.lb-bar { display: flex; align-items: center; gap: 12px; color: #fff; }

.map.no-hint .map-hint { display: none; }
@media (max-width: 700px) {
  .odometer { position: static; margin-top: 12px; box-shadow: none; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stops strong { overflow-wrap: anywhere; }
.stop-date { color: var(--ink); font-weight: 600; }
.stop-seg { display: flex; align-items: flex-start; gap: 6px; }
.stop-seg svg { flex: none; margin-top: 1px; opacity: .8; }
.ov.nolabel .label { display: none; }

/* ---------- Anmeldung, Fotos, Zugänge ---------- */
.whoami { white-space: nowrap; }
@media (max-width: 520px) { .whoami { display: none; } }
a.round { text-decoration: none; }
.field { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--page); color: var(--text); font: inherit; font-size: 15px; min-width: 0; }
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
select.field { padding-right: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; flex: 1 1 320px; }
.upload-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.upload-row .field[type="text"], .upload-row .field[name="name"], .upload-row .field[type="password"] { flex: 1 1 220px; }
.upload-btn { cursor: pointer; }
.photo-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.photo-item .photo { width: 100%; }
.photo-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; min-height: 32px; }
.photo-meta .small { overflow-wrap: anywhere; padding-top: 6px; }
.photo-meta .del { flex: none; }
.photo-meta .del:hover { color: #C0392B; }
.login { max-width: 520px; margin: 12vh auto 0; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login p { margin: 0; line-height: 1.5; }
.login summary { cursor: pointer; color: var(--muted); min-height: 32px; }
.login details form { margin-top: 10px; }
.trip-head p { line-height: 1.5; max-width: 760px; }
.link-box { margin-top: 6px; padding: 14px; border-radius: 12px; background: var(--soft); display: flex; flex-direction: column; gap: 10px; }
.link-box p { margin: 0; }
.users { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.users li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.users li:first-child { border-top: 0; }
.users li > span:first-child { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.users li.inactive strong { text-decoration: line-through; color: var(--muted); }
.users .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text); cursor: pointer; font-size: 14px; }
.chip.danger { color: #B3261E; }
[data-theme="dark"] .chip.danger { color: #FF8A80; }
.badge.role-familie { background: #E1EEF3; color: #164F63; }
.badge.role-kumpels { background: #F6E4D8; color: #7A3510; }
.badge.role-admin { background: var(--track); color: var(--text); }
.badge.readonly-badge { background: transparent; border: 1px solid var(--line); color: var(--muted); }
/* Zugang „nur anschauen“: alles ausblenden, was etwas ändert (der Server lehnt es ohnehin ab) */
body.readonly section[aria-label="Fotos"] > .upload-row,
body.readonly #diary-new, body.readonly .diary-entry footer .linklike,
body.readonly #wishes .ed-add, body.readonly .comment-form,
body.readonly .photo-meta .del { display: none; }
body.readonly .react { pointer-events: none; }
[data-theme="dark"] .badge.role-familie { background: #16323C; color: #9FD6E8; }
[data-theme="dark"] .badge.role-kumpels { background: #3A2418; color: #F3B48A; }

/* ---------- Reise-Editor ---------- */
.editor { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.ed-form { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.ed-map { flex: 1 1 380px; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
@media (max-width: 960px) { .ed-map { position: static; order: -1; } }
.lbl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ed-row .lbl { flex: 1 1 160px; }
.lbl .field { font-weight: 400; }
.ed-row { display: flex; flex-wrap: wrap; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.pick-chip .avatar { margin: 0; width: 24px; height: 24px; border: 0; font-size: 11px; }
.pick-chip:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.ed-add summary { cursor: pointer; color: var(--muted); min-height: 32px; margin-top: 8px; }
.swatches { display: inline-flex; gap: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; display: inline-flex; border: 2px solid transparent; }
.swatch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--card); }
.ed-cost { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ed-cost > .field { flex: 1 1 auto; }
.ed-cost-cat { flex: 1 1 auto; flex-direction: column; gap: 0; color: var(--text); font-size: 15px; }
.m-rest { background: var(--ghost); }
.euro { display: inline-flex; align-items: center; gap: 6px; }
.euro .field { width: 110px; text-align: right; }
.euro .field.km { width: 90px; }
.ed-leg { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ed-leg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ed-leg-tools { margin-left: auto; display: inline-flex; }
.small-seg button { min-height: 36px; padding: 0 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.ed-stops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-stops li { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 170px) auto; gap: 6px; align-items: center; padding: 4px; border-radius: 10px; }
.ed-stops li.active { background: var(--soft); }
.ed-role { color: var(--muted); font-weight: 600; }
.ed-tools { display: inline-flex; }
.icon-btn.on { color: var(--accent); background: var(--soft); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.field.coord { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.field.missing { border-color: #C77700; }
.ed-dates { grid-column: 2 / -1; display: grid; grid-template-columns: auto minmax(0, 160px) auto minmax(0, 160px); justify-content: start; align-items: center; gap: 6px 8px; color: var(--muted); }
.ed-dates label { display: contents; }
.ed-dates .field.date { min-height: 36px; padding: 0 8px; font-size: 14px; width: 100%; box-sizing: border-box; }
@media (max-width: 640px) { .ed-dates { grid-template-columns: auto minmax(0, 1fr); } }
.ed-results { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 4px; }
.ed-results:empty { display: none; }
.ed-hit { text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); padding: 8px 10px; cursor: pointer; font-size: 13px; }
.ed-hit:hover { border-color: var(--accent); }
@media (max-width: 640px) {
  .ed-stops li { grid-template-columns: 40px minmax(0, 1fr); }
  .ed-stops li .coord { grid-column: 2; }
  .ed-stops li .ed-tools { grid-column: 2; flex-wrap: wrap; }
}
.ed-bar { position: sticky; bottom: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; box-shadow: 0 4px 16px var(--shadow); z-index: 5; }
.ed-bar .danger { margin-left: auto; }
.map.picking { cursor: crosshair; }
.waypoint { display: block; width: 8px; height: 8px; margin: 3px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card); }
.stop-marker.active .stop { transform: scale(1.4); box-shadow: 0 0 0 4px var(--soft); }

/* ---------- Geplante Reisen, Titelbilder, Wunschliste ---------- */
h3.sub { margin: 6px 0 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.trip.planned { border-style: dashed; }
.countdown { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--ink); font-size: 13px; }
.stat.next { text-decoration: none; color: inherit; border-style: dashed; }
.stat.next b { font-size: 26px; }
.date { position: relative; overflow: hidden; }
.date.has-cover { height: 62px; padding: 0; background-size: cover; background-position: center; display: flex; align-items: flex-end; justify-content: center; }
.date.has-cover > span { margin-bottom: 4px; padding: 1px 6px; border-radius: 6px; background: var(--card); color: var(--ink); font-size: 10px; line-height: 1.2; }
.date.has-cover b { display: inline; font-size: 10px; margin-left: 3px; }
.route.planned { opacity: .5; stroke-dasharray: 2 7; }
.route.planned.ties { display: none; }
.marker.planned .dot::before { background: var(--card); border-color: var(--accent); border-style: dashed; }
.lg.planned { border-top: 3px dashed var(--accent); opacity: .6; }
.wish-dot { pointer-events: auto; width: 30px; height: 30px; border: 0; padding: 0; border-radius: 50%; background: #F2B33D; color: #3B2A06; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 1px 4px var(--shadow); }
.wish-dot svg { fill: currentColor; }
.wish-dot.temp { outline: 3px dashed #F2B33D; outline-offset: 3px; }
.wish-marker { transform: translate(-15px, -15px); gap: 4px; }
.wish-marker.flip { transform: translate(calc(-100% + 15px), -15px); }
.wish-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.wish-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.wish-list li:first-child { border-top: 0; }
.wish-list li .icon-btn { margin-left: auto; }
.wish-form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linklike.danger { color: #B3261E; }
[data-theme="dark"] .linklike.danger { color: #FF8A80; }
.popup-cover { width: calc(100% + 32px); margin: -14px -16px 4px; height: 110px; object-fit: cover; border-radius: 14px 14px 0 0; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.planned-badge { border: 1px dashed var(--accent); background: transparent; }

/* ---------- Fotos auf der Karte ---------- */
.photo-anchor { transform: translate(-50%, -50%); z-index: 2; transition: transform .35s cubic-bezier(.2, 1.4, .4, 1), opacity .3s; }
.photo-anchor.pending { opacity: 0; transform: translate(-50%, -50%) scale(.3); pointer-events: none; }
.photo-anchor.pop { transform: translate(-50%, -50%) scale(2.6); z-index: 6; }
.photo-pin { pointer-events: auto; display: block; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 3px solid #fff; background-color: var(--card); background-size: cover; background-position: center; box-shadow: 0 2px 6px var(--shadow); cursor: pointer; }
.photo-tools { display: inline-flex; flex: none; }
.photo { position: relative; }
.cover-tag { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: var(--card); color: var(--ink); font-size: 11px; font-weight: 600; }
.geo-tag { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--card); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.photo-meta .social { display: block; margin-top: 2px; }
.photo-head-tools { display: inline-flex; align-items: center; gap: 10px; }
.photo-head-tools .chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.photo-head-tools .chip[hidden] { display: none; }

/* ---------- Großansicht mit Reaktionen und Kommentaren ---------- */
.lb-inner { flex-direction: row; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 18px; max-height: 100%; overflow-y: auto; }
.lb-img { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; flex: 1 1 480px; max-width: 1200px; }
.lb-side { flex: 0 1 320px; padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: 78vh; overflow-y: auto; color: var(--text); }
.reactions { display: flex; flex-wrap: wrap; gap: 6px; }
.react { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); cursor: pointer; font-size: 17px; display: inline-flex; align-items: center; gap: 4px; }
.react span { font-size: 13px; color: var(--muted); }
.react.on { border-color: var(--accent); background: var(--soft); }
.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.comments li { display: flex; justify-content: space-between; gap: 8px; line-height: 1.4; overflow-wrap: anywhere; }
.comment-form { display: flex; gap: 8px; }
.comment-form .field { flex: 1; min-width: 0; }
@media (max-width: 700px) { #lightbox { align-items: flex-start; padding: 12px; } .lb-side { flex: 1 1 100%; max-height: none; } }

/* ---------- Tagebuch ---------- */
.diary-day { display: flex; flex-direction: column; gap: 10px; }
.diary-day + .diary-day { margin-top: 6px; }
.diary-entry { border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; }
.diary-entry p { margin: 0 0 4px; white-space: pre-wrap; line-height: 1.55; }
.diary-edit { display: flex; flex-direction: column; gap: 8px; }
textarea.field { padding: 10px 14px; min-height: 80px; resize: vertical; line-height: 1.5; }
#diary-new { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
#diary-new select, .diary-edit select { align-self: flex-start; }

/* ---------- Statistik und Jahresrückblick ---------- */
.grow { flex: 1 1 340px; min-width: 0; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bars li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 12px; align-items: center; }
.bars .bl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.bars .bt { height: 14px; display: flex; border-radius: 4px; background: var(--track); overflow: hidden; }
.bars .bv { grid-column: 2; font-size: 13px; color: var(--muted); }
.hbar { display: block; height: 100%; }
.m-auto { background: var(--accent); }
.m-zug { background: var(--ink); }
.m-flug { background: #F2B33D; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv li:first-child { border-top: 0; }
.kv li > span:first-child { color: var(--muted); font-size: 14px; flex: none; }
.kv li > :last-child { text-align: right; text-decoration: none; }
.year-head { display: flex; flex-direction: column; gap: 6px; }
.year-head h1 { font-size: clamp(34px, 6vw, 58px); }
.year-nav { display: flex; gap: 16px; font-weight: 600; }
.year-nav a { text-decoration: none; }
.year-trips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.year-trips li { display: flex; gap: 14px; align-items: center; }
.year-trips img, .year-ico { width: 64px; height: 64px; flex: none; border-radius: 12px; object-fit: cover; }
.year-ico { background: var(--soft); color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 2px; }
.best { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.best figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.best img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }

@media print {
  :root, [data-theme="dark"] { --page: #fff; --card: #fff; --text: #111; --muted: #444; --line: #ccc; color-scheme: light; }
  .no-print, .map-controls, .map-hint, .theme-toggle, .segmented, .back, #lightbox { display: none !important; }
  .page { padding: 0; max-width: none; }
  .card { break-inside: avoid; box-shadow: none !important; }
  .map-host .map { height: auto !important; aspect-ratio: 16 / 9 !important; }
}
a.chip { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
