:root {
  --board-chassis: #0A0A0A;
  --cell-bg: #1A1A1A;
  --cell-border: #2E2E2E;
  --char-amber: #F7B500;
  --header-white: #F5F5F0;
  --us-flag-accent: #3CB878;
  --status-alert: #E14B3E;

  --flap-font: 'IBM Plex Mono', ui-monospace, monospace;
  --head-font: 'Archivo', system-ui, sans-serif;
  /* Dot-matrix / LED-sign font for the SINGLE view — a true round-dot variable
     font (has a ROND axis, maxed out below) rather than a regular typeface,
     to match the pixelated dot-matrix departure-sign look of the reference image. */
  --dot-font: 'Doto', var(--flap-font);

  /* Cell width is the real constraint (37 characters across 4 fields per row),
     so font-size tracks width, and height derives from font-size — not the
     other way around. That fills available horizontal space properly instead
     of leaving cells tall but narrow-looking. */
  --cell-w: clamp(17px, 2.05vw, 26px);
  --glyph-size: calc(var(--cell-w) * 1.5);
  --cell-h: calc(var(--glyph-size) * 1.3);
  --cell-gap: 2px;
  --field-gap: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  background: var(--board-chassis);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  display: flex;
  justify-content: center;
}

/* ---------------- Page (board + map, stacked) ---------------- */
/* The board always fills exactly one screen; the map (if enabled) is a second,
   full-width section reached by scrolling down — never both squeezed into one
   viewport. */

.page {
  width: 100%;
  max-width: 1400px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------------- Board chassis ---------------- */

.board {
  position: relative;
  width: 100%;
  min-width: 0;
  /* Sized to its actual content (header + column headers + however many rows
     are configured) rather than a fixed 100vh — a fixed height left a large
     dead gap below the rows whenever the row count was small. The map section
     immediately follows, whatever that content height turns out to be. */
  flex: 0 0 auto;
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 8px;
  flex: 0 0 auto;
}

.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 4px;
  min-width: 0;
  gap: 12px;
  font-family: var(--head-font);
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--header-white);
  font-size: clamp(15px, 2.6vw, 26px);
}

.plane-icon {
  width: 1em;
  height: 1em;
  fill: var(--char-amber);
  flex: 0 0 auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  margin-left: auto;
}

.settings-btn {
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--cell-border);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.settings-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--char-amber);
}

.settings-btn:active {
  background: var(--cell-bg);
}

.settings-panel {
  position: absolute;
  top: 64px;
  right: 16px;
  left: 16px;
  margin-left: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  max-width: min(320px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: var(--cell-bg);
  border: 1px solid var(--cell-border);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.settings-panel[hidden] { display: none; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.settings-label {
  font-family: var(--head-font);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--header-white);
  font-size: 13px;
}

.settings-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.settings-options button {
  min-width: 44px;
  min-height: 40px;
  padding: 6px 12px;
  background: var(--board-chassis);
  border: 1px solid var(--cell-border);
  border-radius: 3px;
  color: var(--char-amber);
  font-family: var(--flap-font);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.settings-options button.active {
  background: var(--char-amber);
  color: var(--board-chassis);
  border-color: var(--char-amber);
}

.row-stepper {
  align-items: center;
}

.row-stepper button {
  min-width: 44px;
  min-height: 44px;
  font-size: 18px;
  line-height: 1;
}

.row-stepper button:disabled {
  opacity: 0.35;
  cursor: default;
}

.rows-count {
  min-width: 28px;
  text-align: center;
  font-family: var(--flap-font);
  font-weight: 700;
  font-size: 16px;
  color: var(--header-white);
}

.zip-input-group {
  align-items: center;
}

#zip-input {
  width: 76px;
  min-height: 40px;
  padding: 6px 10px;
  background: var(--board-chassis);
  border: 1px solid var(--cell-border);
  border-radius: 3px;
  color: var(--char-amber);
  font-family: var(--flap-font);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
}

#zip-input:focus,
#countdown-input:focus,
#alarm-time-input:focus {
  outline: 2px solid var(--char-amber);
  outline-offset: 1px;
}

#countdown-input {
  width: 64px;
  min-height: 40px;
  padding: 6px 8px;
  background: var(--board-chassis);
  border: 1px solid var(--cell-border);
  border-radius: 3px;
  color: var(--char-amber);
  font-family: var(--flap-font);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
}

