/* Wayly web view – Forest design tokens, light + dark. */
:root {
  --forest: #1F6F5C;
  --lime: #C6F36B;
  --sky: #5AA9E6;
  --ink: #142420;
  --cream: #F7F3EA;
  --midnight: #0F1A2A;

  --bg: var(--cream);
  --surface: #FFFFFF;
  --surface-2: #EFEADF;
  --text: var(--ink);
  --muted: #4F5E59;
  --line: rgba(20, 36, 32, 0.12);
  --accent-text: var(--forest);
  --late: #A63D17;
  --early: #1F5F8F;
  --ok: #1F6F5C;
  --shadow: 0 1px 2px rgba(20, 36, 32, 0.06), 0 8px 24px rgba(20, 36, 32, 0.08);

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 28px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Nunito", "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--midnight);
    --surface: #172438;
    --surface-2: #1E2E46;
    --text: #EEF2EC;
    --muted: #AEBCB7;
    --line: rgba(238, 242, 236, 0.12);
    --accent-text: #8FD9B6;
    --late: #FFA27F;
    --early: #8CC8F2;
    --ok: #8FD9B6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); }
h1, h2, h3, h4 { font-family: var(--font-rounded); line-height: 1.2; margin: 0; }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.small { font-size: 0.85rem; color: var(--muted); }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 1000;
  background: var(--forest); color: #fff; padding: 12px 16px; border-radius: var(--r-sm);
}
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* Hero */
.hero {
  padding: calc(24px + env(safe-area-inset-top)) 0 28px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(198, 243, 107, 0.35), transparent 60%),
    radial-gradient(90% 80% at 0% 100%, rgba(90, 169, 230, 0.18), transparent 60%);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-rounded); font-weight: 700;
  color: var(--accent-text); font-size: 1.05rem; }
.brand-mark { width: 24px; height: 24px; color: var(--forest); }
@media (prefers-color-scheme: dark) { .brand-mark { color: var(--accent-text); } }
.hero-icon { display: block; width: 52px; height: 52px; margin: 20px 0 8px; color: var(--accent-text); }
.icon { width: 1.1em; height: 1.1em; vertical-align: -0.2em; flex: none; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); font-weight: 800; letter-spacing: -0.01em; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0 0; color: var(--muted);
  font-weight: 500; }
.hero-desc { margin: 12px 0 0; font-size: 1.05rem; max-width: 60ch; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
  font-family: var(--font-rounded); background: var(--surface-2); color: var(--text); }
.chip-ongoing { background: var(--lime); color: var(--ink); }
.chip-upcoming { background: var(--forest); color: #fff; }

.people { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 0; margin: 20px 0 0; }
.person { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--avatar, var(--forest)); color: #fff; font: 700 0.95rem/1 var(--font-rounded);
  box-shadow: 0 0 0 3px var(--bg);
}
.person-text { display: flex; flex-direction: column; line-height: 1.2; }
.person-text small { color: var(--muted); font-size: 0.8rem; }

/* „Jetzt" on a trip under way: where the group checked in last */
.now {
  display: flex; align-items: flex-start; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 20px; box-shadow: var(--shadow); margin-top: 4px; margin-bottom: 14px;
}
.now-dot {
  flex: none; width: 12px; height: 12px; margin-top: 6px; border-radius: 50%; background: var(--lime);
  box-shadow: 0 0 0 4px rgba(198, 243, 107, 0.35);
}
.now-title { margin: 0; font: 600 1.02rem/1.4 var(--font-rounded); }
.now-since { color: var(--muted); font-weight: 500; }
.now-next { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }

/* Open-in-app banner */
.open-app {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px;
  box-shadow: var(--shadow); margin-top: 4px;
}
.open-title { margin: 0; font: 700 1.05rem/1.3 var(--font-rounded); }
.open-hint { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; max-width: 46ch; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px;
  border-radius: 999px; background: var(--forest); color: #fff; text-decoration: none;
  font: 700 1rem/1 var(--font-rounded); white-space: nowrap; box-shadow: 0 6px 16px rgba(31, 111, 92, 0.28);
}
.button:hover { filter: brightness(1.08); }
.button:active { transform: translateY(1px); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 12px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-value { font: 800 1.45rem/1.15 var(--font-rounded); color: var(--accent-text); white-space: nowrap; }
.stat-value small { font-size: 0.8rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.flags { letter-spacing: 0.5px; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Map */
.map-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow); }
#map { height: min(56vh, 440px); min-height: 280px; background: var(--surface-2); }
.leaflet-container { font: 14px/1.4 var(--font); }
.leaflet-tile-pane { filter: saturate(0.55) contrast(0.95); }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: saturate(0.35) brightness(0.72) contrast(1.05); }
  .leaflet-control-attribution { background: rgba(23, 36, 56, 0.85) !important; color: var(--muted); }
  .leaflet-control-attribution a { color: var(--accent-text); }
  .leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--line); }
  .leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
}
.leaflet-bar a { width: 44px !important; height: 44px !important; line-height: 44px !important; }
.pin-icon span {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--forest); color: #fff; font: 800 0.9rem/1 var(--font-rounded);
  border: 3px solid #fff; box-shadow: 0 3px 10px rgba(20, 36, 32, 0.35);
}
.pin-icon.is-open span { background: #fff; color: var(--forest); border-color: var(--forest); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 12px 16px;
  font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--line); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 26px; height: 0; border-top: 4px solid var(--sky); border-radius: 2px; }
