/* --- Reset & fullscreen base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Bottom-bar height. Both #overlay and the content area reserve this
     amount so content never plays underneath the clock/name strip.
     Adjusting it here moves them together — don't hard-code the bar
     height in pixels elsewhere. */
  --overlay-height: 3rem;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
  cursor: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #fff;
}

/* --- Content area --- */
#content-area {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Reserve space at the bottom only when the overlay is actually showing
   (its visibility toggles via `.hidden`). When the operator disables the
   overlay via display settings, content uses the full viewport again. */
body:has(#overlay:not(.hidden)) #content-area {
  bottom: var(--overlay-height);
}

/* Fade transition for all direct children */
#content-area > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.5s ease;
}

/* Content type specifics. Images default to 'contain' so nothing is
   cropped off-screen; player.js overrides per item from its settings. */
#content-area img {
  object-fit: contain;
}

#content-area video {
  object-fit: cover;
}

#content-area iframe {
  border: none;
}

/* Template/bulletin content rendered as HTML */
#content-area .template-content {
  overflow: hidden;
  padding: 2vw;
}

/* --- Bottom overlay bar --- */
#overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--overlay-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  background: rgba(0, 0, 0, 0.6);
  font-size: 1.4rem;
  z-index: 100;
  transition: opacity 0.3s ease;
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#overlay-clock {
  font-variant-numeric: tabular-nums;
}

/* --- Emergency overlay --- */
#emergency-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4vw;
  /* Background is set per emergency type by JS; this is the fallback. */
  background: #b71c1c;
  /* Pulse via brightness, not a fixed colour, so it works with any
     per-type background colour. */
  animation: pulse-bg 1.5s ease-in-out infinite;
}

#emergency-overlay.hidden {
  display: none;
}

@keyframes pulse-bg {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.18); }
}

/* Per-type icon (built-in lucide SVG, or an org's uploaded <img>; set by
   JS). An empty #emergency-icon div collapses — the margin is on the
   child, not the div. */
#emergency-icon svg,
#emergency-icon img {
  width: 9vw;
  height: 9vw;
  margin-bottom: 1.5vh;
  object-fit: contain;
}

#emergency-headline {
  font-size: 6vw;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#emergency-instructions {
  list-style: none;
  margin-top: 2vh;
  font-size: 3vw;
  line-height: 1.5;
}

#emergency-message {
  margin-top: 2vh;
  font-size: 2.5vw;
  font-weight: 400;
  opacity: 0.9;
}

/* --- Setup / pairing screen --- */
#setup-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}

#setup-screen.hidden {
  display: none;
}

#setup-inner {
  text-align: center;
}

#setup-inner h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 300;
}

#setup-inner p {
  font-size: 1.2rem;
  color: #aaa;
  margin-bottom: 1.5rem;
}

#pairing-code {
  font-size: 6rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  font-family: 'Courier New', monospace;
  margin-bottom: 1.5rem;
}

.setup-hint {
  font-size: 1rem;
  color: #666;
}