#alarm-time-input {
  min-height: 40px;
  padding: 6px 8px;
  background: var(--board-chassis);
  border: 1px solid var(--cell-border);
  border-radius: 3px;
  color: var(--char-amber);
  font-family: var(--flap-font);
  font-weight: 700;
  font-size: 14px;
  color-scheme: dark;
}

.countdown-input-group,
.alarm-input-group {
  align-items: center;
}

/* Visibility toggling for Clock vs Flight settings */
.page.mode-clock .settings-flight-only {
  display: none !important;
}

.settings-clock-only {
  display: none !important;
}

.page.mode-clock .settings-clock-only {
  display: flex !important;
}

/* Alarm notification banner */
.alarm-banner {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(15, 15, 15, 0.95);
  border: 2px solid var(--char-amber);
  border-radius: 6px;
  box-shadow: 0 0 24px rgba(247, 181, 0, 0.6), 0 8px 32px rgba(0, 0, 0, 0.85);
  animation: alarm-pulse 0.8s infinite alternate ease-in-out;
}

.alarm-banner[hidden] {
  display: none;
}

.alarm-banner-text {
  font-family: var(--head-font);
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 16px;
  color: var(--char-amber);
}

.alarm-banner-stop {
  min-height: 36px;
  padding: 6px 16px;
  background: var(--char-amber);
  border: 1px solid var(--char-amber);
  border-radius: 4px;
  color: var(--board-chassis);
  font-family: var(--flap-font);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.05em;
  cursor: pointer;
}

@keyframes alarm-pulse {
  0% {
    box-shadow: 0 0 16px rgba(247, 181, 0, 0.35);
    border-color: rgba(247, 181, 0, 0.65);
  }
  100% {
    box-shadow: 0 0 32px rgba(247, 181, 0, 0.9);
    border-color: rgba(247, 181, 0, 1);
  }
}

.settings-status-row {
  justify-content: flex-end;
  margin-top: -4px;
}

.settings-status {
  font-family: var(--flap-font);
  font-size: 11px;
  color: var(--cell-border);
  min-height: 14px;
}

.settings-status.is-error {
  color: var(--status-alert);
}

.settings-status.is-ok {
  color: var(--us-flag-accent);
}

.eyebrow-divider {
  color: var(--cell-border);
  font-weight: 400;
}

.eyebrow-location {
  color: var(--char-amber);
}

.reconnect-badge {
  margin-left: 10px;
  padding: 3px 10px;
  border: 1px solid var(--status-alert);
  color: var(--status-alert);
  font-size: 11px;
  letter-spacing: 0.12em;
  border-radius: 2px;
  animation: pulse-alert 1.4s ease-in-out infinite;
}

@keyframes pulse-alert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------------- Column headers ---------------- */

.column-headers {
  display: grid;
  grid-template-columns:
    calc(var(--cell-w) * 7 + var(--cell-gap) * 6 + 20px)
    calc(var(--cell-w) * 18 + var(--cell-gap) * 17 + 32px)
    calc(var(--cell-w) * 7 + var(--cell-gap) * 6)
    calc(var(--cell-w) * 5 + var(--cell-gap) * 4);
  column-gap: var(--field-gap);
  padding: 6px 4px 10px;
  border-bottom: 2px solid var(--header-white);
  flex: 0 0 auto;
}

.col {
  font-family: var(--head-font);
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--header-white);
  font-size: clamp(13px, 1.4vw, 17px);
}