.swatch-flight { border-top: 3px dashed var(--sky); }
.swatch-train { border-top: 4px dotted var(--sky); }
.swatch-bus { border-top: 4px dotted #D98A2B; }
.swatch-walk { border-top: 3px dotted var(--forest); }
@media (prefers-color-scheme: dark) { .swatch-walk { border-top-color: var(--accent-text); } }
.swatch-pin { width: 20px; height: 20px; border: 2px solid #fff; border-radius: 50%; background: var(--forest);
  color: #fff; font: 800 0.65rem/16px var(--font-rounded); text-align: center; }

/* Timeline */
.timeline { margin: 32px 0 24px; }
.timeline h2 { font-size: 1.5rem; font-weight: 800; }
.tz-hint { margin: 4px 0 18px; color: var(--muted); font-size: 0.9rem; }
.day { margin: 0 0 22px; }
.day-head { margin-bottom: 10px; }
.day-head h3 { font-size: 1.1rem; font-weight: 700; }
.day-number { display: inline-block; margin-right: 6px; padding: 2px 9px; border-radius: 999px; background: var(--lime);
  color: var(--ink); font-size: 0.8rem; vertical-align: 2px; }
.day-title { margin: 2px 0 0; color: var(--muted); }
.empty { margin: 0; padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--r-md); color: var(--muted);
  font-size: 0.92rem; }
.stay { margin: 0 0 10px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: 0.95rem; }
.stay strong { color: var(--text); }
.stops { list-style: none; margin: 0; padding: 0; position: relative; }
.stops::before { content: ""; position: absolute; left: 21px; top: 22px; bottom: 22px; width: 2px;
  background: linear-gradient(var(--sky), var(--forest)); opacity: 0.35; border-radius: 2px; }
.stop { position: relative; display: flex; gap: 14px; margin: 0 0 10px; }
.pin {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--bg); cursor: pointer;
  background: var(--forest); color: #fff; font: 800 1rem/1 var(--font-rounded); position: relative; z-index: 1;
  box-shadow: 0 2px 8px rgba(20, 36, 32, 0.25);
}
.state-open .pin { background: var(--surface); color: var(--accent-text); border-color: var(--forest); }
.state-missed .pin { background: var(--surface-2); color: var(--muted); }
.stop-body { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px 14px; }
.stop.is-focused .stop-body { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(90, 169, 230, 0.25); }
.stop-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.stop-head h4 { font-size: 1.05rem; font-weight: 700; }
.kind { font-size: 0.8rem; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }

/* The way to the next stop, like in the app: "Auto · 22,6 km · 19 min" and the flight card. */
.leg { margin: 12px 0 0; padding: 8px 12px; border-left: 3px solid var(--sky); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-2); color: var(--muted); font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.leg .icon { color: var(--sky); width: 1.25em; height: 1.25em; }
.leg-walk { border-left-style: dotted; }
.leg-flight { display: block; padding: 12px 14px; color: var(--text); }
.leg-head { margin: 0; display: flex; align-items: center; gap: 8px; }
.leg-sub { color: var(--muted); font-size: 0.85rem; }
.flight-route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; margin-top: 8px; }
.flight-route > div { display: flex; flex-direction: column; gap: 2px; }
.flight-route .iata { font: 800 1.4rem/1.1 var(--font-rounded); }
.flight-route .ftime { font-variant-numeric: tabular-nums; }
.flight-route small { color: var(--muted); }
.flight-mid { align-items: center; text-align: center; }
.flight-arr { align-items: flex-end; text-align: right; }
.where { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.times { margin: 10px 0 0; display: grid; gap: 6px; }
.time-row { display: grid; grid-template-columns: 74px 1fr; align-items: baseline; gap: 8px; }
.times dt { color: var(--muted); font-size: 0.85rem; }
.times dd { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-variant-numeric: tabular-nums; }
.planned.has-actual { color: var(--muted); }
.planned.has-actual time { text-decoration: line-through; text-decoration-thickness: 1px; }
.actual { font-weight: 700; }
.delay { font: 700 0.78rem/1 var(--font-rounded); padding: 4px 8px; border-radius: 999px; background: var(--surface-2); }
.delay-late { color: var(--late); }
.delay-early { color: var(--early); }
.delay-ok { color: var(--ok); }
.checkin { margin: 10px 0 0; font-size: 0.85rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.checkin::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.checkin-visited { color: var(--ok); }
.checkin-visited::before { background: var(--lime); box-shadow: 0 0 0 2px var(--forest); }
.checkin-open { color: var(--muted); }
.checkin-missed { color: var(--muted); }
.notes { margin: 8px 0 0; padding: 8px 10px; background: var(--surface-2); border-radius: var(--r-sm); font-size: 0.9rem; }
.moment { margin: 10px 0 0; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); }
.moment figcaption { font-size: 0.85rem; color: var(--muted, inherit); }
.moment .stars { color: var(--accent-text); letter-spacing: 1px; }
.moment blockquote { margin: 6px 0 0; font-size: 0.95rem; }
.moment-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.moment-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }

