:root {
  --bg: oklch(0.95 0.02 70);
  --panel: oklch(0.985 0.01 80 / 0.92);
  --panel-strong: oklch(0.9 0.02 70 / 0.9);
  --text: oklch(0.26 0.03 270);
  --muted: oklch(0.5 0.03 260);
  --line-neutral: oklch(0.75 0.02 260);
  --grid: oklch(0.84 0.02 80 / 0.45);
  --shadow: 0 30px 80px oklch(0.45 0.03 30 / 0.14);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Outfit", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, oklch(0.92 0.07 235 / 0.85), transparent 30%),
    radial-gradient(circle at top right, oklch(0.94 0.08 20 / 0.45), transparent 28%),
    linear-gradient(135deg, oklch(0.97 0.015 90), oklch(0.92 0.025 240));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black, transparent 80%);
}

.page-shell {
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  padding: clamp(12px, 1.6vw, 20px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(12px, 1.6vw, 18px);
}

.detail-card,
.map-card,
.presentation-footer {
  border: 1px solid oklch(0.82 0.02 80 / 0.75);
  border-radius: 28px;
  box-shadow: var(--shadow);
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.panel-block {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, oklch(0.99 0.01 90 / 0.92), oklch(0.93 0.02 230 / 0.46));
}

.panel-block.compact {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.panel-label,
.detail-topline {
  font: 700 0.8rem/1 "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: oklch(0.47 0.04 255);
}

.panel-actions {
  display: flex;
  gap: 10px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: 700 0.96rem/1 "Space Grotesk", sans-serif;
  cursor: pointer;
  transition:
    transform 180ms var(--ease-out),
    opacity 180ms var(--ease-out),
    background-color 180ms var(--ease-out),
    color 180ms var(--ease-out);
}

button:hover {
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0) scale(0.98);
}

.primary-button {
  color: oklch(0.99 0.01 80);
  background: linear-gradient(135deg, oklch(0.39 0.09 250), oklch(0.57 0.12 320));
}

.ghost-button {
  color: var(--text);
  background: oklch(0.94 0.02 85);
}

.active-badge,
.step-indicator {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--panel-strong);
  font-weight: 700;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: oklch(0.96 0.01 80);
  font-size: 0.92rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 0.8fr);
  gap: clamp(18px, 2.8vw, 28px);
  min-height: 0;
  overflow: hidden;
}

.map-card {
  overflow: hidden;
  min-height: 0;
}

.map-frame {
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 1vw, 12px);
}

#metroMap {
  width: 100%;
  height: 100%;
  display: block;
}

.detail-card {
  padding: 22px;
  align-self: stretch;
  position: relative;
  top: auto;
  min-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-name {
  margin: 0;
  padding: 0 clamp(20px, 2.8vw, 44px);
  font: 700 clamp(2.2rem, 3vw, 3.1rem)/0.95 "Space Grotesk", sans-serif;
  letter-spacing: -0.04em;
  color: oklch(0.2 0.03 260);
  opacity: 0;
  transform: translateY(8px);
  min-height: 0;
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out);
  pointer-events: none;
}

.detail-name.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.station-list {
  list-style: none;
  margin: 0;
  padding: 0 clamp(20px, 2.8vw, 44px);
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  gap: 0;
  flex: 1 1 100%;
  min-height: 0;
}

.detail-name.is-visible + .station-list {
  padding-top: 8px;
}

.station-list:empty {
  display: none;
}

.detail-empty {
  display: grid;
  align-content: stretch;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}

.empty-lines {
  display: grid;
  gap: 16px;
  margin-top: 0;
  align-content: start;
}

.empty-line {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 84px;
  padding: 16px 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, oklch(0.985 0.01 80), oklch(0.95 0.015 250 / 0.6));
  overflow: hidden;
  width: 100%;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.empty-line::before {
  content: "";
  position: absolute;
  left: 32px;
  right: 24px;
  top: 50%;
  height: 10px;
  border-radius: 999px;
  background: var(--line-color, oklch(0.7 0.03 260));
  opacity: 0.3;
  transform: translateY(-50%);
}

.empty-line::after {
  content: "";
  position: absolute;
  left: 52px;
  right: 42px;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  background:
    radial-gradient(circle, white 0 2px, transparent 2.5px) center / 28px 4px repeat-x;
  opacity: 0.85;
  transform: translateY(-50%);
}

.empty-line-dot,
.empty-line-name,
.empty-line-action {
  position: relative;
  z-index: 1;
}

.empty-line-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-color, oklch(0.7 0.03 260));
  box-shadow: 0 8px 18px color-mix(in oklab, var(--line-color, oklch(0.7 0.03 260)) 32%, transparent);
  justify-self: start;
}

.empty-line-name {
  display: block;
  width: 100%;
  font: 700 clamp(1.35rem, 1.9vw, 1.9rem)/1 "Space Grotesk", sans-serif;
  text-align: center;
  letter-spacing: -0.03em;
  color: oklch(0.22 0.03 260);
}

.empty-line-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: oklch(0.42 0.03 260);
  font: 600 0.92rem/1 "Outfit", sans-serif;
}

.station-list li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  width: 100%;
  min-height: 0;
  padding: 18px 14px 18px 10px;
  position: relative;
}

.station-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  border-top: 1px solid oklch(0.86 0.02 80);
}

