@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;600&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap');

/* ── THEME VARIABLES ── */
:root {
  --bg-base:      #0d1117;
  --bg-surface:   #111118;
  --bg-elevated:  #17171f;
  --bg-hover:     #1c1c28;
  --bg-input:     #13131a;
  --border:       #1e1e2a;
  --border-mid:   #2a2a3a;
  --border-hi:    #383848;
  --text-primary: #e8e0d0;
  --text-second:  #8a8a9a;
  --text-muted:   #555566;
  --text-faint:   #333344;
  --gold:         #e8c87a;
  --gold-dim:     #a08840;
  --red-live:     #e8272a;
  --green-live:   #5cb85c;
  --stamp:        #c94a2e;
  --stamp-border: #a33a22;
  --tag-food-bg:  #2a1a0a; --tag-food-fg:  #c87a40; --tag-food-br:  #4a2a1a;
  --tag-transit-bg:#0a1a2a;--tag-transit-fg:#4a8ab0;--tag-transit-br:#1a3a5a;
  --tag-photo-bg: #1a0a2a; --tag-photo-fg: #8a5ab0; --tag-photo-br: #3a1a5a;
  --tag-shrine-bg:#1a2a1a; --tag-shrine-fg:#5a9a5a; --tag-shrine-br:#2a4a2a;
  --tag-priv-bg:  #2a2a0a; --tag-priv-fg:  #a0a040; --tag-priv-br:  #3a3a1a;
  --tag-zoo-bg:   #0a1a2a; --tag-zoo-fg:   #4a8ab0; --tag-zoo-br:   #1a3a5a;
  --map-filter: invert(1) hue-rotate(180deg) saturate(0.38) brightness(0.52);
  --shadow-popup: 0 4px 24px rgba(0,0,0,0.7);
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 10px;
}

[data-theme="light"] {
  --bg-base:      #f0ece2;
  --bg-surface:   #faf7f0;
  --bg-elevated:  #ffffff;
  --bg-hover:     #f0ece2;
  --bg-input:     #f5f2ea;
  --border:       #ddd8cc;
  --border-mid:   #c8c0b0;
  --border-hi:    #b0a890;
  --text-primary: #1a1a1e;
  --text-second:  #5a5a6a;
  --text-muted:   #8a8a9a;
  --text-faint:   #bcbccc;
  --gold:         #b07820;
  --gold-dim:     #c09040;
  --tag-food-bg:  #fdf0e4; --tag-food-fg:  #8a4a10; --tag-food-br:  #e8c090;
  --tag-transit-bg:#e4f0fd;--tag-transit-fg:#1a5a8a;--tag-transit-br:#90c0e8;
  --tag-photo-bg: #f4e4fd; --tag-photo-fg: #5a1a8a; --tag-photo-br: #c090e8;
  --tag-shrine-bg:#e4fde4; --tag-shrine-fg:#1a5a1a; --tag-shrine-br:#90e890;
  --tag-priv-bg:  #fdfde4; --tag-priv-fg:  #5a5a0a; --tag-priv-br:  #e8e890;
  --tag-zoo-bg:   #e4f0fd; --tag-zoo-fg:   #1a5a8a; --tag-zoo-br:   #90c0e8;
  --map-filter: saturate(0.7) brightness(1.0) contrast(0.9);
  --shadow-popup: 0 4px 24px rgba(0,0,0,0.18);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  transition: background 0.3s, color 0.3s;
}

/* ── LAYOUT ── */
#app { display: flex; flex-direction: column; height: 100vh; }

/* ── TOPBAR ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; height: 50px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 1000; position: relative;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.hanko {
  width: 26px; height: 26px; border-radius: 2px;
  background: var(--stamp); border: 1.5px solid var(--stamp-border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Noto Serif JP', serif; font-size: 10px; color: #fff; font-weight: 700;
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Noto Serif JP', serif; font-size: 14px;
  color: var(--text-primary); letter-spacing: 0.04em;
}
.brand-sub {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); margin-left: 2px;
}
.topbar-nav { display: flex; gap: 3px; }
.nav-tab {
  padding: 5px 13px; font-size: 11px; font-weight: 500; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-muted); border: none; background: transparent;
  font-family: 'DM Sans', sans-serif; letter-spacing: 0.02em; transition: all 0.15s;
}
.nav-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-tab.active { color: var(--text-primary); background: var(--bg-elevated); border: 0.5px solid var(--border-mid); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.live-pill {
  display: flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 20px; border: 0.5px solid #2a5a2a;
  background: #1a2e1a; font-size: 10px; color: var(--green-live); font-weight: 500;
}
[data-theme="light"] .live-pill { background: #e8f5e8; border-color: #6ab87a; color: #2a7a2a; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green-live); animation: livepulse 1.4s infinite; }
@keyframes livepulse { 0%,100% { opacity:1 } 50% { opacity:.35 } }
.theme-btn {
  width: 32px; height: 32px; border-radius: var(--radius-md); cursor: pointer;
  background: var(--bg-elevated); border: 0.5px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: all 0.15s; color: var(--text-second);
}
.theme-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.login-btn {
  padding: 5px 14px; font-size: 11px; font-weight: 500; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-primary); background: var(--bg-elevated);
  border: 0.5px solid var(--border-mid); font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}
.login-btn:hover { background: var(--bg-hover); border-color: var(--border-hi); }
.login-btn.logged-in { color: var(--gold); border-color: var(--gold-dim); }

/* ── MAIN ── */
.main { display: flex; flex: 1; overflow: hidden; position: relative; }

/* ── MAP ── */
#map {
  flex: 1; z-index: 1; background: var(--bg-base);
  transition: background 0.3s;
}
.leaflet-tile-pane { filter: var(--map-filter); transition: filter 0.3s; }
[data-theme="light"] .leaflet-tile-pane { filter: var(--map-filter); }

/* ── MAP OVERLAYS ── */
.filter-strip {
  position: absolute; top: 12px; left: 12px;
  display: flex; gap: 3px; flex-wrap: wrap; max-width: 340px;
  background: var(--bg-surface); border: 0.5px solid var(--border-mid);
  border-radius: 20px; padding: 4px 7px; z-index: 500;
}
.filter-btn {
  padding: 3px 10px; border-radius: 14px; font-size: 10px; font-weight: 500;
  cursor: pointer; border: none; background: transparent;
  color: var(--text-muted); transition: all 0.15s; font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}
.filter-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.filter-btn.active { color: var(--gold); background: var(--bg-elevated); border: 0.5px solid var(--border-mid); }

.map-legend {
  position: absolute; bottom: 12px; left: 12px;
  background: var(--bg-surface); border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-md); padding: 9px 12px; z-index: 500; font-size: 10px;
}
.legend-row { display: flex; align-items: center; gap: 7px; color: var(--text-second); margin-bottom: 4px; }
.legend-row:last-child { margin-bottom: 0; }
.legend-line { width: 20px; height: 2px; border-radius: 1px; flex-shrink: 0; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.zoom-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: var(--bg-surface); border: 0.5px solid var(--border-mid);
  border-radius: 14px; padding: 5px 13px; font-size: 10px; color: var(--text-muted);
  z-index: 500; pointer-events: none; white-space: nowrap;
  transition: opacity 0.3s; opacity: 1;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 288px; background: var(--bg-surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; z-index: 2;
  transition: background 0.3s, border-color 0.3s;
}
.sidebar-header { padding: 14px 16px 11px; border-bottom: 0.5px solid var(--border); flex-shrink: 0; }
.sidebar-date { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-muted); margin-bottom: 3px; }
.sidebar-city { font-family: 'Noto Serif JP', serif; font-size: 17px; color: var(--text-primary); font-weight: 600; }
.sidebar-sub { font-size: 11px; color: var(--text-second); margin-top: 3px; }

