:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --card: #151923;
  --line: #2a3040;
  --text: #f5f7fb;
  --muted: #aab2c4;
  --accent: #83e6c2;
  --danger: #ff9a9a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 20% 0, #172236 0, var(--bg) 45%);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, sans-serif;
}

.shell {
  width: min(900px, calc(100% - 32px));
  flex: 1;
  margin: 0 auto;
  padding: 64px 0;
}

.narrow { width: min(460px, calc(100% - 32px)); }

.site-footer {
  width: 100%;
  padding: 18px 16px 24px;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

.page-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.header-actions { flex: 0 0 auto; }

h1 {
  margin: .1em 0;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1.05;
  letter-spacing: -.04em;
}

.narrow h1 { font-size: 2.4rem; }

h2 { margin: 0; line-height: 1.25; }

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.lede, .muted, .notice { color: var(--muted); }

.card, .status {
  margin-top: 28px;
  padding: 24px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 50px #0005;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

input, button {
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
}

input {
  width: 100%;
  padding: 0 14px;
  background: #0e1118;
  color: var(--text);
}

button {
  padding: 0 20px;
  border: 0;
  background: var(--accent);
  color: #07110e;
  font-weight: 800;
  cursor: pointer;
}

button:focus-visible, input:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

button:disabled { cursor: wait; opacity: .5; }

.login-submit {
  display: block;
  min-width: 160px;
  margin: 24px auto 0;
}

.secondary {
  background: #222a37;
  color: var(--text);
  border: 1px solid var(--line);
}

.compact {
  min-height: 40px;
  margin-top: 16px;
  white-space: nowrap;
}

.notice { margin: 14px 0 0; font-size: .88rem; }
.error { color: var(--danger); }
.success { border-color: var(--accent); }
.hidden { display: none; }

.placeholder-card h2 { margin-bottom: 8px; }
.placeholder-card p { margin: 0; }
.placeholder-badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 3px 9px;
  background: color-mix(in srgb, var(--accent) 13%, #10141d);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 750;
}

@media (max-width: 640px) {
  .shell { padding: 36px 0; }
  .page-header { gap: 16px; }
  .page-header h1 { font-size: clamp(2rem, 12vw, 3rem); }
  .compact { margin-top: 8px; }
  .card, .status { padding: 20px; }
}

select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e1118;
  color: var(--text);
  font: inherit;
}

select:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.converter-card h2,
.result-card h2 { margin-bottom: 8px; }

.converter-intro { margin-top: 0; }

.phase-badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 3px 9px;
  background: color-mix(in srgb, var(--accent) 13%, #10141d);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .03em;
}

.drop-zone {
  display: grid;
  min-height: 156px;
  margin-top: 20px;
  padding: 28px;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 1px dashed #465064;
  border-radius: 14px;
  background: #10141d;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, #10141d);
}

.drop-zone.is-dragging { transform: translateY(-1px); }
.drop-zone-title { color: var(--text); font-weight: 800; }

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 16px;
  background: #10141d;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.file-row > div { min-width: 0; }
.file-row strong { display: block; overflow-wrap: anywhere; }
.file-row .compact { margin-top: 0; }

.route-picker { margin-top: 20px; }
.route-picker label { margin-bottom: 8px; }

.result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.result-heading > div { min-width: 0; }
.result-heading button { flex: 0 0 auto; }

.route-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.route-summary > div {
  min-width: 0;
  padding: 14px;
  background: #10141d;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.route-summary .summary-wide { grid-column: 1 / -1; }
.summary-label { display: block; color: var(--muted); font-size: .8rem; }
.route-summary strong { display: block; margin-top: 2px; font-size: 1.1rem; overflow-wrap: anywhere; }

.route-map {
  width: 100%;
  height: 430px;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0e1118;
}

.route-map .leaflet-control-attribution {
  background: color-mix(in srgb, #fff 88%, transparent);
  color: #1a1d24;
}

.route-map .leaflet-control-attribution a { color: #155e75; }
.map-privacy { margin-bottom: 0; }
.success-text { color: var(--accent); }

@media (max-width: 640px) {
  .result-heading { display: grid; }
  .result-heading button { width: 100%; }
  .route-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .route-map { height: 340px; }
  .drop-zone { min-height: 136px; padding: 22px 16px; }
  .file-row { align-items: flex-start; }
}
