:root {
  color-scheme: dark;
  --iron: #26241f;
  --iron-2: #37342d;
  --iron-3: #181713;
  --paint: #8f8a77;
  --paint-dark: #605c50;
  --paper: #ddd3ad;
  --amber: #f0a51b;
  --amber-dim: #b87f18;
  --danger: #c8502f;
  --green: #6f9b46;
  --black: #0d0d0b;
  --line: #4b473d;
  --shadow: rgba(0, 0, 0, .45);
  font-family: "Lucida Console", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 1px, transparent 1px 10px),
    linear-gradient(135deg, #1c1b18, #0e0e0c);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
}

button {
  font: inherit;
}

.console-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 2.5vw, 32px);
}

.machine-panel {
  width: min(1180px, 100%);
  border: 3px solid #11100e;
  background:
    linear-gradient(90deg, rgba(255,255,255,.08), transparent 18%, rgba(0,0,0,.18) 78%),
    var(--iron);
  box-shadow:
    inset 0 0 0 5px var(--paint-dark),
    inset 0 0 0 7px #151410,
    0 24px 60px var(--shadow);
  padding: clamp(12px, 2vw, 22px);
}

.panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 12px;
  align-items: stretch;
  border: 2px solid var(--line);
  background: var(--iron-2);
  padding: clamp(10px, 2vw, 18px);
}

.unit-label {
  margin: 0 0 8px;
  color: var(--amber-dim);
  font-size: clamp(11px, 1.6vw, 14px);
  letter-spacing: 0;
}

h1 {
  margin: 0;
  color: var(--paper);
  font-size: clamp(22px, 4vw, 46px);
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

#refreshButton {
  min-width: 64px;
  min-height: 56px;
  border: 2px solid #15130f;
  background: linear-gradient(#a33322, #6f2118);
  color: #f3d6a4;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.15), inset 0 -4px 0 rgba(0,0,0,.3);
  cursor: pointer;
}

#refreshButton:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 8px rgba(0,0,0,.55);
}

.board-head,
.panel-footer,
.last-reading {
  color: #aaa087;
  font-size: 12px;
}

.last-reading {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 10px;
  border-left: 2px solid var(--line);
  border-right: 2px solid var(--line);
  background: #151410;
  padding: 6px 12px;
}

.last-reading strong {
  color: var(--amber);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.arrival-board {
  border: 3px solid #0a0a09;
  background:
    radial-gradient(circle at 1px 1px, rgba(240,165,27,.2) 1px, transparent 1.6px) 0 0 / 8px 8px,
    var(--black);
  padding: clamp(8px, 1.4vw, 14px);
}

.board-head,
.line-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 150px 92px;
  gap: 12px;
  align-items: center;
}

.board-head {
  padding: 0 10px 8px;
}

.line-rows {
  display: grid;
  gap: 8px;
}

.line-row {
  min-height: 72px;
  border: 1px solid rgba(240,165,27,.35);
  background: rgba(18, 15, 9, .9);
  padding: 10px;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(240,165,27,.45);
}

.line-code {
  font-size: clamp(30px, 5vw, 54px);
  font-weight: 700;
}

.destination {
  min-width: 0;
  color: #ffc04f;
  font-size: clamp(16px, 2.8vw, 30px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eta {
  justify-self: end;
  font-size: clamp(22px, 4vw, 42px);
  font-weight: 700;
  white-space: nowrap;
}

.source {
  justify-self: end;
  color: var(--green);
  font-size: clamp(13px, 2vw, 18px);
}

.line-row.no-data {
  color: #7c755f;
  text-shadow: none;
  border-color: rgba(170,160,135,.22);
}

.line-row.scheduled {
  color: #8f8874;
  text-shadow: none;
  border-color: rgba(170,160,135,.2);
  background: rgba(17, 16, 14, .82);
}

.line-row.no-data .destination,
.line-row.no-data .eta,
.line-row.no-data .source {
  color: #7c755f;
}

.line-row.scheduled .destination,
.line-row.scheduled .eta,
.line-row.scheduled .source {
  color: #8f8874;
}

.panel-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 2px solid var(--line);
  border-top: 0;
  background: var(--iron-3);
  padding: 10px 12px;
}

.empty-state {
  border: 1px solid rgba(240,165,27,.35);
  padding: 20px;
  color: var(--amber);
}

@media (max-width: 720px) {
  .console-shell {
    display: block;
  }

  .machine-panel {
    min-height: calc(100vh - 24px);
  }

  .panel-header {
    grid-template-columns: minmax(0, 1fr) 58px;
  }

  .board-head {
    display: none;
  }

  .last-reading {
    justify-content: flex-start;
    padding: 5px 10px;
  }

  .line-row {
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-areas:
      "line eta"
      "dest dest"
      "source source";
    min-height: 116px;
  }

  .line-code {
    grid-area: line;
  }

  .eta {
    grid-area: eta;
  }

  .destination {
    grid-area: dest;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.15;
  }

  .source {
    grid-area: source;
    justify-self: start;
  }

  .panel-footer {
    flex-direction: column;
  }
}
