* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  background: #111;
  overflow: hidden;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

#board-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2vh 2vw;
  gap: 2vh;
}

/* --- Clock Section --- */
.clock-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8vw;
  margin-bottom: 1vh;
}

.clock-tile-wrapper {
  display: inline-block;
}

.clock-digit {
  width: clamp(60px, 8vw, 220px);
  height: clamp(80px, 10vw, 280px);
  background: #1a1a1a;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.clock-digit-face {
  width: 100%;
  height: 100%;
  background: #222;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.5),
    inset 0 -1px 1px rgba(255, 255, 255, 0.02);
}

/* Horizontal split line on clock digits */
.clock-digit-face::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.clock-digit-face span {
  font-size: clamp(48px, 6.5vw, 190px);
  font-weight: 700;
  color: #f5c825;
  font-family: 'Courier New', Courier, monospace;
  line-height: 1;
}

.clock-colon {
  font-size: clamp(40px, 5.5vw, 160px);
  font-weight: 700;
  color: #f5c825;
  font-family: 'Courier New', Courier, monospace;
  line-height: 1;
  margin: 0 0.3vw;
}

.clock-flipping .clock-digit-face {
  animation: clockFlip 0.3s ease-in-out;
}

@keyframes clockFlip {
  0% { transform: perspective(300px) rotateX(0deg); }
  50% { transform: perspective(300px) rotateX(-10deg); }
  100% { transform: perspective(300px) rotateX(0deg); }
}


/* --- Departures Body --- */
.departures-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1vh;
}

/* --- Departure Row --- */
.departure-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  column-gap: 0;
  align-items: center;
  padding: 0.5vh 1vw;
  border-bottom: 1px solid #1f1f1f;
  transition: opacity 0.5s;
}

/* --- Cell spacing --- */
.dep-time {
  padding-right: 3vw;
}

.dep-dest {
  padding-right: 0;
}

.dep-plat {
  padding-right: 3vw;
}

/* Time colon tile — narrower than digit tiles */
.dep-time .tile:nth-child(3) {
  width: clamp(14px, 1.4vw, 36px);
}

/* --- Tile Row (within cells) --- */
.tile-row {
  display: flex;
  gap: clamp(2px, 0.25vw, 4px);
}

/* --- Departure cell tiles — override tile sizes --- */
.dep-cell .tile {
  width: clamp(24px, 2.8vw, 72px);
  height: clamp(36px, 4.5vw, 115px);
}

.dep-cell .tile-front span,
.dep-cell .tile-back span {
  font-size: clamp(20px, 2.5vw, 70px);
  color: #f5c825;
  font-family: 'Courier New', Courier, monospace;
}

/* Platform tile — slightly larger for emphasis */
.dep-plat .tile {
  width: clamp(30px, 3.2vw, 80px);
  height: clamp(36px, 4.5vw, 115px);
}

.dep-plat .tile-front span,
.dep-plat .tile-back span {
  font-size: clamp(24px, 3vw, 80px);
  color: #fff;
}

/* Status cell */
.dep-status {
  display: flex;
  align-items: center;
}

/* --- Departures label --- */
.board-label {
  font-size: clamp(10px, 1vw, 22px);
  color: #444;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
}

/* --- Top-right toolbar --- */
.top-toolbar {
  position: fixed;
  top: 10px;
  right: 32px;
  z-index: 100;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.config-btn {
  background: #2a2a2a;
  color: #888;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.4;
}

.config-btn:hover {
  color: #f5c825;
  border-color: #f5c825;
}

/* --- Sync widget --- */
.sync-widget {
  position: relative;
}

.sync-btn {
  background: #2a2a2a;
  color: #888;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  transition: all 0.15s;
}

.sync-btn.active {
  background: #f5c825;
  color: #111;
  border-color: #f5c825;
}

.sync-panel {
  position: absolute;
  top: 32px;
  right: 0;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 12px;
  min-width: 220px;
}

.sync-panel input {
  width: 100%;
  background: #222;
  color: #f5c825;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px;
  font-size: 14px;
  font-family: 'Courier New', monospace;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.sync-panel input:focus {
  outline: none;
  border-color: #f5c825;
}

.sync-actions {
  display: flex;
  gap: 8px;
}

.sync-connect, .sync-disconnect {
  flex: 1;
  padding: 6px 12px;
  border: 1px solid #333;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sync-connect {
  background: #f5c825;
  color: #111;
  border-color: #f5c825;
}

.sync-disconnect {
  background: #2a2a2a;
  color: #ef4444;
  border-color: #333;
}

/* --- Connection indicator --- */
.connection-indicator {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  transition: background 0.3s;
}

.connection-indicator.connected {
  background: #22c55e;
}

/* --- Mobile layout --- */
.mobile #board-container {
  padding: 2vh 4vw;
  gap: 3vh;
  overflow: hidden;
}

/* Smaller clock */
.mobile .clock-digit {
  width: 14vw;
  height: 17vw;
}

.mobile .clock-digit-face span {
  font-size: 11vw;
}

.mobile .clock-colon {
  font-size: 9vw;
  margin: 0 1vw;
}

.mobile .clock-section {
  gap: 1.5vw;
  margin-bottom: 2vh;
}

/* Only show first 2 departure rows */
.mobile .departure-row:nth-child(n+3) {
  display: none;
}

/* Hide status column */
.mobile .dep-status {
  display: none;
}

/* Shorten destination to 9 tiles */
.mobile .dep-dest .tile:nth-child(n+10) {
  display: none;
}

/* Larger tiles for readability */
.mobile .dep-cell .tile {
  width: 6vw;
  height: 10vw;
}

.mobile .dep-cell .tile-front span,
.mobile .dep-cell .tile-back span {
  font-size: 5.5vw;
}

.mobile .dep-plat .tile {
  width: 7vw;
  height: 10vw;
}

.mobile .dep-plat .tile-front span,
.mobile .dep-plat .tile-back span {
  font-size: 6vw;
}

/* Narrower colon tile on mobile */
.mobile .dep-time .tile:nth-child(3) {
  width: 3vw !important;
}

/* Tighter cell spacing on mobile */
.mobile .dep-time {
  padding-right: 2vw;
}

.mobile .dep-dest {
  padding-right: 0;
}

.mobile .dep-plat {
  padding-right: 0;
}

.mobile .tile-row {
  gap: 1px;
}

.mobile .departures-body {
  gap: 2vh;
}