/* ---------------- Board content wrapper (groups column-headers/rows/empty-state
   so the BOARD/SINGLE view toggle can hide them as one unit; purely structural —
   the 12px gap it uses matches the gap .board previously applied directly to
   these as top-level flex children, so original spacing is unchanged). ---------------- */

.board-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  /* The board's 37 fixed-width character cells need ~840px minimum, which is
     wider than any phone (folded or unfolded) or narrow foldable cover
     screen. Rather than redesign the locked column layout per breakpoint,
     let this section scroll horizontally as one unit — column-headers and
     rows share the same grid-template-columns formula so they stay aligned
     while scrolling together. */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.board-content[hidden] {
  display: none;
}

/* ---------------- Rows ---------------- */

.rows {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 6px;
}

.flap-row {
  display: grid;
  grid-template-columns:
    calc(var(--cell-w) * 7 + var(--cell-gap) * 6 + 20px)
    calc(var(--cell-w) * 18 + var(--cell-gap) * 17 + 32px)
    calc(var(--cell-w) * 7 + var(--cell-gap) * 6)
    calc(var(--cell-w) * 5 + var(--cell-gap) * 4);
  column-gap: var(--field-gap);
  align-items: center;
  padding: 4px 4px;
  border-bottom: 1px solid var(--cell-border);
}

.flap-row[hidden] {
  display: none;
}

.flap-row.is-last {
  border-bottom: none;
}

.field {
  display: flex;
  gap: var(--cell-gap);
  align-items: center;
}

.field-flight {
  position: relative;
}

.field-cells {
  display: flex;
  gap: var(--cell-gap);
}

.airline-logo {
  width: 26px;
  height: var(--cell-h);
  margin-right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}

.airline-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  visibility: hidden;
}

.airline-logo-img.is-loaded {
  visibility: visible;
}

.us-tag {
  width: 16px;
  height: var(--cell-h);
  margin-right: 4px;
  border: 1px solid var(--cell-border);
  border-radius: 2px;
  background: var(--cell-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--head-font);
  font-weight: 800;
  font-size: 11px;
  color: var(--board-chassis);
  flex: 0 0 auto;
  visibility: hidden;
}

.flap-row.is-us .us-tag {
  visibility: visible;
  background: var(--us-flag-accent);
  color: #0A0A0A;
}

/* ---------------- Flap cell (the signature element) ---------------- */

.flap-cell {
  position: relative;
  width: var(--cell-w);
  height: var(--cell-h);
  perspective: 220px;
  border: 1px solid var(--cell-border);
  border-radius: 2px;
  background: var(--cell-bg);
  flex: 0 0 auto;
}

.flap-half {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  overflow: hidden;
  background: var(--cell-bg);
}

.flap-cell .glyph {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--cell-h);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--flap-font);
  font-weight: 700;
  font-size: var(--glyph-size);
  color: var(--char-amber);
  line-height: 1;
  /* Taller characters without widening them: scale the glyph itself vertically
     rather than the font-size (which would widen it too). */
  transform: scaleY(1.1);
}

.flap-front-top { top: 0; }
.flap-front-top .glyph { top: 0; }

.flap-front-bottom { bottom: 0; }
.flap-front-bottom .glyph { top: calc(var(--cell-h) * -0.5); }

/* the moving leaves */
.flap-leaf {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  overflow: hidden;
  background: var(--cell-bg);
  backface-visibility: hidden;
  will-change: transform;
}

.flap-leaf-top {
  top: 0;
  transform-origin: bottom center;
}
.flap-leaf-top .glyph { top: 0; }
.flap-leaf-top::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 55%, rgba(0,0,0,0.45) 100%);
  pointer-events: none;
}

