:root {
  color-scheme: dark;
  --bg: #020817;
  --bg-deep: #01050d;
  --line: #26334a;
  --line-soft: #182238;
  --text: #f4f7ff;
  --muted: #8e98aa;
  --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, textarea { 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: 22px; line-height: 1.15; }
.phase-pill, .status-pill, .tag, .ready-pill {
  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 14px; 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;
}
textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 132px;
  padding: 16px;
  border: 1px solid #3a465a;
  border-radius: 16px;
  outline: none;
  color: var(--text);
  background: rgba(8, 17, 34, .98);
  font-size: 18px;
  line-height: 1.45;
}
textarea:focus { border-color: #477be5; box-shadow: 0 0 0 3px rgba(42, 104, 234, .16); }
.action-row { display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; margin-top: 12px; }
.button {
  min-height: 54px;
  border: 0;
  border-radius: 12px;
  color: white;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.button:disabled { opacity: .55; cursor: wait; }
.button.secondary { background: #252e3f; border: 1px solid #3b4659; }
.button.secondary.listening { background: #703424; }
.button.primary { background: linear-gradient(135deg, var(--blue), #0b45c3); }
.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; }
.section-kicker { color: #86a7ff; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.result-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 3px 0 0; }
.result-title-row h2 { font-size: 21px; }
.ready-pill { padding: 6px 12px; color: var(--green); border-color: rgba(69, 174, 96, .3); background: var(--green-bg); font-size: 13px; }
.result-card { padding: 18px; }
.route { margin: 0 0 10px; font-size: clamp(20px, 5vw, 26px); font-weight: 850; }
.time-line { margin: 0; font-size: 17px; line-height: 1.4; }
.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); }
.data-note { margin: 13px 0 0; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); line-height: 1.45; font-size: 14px; }

.clarification-card { padding: 18px; border-color: #594322; }
.clarification-title { display: flex; gap: 12px; align-items: flex-start; }
.question-mark { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid #9e6d22; border-radius: 50%; color: var(--amber); }
.clarification-card h3 { margin: 0; font-size: 20px; }
.clarification-card p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.error-card { padding: 18px; border-color: #662a34; }
.error-card h3 { margin: 0 0 8px; color: #ffd3d7; }
.error-card p { color: var(--muted); }

.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 { margin-top: 4px; color: var(--muted); font-size: 14px; }
.legs { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 7px; }
.leg { display: grid; grid-template-columns: 72px 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; line-height: 1.35; }
.delay { color: var(--red); font-size: 12px; font-weight: 750; }

.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;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 520px) {
  .shell { padding-inline: 14px; }
  .app-header { grid-template-columns: auto 1fr; }
  .phase-pill { display: none; }
  .app-footer { grid-template-columns: 1fr; }
  .status-pills { justify-content: flex-start; }
  .leg { grid-template-columns: 62px 1fr; }
}
