:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d7deea;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.10);
  --radius: 22px;
  --primary: #1a73e8;
  --primary-dark: #1558b0;
  --danger: #b42318;
  --success: #027a48;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #e9f1ff 0, transparent 34rem), var(--bg);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  background: #eef2f7;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.12);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

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

.app-header {
  max-width: 1240px;
  margin: 0 auto;
  padding: 3rem 1.25rem 1.5rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2.2rem, 7vw, 5rem);
  letter-spacing: -0.07em;
}

h2 {
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  letter-spacing: -0.03em;
}

.subtitle {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
}

.app-shell {
  max-width: 1240px;
  margin: 0 auto 2.5rem;
  padding: 0 1.25rem;
}

.setup-card,
.controls-card,
.map-card,
.policy-note,
.street-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(215, 222, 234, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.setup-card,
.controls-card,
.map-card,
.policy-note {
  padding: 1.25rem;
}

.hidden {
  display: none !important;
}

.setup-card {
  margin-bottom: 1rem;
}

.setup-card p,
.policy-note p {
  color: var(--muted);
  line-height: 1.6;
}

.setup-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.route-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr) repeat(3, minmax(120px, 150px));
  gap: 0.8rem;
  align-items: end;
}

.field {
  display: grid;
  gap: 0.4rem;
}

label {
  color: #344054;
  font-size: 0.82rem;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.12);
}

.swap-button {
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 1.3rem;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.status-grid {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  color: var(--muted);
}

.status-text,
.route-summary {
  margin: 0;
  line-height: 1.5;
}

.status-text[data-type="error"] {
  color: var(--danger);
  font-weight: 700;
}

.status-text[data-type="success"] {
  color: var(--success);
  font-weight: 700;
}

.panels-section {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.street-panel {
  overflow: hidden;
}

.center-panel {
  outline: 3px solid rgba(26, 115, 232, 0.18);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-header strong {
  color: var(--ink);
}

.image-box {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  background: linear-gradient(135deg, #e4e9f2, #f9fafb);
  overflow: hidden;
}

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

.panel-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.maps-attribution {
  position: absolute;
  left: 10px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #5e5e5e;
  font-family: Roboto, Arial, Sans-Serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: normal;
  white-space: nowrap;
  pointer-events: none;
}

.panel-meta,
.panel-copyright {
  margin: 0;
  padding: 0.9rem 1rem 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.panel-copyright {
  min-height: 2.2rem;
  padding-top: 0.35rem;
  padding-bottom: 0.9rem;
}

.map-card {
  margin-top: 1rem;
}

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

.map-link {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.map-link.disabled {
  color: var(--muted);
  pointer-events: none;
}

.map-canvas {
  height: min(48vw, 440px);
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.policy-note {
  margin-top: 1rem;
}

.app-footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.2rem 1.25rem 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

.footer-brand {
  color: var(--ink);
  font-weight: 900;
}

.footer-attribution {
  font-family: Roboto, Arial, Sans-Serif;
  font-weight: 400;
  color: #5e5e5e;
}

.legal-page {
  max-width: 880px;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

.legal-page article {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 4vw, 2rem);
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  line-height: 1.65;
}

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

  .field-small,
  .form-actions {
    grid-column: span 1;
  }

  .panels-section {
    grid-template-columns: 1fr;
  }

  .image-box {
    min-height: 260px;
  }
}

@media (max-width: 720px) {
  .route-form,
  .setup-row {
    grid-template-columns: 1fr;
  }

  .swap-button {
    width: 100%;
  }

  .form-actions,
  .status-grid,
  .map-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  button {
    width: 100%;
  }

  .map-canvas {
    height: 360px;
  }
}
