:root {
  color-scheme: dark;
  --bg: #101923;
  --panel: #172432;
  --panel-strong: #203244;
  --text: #f4f8fb;
  --muted: #a8b8c7;
  --accent: #4db3ff;
  --good: #73d179;
  --warn: #ffd166;
  --bad: #ff6b6b;
  --border: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.display-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.display-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.display-header p {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.display-header h1 {
  margin: 0;
  font-size: clamp(28px, 3.5vw, 52px);
  line-height: 1;
}

.display-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.display-home-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.display-home-button:hover,
.display-home-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.display-home-button svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

#display-status {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  white-space: nowrap;
}

.display-footer {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 16px;
}

.display-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}

.display-modes a {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.display-modes a.active {
  background: var(--accent);
  color: #07131e;
}

.display-board {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.display-board header {
  padding: 16px 18px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--border);
}

.display-board h2 {
  margin: 0;
  font-size: clamp(24px, 2.4vw, 34px);
}

.display-board p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.display-row {
  display: grid;
  grid-template-columns: clamp(116px, 10vw, 150px) minmax(0, 1fr);
  gap: clamp(14px, 1.5vw, 22px);
  align-items: start;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.display-row:last-child {
  border-bottom: 0;
}

.time {
  font-size: clamp(34px, 3.4vw, 46px);
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0;
}

.line {
  border-radius: 6px;
  padding: 4px 7px;
  background: #e7f4ff;
  color: #0f4167;
  font-weight: 950;
  text-align: center;
}

.trip {
  min-width: 0;
}

.direction {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.12;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
  font-size: clamp(15px, 1.3vw, 18px);
}

.ok {
  color: var(--good);
}

.late {
  color: var(--warn);
}

.cancelled {
  color: var(--bad);
}

@media (max-width: 1000px) {
  .display-grid {
    grid-template-columns: 1fr;
  }

  .display-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .display-header-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 520px) {
  .display-shell {
    padding: 12px;
  }

  .display-home-button {
    min-height: 40px;
  }

  .display-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .time {
    font-size: clamp(42px, 15vw, 64px);
  }

  .direction {
    white-space: normal;
  }
}
