:root {
  --bg: #f5f5f0;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #666;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e5e5e0;
  --error: #b91c1c;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
}

.tagline {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.upload-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.input-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.text-input {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
}

.file-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  padding: 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}

.file-label:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}

.file-placeholder {
  color: var(--muted);
}

.file-name {
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}

.file-label input[type="file"] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.hint {
  margin: 0.75rem 0 1rem 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

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

.btn-secondary:hover {
  background: var(--border);
}

footer {
  margin-top: auto;
  padding-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-subtle-link {
  color: #7a7a7a;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: #c8c8c8;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.footer-subtle-link:hover {
  color: #5f5f5f;
  text-decoration-color: #9f9f9f;
}

/* Route page */
.container.route-page {
  max-width: 1040px;
}

.route-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.route-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.route-meta {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
  color: var(--text);
}

.meta-item {
  margin: 0;
}

.map {
  height: 560px;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
  margin-bottom: 0.5rem;
}

.error-message {
  color: var(--error);
  margin: 0 0 1rem 0;
}

.error-message[hidden] {
  display: none;
}

/* Error page */
.error-page {
  justify-content: center;
}

.error-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  text-align: center;
}

.error-text {
  margin: 0 0 1rem 0;
  color: var(--text);
}

@media (max-width: 640px) {
  .route-header {
    flex-direction: column;
    align-items: stretch;
  }
  .route-actions {
    justify-content: stretch;
  }
  .route-actions .btn {
    flex: 1;
    text-align: center;
  }
  .map {
    height: 440px;
  }
}