.flap-leaf-bottom {
  bottom: 0;
  transform-origin: top center;
}
.flap-leaf-bottom .glyph { top: calc(var(--cell-h) * -0.5); }
.flap-leaf-bottom::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, transparent 55%, rgba(0,0,0,0.45) 100%);
  pointer-events: none;
}

/* static crease line at the fold */
.flap-cell::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - 0.5px);
  height: 1px;
  background: rgba(0,0,0,0.55);
  z-index: 5;
  pointer-events: none;
}

/* ---------------- Empty state ---------------- */

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  font-family: var(--head-font);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cell-border);
  font-size: clamp(14px, 1.6vw, 18px);
}

.empty-state[hidden] { display: none; }

/* ---------------- Single-flight view (alternate to the split-flap board,
   selectable via Settings > VIEW; a white LED-sign-style "now overhead" display
   showing just the nearest flight, styled after an airport departure sign). ---------------- */

.single-content {
  flex: 1 1 auto;
  min-height: 0; /* allow this flex child to shrink below its content's natural size */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px clamp(24px, 6vw, 96px);
  overflow: hidden;
  /* LED-panel dot grid across the whole sign, echoing the physical matrix the
     reference photo was shot on. */
  background-image: radial-gradient(rgba(245, 245, 240, 0.16) 1.3px, transparent 1.4px);
  background-size: 7px 7px;
}

.single-content[hidden] {
  display: none;
}

/* SINGLE view fills the whole screen (e.g. iPad landscape) like a standalone
   departure sign, rather than sizing to its content the way the multi-row board
   does — .board is pinned to exactly one viewport (not just min-height, so a
   long destination name's 3-line clamp plus the info block above it can never
   push the sign past the screen's bottom edge) and single-content, as its only
   flexed child once board-content is hidden, stretches to fill what's left
   under the header. */
.page.mode-single .board {
  height: 100vh;
  overflow: hidden;
}

.single-card {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 6vh, 72px);
}

.single-top {
  display: flex;
  align-items: center;
  gap: clamp(48px, 8vw, 112px);
}

.single-logo-box {
  position: relative;
  width: clamp(222px, 31.7vw, 443px);
  height: clamp(222px, 31.7vw, 443px);
  flex: 0 0 auto;
  /* No background chip — the dot-matrix mark sits directly on the sign's own
     black backdrop, like the rest of the display, rather than in a colored box. */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.single-logo-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.single-info {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.4vw, 16px);
  min-width: 0;
}

.single-flight,
.single-route,
.single-type {
  font-family: var(--dot-font);
  font-variation-settings: 'ROND' 100;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--header-white);
  font-size: clamp(36px, 8vw, 88px);
  line-height: 1.15;
  text-shadow: 0 0 14px rgba(245, 245, 240, 0.3);
}

.single-flight {
  padding-top: clamp(14px, 2.5vw, 28px);
}

.single-route,
.single-type {
  color: rgba(245, 245, 240, 0.78);
  font-size: clamp(26px, 5.6vw, 58px);
}

.single-telemetry {
  font-family: var(--dot-font);
  font-variation-settings: 'ROND' 100;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(245, 245, 240, 0.55);
  font-size: clamp(18px, 3.6vw, 36px);
  line-height: 1.2;
}

.single-departing {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vw, 10px);
}

.single-departing-label {
  font-family: var(--head-font);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(245, 245, 240, 0.65);
  font-size: clamp(18px, 2.8vw, 28px);
  text-transform: uppercase;
}

.single-departing-dest {
  font-family: var(--dot-font);
  font-variation-settings: 'ROND' 100;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--header-white);
  font-size: clamp(36px, 8vw, 88px);
  line-height: 1.1;
  text-shadow: 0 0 18px rgba(245, 245, 240, 0.3);
  /* Long destination names (e.g. "Barnstable Municipal Boardman Polando Field")
     can run past 3 lines at this font size and push past the screen's bottom
     edge — clamp to 3 lines with an ellipsis rather than letting it overflow. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* ---------------- Map ---------------- */