.detail-name.is-visible + .station-list li:first-child::before {
  display: block;
}

.detail-name.is-visible + .station-list li:first-child {
  padding-top: 22px;
}

.station-list li:first-child::before {
  display: none;
}

.station-dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  justify-self: center;
  align-self: center;
  position: relative;
  z-index: 1;
}

.station-list li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 46px;
  top: calc(50% + 14px);
  bottom: calc(-50% + 14px);
  border-left: 3px dashed var(--connector-color, oklch(0.75 0.02 260));
  opacity: 0.8;
}

.station-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  min-height: 100%;
  max-width: 410px;
}

.station-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0;
  font-size: clamp(1.7rem, 2.3vw, 2.25rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.station-meta {
  color: var(--muted);
  font-size: clamp(1.22rem, 1.48vw, 1.52rem);
  line-height: 1.34;
  max-width: 24ch;
}

.line-shadow,
.line-path,
.line-dashes {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition:
    opacity 260ms var(--ease-out),
    stroke-width 260ms var(--ease-out),
    filter 260ms var(--ease-out);
}

.line-shadow {
  stroke-width: 28;
  transform: translate(5px, 8px);
}

.line-path {
  stroke-width: 20;
  opacity: 0.34;
  filter: drop-shadow(0 10px 20px oklch(0.3 0.04 260 / 0.15));
}

.line-dashes {
  stroke-width: 5.5;
  opacity: 0.9;
}

.line-shadow.is-muted,
.line-path.is-muted,
.line-dashes.is-muted,
.station-group.is-muted,
.line-name-tag.is-muted,
.line-end-badge.is-muted {
  opacity: 0.16;
}

.line-path.is-active {
  opacity: 1;
  filter: drop-shadow(0 0 24px oklch(0.84 0.08 260 / 0.9));
}

.station-core,
.station-ring {
  transition:
    opacity 260ms var(--ease-out),
    fill 260ms var(--ease-out),
    stroke-width 260ms var(--ease-out),
    r 260ms var(--ease-out);
}

.station-group.is-active .station-ring {
  stroke-width: 4;
}

.station-group.is-active .station-core {
  opacity: 1;
}

.label-name,
.label-role {
  pointer-events: none;
}

.label-group {
  opacity: 0;
  transition: opacity 220ms var(--ease-out);
}

.label-connector {
  fill: none;
  stroke: oklch(0.52 0.02 260 / 0.6);
  stroke-width: 2;
  stroke-dasharray: 5 6;
  pointer-events: none;
}

.label-group.is-visible {
  opacity: 1;
}

.label-group.is-muted {
  opacity: 0;
}

.label-name {
  font: 700 34px/1.02 "Space Grotesk", sans-serif;
  fill: oklch(0.23 0.03 260);
  paint-order: stroke fill;
  stroke: oklch(0.98 0.01 80 / 0.92);
  stroke-width: 8px;
  stroke-linejoin: round;
}

.label-role {
  display: none;
}

.map-title {
  font: 800 58px/1 "Space Grotesk", sans-serif;
  fill: oklch(0.28 0.05 250);
  letter-spacing: -0.04em;
}

.map-subtitle {
  font: 600 18px/1 "Outfit", sans-serif;
  fill: oklch(0.5 0.04 250);
}

.central-halo {
  fill: url(#centralGlow);
}

.central-shadow {
  fill: oklch(0.28 0.02 260 / 0.14);
}

.central-mask {
  fill: oklch(0.975 0.01 80);
}

.central-node {
  fill: oklch(0.98 0.01 80);
  stroke: oklch(0.23 0.03 260);
  stroke-width: 7;
  cursor: pointer;
  transition:
    transform 180ms var(--ease-out),
    filter 180ms var(--ease-out);
  transform-origin: center;
}

.central-text {
  font: 800 42px/1 "Space Grotesk", sans-serif;
  fill: oklch(0.2 0.02 260);
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.central-node:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 12px 18px oklch(0.3 0.03 260 / 0.18));
}

.line-name-tag {
  font: 700 54px/1 "Space Grotesk", sans-serif;
  fill: oklch(0.16 0.02 260);
  transition: opacity 220ms var(--ease-out);
  text-anchor: middle;
}

.line-end-badge {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 4;
  filter: drop-shadow(0 8px 16px oklch(0.3 0.03 260 / 0.18));
}

.line-name-tag.is-hidden {
  opacity: 0;
}

.station-pulse {
  fill: none;
  stroke-width: 6;
  opacity: 0;
}

.traveller {
  stroke: white;
  stroke-width: 3;
  filter: drop-shadow(0 10px 20px oklch(0.35 0.03 260 / 0.18));
}

.traveller-ring {
  fill: none;
  stroke-width: 8;
  opacity: 0.24;
}

.presentation-flash {
  animation: pulse-ring 950ms var(--ease-out);
}

@keyframes pulse-ring {
  0% {
    opacity: 0.9;
    transform: scale(0.65);
  }

  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}

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

  .page-shell {
    min-height: 100dvh;
    grid-template-rows: minmax(0, 1fr) auto;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: 100%;
    min-height: 100dvh;
    padding: 8px;
  }

  .detail-card {
    padding: 14px;
  }

  .panel-block.compact {
    grid-template-columns: 1fr;
  }

  .panel-actions {
    flex-wrap: wrap;
  }

}

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