:root {
  --bg: #fdf6ec;
  --bg-elevated: #ffffff;
  --text: #3b3226;
  --text-muted: #8a7c6a;
  --accent: #e2725b;
  --accent-dark: #c8583f;
  --border: #ecdfca;
  --completed: #6a9c78;
  --active: #e2725b;
  --upcoming: #c9bfae;
  --shadow: 0 2px 10px rgba(60, 45, 25, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1815;
    --bg-elevated: #262019;
    --text: #f2e9db;
    --text-muted: #a89a84;
    --accent: #ef8567;
    --accent-dark: #f2a084;
    --border: #3a3128;
    --completed: #7fbd8e;
    --active: #ef8567;
    --upcoming: #4a4238;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 2rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
}

.topbar h1 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 700;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.status-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.status-label {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
}

.status-updated {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.status-controls {
  display: flex;
  gap: 0.6rem;
}

.photo-nudge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: white;
  flex: 1;
}

.btn-primary:active { background: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  background: var(--border);
  color: var(--text);
}

.hero-card { display: flex; flex-direction: column; }

.carousel-wrap {
  position: relative;
  height: 320px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--border);
}

.carousel-slide {
  height: 100%;
  width: 100%;
  cursor: pointer;
}

.carousel-slide img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  display: block;
}

.carousel-play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  color: white;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-arrow-left { left: 10px; }
.carousel-arrow-right { right: 10px; }
.carousel-arrow:hover { background: rgba(0, 0, 0, 0.55); }

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  padding: 0;
}
.carousel-dot.active { background: white; }

.map-card { padding: 0; overflow: hidden; }

#map {
  height: 340px;
  width: 100%;
  border-radius: 16px;
}

h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.section-header h2 { margin: 0; }

.photo-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.media-thumb {
  position: relative;
  height: 84px;
  width: 84px;
  flex: none;
  cursor: pointer;
}

.media-thumb img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  pointer-events: none;
}

.leg-photos {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  margin-top: 0.6rem;
}

#timeline {
  display: flex;
  flex-direction: column;
}

.step {
  display: flex;
  gap: 0.75rem;
  position: relative;
  padding-bottom: 1.1rem;
}

.step:last-child { padding-bottom: 0; }

.step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 24px;
}

.step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--upcoming);
  flex: none;
  margin-top: 2px;
}

.step-dot.completed { background: var(--completed); }
.step-dot.active {
  background: var(--active);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--active) 25%, transparent);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--active) 25%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--active) 12%, transparent); }
}

.step-line {
  width: 2px;
  flex: 1;
  background: var(--upcoming);
  margin-top: 2px;
}
.step-line.completed { background: var(--completed); }

.step-body { flex: 1; padding-top: 0; }

.step-title {
  font-weight: 700;
  font-size: 0.98rem;
}

.step-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.step-status-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.step-status-pill.completed { background: color-mix(in srgb, var(--completed) 25%, transparent); color: var(--completed); }
.step-status-pill.active { background: color-mix(in srgb, var(--active) 22%, transparent); color: var(--active); }
.step-status-pill.upcoming { background: var(--upcoming); color: var(--text-muted); }

.leg-actions {
  margin-top: 0.5rem;
}

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 1rem;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 10, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.login-card {
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow);
}

.login-card h2 { text-transform: none; color: var(--text); margin-bottom: 0.4rem; }
.login-card p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0; }

.login-card input[type="password"],
.login-card input[type="text"] {
  width: 100%;
  padding: 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin: 0.5rem 0;
  font-family: inherit;
}

.place-results {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 0.4rem;
}

.place-result {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}
.place-result:hover { background: var(--border); }

.place-selected {
  background: color-mix(in srgb, var(--completed) 15%, transparent);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.moment-card {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}
.moment-card:last-child { border-bottom: none; }

.moment-title { font-weight: 700; font-size: 0.98rem; }
.moment-sub { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.1rem; }

.lodging-card {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}
.lodging-card:last-child { border-bottom: none; }

.lodging-name { font-weight: 700; font-size: 0.98rem; }
.lodging-dates { color: var(--accent); font-size: 0.82rem; font-weight: 600; margin-top: 0.1rem; }
.lodging-sub { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.1rem; }

.lodging-date-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.lodging-date-label input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
}

.albums-list {
  display: flex;
  gap: 0.8rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.album-card {
  flex: none;
  width: 108px;
  cursor: pointer;
  text-align: center;
}

.album-card img {
  width: 108px;
  height: 108px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.album-label {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.92);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
}

.lightbox-actions {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 0.5rem;
}

.lightbox-action-btn {
  border: none;
  border-radius: 20px;
  padding: 0.5rem 0.9rem;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.lightbox-action-btn:hover { background: rgba(255, 255, 255, 0.28); }
#lightbox-delete:hover { background: rgba(220, 60, 60, 0.5); }

.lightbox-move-menu {
  position: absolute;
  top: 62px;
  left: 16px;
  max-width: calc(100% - 32px);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: #2a2420;
  color: white;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.lightbox-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 900px;
  padding: 0 1rem;
}

.lightbox-content .carousel-arrow {
  position: static;
  transform: none;
  flex: none;
  background: rgba(255, 255, 255, 0.15);
}
.lightbox-content .carousel-arrow:hover { background: rgba(255, 255, 255, 0.3); }

.lightbox-slide {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-slide img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 6px;
  display: block;
}

.lightbox-video-link {
  color: white;
  font-size: 1.4rem;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.12);
  padding: 2rem 3rem;
  border-radius: 12px;
}

.lightbox-counter {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.guestbook-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.guestbook-form input,
.guestbook-form textarea {
  padding: 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.guestbook-form textarea {
  min-height: 70px;
  resize: vertical;
}

.guestbook-entry {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.guestbook-entry:last-child { border-bottom: none; }

.guestbook-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.guestbook-author { font-weight: 700; font-size: 0.9rem; }
.guestbook-time { color: var(--text-muted); font-size: 0.75rem; flex: none; }
.guestbook-message { font-size: 0.9rem; margin-top: 0.2rem; white-space: pre-wrap; }

.login-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.login-actions .btn { flex: 1; }

.error-text {
  color: var(--accent);
  font-size: 0.85rem;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--bg-elevated);
  color: var(--text);
}

.photo-pin {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.photo-pin img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.plane-icon, .airport-icon, .moment-icon, .lodging-icon {
  font-size: 1.4rem;
  line-height: 1;
  text-align: center;
}

@media (max-width: 480px) {
  .status-label { font-size: 1.15rem; }
  #map { height: 280px; }
  .carousel-wrap { height: 240px; }
}