.map-section {
  position: relative;
  z-index: 0; /* contains Leaflet's internal panes in their own stacking context */
  flex: 0 0 auto;
  height: 100vh;
  border-top: 1px solid var(--cell-border);
  background: var(--board-chassis);
}

.map-section[hidden] {
  display: none;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--board-chassis);
}

/* This basemap only ships a light style (the free CARTO dark style now requires
   an API key — see initMap in app.js). Invert+rotate just the tile pane to
   approximate a dark map without touching marker/popup panes, which stay their
   real colors. */
.leaflet-tile-pane {
  filter: grayscale(0.6) invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.7);
}

/* Leaflet's own UI chrome, restyled to match the board rather than its default look. */
.leaflet-control-attribution {
  background: rgba(10, 10, 10, 0.7) !important;
  color: var(--cell-border) !important;
  font-family: var(--flap-font) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a {
  color: var(--cell-border) !important;
}

/* Zoom control lives top-right too (see initMap) — push it down below the
   radius label so the two never overlap, regardless of exact label width. */
.leaflet-top.leaflet-right {
  top: 42px;
}

.leaflet-control-zoom a {
  background: rgba(10, 10, 10, 0.85) !important;
  color: var(--char-amber) !important;
  border-color: var(--cell-border) !important;
}

.map-radius-label {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 500;
  font-family: var(--head-font);
  font-weight: 800;
  letter-spacing: 0.1em;
  font-size: 10px;
  color: var(--header-white);
  background: rgba(10, 10, 10, 0.7);
  padding: 3px 8px;
  border: 1px solid var(--cell-border);
  border-radius: 2px;
  pointer-events: none;
}

.map-home-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--header-white);
  border: 2px solid var(--board-chassis);
  box-shadow: 0 0 0 1px var(--header-white);
}

.map-plane-icon {
  width: 27px;
  height: 27px;
  overflow: visible;
}
.map-plane-icon svg {
  width: 100%;
  height: 100%;
  fill: var(--char-amber);
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8));
}
.map-plane-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 1px;
  font-family: var(--flap-font);
  font-weight: 700;
  font-size: 10px;
  color: var(--char-amber);
  white-space: nowrap;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9), 0 0 3px rgba(0, 0, 0, 0.9);
}

/* ---------------- Clock (separate visual register: 7-segment) ---------------- */

.clock {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.seg-digit {
  position: relative;
  width: 15px;
  height: 26px;
}

.seg {
  position: absolute;
  background: rgba(247, 181, 0, 0.08);
}
.seg.on {
  background: var(--char-amber);
  box-shadow: 0 0 6px rgba(247, 181, 0, 0.65), 0 0 1px rgba(247, 181, 0, 0.9);
}

.seg-a, .seg-d, .seg-g {
  left: 2px;
  width: 11px;
  height: 3px;
  clip-path: polygon(15% 0%, 85% 0%, 100% 50%, 85% 100%, 15% 100%, 0% 50%);
}
.seg-a { top: 0; }
.seg-g { top: 11.5px; }
.seg-d { top: 23px; }

.seg-b, .seg-c, .seg-e, .seg-f {
  width: 3px;
  height: 10.5px;
  clip-path: polygon(0% 15%, 50% 0%, 100% 15%, 100% 85%, 50% 100%, 0% 85%);
}
.seg-f { left: 0; top: 1.5px; }
.seg-b { right: 0; top: 1.5px; }
.seg-e { left: 0; top: 14px; }
.seg-c { right: 0; top: 14px; }

.seg-colon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
  height: 26px;
}
.seg-colon .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--char-amber);
  box-shadow: 0 0 6px rgba(247, 181, 0, 0.65);
}

/* ---------------- Splash ---------------- */

