:root {
  color-scheme: dark;
  --bg: #020817;
  --bg-deep: #01050d;
  --panel: rgba(3, 12, 29, 0.94);
  --line: #26334a;
  --line-soft: #182238;
  --text: #f4f7ff;
  --muted: #96a1b4;
  --blue: #0b49ce;
  --blue-bright: #1d63ed;
  --green: #6ce08a;
  --green-bg: rgba(14, 83, 35, 0.28);
  --amber: #f2bd59;
  --amber-bg: rgba(112, 67, 10, 0.22);
  --red: #ff7777;
  --red-bg: rgba(108, 20, 29, 0.25);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, rgba(18, 74, 182, 0.22), transparent 38rem),
    linear-gradient(180deg, #061126 0%, var(--bg) 40%, var(--bg-deep) 100%);
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: #8fb4ff; }

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px max(34px, env(safe-area-inset-bottom));
}
.app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 20px;
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--blue-bright), #1143a7);
  font-size: 28px;
  font-weight: 800;
}
.brand-copy { min-width: 0; }
.eyebrow { color: #8aa8ff; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
h1 { margin: 0; font-size: clamp(21px, 5vw, 28px); line-height: 1.05; }
h2 { margin: 0; font-size: 21px; line-height: 1.2; }
.phase-pill, .status-pill, .tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.phase-pill { padding: 6px 10px; color: var(--muted); font-size: 13px; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(4, 13, 31, .96), rgba(2, 9, 22, .96));
  box-shadow: 0 20px 70px rgba(0, 0, 0, .28);
}
.input-panel { padding: 18px; }
.panel-title-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.input-panel p { margin: 8px 0 16px; color: var(--muted); line-height: 1.45; }
.icon-button {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #10192b;
  color: var(--text);
  cursor: pointer;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; }
.field > span { color: #b5c0d2; font-size: 13px; font-weight: 800; }
.field-wide { grid-column: 1 / -1; }
input, select {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid #3a465a;
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: rgba(8, 17, 34, .98);
}
input:focus, select:focus { border-color: #477be5; box-shadow: 0 0 0 3px rgba(42, 104, 234, .16); }
.action-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.action-stack .primary { grid-column: 1 / -1; }
.button {
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
.button:disabled { opacity: .55; cursor: wait; }
.button.secondary { background: #252e3f; border: 1px solid #3b4659; }
.button.primary { background: linear-gradient(135deg, var(--blue), #0b45c3); font-size: 18px; }
.service-message { min-height: 44px; margin-bottom: 0 !important; font-size: 14px; }
.service-message.error { color: var(--red); }
.service-message.success { color: #8ec5ff; }
.result-section { margin-top: 20px; display: grid; gap: 12px; }
.result-card { padding: 18px; }
.result-card h3 { margin: 0 0 10px; font-size: 19px; }
.result-card p { margin: 5px 0; color: var(--muted); line-height: 1.45; }
.result-card.success { border-color: rgba(69, 174, 96, .4); }
.result-card.warning { border-color: #594322; }
.result-card.error { border-color: #662a34; }
.result-card.error h3 { color: #ffd3d7; }
.route { margin: 0 0 12px !important; color: var(--text) !important; font-size: clamp(20px, 5vw, 26px); font-weight: 850; }
.journey-card { padding: 17px; }
.journey-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.journey-times { font-size: 21px; font-weight: 850; }
.journey-meta { color: var(--muted); font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.tag { padding: 6px 10px; color: #c1ccdd; background: #0d1423; font-size: 13px; font-weight: 750; }
.tag.live { color: var(--green); background: var(--green-bg); border-color: rgba(48,151,74,.35); }
.tag.schedule { color: var(--amber); background: var(--amber-bg); border-color: rgba(158,109,34,.45); }
.legs { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.leg { display: grid; grid-template-columns: 80px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.leg:last-child { border-bottom: 0; }
.leg-time { font-weight: 800; }
.leg-copy strong { color: #dce5f5; }
.leg-copy small { display: block; color: var(--muted); margin-top: 3px; }
details { margin-top: 12px; }
summary { color: #9bb8f5; cursor: pointer; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; color: #bdc9dc; background: #071022; padding: 12px; border-radius: 12px; font-size: 12px; }
.attribution { margin-top: 18px; padding: 17px; }
.attribution h2 { font-size: 17px; }
.attribution p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; font-size: 13px; }
.app-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  margin-top: 22px;
  padding: 18px 2px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}
.build-copy strong { color: #aab4c4; }
.status-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.status-pill { padding: 6px 9px; }
.status-pill.good { color: var(--green); background: var(--green-bg); border-color: rgba(48,151,74,.35); }
.status-pill.bad { color: var(--red); background: var(--red-bg); border-color: rgba(197,65,78,.36); }
.status-pill.neutral { color: var(--muted); }
.report-button {
  grid-column: 1 / -1;
  min-height: 45px;
  border: 1px solid #3d485d;
  border-radius: 12px;
  background: #151d2b;
  color: #e7ecf5;
  font-weight: 750;
  cursor: pointer;
}

@media (max-width: 560px) {
  .shell { padding-inline: 14px; }
  .app-header { grid-template-columns: auto 1fr; }
  .phase-pill { display: none; }
  .field-grid, .action-stack { grid-template-columns: 1fr; }
  .field-wide, .action-stack .primary { grid-column: auto; }
  .app-footer { grid-template-columns: 1fr; }
  .status-pills { justify-content: flex-start; }
  .leg { grid-template-columns: 66px 1fr; }
}