/* ── DAY TABS ── */
.day-tabs { display: flex; border-bottom: 0.5px solid var(--border); flex-shrink: 0; overflow-x: auto; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex-shrink: 0; padding: 8px 14px; font-family: 'DM Mono', monospace;
  font-size: 10px; color: var(--text-faint); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.15s;
}
.day-tab:hover:not(.active):not(.future) { color: var(--text-second); }
.day-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.day-tab.future { color: var(--text-faint); cursor: default; opacity: 0.4; }

/* ── ENTRY LIST ── */
.entry-list { flex: 1; overflow-y: auto; padding: 10px; }
.entry-list::-webkit-scrollbar { width: 3px; }
.entry-list::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

.entry-card {
  background: var(--bg-elevated); border: 0.5px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 8px;
  cursor: pointer; transition: all 0.15s;
}
.entry-card:hover { border-color: var(--border-hi); background: var(--bg-hover); }
.entry-card.active { border-color: rgba(232,200,122,0.4); background: var(--bg-hover); }
.entry-time { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--text-faint); margin-bottom: 4px; }
.entry-place { font-size: 12px; color: var(--text-primary); font-weight: 500; margin-bottom: 1px; }
.entry-jp { font-family: 'Noto Serif JP', serif; font-size: 9px; color: var(--text-muted); margin-bottom: 5px; }
.entry-note {
  font-size: 11px; color: var(--text-second); line-height: 1.65;
}
.entry-note p { margin: 0 0 7px; }
.entry-note p:last-child { margin-bottom: 0; }

/* Collapsed long notes */
.entry-note.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-expand-btn {
  display: inline-block; margin-top: 4px; font-size: 10px;
  color: var(--gold-dim); cursor: pointer; font-family: 'DM Mono', monospace;
  background: none; border: none; padding: 0; transition: color .15s;
}
.note-expand-btn:hover { color: var(--gold); }

/* Long note pull-quote style: first paragraph slightly larger */
.entry-note.long p:first-child {
  font-size: 12px; color: var(--text-primary); font-weight: 400;
  border-left: 2px solid var(--gold-dim); padding-left: 9px; margin-bottom: 9px;
}

