:root {
  color-scheme: light;
  --ink: #20242a;
  --muted: #5f6670;
  --line: #d7dde4;
  --panel: #ffffff;
  --wash: #eef3f4;
  --blue: #2266aa;
  --green: #12715c;
  --red: #b13c36;
  --amber: #8b641a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #f5f7f8;
}

button,
input,
select {
  font: inherit;
  min-width: 0;
}

.route-preview-shell {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  min-height: 100vh;
}

.planner-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 28px;
  min-width: 0;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 22px;
}

.status-pill {
  color: #153d35;
  background: #dff2ec;
  border: 1px solid #a9d8ca;
  border-radius: 999px;
  padding: 5px 9px;
  font-weight: 700;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 0 0 10px;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  margin: 0 0 10px;
  letter-spacing: 0;
}

.lede {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 24px;
}

.planner-form {
  display: grid;
  gap: 11px;
  min-width: 0;
}

label,
legend {
  font-weight: 700;
}

.origin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  min-width: 0;
}

input[type="text"],
select {
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  border: 1px solid #b8c3cc;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

button {
  min-height: 42px;
  border: 1px solid #9facb7;
  border-radius: 6px;
  padding: 9px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.primary-action {
  margin-top: 4px;
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 700;
}

.field-note {
  margin: -5px 0 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}

.segmented label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  font-weight: 600;
  background: #fafbfc;
  min-width: 0;
  overflow-wrap: anywhere;
}

.segmented input {
  flex: 0 0 auto;
  width: auto;
  min-height: 0;
}

.disabled-mode {
  color: #686f77;
  background: #f1f1f1;
}

.privacy-box {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.privacy-box ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.route-stage {
  position: relative;
  display: grid;
  grid-template-rows: minmax(360px, 1fr) auto;
  min-width: 0;
}

.map-surface {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  background: #e9eef0;
}

#route-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-key {
  position: absolute;
  z-index: 500;
  top: 12px;
  right: 12px;
  display: grid;
  gap: 7px;
  width: min(260px, calc(100% - 70px));
  padding: 12px;
  border: 1px solid rgba(32, 36, 42, .18);
  border-radius: 6px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 3px 14px rgba(26, 34, 42, .16);
  font-size: 13px;
}

.map-key label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.map-key small {
  color: var(--muted);
  line-height: 1.35;
}

.key-line {
  display: inline-block;
  width: 26px;
  height: 4px;
  margin-right: 6px;
  border-radius: 2px;
  background: #d64045;
  vertical-align: middle;
}

.map-fallback {
  position: absolute;
  z-index: 600;
  inset: auto 12px 12px 12px;
  padding: 10px;
  border-radius: 6px;
  background: #fff4d7;
  color: #654b12;
  box-shadow: 0 3px 14px rgba(26, 34, 42, .16);
}

.result-card {
  margin: 0;
  padding: 22px 28px 28px;
  background: #fff;
  border-top: 1px solid var(--line);
  min-height: 220px;
}

.result-card h2 {
  font-size: 22px;
}

.truth-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.truth-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfd;
}

.truth-item strong {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 5px;
}

.truth-ok {
  color: var(--green);
  font-weight: 800;
}

.truth-warn {
  color: var(--amber);
  font-weight: 800;
}

.truth-blocked {
  color: var(--red);
  font-weight: 800;
}

.notes {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 820px) {
  .route-preview-shell {
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  .planner-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .route-stage {
    grid-template-rows: 310px auto;
  }

  .map-surface {
    min-height: 310px;
  }

  .truth-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .origin-row,
  .segmented {
    grid-template-columns: 1fr;
  }

  .status-line {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  .planner-panel,
  .result-card {
    padding-left: 16px;
    padding-right: 16px;
  }
}
