:root {
  --font: "Helvetica Neue", Helvetica, Inter, Arial, sans-serif;

  --tile: #f5f3ee;
  --card: #ffffff;
  --ink: #111111;
  --muted: #62666e;
  --line: #e4e0d6;
  --chip: #f1eee7;

  --sign: #111111;        /* MTA station sign black */
  --street: #00704a;      /* NYC street sign green */
  --taxi: #fccc0a;        /* taxi / N-Q-R-W yellow */
  --accent: #0039a6;      /* A-C-E blue */
  --good: #1f8a4c;
  --warn: #b86e00;
  --bad: #d22b25;

  --night-1: #070b1a;
  --night-2: #1b2c5a;
  --skyline: #05070d;

  --mosaic-a: #8a2f28;
  --mosaic-b: #ead9b6;
  --mosaic-edge: #1e5b57;

  --shadow: 0 1px 0 rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --tile: #121418;
    --card: #1a1d22;
    --ink: #eef0f3;
    --muted: #9ba1ab;
    --line: #2c3038;
    --chip: #24272e;
    --sign: #000000;
    --accent: #7ea2ff;
    --good: #4cc27f;
    --warn: #f0a63a;
    --bad: #ff6b6b;
    --mosaic-b: #b9a888;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font: 15px/1.5 var(--font);
  /* Offset "subway tile" brick pattern */
  background-color: var(--tile);
  background-image: var(--tile-img);
  background-size: 48px 24px;
}
:root {
  --tile-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='24'%3E%3Cpath d='M0 .5H48M0 12.5H48M.5 0V12M24.5 12V24' stroke='%23e1dccf' fill='none'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --tile-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='24'%3E%3Cpath d='M0 .5H48M0 12.5H48M.5 0V12M24.5 12V24' stroke='%231e2127' fill='none'/%3E%3C/svg%3E");
  }
}
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- Masthead: night sky + skyline ---------- */
.masthead {
  position: relative;
  color: #fff;
  background:
    radial-gradient(1px 1px at 12% 22%, #fff9, transparent),
    radial-gradient(1px 1px at 34% 12%, #fff8, transparent),
    radial-gradient(1px 1px at 58% 30%, #fff7, transparent),
    radial-gradient(1.5px 1.5px at 76% 16%, #fffa, transparent),
    radial-gradient(1px 1px at 90% 34%, #fff6, transparent),
    radial-gradient(ellipse at 50% 120%, #3b3f7a 0%, transparent 60%),
    linear-gradient(var(--night-1), var(--night-2));
  overflow: hidden;
}
.masthead-text { position: relative; padding-top: 34px; padding-bottom: 8px; z-index: 1; }
.kicker {
  margin: 0; display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: #111; background: var(--taxi); padding: 3px 8px; border-radius: 3px;
}
h1 {
  font-weight: 700; letter-spacing: -.025em;
  font-size: clamp(34px, 6.5vw, 64px); line-height: 1.02; margin: 12px 0 8px;
}
.greeting { margin: 0; color: #c9cfdf; font-size: 17px; max-width: 60ch; }
/* "Subway right now" status chips in the masthead */
.trunk-wrap { margin-top: 18px; }
.trunk-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #fff; }
.trunk-title span { font-weight: 500; letter-spacing: .02em; text-transform: none; color: #9aa3bb; }
.trunk { display: flex; flex-wrap: wrap; gap: 6px; }
.trunk-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 9px 3px 3px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  color: #fff; font: inherit; font-size: 12px;
}
.trunk-chip:hover, .trunk-chip:focus-visible { background: rgba(255,255,255,.16); outline: none; border-color: #fff; }
.trunk-lines {
  background: var(--c); color: #fff; border-radius: 999px;
  padding: 2px 8px; font-weight: 700; font-size: 13px; letter-spacing: .04em; white-space: nowrap;
}
.trunk-chip.dark-text .trunk-lines { color: #111; }
.trunk-status { font-weight: 600; white-space: nowrap; }
.trunk-chip.good .trunk-status { color: #7ee2a8; }
.trunk-chip.warn .trunk-status { color: #ffc857; }
.trunk-chip.bad { border-color: #ff6b61; animation: pulse 2s ease-in-out infinite; }
.trunk-chip.bad .trunk-status { color: #ff8a80; }
.trunk-chip.loading .trunk-status { color: #9aa3bb; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(255, 90, 80, .25); } }
@media (prefers-reduced-motion: reduce) { .trunk-chip.bad { animation: none; } }
.skyline { display: block; width: 100%; height: 10vw; min-height: 84px; max-height: 200px; margin-top: -10px; }

/* Station mosaic band under the skyline */
.mosaic {
  height: 22px;
  border-top: 4px solid var(--mosaic-edge);
  border-bottom: 4px solid var(--mosaic-edge);
  background: conic-gradient(var(--mosaic-a) 25%, var(--mosaic-b) 0 50%, var(--mosaic-a) 0 75%, var(--mosaic-b) 0) 0 0 / 14px 14px;
  margin-bottom: 28px;
}

/* ---------- Times Square ticker ---------- */
.ticker {
  --led: #ffb52e;
  display: flex; align-items: stretch;
  background: #050505;
  border-top: 2px solid #2a2a2a;
  border-bottom: 2px solid #2a2a2a;
  height: 46px;
}
.ticker-label {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; background: var(--bad); color: #fff;
  font-weight: 800; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
  box-shadow: 6px 0 12px #000;
  position: relative; z-index: 1;
}
.ticker-label .live { font-weight: 600; font-size: 11px; opacity: .9; animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { to { opacity: .35; } }
.ticker-viewport { position: relative; flex: 1; overflow: hidden; min-width: 0; }
/* LED dot-matrix overlay */
.ticker-viewport::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, transparent 1.1px, rgba(5,5,5,.75) 1.5px) 0 0 / 3px 3px;
}
.ticker-track {
  display: inline-flex; align-items: center; height: 100%; white-space: nowrap;
  font-family: "DotGothic16", ui-monospace, monospace; font-size: 22px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--led); text-shadow: 0 0 6px rgba(255, 170, 40, .75), 0 0 14px rgba(255, 120, 0, .35);
  animation: ticker var(--ticker-duration, 60s) linear infinite;
  will-change: transform;
}
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker-item { padding: 0 6px; }
.ticker-item a { color: inherit; text-decoration: none; }
.ticker-item a:hover { color: #fff; }
.ticker-item .src { color: #6fd3ff; text-shadow: 0 0 6px rgba(80, 190, 255, .7); }
.ticker-item.alert-item { color: #ff5a4e; text-shadow: 0 0 6px rgba(255, 70, 60, .8); }
.ticker-sep { color: #ff3b30; text-shadow: 0 0 6px rgba(255, 59, 48, .8); padding: 0 14px; }
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .ticker-viewport { overflow-x: auto; }
}
@media (max-width: 520px) {
  .ticker-label { padding: 0 10px; font-size: 11px; }
  .ticker-label .live { display: none; }
  .ticker-track { font-size: 18px; }
}

/* ---------- Layout ---------- */
.grid {
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr 1.3fr;
  grid-template-areas: "weather subway" "board board" "bikes bikes" "access access" "events events";
}
.weather { grid-area: weather; }
.subway { grid-area: subway; }
.board { grid-area: board; }
.bikes { grid-area: bikes; }
.access { grid-area: access; }
.events { grid-area: events; }
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; grid-template-areas: "weather" "subway" "board" "bikes" "access" "events"; }
}

.card { background: var(--card); border-radius: 6px; box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.card-body { padding: 18px 20px 20px; }
.meta { color: #b9bdc6; font-size: 13px; }
.loading { color: var(--muted); }
.error { color: var(--bad); }

/* MTA station-sign header: black band with a thin white rule near the top */
.sign {
  position: relative;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--sign); color: #fff;
  padding: 18px 20px 12px;
}
.sign::before {
  content: ""; position: absolute; left: 0; right: 0; top: 7px;
  height: 1.5px; background: #fff;
}
h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 0; }

/* Green street sign variant */
.sign.street { background: var(--street); padding: 14px 20px; }
.sign.street::before {
  inset: 5px; height: auto; background: none;
  border: 2px solid #fff; border-radius: 5px;
}
.sign.street h2 { text-transform: uppercase; letter-spacing: .04em; padding: 0 6px; }
.sign.street h2 span { font-weight: 400; }

/* ---------- Weather ---------- */
.now { display: flex; align-items: center; gap: 16px; }
.now .icon { font-size: 52px; line-height: 1; }
.now .temp { font-size: 52px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.now .desc { font-weight: 700; margin-top: 4px; }
.now .sub { color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.stat { background: var(--chip); border-radius: 4px; padding: 8px 10px; border-left: 3px solid var(--sign); }
.stat b { display: block; font-size: 16px; white-space: nowrap; }
@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .card-body { padding: 16px; }
  .sign { padding-left: 16px; padding-right: 16px; }
}
.stat span { font-size: 12px; color: var(--muted); }
.hourly { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.hour { flex: 0 0 auto; text-align: center; min-width: 52px; padding: 6px 4px; border-radius: 4px; border: 1px solid var(--line); font-size: 12px; }
.hour:first-child { background: var(--sign); color: #fff; border-color: var(--sign); }
.hour:first-child .rain { color: var(--taxi); }
.hour .i { font-size: 18px; display: block; }
.hour b { display: block; font-size: 14px; }
.hour .rain { color: var(--accent); }

/* Taxi-yellow tip with the checkerboard stripe */
.tip {
  position: relative; margin-top: 14px; font-size: 14px; font-weight: 600;
  padding: 11px 12px 11px 30px; background: var(--taxi); color: #111; border-radius: 4px; overflow: hidden;
}
.tip::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 16px;
  background: conic-gradient(#111 25%, #fff 0 50%, #111 0 75%, #fff 0) 0 0 / 8px 8px;
}

/* ---------- Subway ---------- */
.lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.line {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 4px; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.line:hover, .line[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.line .status { font-size: 12px; line-height: 1.2; font-weight: 500; }
.status.good { color: var(--good); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }
.bullet {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 50%;
  font-family: var(--font); font-weight: 700; font-size: 16px; color: #fff; vertical-align: middle;
}
.bullet.sm { width: 20px; height: 20px; font-size: 12px; }
.bullet.dark { color: #111; }
.alerts { margin-top: 14px; }
.alert { border-top: 1px solid var(--line); padding: 12px 0; }
.alert-type { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.alert p { margin: 4px 0 0; }
.alert details { color: var(--muted); font-size: 13px; margin-top: 4px; white-space: pre-line; }
.alert summary { cursor: pointer; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

/* ---------- Countdown clock ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.board-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.station-input {
  flex: 1 1 260px; min-width: 0;
  font: inherit; font-size: 15px; padding: 9px 12px;
  border: 2px solid var(--sign); border-radius: 4px; background: var(--card); color: var(--ink);
}
.station-input:focus { outline: 3px solid var(--taxi); outline-offset: 1px; }
.board-station { font-size: 20px; font-weight: 700; margin: 16px 0 10px; letter-spacing: -.01em; }
.board-station small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.clock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.clock {
  --led: #ffb52e;
  position: relative; overflow: hidden;
  background: #050505; color: var(--led); border-radius: 6px;
  border: 3px solid #2b2b2b; box-shadow: inset 0 0 0 1px #000;
  padding: 10px 12px 8px;
}
.clock::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, transparent 1.1px, rgba(5,5,5,.6) 1.5px) 0 0 / 3px 3px;
}
.clock-head {
  display: flex; align-items: center; gap: 6px;
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid #333;
}
.clock-head .dir { margin-left: auto; color: #bbb; }
.clock-row {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px;
  font-family: "DotGothic16", ui-monospace, monospace; font-size: 19px; text-transform: uppercase;
  text-shadow: 0 0 6px rgba(255, 170, 40, .7);
  padding: 4px 0;
}
.clock-row .dest { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clock-row .min { font-variant-numeric: tabular-nums; }
.clock-row.now .min { color: #ff5a4e; text-shadow: 0 0 6px rgba(255, 70, 60, .8); animation: blink 1s steps(2, start) infinite; }
.clock-row .bullet { text-shadow: none; }
.clock-empty { font-family: "DotGothic16", monospace; color: #8a6a2a; padding: 6px 0; text-transform: uppercase; }
.clock-note { position: relative; z-index: 1; margin: 2px 0 4px; color: #ddd; font-size: 13px; line-height: 1.4; }

/* ---------- Citi Bike ---------- */
.bike-sign { border-bottom: 5px solid var(--bike); }
:root { --bike: #0a6cc2; --bike-soft: #d7e8f8; }
@media (prefers-color-scheme: dark) { :root { --bike: #4a9cf0; --bike-soft: #1e3247; } }
.bike-summary { margin: 0 0 12px; font-size: 15px; }
.bike-summary b { font-size: 17px; }
.bike-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.dock { border: 1px solid var(--line); border-radius: 6px; padding: 12px; border-top: 3px solid var(--bike); }
.dock.empty { border-top-color: var(--bad); }
.dock-name { font-weight: 700; line-height: 1.3; }
.dock-dist { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dock-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; text-align: center; }
.dock-counts b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dock-counts span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dock-counts .zero b { color: var(--muted); opacity: .6; }
.dock-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--bike-soft); margin-top: 10px; }
.dock-bar i { display: block; height: 100%; }
.dock-bar .c { background: var(--bike); }
.dock-bar .e { background: var(--taxi); }

/* ---------- Elevators & escalators ---------- */
.access-sign { border-bottom: 5px solid var(--accent); }
.access-sign h2::before { content: "♿ "; }
.access-summary { margin: 0 0 12px; font-size: 15px; }
.access-summary .ok { color: var(--good); font-weight: 700; }
.access-summary .out { color: var(--bad); font-weight: 700; }
.access-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.outage { border: 1px solid var(--line); border-radius: 6px; padding: 12px; border-top: 3px solid var(--bad); }
.ene-type { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--accent); }
.ene-type.es { background: var(--muted); }
@media (prefers-color-scheme: dark) { .ene-type { color: #111; } }
.ene-station { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.ene-serving { font-weight: 700; line-height: 1.3; margin-top: 8px; }
.ene-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.ene-meta b { color: var(--ink); }
.ene-alt { margin-top: 8px; font-size: 13px; }
.ene-alt summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.ene-alt p { margin: 6px 0 0; line-height: 1.45; }
.ene-h { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ene-planned { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.ene-planned li { padding: 6px 0; border-top: 1px solid var(--line); }
.ene-planned span { color: var(--muted); white-space: nowrap; }
.access-city { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.access-city summary { cursor: pointer; font-size: 14px; }
.access-city-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 24px; font-size: 13px; }
.access-city-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.access-city-list div { color: var(--muted); }
.ene-lines { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin-left: 4px; }

/* ---------- Events ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--chip); color: inherit;
  border-radius: 999px; padding: 5px 13px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--street); color: #fff; border-color: var(--street); }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 24px; }
.event { display: grid; grid-template-columns: 66px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.event time {
  align-self: start; text-align: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
  background: var(--sign); color: var(--taxi); border-radius: 3px; padding: 3px 4px;
}
.event .name { font-weight: 700; }
.event .where { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); margin-top: 4px; }

/* ---------- Footer ---------- */
.footer { margin-top: 36px; background: var(--sign); color: #b9bdc6; font-size: 13px; padding: 20px 0 28px; position: relative; }
.footer::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 1.5px; background: #fff; }
.footer a, .link-btn { color: #fff; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
