:root {
  --bg: #f5f2ec;
  --ink: #182026;
  --muted: #65717b;
  --line: rgba(24, 32, 38, 0.12);
  --panel: rgba(255, 255, 255, 0.62);
  --good: #116a54;
  --warn: #a85e00;
  --bad: #b62732;
  --track: #275d8f;
  --shadow: rgba(26, 31, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: start center;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.widget {
  width: min(100vw, 760px);
  height: auto;
  min-height: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.18)),
    var(--bg);
  overflow: hidden;
}

.topbar,
.summary,
.footer {
  flex: 0 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow,
.summary span,
.footer,
.meta,
.reason {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.eyebrow {
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 750;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.02;
  letter-spacing: 0;
}

.stamp {
  min-width: 72px;
  padding-top: 1px;
  text-align: right;
}

.stamp span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.stamp strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
  line-height: 1;
}

.summary {
  display: grid;
  grid-template-columns: 1.1fr 0.75fr 1fr;
  gap: 6px;
}

.summary-item {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.summary strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.1;
}

.trains {
  flex: 0 0 auto;
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 8px;
  min-height: 0;
}

.train {
  display: grid;
  grid-template-columns: 64px minmax(78px, 1fr) 40px 62px;
  align-items: center;
  gap: 6px;
  min-height: 43px;
  align-self: start;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--good);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 20px var(--shadow);
}

.train.delayed {
  border-left-color: var(--warn);
}

.train.cancelled {
  border-left-color: var(--bad);
  opacity: 0.72;
}

.time {
  min-width: 0;
}

.time strong {
  display: block;
  font-size: 19px;
  line-height: 1;
}

.time span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.time .expected {
  color: var(--warn);
}

.cancelled .time .expected {
  color: var(--bad);
  font-size: 17px;
  font-weight: 800;
}

.detail {
  min-width: 0;
}

.detail strong,
.platform strong,
.duration strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.1;
}

.platform,
.duration {
  min-width: 0;
}

.platform span,
.duration span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.platform strong {
  color: var(--track);
  font-size: 17px;
}

.duration strong {
  font-size: 12px;
}

.duration .changed {
  color: var(--warn);
}

.duration-note {
  display: block;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.arrival {
  display: inline-block;
}

.early-arrival {
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(17, 106, 84, 0.13);
  color: var(--good);
  font-weight: 800;
}

.reason {
  grid-column: 1 / -1;
  margin-top: -2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: none;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 124px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.44);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
  white-space: nowrap;
}

.footer span {
  overflow: hidden;
  text-overflow: ellipsis;
}
