:root {
  color-scheme: dark;
  --ink: #07131d;
  --ink-2: #0d2130;
  --panel: #102635;
  --panel-2: #142c3d;
  --paper: #f6f3ea;
  --paper-2: #ebe6d8;
  --text: #f7f7f2;
  --muted: #9caeb7;
  --dark-text: #14232c;
  --coral: #ff6b4a;
  --coral-dark: #d84a2e;
  --aqua: #64d6ca;
  --line: rgba(255,255,255,.12);
  --shadow: 0 24px 60px rgba(0,0,0,.3);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { min-height: 100%; background: var(--ink); color: var(--text); overflow-x: hidden; overflow-y: auto; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--aqua); outline-offset: 3px; }

.app-shell { min-height: 100dvh; display: grid; grid-template-rows: 76px auto 32px; overflow: visible; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  position: sticky; top: 0; height: 76px; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(7,19,29,.96); z-index: 1200;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; background: var(--coral); border-radius: 14px 14px 14px 4px; transform: rotate(-2deg); }
.brand-mark svg { width: 30px; fill: none; stroke: white; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-family: Georgia, serif; font-size: 1.28rem; line-height: 1; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: .74rem; margin-top: 5px; letter-spacing: .025em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.privacy-pill { padding: 9px 13px; border: 1px solid var(--line); color: #c5d3d8; border-radius: 999px; font-size: .78rem; }
.privacy-pill span { color: var(--aqua); font-size: .68rem; margin-right: 6px; }
.header-button { min-height: 40px; border: 1px solid var(--line); background: transparent; color: white; border-radius: 999px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-size: .75rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.header-button:hover { background: rgba(255,255,255,.08); }
.header-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.facebook-button { border-color: rgba(106,162,255,.42); background: rgba(24,119,242,.12); }
.facebook-f { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #1877f2; color: white; font-family: Arial,sans-serif; font-size: .95rem; font-weight: 900; line-height: 1; }
.icon-button, .add-button { border: 1px solid var(--line); background: transparent; border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; font-weight: 700; }
.icon-button:hover, .add-button:hover { background: rgba(255,255,255,.08); }
.icon-button svg, .add-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.workspace { min-height: calc(100dvh - 108px); display: grid; grid-template-columns: minmax(0, 1fr) 410px; align-items: start; overflow: visible; }
.map-stage { position: sticky; top: 76px; height: calc(100dvh - 108px); min-height: 520px; min-width: 0; overflow: hidden; background: #17313a; }
#map { position: absolute; inset: 0; z-index: 1; background: #17313a; }
.map-shade { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(90deg, rgba(5,18,27,.15), transparent 55%), linear-gradient(0deg, rgba(5,18,27,.22), transparent 35%); }
.leaflet-control-attribution { background: rgba(255,255,255,.78) !important; font-size: 10px !important; color: #354850 !important; }
.leaflet-control-attribution a { color: #284c5c !important; }
.leaflet-bar a { background: #102635 !important; color: white !important; border-bottom-color: rgba(255,255,255,.1) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #102635; color: white; }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 8px; }
.map-popup { width: 190px; cursor: pointer; }
.map-popup img { width: 100%; height: 145px; object-fit: contain; background: #07131d; border-radius: 8px; display: block; }
.map-popup strong { display: block; font-size: .83rem; margin: 8px 3px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-popup small { color: var(--muted); margin: 0 3px 3px; display: block; }
.photo-marker { background: transparent; border: 0; }
.photo-marker span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50% 50% 50% 7px; transform: rotate(-45deg); background: var(--coral); border: 3px solid white; box-shadow: 0 7px 16px rgba(0,0,0,.3); }
.photo-marker span::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: white; }
.photo-marker.selected span { background: var(--aqua); transform: rotate(-45deg) scale(1.18); }

.empty-card { position: absolute; z-index: 400; left: clamp(24px, 6vw, 86px); top: 50%; transform: translateY(-50%); width: min(560px, calc(100% - 48px)); padding: clamp(24px, 4vw, 48px); border: 1px solid rgba(255,255,255,.2); background: rgba(7,23,34,.88); border-radius: 28px 28px 28px 7px; box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.eyebrow, .section-kicker { font-size: .7rem; font-weight: 800; letter-spacing: .18em; color: var(--coral); }
.empty-card h1 { font-family: Georgia, serif; font-weight: 500; font-size: clamp(2.15rem, 4.8vw, 4.35rem); letter-spacing: -.055em; line-height: .98; margin: 18px 0 20px; }
.empty-card p { max-width: 470px; color: #c0cdd1; font-size: 1rem; line-height: 1.55; }
.upload-primary { border: 0; background: var(--coral); color: white; border-radius: 12px; padding: 14px 19px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 800; cursor: pointer; box-shadow: 0 10px 24px rgba(216,74,46,.3); }
.upload-primary:hover { background: #ff7a5b; transform: translateY(-1px); }
.upload-primary svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.upload-primary.full { width: 100%; margin-top: 5px; }
.drop-note { margin-top: 14px; font-size: .75rem; color: #849aa3; }

.map-toolbar { position: absolute; z-index: 450; top: 20px; left: 20px; display: flex; gap: 8px; padding: 6px; background: rgba(7,22,32,.88); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(12px); }
.tool-button { border: 0; background: transparent; border-radius: 9px; padding: 9px 12px; cursor: pointer; color: #b7c6cc; font-size: .79rem; font-weight: 700; white-space: nowrap; }
.tool-button:hover, .tool-button.active { background: rgba(255,255,255,.1); color: white; }
.route-summary { position: absolute; z-index: 450; bottom: 24px; left: 24px; display: flex; align-items: center; gap: 11px; padding: 11px 15px; background: rgba(7,22,32,.9); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(12px); }
.route-icon { font-size: 1.6rem; color: var(--aqua); }
.route-summary small { display: block; color: var(--muted); font-size: .6rem; letter-spacing: .1em; }
.route-summary strong { display: block; margin-top: 2px; }

.side-panel { min-height: calc(100dvh - 108px); overflow: visible; background: var(--paper); color: var(--dark-text); display: block; position: relative; z-index: 800; box-shadow: -15px 0 40px rgba(0,0,0,.12); }
.panel-head { padding: 24px 24px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-head .section-kicker { color: var(--coral-dark); }
.panel-head h2 { font-family: Georgia, serif; font-weight: 500; font-size: 1.55rem; letter-spacing: -.025em; margin: 5px 0 0; }
.add-button { color: var(--dark-text); border-color: rgba(20,35,44,.18); }
.stats { margin: 0 24px 16px; display: grid; grid-template-columns: repeat(3,1fr); border: 1px solid rgba(20,35,44,.12); border-radius: 13px; overflow: hidden; background: rgba(255,255,255,.42); }
.stats div { padding: 11px 12px; border-right: 1px solid rgba(20,35,44,.1); }
.stats div:last-child { border-right: 0; }
.stats strong { display: block; font-family: Georgia, serif; font-size: 1.25rem; line-height: 1; }
.stats span { display: block; font-size: .66rem; color: #728087; margin-top: 5px; text-transform: uppercase; letter-spacing: .06em; }
.view-tabs { display: flex; padding: 0 24px; border-bottom: 1px solid rgba(20,35,44,.13); }
.view-tab { border: 0; border-bottom: 3px solid transparent; background: transparent; color: #6f7a7f; padding: 11px 14px 10px; cursor: pointer; font-size: .78rem; font-weight: 800; }
.view-tab:first-child { padding-left: 0; }
.view-tab.active { color: var(--dark-text); border-bottom-color: var(--coral); }
.panel-content { min-height: 290px; overflow: visible; }
.view { display: none; padding: 19px 24px 24px; }
.view.active { display: block; }
.empty-list, .detail-empty { min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #6e7b80; }
.empty-compass { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 12px; border: 1px solid #c9c3b5; border-radius: 50%; font-size: 1.4rem; color: var(--coral-dark); }
.empty-list strong { color: var(--dark-text); }
.empty-list p, .detail-empty p { max-width: 260px; line-height: 1.5; font-size: .84rem; }

.timeline { display: grid; gap: 10px; }
.date-group { display: grid; grid-template-columns: 42px 1fr; gap: 10px; position: relative; }
.date-group::before { content: ""; position: absolute; left: 20px; top: 38px; bottom: -12px; width: 1px; background: #d7d0c1; }
.date-group:last-child::before { display: none; }
.date-badge { text-align: center; padding-top: 2px; }
.date-badge strong { display: block; font-family: Georgia, serif; font-size: 1.45rem; line-height: 1; }
.date-badge small { font-size: .58rem; letter-spacing: .08em; color: #7e888c; }
.day-photos { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding-bottom: 12px; }
.photo-card { border: 0; padding: 0; background: #102635; border-radius: 11px; overflow: hidden; position: relative; cursor: pointer; aspect-ratio: 1 / 1; min-height: 150px; }
.photo-card img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; transition: transform .25s ease; }
.photo-card:hover img { transform: scale(1.04); }
.photo-card::after { content: ""; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent,rgba(0,0,0,.75)); }
.photo-card.selected { box-shadow: 0 0 0 3px var(--coral); }
.photo-card span { position: absolute; z-index: 1; left: 9px; right: 9px; bottom: 8px; color: white; text-align: left; font-size: .68rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-card.no-gps::before { content: "OHNE GPS"; position: absolute; z-index: 2; top: 7px; right: 7px; background: rgba(7,19,29,.82); color: white; padding: 4px 5px; border-radius: 4px; font-size: .52rem; letter-spacing: .05em; }

.place-list { display: grid; gap: 10px; }
.place-card { border: 1px solid #d5cfc1; background: rgba(255,255,255,.4); border-radius: 13px; padding: 13px; display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; cursor: pointer; text-align: left; color: inherit; }
.place-card:hover { background: white; }
.place-thumb { width: 64px; height: 64px; border-radius: 9px; object-fit: contain; background: #102635; }
.place-card strong { display: block; font-size: .86rem; }
.place-card small { display: block; margin-top: 3px; color: #728087; font-size: .68rem; }
.place-count { min-width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; background: var(--ink-2); color: white; font-size: .7rem; }

.photo-detail { padding-bottom: 10px; }
.detail-image { width: 100%; max-height: 460px; object-fit: contain; background: #102635; border-radius: 15px; display: block; }
.detail-title { font-family: Georgia, serif; font-size: 1.15rem; margin: 14px 0 2px; word-break: break-word; }
.detail-place { color: var(--coral-dark); font-weight: 700; font-size: .76rem; }
.primary-meta { margin: 16px 0 0; border-top: 1px solid #d9d3c6; }
.primary-row { display: grid; grid-template-columns: 94px minmax(0,1fr); gap: 10px; padding: 11px 2px; border-bottom: 1px solid #d9d3c6; align-items: baseline; }
.primary-row dt { color: #6d797e; font-size: .72rem; font-weight: 800; }
.primary-row dd { margin: 0; font-size: .8rem; font-weight: 700; line-height: 1.38; overflow-wrap: anywhere; }
.meta-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1px; border: 1px solid #d9d3c6; background: #d9d3c6; margin-top: 10px; border-radius: 12px; overflow: hidden; }
.meta-grid div { background: var(--paper); padding: 10px; min-width: 0; }
.meta-grid small { display: block; color: #788489; font-size: .58rem; text-transform: uppercase; letter-spacing: .06em; }
.meta-grid strong { display: block; margin-top: 4px; font-size: .77rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-info-button { width: 100%; margin-top: 12px; border: 1px solid #cfc8b9; background: white; color: var(--dark-text); border-radius: 9px; padding: 10px; font-size: .75rem; font-weight: 800; cursor: pointer; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.detail-actions button, .detail-actions a { flex: 1 1 130px; border: 1px solid #cfc8b9; background: rgba(255,255,255,.45); color: var(--dark-text); border-radius: 9px; padding: 10px; font-size: .72rem; font-weight: 800; cursor: pointer; text-decoration: none; text-align: center; }
.detail-actions .delete-file { flex-basis: 100%; border-color: rgba(165,71,55,.35); color: #a54737; background: rgba(165,71,55,.06); }

.panel-footer { padding: 15px 24px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(20,35,44,.13); display: grid; gap: 8px; background: var(--paper); }
.footer-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-footer { min-height: 32px; display: flex; align-items: center; justify-content: center; gap: 7px; border-top: 1px solid var(--line); background: #07131d; color: #bdc9ce; font-size: .74rem; letter-spacing: .035em; position: relative; z-index: 1300; }
.site-footer span:first-child { color: white; font-weight: 800; }
.secondary-button { border: 1px solid #c7c1b4; background: white; color: var(--dark-text); border-radius: 10px; padding: 10px 12px; display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: .75rem; cursor: pointer; }
.secondary-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
button:disabled { opacity: .38; cursor: not-allowed; }
.text-button { border: 0; background: transparent; cursor: pointer; font-size: .72rem; font-weight: 700; }
.danger { color: #a54737; }
.export-menu-wrap { position: relative; }
.export-menu { position: absolute; z-index: 20; left: 0; bottom: calc(100% + 8px); width: 190px; padding: 6px; background: white; border: 1px solid #d1cabd; border-radius: 11px; box-shadow: 0 15px 40px rgba(15,32,41,.18); }
.export-menu button { width: 100%; border: 0; border-radius: 7px; background: transparent; color: var(--dark-text); padding: 9px 10px; text-align: left; cursor: pointer; font-size: .73rem; }
.export-menu button:hover { background: #eee9de; }

.drop-overlay { position: fixed; inset: 0; z-index: 3000; background: rgba(6,19,29,.88); border: 8px solid var(--coral); place-items: center; backdrop-filter: blur(10px); }
.drop-overlay[hidden] { display: none; }
.drop-overlay:not([hidden]) { display: grid; }
.drop-overlay div { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop-overlay span { width: 74px; height: 74px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); font-size: 2.3rem; }
.drop-overlay strong { font-family: Georgia, serif; font-size: clamp(1.8rem,5vw,3.5rem); }
.drop-overlay small { color: #b8c7cd; }

dialog { max-width: 540px; width: calc(100% - 28px); border: 0; padding: 0; border-radius: 20px; background: var(--paper); color: var(--dark-text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(4,13,20,.75); backdrop-filter: blur(6px); }
.dialog-card { position: relative; padding: 30px; }
.dialog-close { position: absolute; right: 16px; top: 14px; border: 0; background: transparent; color: #6f797d; font-size: 1.6rem; cursor: pointer; }
.dialog-card h2 { font-family: Georgia,serif; font-weight: 500; font-size: 1.8rem; line-height: 1.12; margin: 10px 28px 14px 0; }
.dialog-card p { font-size: .89rem; line-height: 1.55; color: #55656c; }
.info-block { padding: 14px; background: #e9e4d8; border-radius: 11px; margin: 16px 0; }
.info-block strong { font-size: .8rem; }
.info-block p { margin: 5px 0 0; font-size: .78rem; }
.dialog-note { font-size: .74rem !important; }
.install-instructions { color: #46585f; font-size: .88rem; line-height: 1.55; }
.install-instructions ol { margin: 10px 0 20px; padding-left: 22px; }
.install-instructions li { margin: 7px 0; }
.install-instructions strong { color: var(--dark-text); }
.toast-region { position: fixed; z-index: 4000; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast { background: #102635; color: white; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; padding: 11px 15px; box-shadow: var(--shadow); font-size: .78rem; animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  body { overflow: auto; background: var(--paper); }
  .app-shell { height: auto; min-height: 100dvh; grid-template-rows: 64px auto 36px; overflow: visible; }
  .topbar { position: sticky; top: 0; height: 64px; padding: 0 14px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 11px 11px 11px 4px; }
  .brand-mark svg { width: 26px; }
  .brand strong { font-size: 1.03rem; }
  .brand small, .privacy-pill { display: none; }
  .header-button { width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 50%; }
  .action-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .workspace { height: auto; display: block; overflow: visible; }
  .map-stage { position: relative; top: auto; height: min(58dvh, 520px); min-height: 390px; }
  .side-panel { height: auto; min-height: 46dvh; max-height: none; display: block; box-shadow: 0 -14px 35px rgba(4,15,22,.15); border-radius: 22px 22px 0 0; margin-top: -20px; overflow: visible; }
  .empty-card { left: 14px; width: calc(100% - 28px); padding: 25px 22px; border-radius: 21px 21px 21px 6px; }
  .empty-card h1 { font-size: clamp(2.15rem, 11vw, 3.4rem); margin: 14px 0; }
  .empty-card p { font-size: .88rem; margin-bottom: 18px; }
  .drop-note { display: none; }
  .map-toolbar { top: 12px; left: 12px; right: 12px; overflow-x: auto; scrollbar-width: none; }
  .map-toolbar::-webkit-scrollbar { display: none; }
  .route-summary { left: 12px; bottom: 28px; }
  .panel-head { padding-top: 22px; }
  .panel-content { max-height: none; overflow: visible; min-height: 290px; }
  .panel-footer { position: static; }
  .site-footer { min-height: 36px; }
}

@media (max-width: 420px) {
  .topbar { padding: 0 10px; }
  .brand { gap: 9px; }
  .top-actions { gap: 6px; }
  .icon-button { width: 37px; height: 37px; }
  .empty-card h1 { font-size: 2.25rem; }
  .panel-head, .view, .panel-footer { padding-left: 17px; padding-right: 17px; }
  .stats { margin-left: 17px; margin-right: 17px; }
  .view-tabs { padding-left: 17px; padding-right: 17px; }
  .day-photos { grid-template-columns: 1fr 1fr; }
  .photo-card { min-height: 145px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
