/* Last Train Home — built for the hour it gets used.
   Deep night blue, warm amber for times, coral for the thing to tap. */
:root {
  --night: #141B2D;        /* page */
  --panel: #1C2439;        /* cards */
  --panel-2: #222C46;      /* raised bits */
  --line: #2A344F;
  --ink: #E9EDF6;
  --muted: #98A3BC;
  --amber: #FFC978;        /* times, headings */
  --coral: #FF8A5B;        /* primary action */
  --mint: #8FE3C8;         /* taxi / positive */
  --red: #FF6B6B;          /* delays, cancellations */

  --train: #FFC978;
  --coach: #B99BFF;
  --taxi: #8FE3C8;
  --drive: #7FB2FF;
  --tram: #6FD7D0;
  --local: #9FE08A;

  --radius: 16px;
  --radius-card: 12px;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Instrument Sans", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--night);
}
* { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body { margin: 0; line-height: 1.45; background: var(--night); }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px 48px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* Brand line */
.brand {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 2px 12px; font-weight: 700; letter-spacing: -0.01em;
}
.brand span { color: var(--amber); }
.brand small { color: var(--muted); font-weight: 400; font-size: 0.82rem; margin-left: auto; }

/* Late-night panel */
.tonight {
  background: linear-gradient(160deg, #2A2140, #17203A);
  border: 1px solid #3A3358; border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 12px;
}
.tonight h2 { margin: 0 0 4px; font-size: 1.55rem; color: var(--amber); letter-spacing: -0.01em; }
.tonight p { margin: 0 0 14px; color: #C6CEE0; }
.go.big { width: 100%; height: 52px; font-size: 1.1rem; }
.link-btn {
  display: block; width: 100%; margin-top: 10px; padding: 10px; cursor: pointer;
  background: transparent; color: var(--amber); border: 0; font-size: 0.95rem; text-decoration: underline;
}

/* Search */
.sign { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; }
.sign-inner { padding: 18px 16px 16px; }
.sign-title { margin: 0 0 14px; font-size: 1.9rem; line-height: 1.1; letter-spacing: -0.02em; }
.field { position: relative; margin-bottom: 12px; }
.field label { display: block; font-size: 0.92rem; margin-bottom: 5px; color: var(--muted); }
.field input, .home-setter input {
  width: 100%; padding: 13px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #151C2E; color: var(--ink); font-size: 1.05rem;
}
.field input::placeholder, .home-setter input::placeholder { color: #6C7793; }
.from-row { display: flex; gap: 8px; }
.from-row input { flex: 1; min-width: 0; }
.ghost {
  flex: none; background: transparent; color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 12px; cursor: pointer; font-size: 0.9rem;
}
.suggest {
  list-style: none; margin: 4px 0 0; padding: 4px 0; position: absolute; z-index: 5;
  left: 0; right: 0; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 14px 34px rgba(0,0,0,.45); max-height: 280px; overflow: auto;
}
.suggest li { padding: 11px 12px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: #2C3752; }
.suggest small { color: var(--muted); display: block; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.people { margin-bottom: 0; }
.stepper { display: flex; align-items: center; background: #151C2E; border: 1px solid var(--line); border-radius: 10px; }
.stepper button { width: 44px; height: 46px; border: 0; background: none; font-size: 1.4rem; cursor: pointer; color: var(--ink); }
.stepper output { min-width: 24px; text-align: center; font-weight: 700; }
.go {
  flex: 1; height: 48px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--coral); color: #1A1206; font-weight: 700; font-size: 1.05rem;
}
.go[disabled] { opacity: 0.7; cursor: progress; }

.home-setter { position: relative; margin-top: 12px; }
.home-setter label { display: block; font-size: 0.92rem; margin-bottom: 5px; color: #C6CEE0; }
.home-setter input { margin-bottom: 10px; }
.home-setter .go { width: 100%; height: 46px; }
.home-setter .suggest { top: 80px; }

.notice {
  margin: 14px 2px 0; padding: 12px 14px; border-radius: var(--radius-card);
  background: #2A2E1C; border: 1px solid #4A4A24; color: #F4ECCF;
}
.notice a { color: var(--amber); }
.notice.error { background: #33202A; border-color: #5A2B39; color: #FFD9DF; }

/* Results */
.trip { margin: 22px 2px 10px; }
.trip h2 { margin: 0; font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.01em; }
.trip p { margin: 4px 0 0; color: var(--muted); }
.sort { display: flex; gap: 6px; margin: 12px 0; }
.sort button {
  flex: 1; padding: 9px 4px; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--muted); font-weight: 600; cursor: pointer;
}
.sort button[aria-selected="true"] { background: var(--amber); color: #23180A; border-color: var(--amber); }

.options { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.opt {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 14px; display: grid; grid-template-columns: 42px 1fr auto; gap: 4px 12px;
}
.badge { grid-row: span 2; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: #16203A; }
.badge svg { width: 24px; height: 24px; }
.m-train .badge { background: var(--train); }
.m-coach .badge { background: var(--coach); }
.m-taxi .badge { background: var(--taxi); }
.m-drive .badge { background: var(--drive); }
.m-tram .badge { background: var(--tram); }
.m-local .badge { background: var(--local); }
.opt h3 { margin: 0; font-size: 1.05rem; }
.time { font-weight: 700; font-size: 1.1rem; text-align: right; white-space: nowrap; color: var(--amber); }
.time small { display: block; font-weight: 400; font-size: 0.76rem; color: var(--muted); }
.sub { color: var(--muted); font-size: 0.9rem; }
.price { text-align: right; white-space: nowrap; }
.price b { font-size: 1.02rem; }
.price small { display: block; color: var(--muted); }
.detail { grid-column: 1 / -1; margin-top: 8px; }
.detail p { margin: 6px 0; font-size: 0.92rem; }
.tip { background: #222C46; border-radius: 8px; padding: 9px 11px; color: #C6CEE0; }
.live { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.live h4 { margin: 0 0 6px; font-size: 0.92rem; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.live h4::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.live table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.live td { padding: 5px 0; border-bottom: 1px solid #232C44; }
.live td:last-child { text-align: right; }
.late { color: var(--red); font-weight: 700; }
.freshness { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 8px 0 0; font-size: 0.82rem; color: var(--muted); }
.refresh { border: 1px solid var(--line); background: transparent; border-radius: 8px;
  padding: 6px 12px; font-size: 0.82rem; cursor: pointer; color: var(--ink); }
.refresh[disabled] { opacity: 0.6; cursor: progress; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.links a {
  text-decoration: none; padding: 9px 13px; border-radius: 9px; font-weight: 700; font-size: 0.92rem;
  background: transparent; color: var(--ink); border: 1px solid var(--line);
}
.links a.primary { background: var(--coral); color: #1A1206; border-color: var(--coral); }
.save-home {
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px; font-size: 0.85rem; cursor: pointer; color: var(--muted); margin-top: 8px;
}

/* Stay over */
.stay {
  margin-top: 14px; padding: 16px; border-radius: var(--radius-card);
  background: linear-gradient(160deg, #2A2140, #17203A); border: 1px solid #3A3358;
}
.stay h3 { margin: 0 0 6px; font-size: 1.15rem; color: var(--amber); }
.stay p { margin: 0 0 12px; color: #C6CEE0; font-size: 0.92rem; }
.stay .links a { background: var(--coral); color: #1A1206; border-color: var(--coral); }
.stay .links a.plain { background: transparent; color: var(--ink); border-color: #44507A; }
.tiny { font-size: 0.76rem; color: #7A88A6; margin: 10px 0 0; }
.small { color: var(--muted); font-size: 0.83rem; margin-top: 16px; }

@media (prefers-reduced-motion: no-preference) {
  .options.fresh .opt { animation: rise .25s ease-out both; }
  .options.fresh .opt:nth-child(2) { animation-delay: .04s; }
  .options.fresh .opt:nth-child(3) { animation-delay: .08s; }
  .options.fresh .opt:nth-child(n+4) { animation-delay: .12s; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } }
}
@media (max-width: 380px) {
  .sign-title { font-size: 1.65rem; }
  .row { flex-direction: column; align-items: stretch; }
}
