:root {
  --blue: #0b66c3;
  --green: #16955f;
  --ink: #0e2233;
  --muted: #5e7180;
  --line: #d8e7ed;
  --soft: #eef8f5;
  --bg: #f6fbfd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto minmax(110px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 44px);
  background: linear-gradient(90deg, #e7f5ff, #e8f8ef);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.brand img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
}

.header-actions {
  display: flex;
  align-items: center;
}

.header-actions-left {
  justify-content: flex-start;
}

.header-actions-right {
  justify-content: flex-end;
}

.topbar h1,
.panel h2 {
  margin: 0;
}

.topbar p,
.muted {
  color: var(--muted);
  margin: 4px 0 0;
}

main {
  padding: 24px clamp(16px, 4vw, 44px);
}

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 10px 26px rgba(14, 34, 51, 0.06);
}

#login {
  max-width: 440px;
  margin: 40px auto;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  font-weight: 650;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--blue);
  color: white;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

.ghost {
  background: white;
  color: var(--blue);
  border: 1px solid var(--line);
}

#loginButton {
  width: 100%;
  margin-top: 18px;
  background: var(--green);
}

.hidden {
  display: none !important;
}

#tripOverview {
  max-width: 1120px;
  margin: 0 auto;
}

.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.trip-card {
  display: grid;
  align-content: start;
  min-height: 240px;
  gap: 8px;
  padding: 16px;
  border: 1px solid #cfe9df;
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(145deg, #eef8f5, #eaf5ff);
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(14, 34, 51, 0.06);
}

.trip-card:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.trip-card strong {
  font-size: 1.08rem;
}

.trip-card span,
.trip-card small {
  color: var(--muted);
}

.trip-preview {
  display: block;
  width: 100%;
  aspect-ratio: 13 / 6;
  margin-bottom: 4px;
  border-radius: 8px;
  overflow: hidden;
}

.trip-preview-bg {
  fill: #dff0f8;
}

.trip-preview-grid {
  fill: none;
  stroke: rgba(11, 102, 195, 0.12);
  stroke-width: 1;
}

.trip-preview-route-shadow,
.trip-preview-route {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trip-preview-route-shadow {
  stroke: rgba(14, 34, 51, 0.18);
  stroke-width: 8;
}

.trip-preview-route {
  stroke: var(--green);
  stroke-width: 4;
}

.trip-preview-start {
  fill: white;
  stroke: var(--green);
  stroke-width: 3;
}

.trip-preview-end {
  fill: var(--blue);
  stroke: white;
  stroke-width: 3;
}

.trip-preview-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--muted);
  background: repeating-linear-gradient(
    135deg,
    #e7f5ff,
    #e7f5ff 10px,
    #eef8f5 10px,
    #eef8f5 20px
  );
  border: 1px solid #c9dfe8;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 1120px;
  margin: 0 auto;
  gap: 18px;
  align-items: start;
}

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.route-panel {
  display: grid;
  gap: 18px;
}

.summaries-panel,
.stations-panel {
  display: grid;
  gap: 12px;
}

#map {
  height: min(62vh, 620px);
  min-height: 380px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.summary-list,
.station-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
}

.summary,
.station {
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid #cfe9df;
}

.station {
  display: grid;
  gap: 12px;
}

.summary strong,
.station strong {
  display: block;
  margin-bottom: 6px;
}

.station-copy span {
  color: var(--muted);
  font-size: 0.92rem;
}

.station-copy p {
  margin: 8px 0 0;
}

.station-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  margin-right: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  color: white;
  background: #1677b8;
  font-size: 0.78rem;
  line-height: 1;
}

.station-copy .station-number {
  color: white;
}

.station-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  align-items: start;
  gap: 10px;
}

.media-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #c9dfe8;
  background: #f9fdff;
  cursor: zoom-in;
}

.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.media-play {
  position: absolute;
  inset: auto auto 8px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: white;
  background: rgba(11, 102, 195, 0.92);
  font-size: 0.85rem;
}

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  grid-template-columns: minmax(46px, 80px) minmax(0, 1fr) minmax(46px, 80px);
  align-items: center;
  gap: 10px;
  padding: 22px;
  background: rgba(5, 18, 28, 0.88);
}

.lightbox-stage {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 0;
  min-width: 0;
}

.lightbox-stage img,
.lightbox-stage video {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  background: black;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.lightbox-stage figcaption {
  color: white;
  font-weight: 700;
}

.lightbox-close,
.lightbox-nav {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: white;
  background: rgba(11, 102, 195, 0.88);
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.8rem;
  line-height: 1;
}

.lightbox-nav {
  width: 52px;
  min-height: 72px;
  padding: 0;
  justify-self: center;
  border-radius: 8px;
  font-size: 2.4rem;
  line-height: 1;
}

.station-empty {
  margin: 0;
}

.station-marker-wrap {
  background: transparent;
  border: 0;
}

.station-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 2px solid white;
  color: white;
  background: #1677b8;
  box-shadow: 0 4px 12px rgba(22, 57, 90, 0.25);
  font: 700 12px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (max-width: 850px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .brand {
    order: 1;
  }

  .header-actions-left {
    order: 2;
    justify-content: center;
  }

  .header-actions-right {
    order: 3;
    justify-content: center;
  }

  .section-head {
    display: grid;
  }

  .media-lightbox {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: 12px;
  }

  .lightbox-nav {
    width: 40px;
    min-height: 58px;
  }
}
