:root { color-scheme: dark; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  /* Signage runs unattended: no text selection, no long-press menus. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Hide the mouse pointer on kiosk displays. */
body.kiosk { cursor: none; }

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}

/* --- zones ------------------------------------------------------------- */
/* Geometry comes from the manifest as percentages, so the same layout fills
   any resolution or aspect ratio without a scaling pass. */
.zone {
  position: absolute;
  overflow: hidden;
}

/* Two stacked layers per zone let us crossfade between playlist items
   without a reflow. */
.layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 600ms ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}
.layer.visible { opacity: 1; }

.layer img,
.layer video {
  width: 100%;
  height: 100%;
  display: block;
}
.fit-cover img,   .fit-cover video   { object-fit: cover; }
.fit-contain img, .fit-contain video { object-fit: contain; }
.fit-fill img,    .fit-fill video    { object-fit: fill; }

.layer iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.widget-text {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3%;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

.widget-clock {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.widget-clock .time { font-weight: 600; line-height: 1; }
.widget-clock .date { opacity: .75; margin-top: .4em; font-size: .35em; }

/* --- overlays ---------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0e14;
}
.overlay[hidden] { display: none; }

.card {
  max-width: 32rem;
  padding: 2.5rem;
  text-align: center;
}
.card h1 { margin: 0 0 .75rem; font-size: 2rem; font-weight: 600; }
.card p  { margin: 0 0 1.5rem; color: #98a2b3; font-size: 1rem; }

#pair-form { display: flex; gap: .5rem; justify-content: center; }

#pair-code {
  font-size: 2rem;
  letter-spacing: .35em;
  text-align: center;
  text-transform: uppercase;
  width: 9ch;
  padding: .5rem;
  border-radius: .5rem;
  border: 2px solid #344054;
  background: #101828;
  color: #fff;
}
#pair-code:focus { outline: none; border-color: #4c8dff; }

button {
  font-size: 1rem;
  padding: .75rem 1.5rem;
  border-radius: .5rem;
  border: 0;
  background: #4c8dff;
  color: #fff;
  cursor: pointer;
}
button:hover { background: #3a7ae8; }

.error { color: #ff7b72; min-height: 1.2em; margin: 1rem 0 0; }

#debug {
  position: fixed;
  right: 0; bottom: 0;
  z-index: 9500;
  max-width: 34rem;
  padding: .75rem 1rem;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(0, 0, 0, .82);
  color: #7ee787;
  white-space: pre-wrap;
  border-top-left-radius: .5rem;
}
#debug[hidden] { display: none; }