/* Footer */
.footer { padding: 24px 0 calc(32px + env(safe-area-inset-bottom)); color: var(--muted); border-top: 1px solid var(--line); }
.footer p { margin: 0 0 6px; }

/* 404 */
.notfound { min-height: 100vh; display: grid; place-items: center; }
.notfound-card { max-width: 520px; padding: 40px 16px; text-align: left; }
.notfound-card h1 { font-size: 1.9rem; font-weight: 800; margin-top: 4px; }
.notfound-card p { color: var(--muted); font-size: 1.05rem; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Join page (/join/{token}) */
.join-kicker { margin: 18px 0 0; font: 700 1rem/1.3 var(--font-rounded); color: var(--accent-text); }
.join .hero-icon { margin-top: 12px; }
.join-card { margin-top: 8px; }
.join-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button-secondary { background: var(--surface-2); color: var(--text); box-shadow: none; border: 1px solid var(--line); }
.join-note { flex-basis: 100%; margin: 0; }

/* /tv – Apple TV verbinden */
.tv-steps { list-style: none; counter-reset: tv-step; margin: 0; padding: 0; display: grid; gap: 12px; flex-basis: 100%; }
.tv-steps li { counter-increment: tv-step; display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; align-items: baseline; }
.tv-steps li::before { content: counter(tv-step); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%;
  display: inline-grid; place-items: center; background: var(--lime); color: var(--ink); font: 800 0.95rem/1 var(--font-rounded); }
.tv-steps strong { font: 700 1rem/1.3 var(--font-rounded); }
.tv-steps span { color: var(--muted); font-size: 0.92rem; }

/* S4 · Familien-Seite (/follow/<token>) */
.notfound-card form .button { border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.follow-headline { font: 800 2rem/1.15 var(--font-rounded); margin: 6px 0 4px; }
.follow-who { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.follow-who .avatar { width: 36px; height: 36px; font-size: 0.95rem; }
.follow-section { margin: 22px 0; }
.follow-section h2 { font: 800 1.15rem/1.2 var(--font-rounded); margin: 0 0 10px; }
.follow-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.follow-list li { background: var(--surface); border-radius: var(--r-sm); padding: 12px 14px; display: flex; gap: 12px;
  align-items: baseline; justify-content: space-between; box-shadow: var(--shadow, none); }
.follow-list .time { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.follow-list .done::before { content: ""; display: inline-block; width: 9px; height: 5px; margin: 0 8px 3px 2px; border-left: 2.5px solid var(--accent-text); border-bottom: 2.5px solid var(--accent-text); transform: rotate(-45deg); }
.follow-map { height: 300px; border-radius: var(--r, 20px); overflow: hidden; margin: 18px 0; }
.follow-live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.follow-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--forest); }

/* Legal pages (/legal/…) */
.legal { max-width: 720px; padding-top: 28px; padding-bottom: 56px; line-height: 1.6; }
.legal h1 { font-family: var(--font-rounded); font-size: 2rem; margin: 18px 0 8px; }
.legal h2 { font-family: var(--font-rounded); font-size: 1.15rem; margin: 28px 0 6px; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: 8px; }
.legal a { color: var(--accent-text); }
.legal-nav { margin-top: 12px; font-size: .95rem; color: var(--muted); }
.legal-nav a { color: var(--accent-text); text-decoration: none; }
.legal-nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
.footer-legal a { color: inherit; }

/* Live update: what just changed fades in briefly. */
@keyframes fresh { from { opacity: 0.35; } to { opacity: 1; } }
.is-fresh { animation: fresh 0.5s ease-out; }
@media (prefers-reduced-motion: reduce) { .is-fresh { animation: none; } }