.splash {
  position: fixed;
  inset: 0;
  background: var(--board-chassis);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Leaflet's internal panes (tile/marker/popup) run up to z-index ~700 and, since
     .map-section has no z-index of its own to contain them in a local stacking
     context, they escape to the document root — must outrank all of them. */
  z-index: 9999;
}

.splash[hidden] { display: none; }

.splash-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.splash-plane {
  width: 48px;
  height: 48px;
  fill: var(--char-amber);
}

.splash-inner h1 {
  font-family: var(--head-font);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--header-white);
  font-size: clamp(28px, 6vw, 44px);
  margin: 0;
}

.splash-inner p {
  font-family: var(--flap-font);
  color: var(--char-amber);
  font-size: 14px;
  margin: 0 0 12px;
  letter-spacing: 0.04em;
}

#tap-start {
  font-family: var(--head-font);
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 16px;
  color: var(--board-chassis);
  background: var(--char-amber);
  border: none;
  border-radius: 3px;
  padding: 16px 32px;
  cursor: pointer;
  min-height: 44px;
}

#tap-start:active {
  background: #d99f00;
}

/* ---------------- Clock view (full-bleed artwork with a live clock) ---------------- */
/* The stage is fixed to the viewport (so it fills the page edge-to-edge even past
   .page's 1400px max-width) and sized like `object-fit: cover`: wide enough to
   cover both the viewport width and — via the image's aspect ratio — its height.
   The <img> and the SVG overlay share the exact same box, so the clock face drawn
   in the SVG (in image pixel coordinates) always lines up with the picture. */

.clock-content {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #000;
}

.clock-content[hidden] {
  display: none;
}

.clock-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100vw, calc(100vh * 1376 / 768));
  aspect-ratio: 1376 / 768;
  transform: translate(-50%, -50%);
  background-color: #9ad6ee;
  overflow: hidden;
}

.clock-sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.clock-cloud {
  position: absolute;
  left: 0;
  display: block;
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

.clock-cloud.cloud-1 {
  top: 7.8%;
  width: 18.46%;
  aspect-ratio: 254 / 78;
  animation: cloud-1-drift 62s linear infinite;
}

.clock-cloud.cloud-2 {
  top: 4.6%;
  width: 15%;
  aspect-ratio: 254 / 78;
  opacity: 0.9;
  animation: cloud-2-drift 62s linear infinite;
  animation-delay: -31s;
}

@keyframes cloud-1-drift {
  0% {
    transform: translate3d(560%, 0, 0);
  }
  100% {
    transform: translate3d(-120%, 0, 0);
  }
}

@keyframes cloud-2-drift {
  0% {
    transform: translate3d(680%, 0, 0);
  }
  100% {
    transform: translate3d(-120%, 0, 0);
  }
}

.clock-art,
.clock-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.clock-art {
  z-index: 2;
  transition: opacity 0.2s ease;
}

.clock-overlay {
  z-index: 3;
  transition: opacity 0.2s ease;
}

.clock-alarm-video,
.clock-alarm-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

.clock-alarm-fallback {
  z-index: 4;
}

.clock-alarm-video {
  z-index: 5;
}

.clock-stage.is-alarm .clock-alarm-video,
.clock-stage.is-alarm .clock-alarm-fallback {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.clock-stage.is-alarm .clock-art,
.clock-stage.is-alarm .clock-overlay,
.clock-stage.is-alarm .clock-sky {
  opacity: 0;
  visibility: hidden;
}

/* Header floats over the artwork: only the settings button stays visible (the
   eyebrow and corner clock would be redundant on top of the picture). */
.page.mode-clock .board {
  height: 100vh;
  overflow: hidden;
}

.page.mode-clock .board-header {
  position: relative;
  z-index: 2;
}

.page.mode-clock .eyebrow,
.page.mode-clock .clock {
  display: none;
}

.page.mode-clock .settings-btn {
  background: rgba(10, 10, 10, 0.65);
  border-color: rgba(245, 245, 240, 0.25);
}