/* Private note wrapper */
.note-private-wrap {
  background: var(--tag-priv-bg); border: 0.5px solid var(--tag-priv-br);
  border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 0;
}
.note-private-wrap .private-label {
  font-size: 9px; font-family: 'DM Mono', monospace;
  color: var(--tag-priv-fg); margin-bottom: 7px; display: flex; align-items: center; gap: 4px;
}
.note-private-wrap .entry-note { color: var(--text-second); }
.entry-media { display: flex; gap: 4px; margin-top: 7px; }
.media-thumb {
  width: 48px; height: 38px; border-radius: 4px; background: var(--bg-base);
  border: 0.5px solid var(--border-mid); display: flex; align-items: center;
  justify-content: center; font-size: 16px; overflow: hidden; flex-shrink: 0;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-more {
  width: 48px; height: 38px; border-radius: 4px; background: var(--bg-hover);
  border: 0.5px solid var(--border-mid); display: flex; align-items: center;
  justify-content: center; font-size: 10px; color: var(--text-muted); font-family: 'DM Mono', monospace;
}
.entry-tags { display: flex; gap: 3px; margin-top: 7px; flex-wrap: wrap; }
.tag {
  padding: 2px 6px; border-radius: 3px; font-size: 9px; font-weight: 500;
  font-family: 'DM Mono', monospace; border: 0.5px solid;
}
.tag-food     { background: var(--tag-food-bg);    color: var(--tag-food-fg);    border-color: var(--tag-food-br); }
.tag-transit  { background: var(--tag-transit-bg); color: var(--tag-transit-fg); border-color: var(--tag-transit-br); }
.tag-photo    { background: var(--tag-photo-bg);   color: var(--tag-photo-fg);   border-color: var(--tag-photo-br); }
.tag-shrine   { background: var(--tag-shrine-bg);  color: var(--tag-shrine-fg);  border-color: var(--tag-shrine-br); }
.tag-private  { background: var(--tag-priv-bg);    color: var(--tag-priv-fg);    border-color: var(--tag-priv-br); }
.tag-zoo      { background: var(--tag-zoo-bg);     color: var(--tag-zoo-fg);     border-color: var(--tag-zoo-br); }
.route-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 3px; font-size: 9px; margin-top: 5px;
  font-family: 'DM Mono', monospace; border: 0.5px solid;
}
.route-shinkansen { background: #2a0a0a; color: #e06060; border-color: #5a1a1a; }
.route-metro      { background: #0a1a2a; color: #6090c0; border-color: #1a3a5a; }
[data-theme="light"] .route-shinkansen { background: #fde8e8; color: #8a1a1a; border-color: #e8b0b0; }
[data-theme="light"] .route-metro      { background: #e8f0fd; color: #1a3a8a; border-color: #b0c8e8; }

.add-entry-btn {
  margin: 2px 0 10px; padding: 9px 0;
  background: transparent; border: 0.5px dashed var(--border-mid);
  border-radius: var(--radius-md); font-size: 11px; color: var(--text-muted);
  cursor: pointer; text-align: center; transition: all 0.15s;
  font-family: 'DM Sans', sans-serif; width: 100%;
}
.add-entry-btn:hover { color: var(--text-primary); border-color: var(--border-hi); background: var(--bg-hover); }

/* ── MODAL BASE ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.3); }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-elevated); border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-lg); padding: 26px 28px; width: 360px;
  max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow-y: auto;
  transition: background 0.3s;
}
.modal-title { font-family: 'Noto Serif JP', serif; font-size: 17px; color: var(--text-primary); margin-bottom: 4px; }
.modal-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }

/* ── FORM ELEMENTS ── */
.field-group { margin-bottom: 14px; }
.field-label { font-size: 11px; font-weight: 500; color: var(--text-second); margin-bottom: 5px; display: block; font-family: 'DM Sans', sans-serif; }
.field-input, .field-textarea, .field-select {
  width: 100%; padding: 8px 11px;
  background: var(--bg-input); border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: 'DM Sans', sans-serif; font-size: 12px;
  outline: none; transition: border-color 0.15s;
}
.field-input:focus, .field-textarea:focus { border-color: var(--gold-dim); }
.field-textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.field-select { cursor: pointer; }
.field-hint { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.field-gmaps-parsed {
  font-size: 10px; font-family: 'DM Mono', monospace;
  color: var(--green-live); margin-top: 4px; display: none;
}
.field-gmaps-parsed.show { display: block; }

.btn-row { display: flex; gap: 8px; margin-top: 20px; }
.btn-primary {
  flex: 1; padding: 9px; background: var(--gold); border: none;
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  cursor: pointer; color: #1a1400; font-family: 'DM Sans', sans-serif;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-secondary {
  padding: 9px 16px; background: transparent; border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--text-second);
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--border-hi); color: var(--text-primary); }

/* ── TAG SELECTOR ── */
.tag-selector { display: flex; gap: 5px; flex-wrap: wrap; }
.tag-option {
  padding: 3px 9px; border-radius: 12px; font-size: 10px; font-weight: 500;
  cursor: pointer; border: 0.5px solid var(--border-mid);
  background: var(--bg-input); color: var(--text-muted);
  font-family: 'DM Mono', monospace; transition: all 0.15s;
}
.tag-option.selected { border-color: var(--gold-dim); color: var(--gold); background: var(--bg-hover); }

/* ── MEDIA UPLOAD ── */
.upload-zone {
  border: 0.5px dashed var(--border-mid); border-radius: var(--radius-md);
  padding: 16px; text-align: center; cursor: pointer;
  transition: all 0.15s; color: var(--text-muted); font-size: 11px;
}
.upload-zone:hover { border-color: var(--border-hi); color: var(--text-second); background: var(--bg-hover); }
.upload-zone.dragover { border-color: var(--gold-dim); background: var(--bg-hover); }
.upload-previews { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.upload-preview-item {
  width: 56px; height: 44px; border-radius: 4px; background: var(--bg-base);
  border: 0.5px solid var(--border-mid); overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.upload-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-item { overflow: hidden; } /* previews can clip, they have delete btn inside */
.upload-preview-item .remove-media {
  position: absolute; top: 1px; right: 1px; width: 14px; height: 14px;
  background: rgba(0,0,0,0.6); border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 9px; color: #fff;
  cursor: pointer; line-height: 1;
}

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--bg-elevated); border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-md); padding: 9px 16px; font-size: 12px;
  color: var(--text-primary); z-index: 3000; opacity: 0;
  transition: all 0.25s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: #2a5a2a; color: var(--green-live); }
.toast.error { border-color: #5a1a1a; color: #e86060; }

/* ── LEAFLET OVERRIDES ── */
.leaflet-popup-content-wrapper {
  background: var(--bg-elevated) !important;
  border: 0.5px solid var(--border-mid) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-popup) !important;
  padding: 0 !important;
}
.leaflet-popup-content { margin: 11px 13px !important; color: var(--text-primary) !important; }
.leaflet-popup-tip { background: var(--bg-elevated) !important; }
.leaflet-popup-close-button { color: var(--text-muted) !important; top: 8px !important; right: 10px !important; font-size: 16px !important; }
.leaflet-control-zoom a {
  background: var(--bg-elevated) !important; color: var(--text-second) !important;
  border-color: var(--border-mid) !important;
}
.leaflet-control-zoom a:hover { background: var(--bg-hover) !important; color: var(--text-primary) !important; }
.leaflet-control-attribution { background: rgba(13,13,28,0.7) !important; color: var(--text-faint) !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--text-muted) !important; }
[data-theme="light"] .leaflet-control-attribution { background: rgba(240,236,226,0.85) !important; }

.tabi-tooltip {
  background: var(--bg-elevated) !important; border: 0.5px solid var(--border-mid) !important;
  color: var(--text-primary) !important; border-radius: var(--radius-md) !important;
  font-size: 12px !important; padding: 7px 10px !important;
  box-shadow: var(--shadow-popup) !important; font-family: 'DM Sans', sans-serif !important;
}
.tabi-tooltip::before { display: none !important; }

/* ── POPUP CONTENT ── */
.popup-name { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.popup-jp { font-size: 10px; color: var(--text-muted); margin-bottom: 6px; font-family: 'Noto Serif JP', serif; }
.popup-note { font-size: 11px; color: var(--text-second); margin-bottom: 7px; line-height: 1.4; }
.popup-status {
  display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 3px;
  font-family: 'DM Mono', monospace;
}
.popup-visited { background: #1a2e1a; color: #5cb85c; }
.popup-unvisited { background: var(--bg-hover); color: var(--text-muted); }
[data-theme="light"] .popup-visited { background: #e0f5e0; color: #2a7a2a; }

/* ── PRIVATE NOTE BANNER ── */
.private-banner {
  background: var(--tag-priv-bg); border: 0.5px solid var(--tag-priv-br);
  border-radius: var(--radius-sm); padding: 6px 10px;
  font-size: 10px; color: var(--tag-priv-fg); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 12px;
}
.empty-state .empty-icon { font-size: 28px; margin-bottom: 10px; }

/* ── ANIMATIONS ── */
@keyframes ripple {
  0%   { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(2.8); opacity: 0; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.entry-card { animation: fadeIn 0.2s ease; }

/* ── SCROLLBAR ── */
* { scrollbar-width: thin; scrollbar-color: var(--border-mid) transparent; }

/* ── TRANSIT CARD ── */
.entry-transit {
  background: var(--bg-elevated);
  border-color: var(--border);
  padding: 10px 12px;
}
.entry-transit:hover { border-color: var(--border-hi); }
.entry-transit.active { border-color: rgba(85,153,238,0.4); background: var(--bg-hover); }

.transit-card-inner { display: flex; gap: 10px; align-items: flex-start; }

.transit-icon-col { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; padding-top: 2px; }
.transit-mode-icon { font-size: 18px; line-height: 1; margin-bottom: 4px; }
.transit-line-vis { display: flex; flex-direction: column; align-items: center; flex: 1; }
.transit-dot { width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--border-hi); background: var(--bg-base); flex-shrink: 0; }
.transit-vert-line { width: 2px; flex: 1; min-height: 16px; background: var(--border-hi); margin: 2px 0; }
.route-shinkansen-line { background: #ff4444; }
.route-train-line      { background: #f7a800; }
.route-metro-line      { background: #5599ee; }
.route-bus-line        { background: #88bb44; }
.route-ferry-line      { background: #44bbcc; }

.transit-body { flex: 1; min-width: 0; }
.transit-from { font-size: 12px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.transit-to   { font-size: 12px; font-weight: 500; color: var(--text-primary); margin-top: 4px; }

/* Additional route badge colors */
.route-train { background: #2a1e00; color: #d4920a; border-color: #4a3800; }
.route-bus   { background: #1a2a0a; color: #7aaa3a; border-color: #3a4a1a; }
.route-ferry { background: #0a2a2a; color: #3aaabb; border-color: #1a4a4a; }
[data-theme="light"] .route-train { background: #fdf5e0; color: #7a4a00; border-color: #e8c880; }
[data-theme="light"] .route-bus   { background: #f0fce0; color: #2a5a0a; border-color: #a0d870; }
[data-theme="light"] .route-ferry { background: #e0f8f8; color: #0a5a6a; border-color: #70ccd8; }

/* ── ENTRY TYPE TOGGLE (modal) ── */
.entry-type-row { display: flex; gap: 6px; margin-bottom: 18px; }
.entry-type-btn {
  flex: 1; padding: 8px 0; border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-mid); background: var(--bg-input);
  color: var(--text-muted); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; font-family: 'DM Sans', sans-serif;
}
.entry-type-btn:hover { border-color: var(--border-hi); color: var(--text-primary); }
.entry-type-btn.active {
  background: var(--bg-hover); border-color: var(--gold-dim);
  color: var(--gold);
}

/* ── TRANSIT MODE SELECT ── */
.transit-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── WALK CARD ── */
.entry-walk { background: var(--bg-elevated); border-color: var(--border); }
.entry-walk:hover { border-color: var(--border-hi); }
.entry-walk.active { border-color: rgba(106,184,122,0.4); background: var(--bg-hover); }

.walk-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.walk-icon { font-size: 18px; flex-shrink: 0; padding-top: 1px; }
.walk-meta { flex: 1; min-width: 0; }
.walk-title { font-size: 12px; font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.walk-subtitle { font-size: 10px; color: var(--text-muted); font-family: 'DM Mono', monospace; }
.walk-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 3px; font-size: 9px;
  font-family: 'DM Mono', monospace; border: 0.5px solid;
  background: #0e2218; color: #6ab87a; border-color: #1a4028; margin-top: 4px;
}
[data-theme="light"] .walk-badge { background: #e8faf0; color: #1a6030; border-color: #90d8b0; }

.walk-stops { margin-top: 8px; border-top: 0.5px solid var(--border); padding-top: 8px; }
.walk-stop {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 0; border-bottom: 0.5px solid var(--border);
  font-size: 11px;
}
.walk-stop:last-child { border-bottom: none; padding-bottom: 0; }
.walk-stop-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  margin-top: 3px; border: 1.5px solid rgba(0,0,0,.3);
}
.walk-stop-info { flex: 1; min-width: 0; }
.walk-stop-name { color: var(--text-primary); font-weight: 500; }
.walk-stop-note { color: var(--text-second); font-size: 10px; margin-top: 1px; line-height: 1.4; }
.walk-stop-tag {
  font-size: 9px; padding: 1px 5px; border-radius: 3px;
  font-family: 'DM Mono', monospace; border: 0.5px solid; flex-shrink: 0; margin-top: 2px;
}
.walk-add-stop {
  width: 100%; margin-top: 6px; padding: 5px 0;
  background: transparent; border: 0.5px dashed var(--border-mid);
  border-radius: 5px; font-size: 10px; color: var(--text-muted);
  cursor: pointer; text-align: center; transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.walk-add-stop:hover { color: var(--text-primary); border-color: var(--border-hi); background: var(--bg-hover); }

/* ── ADD STOP (inside modal) ── */
.stop-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.stop-item {
  background: var(--bg-input); border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm); padding: 8px 10px;
  display: flex; align-items: flex-start; gap: 8px;
}
.stop-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.stop-item-remove {
  width: 18px; height: 18px; border-radius: 50%; background: var(--bg-hover);
  border: 0.5px solid var(--border-mid); display: flex; align-items: center;
  justify-content: center; font-size: 11px; cursor: pointer; color: var(--text-muted);
  flex-shrink: 0; margin-top: 1px; transition: all .15s;
}
.stop-item-remove:hover { color: #e86060; border-color: #5a1a1a; }
.add-stop-btn {
  width: 100%; padding: 7px 0; background: transparent;
  border: 0.5px dashed var(--border-mid); border-radius: var(--radius-sm);
  font-size: 11px; color: var(--text-muted); cursor: pointer;
  text-align: center; transition: all 0.15s; font-family: 'DM Sans', sans-serif; margin-top: 4px;
}
.add-stop-btn:hover { color: var(--text-primary); border-color: var(--border-hi); background: var(--bg-hover); }

/* ════════════════════════════════════════
   EDIT ENTRY
   ════════════════════════════════════════ */
.entry-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 6px;
}
.entry-card-header .entry-main { flex: 1; min-width: 0; }
.edit-btn {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: var(--radius-sm);
  background: transparent; border: 0.5px solid transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-faint); font-size: 13px;
  transition: all 0.15s; opacity: 0;
}
.entry-card:hover .edit-btn { opacity: 1; }
.edit-btn:hover { background: var(--bg-hover); border-color: var(--border-mid); color: var(--text-second); }

/* "Edited" badge shown after update */
.edited-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; font-family: 'DM Mono', monospace;
  color: var(--gold-dim); margin-left: 4px;
}

/* Photos-pending indicator on entry card */
.photos-pending {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-family: 'DM Mono', monospace;
  color: var(--text-muted); padding: 2px 6px; border-radius: 3px;
  background: var(--bg-hover); border: 0.5px dashed var(--border-mid);
  margin-top: 6px;
}

/* Existing media grid in edit modal */
.existing-media-grid {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px;
}
.existing-media-item {
  position: relative;
  width: 64px; height: 50px; border-radius: var(--radius-sm);
  background: var(--bg-base); border: 0.5px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  /* No overflow:hidden — delete button must be visible */
}
.existing-media-item img { width: 100%; height: 100%; object-fit: cover; }
.existing-media-item .remove-media {
  position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; z-index: 10;
  background: rgba(200,40,40,0.92); border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 11px; line-height:1;
  color: #fff; cursor: pointer; font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.media-section-label {
  font-size: 10px; color: var(--text-muted); margin-bottom: 5px;
  font-family: 'DM Mono', monospace;
}

/* ════════════════════════════════════════
   MOBILE RESPONSIVE
   ════════════════════════════════════════ */

/* Sidebar toggle button — mobile only */
.sidebar-toggle {
  display: none;
  position: absolute; bottom: 20px; right: 16px; z-index: 600;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-surface); border: 1px solid var(--border-mid);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; color: var(--text-primary);
  transition: all 0.15s;
}
.sidebar-toggle:hover { background: var(--bg-hover); }
[data-theme="light"] .sidebar-toggle { box-shadow: 0 2px 12px rgba(0,0,0,0.15); }

@media (max-width: 768px) {
  /* ── Topbar ── */
  .topbar { padding: 0 12px; height: 48px; }
  .brand-sub { display: none; }
  .topbar-nav { display: none; } /* Hide on mobile — use bottom sheet nav instead */
  .live-pill { padding: 3px 8px; font-size: 9px; }
  .login-btn { padding: 4px 10px; font-size: 11px; }

  /* ── Main layout: stack map + bottom sheet ── */
  .main { flex-direction: column; position: relative; }

  /* ── Map fills screen ── */
  #map { flex: 1; min-height: 0; }

  /* ── Filter strip: scroll horizontally, smaller ── */
  .filter-strip {
    top: 8px; left: 8px; right: 8px; max-width: none;
    border-radius: 12px; overflow-x: auto; flex-wrap: nowrap;
  }
  .filter-strip::-webkit-scrollbar { display: none; }

  /* ── Legend: hidden on mobile (too cramped) ── */
  .map-legend { display: none; }

  /* ── Zoom hint: smaller ── */
  .zoom-hint { font-size: 9px; bottom: 72px; }

  /* ── Sidebar becomes a bottom sheet ── */
  .sidebar {
    position: absolute; bottom: 0; left: 0; right: 0;
    width: 100%; height: 52px; /* collapsed: just header showing */
    border-left: none; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transition: height 0.35s cubic-bezier(0.32,0.72,0,1), background 0.3s;
    z-index: 600; overflow: hidden;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.35);
  }
  [data-theme="light"] .sidebar { box-shadow: 0 -4px 24px rgba(0,0,0,0.1); }
  .sidebar.expanded { height: 70vh; }

  /* Drag handle */
  .sidebar-header::before {
    content: '';
    display: block; width: 36px; height: 4px;
    background: var(--border-hi); border-radius: 2px;
    margin: 0 auto 10px;
  }
  .sidebar-header {
    padding: 10px 16px 10px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center;
  }
  .sidebar-header-row {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
  }
  .sidebar-city { font-size: 14px; }
  .sidebar-date { font-size: 9px; }
  .sidebar-sub  { font-size: 10px; margin-top: 1px; }

  /* ── Sidebar toggle FAB ── */
  .sidebar-toggle { display: flex; }

  /* ── Modal: full-screen bottom sheet on mobile ── */
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh; padding: 20px 20px 32px;
    border-bottom: none;
  }

  /* ── Entry cards: slightly larger tap targets ── */
  .entry-card { padding: 12px 13px; margin-bottom: 10px; }
  .edit-btn { opacity: 1; width: 32px; height: 32px; font-size: 15px; }

  /* ── Buttons: full-width friendlier ── */
  .btn-row { flex-direction: column; gap: 6px; }
  .btn-primary, .btn-secondary { width: 100%; text-align: center; padding: 11px; }

  /* ── Tag selector: bigger tap targets ── */
  .tag-option { padding: 5px 12px; font-size: 11px; }

  /* ── Entry type buttons ── */
  .entry-type-btn { padding: 10px 0; font-size: 11px; }

  /* ── Upload zone: taller ── */
  .upload-zone { padding: 22px 16px; }

  /* ── Transit mode grid: single col ── */
  .transit-mode-grid { grid-template-columns: 1fr; }

  /* ── Leaflet zoom control: move up so FAB doesn't overlap ── */
  .leaflet-control-zoom { margin-bottom: 70px !important; }
}

@media (max-width: 400px) {
  .topbar { padding: 0 10px; }
  .theme-btn { display: none; } /* save space on very small screens */
}

/* ════════════════════════════════════════
   COUNTDOWN BANNER
   ════════════════════════════════════════ */
.countdown-banner {
  flex-shrink: 0; z-index: 999; position: relative;
  background: linear-gradient(135deg, #0d1e30 0%, #111828 50%, #1a1010 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0; max-height: 0; /* hidden by default, shown via JS */
  transition: max-height 0.4s ease;
}
.countdown-banner.visible { max-height: 120px; }
.countdown-main-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; }

/* Subtle animated background shimmer */
.countdown-banner::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px, transparent 60px,
    rgba(255,255,255,0.012) 60px, rgba(255,255,255,0.012) 61px
  );
  pointer-events: none;
}

.countdown-left { display: flex; flex-direction: column; gap: 2px; }
.countdown-label {
  font-size: 9px; font-family: 'DM Mono', monospace; letter-spacing: 0.1em;
  color: #4a6a8a; text-transform: uppercase;
}
.countdown-title {
  font-family: 'Noto Serif JP', serif; font-size: 14px;
  color: #c8ddf0; font-weight: 600; letter-spacing: 0.02em;
}

.countdown-units {
  display: flex; align-items: flex-end; gap: 14px;
}
.countdown-unit { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.countdown-num {
  font-family: 'DM Mono', monospace; font-size: 22px; font-weight: 500;
  color: #e8c87a; line-height: 1; letter-spacing: -0.02em;
  min-width: 2ch; text-align: center;
}
.countdown-unit-label {
  font-family: 'DM Mono', monospace; font-size: 8px; color: #4a5a6a;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.countdown-sep {
  font-size: 18px; color: #2a3a4a; margin-bottom: 6px; font-weight: 300;
}

.countdown-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
}
.countdown-flight {
  font-size: 10px; color: #4a7aaa; font-family: 'DM Mono', monospace;
}
.countdown-dismiss {
  font-size: 10px; color: #2a3a4a; cursor: pointer; font-family: 'DM Mono', monospace;
  transition: color 0.15s; background: none; border: none; padding: 0;
}
.countdown-dismiss:hover { color: #6a8aaa; }

[data-theme="light"] .countdown-banner {
  background: linear-gradient(135deg, #e8f0fa 0%, #f0eef8 50%, #fce8e8 100%);
  border-bottom-color: var(--border);
}
[data-theme="light"] .countdown-label  { color: #7a9abA; }
[data-theme="light"] .countdown-title  { color: #1a3a5a; }
[data-theme="light"] .countdown-num    { color: #8a5a00; }
[data-theme="light"] .countdown-unit-label { color: #8a9aaa; }
[data-theme="light"] .countdown-sep    { color: #c0ccd8; }
[data-theme="light"] .countdown-flight { color: #4a6a8a; }
[data-theme="light"] .countdown-dismiss { color: #aab8c8; }

/* ════════════════════════════════════════
   EXCITEMENT / REFLECTION PANEL
   ════════════════════════════════════════ */
.day-vibe-panel {
  flex-shrink: 0; border-bottom: 0.5px solid var(--border);
  background: var(--bg-surface); overflow: hidden;
  max-height: 0; transition: max-height 0.3s ease;
}
.day-vibe-panel.open { max-height: 400px; }

.vibe-inner { padding: 11px 16px 13px; }

/* Tab row: Excited / Reflect */
.vibe-tabs {
  display: flex; gap: 0; margin-bottom: 11px;
  border: 0.5px solid var(--border-mid); border-radius: var(--radius-sm); overflow: hidden;
}
.vibe-tab {
  flex: 1; padding: 5px 0; font-size: 10px; font-weight: 500;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}
.vibe-tab.active {
  background: var(--bg-elevated); color: var(--text-primary);
}
.vibe-tab:first-child { border-right: 0.5px solid var(--border-mid); }

/* Excited list */
.excitement-list { display: flex; flex-direction: column; gap: 5px; }
.excitement-item {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 11px; color: var(--text-second); line-height: 1.45;
}
.excitement-item::before {
  content: '✦'; font-size: 8px; color: var(--gold-dim);
  margin-top: 2px; flex-shrink: 0;
}

/* Empty excitement (upcoming day) */
.excitement-empty {
  font-size: 11px; color: var(--text-faint); font-style: italic;
  padding: 4px 0;
}

/* Reflection area */
.reflection-text {
  font-size: 11px; color: var(--text-second); line-height: 1.65;
}
.reflection-text p { margin: 0 0 6px; }
.reflection-text p:last-child { margin: 0; }

.reflection-empty {
  display: flex; flex-direction: column; gap: 8px;
}
.reflection-placeholder {
  font-size: 11px; color: var(--text-faint); font-style: italic; line-height: 1.5;
}
.reflection-write-btn {
  align-self: flex-start; padding: 5px 12px; background: transparent;
  border: 0.5px dashed var(--border-mid); border-radius: var(--radius-sm);
  font-size: 10px; color: var(--text-muted); cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all 0.15s;
}
.reflection-write-btn:hover { color: var(--text-primary); border-color: var(--border-hi); background: var(--bg-hover); }

/* Vibe toggle button in sidebar header */
.vibe-toggle-btn {
  padding: 3px 9px; border-radius: 12px; font-size: 9px; font-weight: 500;
  cursor: pointer; border: 0.5px solid var(--border-mid);
  background: var(--bg-input); color: var(--text-muted);
  font-family: 'DM Mono', monospace; transition: all 0.15s; white-space: nowrap;
}
.vibe-toggle-btn:hover { border-color: var(--border-hi); color: var(--text-primary); }
.vibe-toggle-btn.active { border-color: var(--gold-dim); color: var(--gold); background: var(--bg-hover); }

@media (max-width: 768px) {
  .countdown-banner.visible { padding: 10px 14px; }
  .countdown-title { font-size: 12px; }
  .countdown-num { font-size: 18px; }
  .countdown-units { gap: 10px; }
  .countdown-right { display: none; }
}

/* ════════════════════════════════════════
   PHOTO CAROUSEL
   ════════════════════════════════════════ */
.carousel-overlay {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(0,0,0,0.96);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.carousel-overlay.open { opacity: 1; pointer-events: all; }

/* Top bar */
.carousel-topbar {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 0.5px solid rgba(255,255,255,0.07);
}
.carousel-counter {
  font-family: 'DM Mono', monospace; font-size: 12px; color: rgba(255,255,255,0.4);
}
.carousel-action-btn {
  padding: 5px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06); border: 0.5px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7); font-size: 12px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all 0.15s;
}
.carousel-action-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.carousel-close {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.5);
  font-size: 18px; cursor: pointer; transition: all 0.15s;
}
.carousel-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Main media area */
.carousel-main {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; min-height: 0;
}
.carousel-media {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; padding: 16px 64px;
}
.carousel-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
}
.carousel-video {
  max-width: 100%; max-height: 100%; border-radius: 3px;
  outline: none;
}
.carousel-video-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-height: 200px;
  color: rgba(255,255,255,0.5); text-align: center; padding: 24px;
}

/* Nav arrows */
.carousel-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 0.5px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 20px; color: rgba(255,255,255,0.6);
  transition: all 0.15s; z-index: 10;
}
.carousel-nav:hover { background: rgba(255,255,255,0.16); color: #fff; }
#carousel-prev { left: 12px; }
#carousel-next { right: 12px; }

/* Caption area */
.carousel-caption-area {
  flex-shrink: 0; padding: 10px 18px 8px;
  min-height: 44px; display: flex; align-items: center;
}
.carousel-caption-text {
  font-size: 13px; color: rgba(255,255,255,0.75); line-height: 1.5;
  font-style: italic; text-align: center; width: 100%;
  max-width: 640px; margin: 0 auto;
}
.carousel-caption-empty {
  font-size: 11px; color: rgba(255,255,255,0.2); text-align: center;
  width: 100%; font-family: 'DM Mono', monospace; font-style: italic;
}
.carousel-caption-row {
  display: flex; gap: 8px; align-items: center; width: 100%; max-width: 560px; margin: 0 auto;
}
.carousel-caption-input {
  flex: 1; background: rgba(255,255,255,0.07) !important;
  border-color: rgba(255,255,255,0.15) !important; color: #fff !important;
  font-size: 13px !important;
}
.carousel-caption-input::placeholder { color: rgba(255,255,255,0.25) !important; }
.carousel-caption-input:focus { border-color: rgba(232,200,122,0.5) !important; }
.carousel-caption-save {
  flex-shrink: 0; padding: 7px 14px; background: var(--gold);
  border: none; border-radius: var(--radius-sm); font-size: 12px;
  font-weight: 500; color: #1a1400; cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: opacity 0.15s;
}
.carousel-caption-save:hover { opacity: 0.85; }

/* Film strip */
.carousel-strip-wrap {
  flex-shrink: 0; border-top: 0.5px solid rgba(255,255,255,0.07);
  padding: 10px 14px; background: rgba(0,0,0,0.4);
}
.carousel-strip {
  display: flex; gap: 6px; overflow-x: auto; justify-content: center;
  padding-bottom: 2px;
}
.carousel-strip::-webkit-scrollbar { height: 2px; }
.carousel-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 1px; }
.strip-thumb {
  flex-shrink: 0; width: 52px; height: 40px; border-radius: 4px;
  overflow: hidden; cursor: pointer; position: relative;
  border: 1.5px solid transparent; transition: border-color 0.15s;
  background: rgba(255,255,255,0.04);
}
.strip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.strip-thumb.active { border-color: var(--gold); }
.strip-thumb:hover:not(.active) { border-color: rgba(255,255,255,0.3); }
.strip-video-icon {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; font-size: 18px;
}
.strip-caption-dot {
  position: absolute; bottom: 3px; right: 3px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 4px rgba(232,200,122,0.6);
}

/* ── Caption badge on entry card media thumbs ── */
.media-thumb-wrap {
  position: relative; display: inline-block; flex-shrink: 0;
}
.media-caption-badge {
  position: absolute; bottom: 2px; left: 2px; right: 2px;
  background: rgba(0,0,0,0.65); border-radius: 2px;
  font-size: 8px; color: rgba(255,255,255,0.85); padding: 1px 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3; pointer-events: none;
}

/* ── "Add captions" prompt after upload ── */
.caption-prompt {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  background: rgba(232,200,122,0.07); border: 0.5px solid rgba(232,200,122,0.2);
  font-size: 11px; color: var(--gold-dim); cursor: pointer;
  transition: all 0.15s; font-family: 'DM Sans', sans-serif;
}
.caption-prompt:hover { background: rgba(232,200,122,0.12); color: var(--gold); }

@media (max-width: 768px) {
  .carousel-media { padding: 12px 44px; }
  .carousel-nav { width: 36px; height: 36px; font-size: 16px; }
  #carousel-prev { left: 4px; }
  #carousel-next { right: 4px; }
  .strip-thumb { width: 42px; height: 32px; }
  .carousel-caption-row { max-width: 100%; }
}

/* ════════════════════════════════════════
   DEPARTURE EDITOR (in countdown banner)
   ════════════════════════════════════════ */
.countdown-edit-btn {
  font-size: 10px; color: #3a5a7a; cursor: pointer;
  font-family: 'DM Mono', monospace; background: none; border: none;
  padding: 0; transition: color .15s; margin-left: 6px;
}
.countdown-edit-btn:hover { color: #6a9aba; }

.departure-editor {
  display: none; align-items: center; gap: 8px; margin-top: 6px;
  padding: 8px 10px; background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.1); border-radius: 6px;
}
.departure-editor.show { display: flex; }
.departure-editor input[type="datetime-local"] {
  background: rgba(255,255,255,0.06); border: 0.5px solid rgba(255,255,255,0.15);
  border-radius: 4px; color: #c8ddf0; font-family: 'DM Mono', monospace;
  font-size: 11px; padding: 4px 8px; outline: none;
}
.departure-editor input:focus { border-color: rgba(232,200,122,0.4); }
.departure-save-btn {
  padding: 4px 10px; background: rgba(232,200,122,0.15);
  border: 0.5px solid rgba(232,200,122,0.3); border-radius: 4px;
  color: #e8c87a; font-size: 11px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; white-space: nowrap; transition: all .15s;
}
.departure-save-btn:hover { background: rgba(232,200,122,0.25); }

[data-theme="light"] .departure-editor {
  background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .departure-editor input[type="datetime-local"] {
  background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.15); color: #1a3a5a;
}

/* ════════════════════════════════════════
   VIBE PANEL — EDITABLE STATES
   ════════════════════════════════════════ */
.vibe-edit-btn {
  float: right; font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: transparent; border: 0.5px solid var(--border-mid);
  color: var(--text-muted); cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all .15s; margin-top: 1px;
}
.vibe-edit-btn:hover { border-color: var(--border-hi); color: var(--text-primary); }

/* Inline excitement editor */
.excitement-editor { display: flex; flex-direction: column; gap: 5px; }
.excitement-item-row {
  display: flex; align-items: center; gap: 6px;
}
.excitement-item-input {
  flex: 1; padding: 5px 9px; background: var(--bg-input);
  border: 0.5px solid var(--border-mid); border-radius: var(--radius-sm);
  color: var(--text-primary); font-family: 'DM Sans', sans-serif; font-size: 11px;
  outline: none; transition: border-color .15s;
}
.excitement-item-input:focus { border-color: var(--gold-dim); }
.excitement-item-del {
  width: 20px; height: 20px; border-radius: 50%; background: var(--bg-hover);
  border: 0.5px solid var(--border-mid); color: var(--text-muted);
  font-size: 12px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: all .15s;
}
.excitement-item-del:hover { color: #e86060; border-color: #5a1a1a; }
.excitement-add-row {
  display: flex; gap: 6px; margin-top: 2px;
}
.excitement-add-input {
  flex: 1; padding: 5px 9px; background: var(--bg-input);
  border: 0.5px dashed var(--border-mid); border-radius: var(--radius-sm);
  color: var(--text-primary); font-family: 'DM Sans', sans-serif; font-size: 11px;
  outline: none;
}
.excitement-add-input:focus { border-color: var(--gold-dim); border-style: solid; }
.vibe-save-btn {
  margin-top: 8px; padding: 5px 14px; background: var(--gold);
  border: none; border-radius: var(--radius-sm); font-size: 11px;
  font-weight: 500; color: #1a1400; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: opacity .15s;
}
.vibe-save-btn:hover { opacity: .85; }

/* Day title editor (inline in sidebar header) */
.sidebar-city-wrap {
  display: flex; align-items: center; gap: 6px; cursor: default;
}
.day-title-edit-btn {
  font-size: 11px; color: var(--text-faint); cursor: pointer;
  background: none; border: none; padding: 0; transition: color .15s;
  opacity: 0; transition: opacity .15s;
}
.sidebar-header:hover .day-title-edit-btn { opacity: 1; }
.day-title-edit-btn:hover { color: var(--text-second); }
.day-title-input {
  font-family: 'Noto Serif JP', serif; font-size: 15px;
  color: var(--text-primary); background: transparent;
  border: none; border-bottom: 1px solid var(--gold-dim);
  outline: none; width: 100%; padding: 1px 0;
}
.day-sub-input {
  font-size: 11px; color: var(--text-second); background: transparent;
  border: none; border-bottom: 1px solid var(--border-mid);
  outline: none; width: 100%; padding: 1px 0; font-family: 'DM Sans', sans-serif;
}

/* ════════════════════════════════════════
   VIEW PANELS (Timeline / Gallery)
   ════════════════════════════════════════ */
.view-panel {
  display: none; flex: 1; overflow: hidden; flex-direction: column;
}
.view-panel.active { display: flex; }

/* ── Timeline ── */
.timeline-wrap {
  flex: 1; overflow-y: auto; padding: 24px 28px;
  background: var(--bg-base);
}
.timeline-wrap::-webkit-scrollbar { width: 3px; }
.timeline-wrap::-webkit-scrollbar-thumb { background: var(--border-mid); }

.timeline-day-group { margin-bottom: 32px; }
.timeline-day-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px;
}
.timeline-day-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  background: var(--gold); border: 2px solid var(--bg-base);
  box-shadow: 0 0 0 2px var(--gold-dim);
}
.timeline-day-dot.current { background: var(--red-live); box-shadow: 0 0 0 2px #e8272a55; }
.timeline-day-dot.future  { background: var(--border-mid); box-shadow: 0 0 0 2px var(--border); }
.timeline-day-label { font-size: 11px; font-family: 'DM Mono', monospace; color: var(--text-muted); }
.timeline-day-title { font-family: 'Noto Serif JP', serif; font-size: 15px; color: var(--text-primary); font-weight: 600; }

.timeline-spine {
  display: flex; gap: 0; margin-left: 5px;
}
.timeline-line {
  width: 2px; background: var(--border); margin: 0 5px;
  flex-shrink: 0; border-radius: 1px;
}
.timeline-entries { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 4px 12px; }

.timeline-entry {
  background: var(--bg-elevated); border: 0.5px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 13px;
  cursor: pointer; transition: all .15s;
}
.timeline-entry:hover { border-color: var(--border-hi); background: var(--bg-hover); }
.timeline-entry-time  { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--text-faint); margin-bottom: 3px; }
.timeline-entry-place { font-size: 12px; font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.timeline-entry-note  { font-size: 11px; color: var(--text-second); line-height: 1.4; }
.timeline-entry-meta  { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.timeline-media-count {
  font-size: 9px; font-family: 'DM Mono', monospace; color: var(--text-muted);
  padding: 1px 5px; border-radius: 3px; background: var(--bg-hover); border: 0.5px solid var(--border-mid);
}

/* ── Gallery ── */
.gallery-wrap {
  flex: 1; overflow-y: auto; padding: 20px;
  background: var(--bg-base);
}
.gallery-wrap::-webkit-scrollbar { width: 3px; }
.gallery-wrap::-webkit-scrollbar-thumb { background: var(--border-mid); }

.gallery-day-section { margin-bottom: 28px; }
.gallery-day-label {
  font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-muted);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.gallery-day-label::after {
  content: ''; flex: 1; height: 0.5px; background: var(--border);
}

.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px;
}
.gallery-thumb {
  aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden;
  cursor: pointer; position: relative;
  background: var(--bg-elevated); border: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.gallery-thumb:hover { border-color: var(--gold-dim); transform: scale(1.02); }
.gallery-thumb img   { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb-icon  { font-size: 28px; }
.gallery-thumb-cap   {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  padding: 12px 6px 5px; font-size: 9px; color: rgba(255,255,255,0.85);
  line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gallery-thumb-video {
  position: absolute; top: 5px; right: 5px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.6); display: flex; align-items: center;
  justify-content: center; font-size: 9px;
}
.gallery-empty {
  text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 12px;
}

/* ── Auth gate overlay ── */
.auth-gate {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(var(--bg-base-raw,13,17,23), 0.7); backdrop-filter: blur(4px);
  z-index: 50; flex-direction: column; gap: 12px; text-align: center;
}
.auth-gate-icon { font-size: 32px; }
.auth-gate-msg  { font-size: 13px; color: var(--text-second); }
.auth-gate-btn  {
  padding: 7px 20px; background: var(--gold); border: none;
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  color: #1a1400; cursor: pointer; font-family: 'DM Sans', sans-serif;
}

/* Edit-mode: photo delete button */
.media-thumb-wrap { position: relative; }
.media-delete-btn {
  position: absolute; top: -5px; right: -5px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #c0392b; border: 1.5px solid var(--bg-base);
  display: none; align-items: center; justify-content: center;
  font-size: 9px; color: #fff; cursor: pointer; z-index: 5;
  line-height: 1;
}
.entry-card.edit-mode .media-delete-btn { display: flex; }

@media (max-width: 768px) {
  .timeline-wrap  { padding: 16px; }
  .gallery-grid   { grid-template-columns: repeat(auto-fill, minmax(90px,1fr)); gap: 4px; }
  .gallery-wrap   { padding: 14px; }
}

/* ── Hide edit controls when logged out ── */
/* Edit buttons on entry cards */
body:not(.logged-in) .edit-btn { display: none !important; }
/* Vibe edit buttons */
body:not(.logged-in) .vibe-edit-btn { display: none !important; }
/* Day title edit pencil */
body:not(.logged-in) .day-title-edit-btn { display: none !important; }
/* Countdown edit button */
body:not(.logged-in) #cd-edit-btn { display: none !important; }
/* Add entry button — hidden when logged out */
body:not(.logged-in) .add-entry-btn { display: none !important; }
/* Photos-pending nudge — only meaningful when logged in */
body:not(.logged-in) .photos-pending { display: none !important; }

/* ── Timeline photo strip ── */
.timeline-photo-strip {
  display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap;
}
.timeline-photo-thumb {
  width: 52px; height: 42px; border-radius: 4px;
  background: var(--bg-hover); border: 0.5px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; overflow: hidden; position: relative;
  transition: border-color .15s, transform .15s; flex-shrink: 0;
}
.timeline-photo-thumb:hover { border-color: var(--gold-dim); transform: scale(1.04); }
.timeline-photo-thumb img   { width: 100%; height: 100%; object-fit: cover; }
.timeline-photo-more {
  background: var(--bg-elevated); font-size: 11px; color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}
.timeline-video-badge {
  position: absolute; top: 3px; right: 3px; width: 14px; height: 14px;
  background: rgba(0,0,0,.6); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 7px; color: #fff;
}

/* ── Day config modal ── */
.day-config-row {
  display: grid; grid-template-columns: 48px 1fr 1fr; gap: 8px;
  align-items: center; padding: 6px 0;
  border-bottom: 0.5px solid var(--border);
}
.day-config-row:last-child { border-bottom: none; }
.day-config-num {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); text-align: center;
}
.day-config-input {
  padding: 5px 8px; background: var(--bg-input); border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: 'DM Sans', sans-serif; font-size: 11px; outline: none;
  transition: border-color .15s;
}
.day-config-input:focus { border-color: var(--gold-dim); }
.day-config-header {
  display: grid; grid-template-columns: 48px 1fr 1fr; gap: 8px;
  padding: 0 0 8px; font-size: 10px; font-family: 'DM Mono', monospace;
  color: var(--text-muted); border-bottom: 0.5px solid var(--border); margin-bottom: 4px;
}
.day-config-list { max-height: 320px; overflow-y: auto; padding-right: 4px; }
.day-config-list::-webkit-scrollbar { width: 3px; }
.day-config-list::-webkit-scrollbar-thumb { background: var(--border-mid); }
.day-config-actions {
  display: flex; gap: 8px; margin-top: 10px; padding-top: 10px;
  border-top: 0.5px solid var(--border);
}
.add-day-btn {
  padding: 5px 12px; background: transparent; border: 0.5px dashed var(--border-mid);
  border-radius: var(--radius-sm); font-size: 11px; color: var(--text-muted);
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all .15s;
}
.add-day-btn:hover { border-color: var(--border-hi); color: var(--text-primary); }
.del-day-btn {
  width: 22px; height: 22px; border-radius: 50%; background: var(--bg-hover);
  border: 0.5px solid var(--border-mid); color: var(--text-muted);
  font-size: 13px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: all .15s;
}
.del-day-btn:hover { color: #e86060; border-color: #5a1a1a; background: #2a0a0a; }

/* Settings gear button in topbar */
.settings-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--bg-elevated); border: 0.5px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: all .15s; color: var(--text-second);
}
.settings-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Demo/Live mode pill ── */
.demo-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 11px; border-radius: 20px; font-size: 10px; font-weight: 500;
  cursor: pointer; font-family: 'DM Mono', monospace;
  transition: background .2s, color .2s, border-color .2s;
  white-space: nowrap; border: 0.5px solid transparent;
}
.demo-pill-demo {
  background: rgba(232,200,122,0.10);
  border-color: rgba(232,200,122,0.28);
  color: var(--gold);
}
.demo-pill-live {
  background: rgba(92,184,92,0.10);
  border-color: rgba(92,184,92,0.28);
  color: var(--green-live);
}
.demo-pill:hover { opacity: 0.8; }

/* ════════════════════════════════════════
   MOBILE BOTTOM NAV BAR
   ════════════════════════════════════════ */
.bottom-nav {
  display: none; /* mobile only */
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 700;
  background: var(--bg-surface); border-top: 1px solid var(--border);
  height: 56px; align-items: stretch; justify-content: space-around;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
}
[data-theme="light"] .bottom-nav { box-shadow: 0 -2px 12px rgba(0,0,0,0.08); }
.bottom-nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; cursor: pointer;
  background: none; border: none; color: var(--text-muted);
  font-family: 'DM Sans', sans-serif; font-size: 10px; font-weight: 500;
  transition: color .15s; padding: 0;
}
.bottom-nav-btn .nav-icon { font-size: 18px; line-height: 1; }
.bottom-nav-btn.active { color: var(--gold); }
.bottom-nav-btn:hover:not(.active) { color: var(--text-second); }

@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  /* Push content above the bottom nav */
  .main { padding-bottom: 56px; }
  /* Sidebar FAB moves up above bottom nav */
  .sidebar-toggle { bottom: 68px; }
  /* Leaflet zoom controls above bottom nav */
  .leaflet-control-zoom { margin-bottom: 70px !important; }
}

/* ════════════════════════════════════════
   CAROUSEL DELETE BUTTON
   ════════════════════════════════════════ */
.carousel-delete-btn {
  padding: 5px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06); border: 0.5px solid rgba(255,80,60,0.4);
  color: #ff8070; font-size: 12px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all .15s;
  display: none; align-items: center; gap: 5px;
}
.carousel-delete-btn:hover { background: rgba(192,57,43,0.25); border-color: rgba(255,80,60,0.7); color: #ffaaaa; }
body.logged-in .carousel-delete-btn { display: inline-flex; }

/* ── Demo notice banner ── */
.demo-notice-banner {
  flex-shrink: 0; z-index: 998;
  background: linear-gradient(90deg, rgba(232,200,122,0.07) 0%, rgba(232,200,122,0.03) 100%);
  border-bottom: 0.5px solid rgba(232,200,122,0.18);
  padding: 7px 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.demo-notice-text {
  font-size: 11px; color: var(--gold-dim); line-height: 1.45; flex: 1;
}
.demo-notice-text strong { color: var(--gold); font-weight: 600; }
.demo-notice-action {
  padding: 4px 12px; border-radius: 14px; font-size: 10px; font-weight: 500;
  cursor: pointer; background: rgba(232,200,122,0.12);
  border: 0.5px solid rgba(232,200,122,0.3); color: var(--gold);
  font-family: 'DM Sans', sans-serif; white-space: nowrap; transition: all .15s;
}
.demo-notice-action:hover { background: rgba(232,200,122,0.22); }

[data-theme="light"] .demo-notice-banner {
  background: linear-gradient(90deg, rgba(176,120,32,0.06) 0%, rgba(176,120,32,0.02) 100%);
  border-bottom-color: rgba(176,120,32,0.2);
}
[data-theme="light"] .demo-notice-text  { color: #7a5a10; }
[data-theme="light"] .demo-notice-text strong { color: #5a3a00; }
[data-theme="light"] .demo-notice-action { color: #5a3a00; border-color: rgba(90,58,0,0.25); background: rgba(90,58,0,0.07); }

/* ── Delete entry button ── */
.delete-entry-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: transparent; border: 0.5px solid transparent;
  color: var(--text-faint); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.delete-entry-btn:hover {
  background: rgba(200,40,40,0.15); border-color: rgba(200,40,40,0.3);
  color: #e86060;
}
body:not(.logged-in) .delete-entry-btn { display: none !important; }
