* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --walking: #34c759;
  --riding: #007aff;
  --driving: #ff9500;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.app-header {
  margin-bottom: 24px;
}

.app-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.input-panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 240px;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: border-color var(--transition);
}

.input-row:focus-within {
  border-color: var(--riding);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot--origin {
  background: var(--walking);
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.18);
}

.dot--dest {
  background: #ff3b30;
  box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.18);
}

.input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text);
}

.input::placeholder {
  color: #9ca3af;
}

.btn-primary {
  background: linear-gradient(135deg, #007aff, #5856d6);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s, box-shadow var(--transition);
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.workspace {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 16px;
  min-height: 540px;
}

.side-panel,
.detail-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 540px;
}

.side-panel {
  overflow-y: auto;
}

.placeholder-text,
.detail-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.route-card {
  padding: 14px 16px;
  border-left: 4px solid transparent;
  cursor: pointer;
  position: relative;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    transform var(--transition);
  border-bottom: 1px solid var(--border);
}

.route-card:last-child {
  border-bottom: none;
}

.route-card:hover {
  background: #fafbfc;
}

.route-card.active {
  border-left-color: var(--mode-color);
  background: color-mix(in srgb, var(--mode-color) 6%, transparent);
}

.route-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.route-mode {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

.route-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: white;
  background: var(--mode-color);
}

.route-time {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.route-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.route-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.route-progress {
  margin-top: 8px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.route-progress-bar {
  height: 100%;
  background: var(--mode-color);
  transform-origin: left;
  animation: bar-grow var(--transition) ease-out;
}

@keyframes bar-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.map-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  min-height: 540px;
}

.map {
  width: 100%;
  height: 540px;
}

.detail-panel {
  overflow-y: auto;
}

.detail-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--mode-color, #888) 8%, transparent),
    transparent
  );
}

.detail-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.detail-summary {
  padding: 4px 16px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.detail-steps {
  list-style: none;
  padding: 4px 0;
}

.step-item {
  display: flex;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-left: 3px solid transparent;
}

.step-item:hover {
  background: #fafbfc;
}

.step-item.highlighted {
  border-left-color: var(--mode-color);
  background: color-mix(in srgb, var(--mode-color) 6%, transparent);
}

.step-index {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.step-content {
  flex: 1;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.step-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(31, 41, 55, 0.92);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid white;
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .map { height: 360px; }
}
