:root {
  --navy: #1f3864;
  --blue: #2e75b6;
  --blue-light: #bdd7ee;
  --amber: #e08a00;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--navy);
  color: #fff;
}

.screen {
  position: relative;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}
.screen[hidden] { display: none; }

#screen-idle {
  background: linear-gradient(135deg, var(--navy), var(--blue));
}

/* Fullscreen image/video, replacing the logo/splash or the revisit text
   fields whenever the Ads Setup screen has media configured for the
   current idle time slot / detected gender / detected age group. Sits
   underneath the version badge (a later sibling in the DOM, so it paints
   on top at the same default stacking order) so that stays visible. */
.media-fill {
  position: absolute;
  inset: 0;
}
.media-fill[hidden] { display: none; }

.media-fill img,
.media-fill video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo {
  width: 18vh;
  height: 18vh;
  fill: #fff;
  opacity: 0.95;
}

#screen-idle h1 {
  font-size: 8vh;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.02em;
}

.version {
  position: absolute;
  bottom: 18px;
  right: 24px;
  font-size: 14px;
  font-family: "SF Mono", "Courier New", monospace;
  opacity: 0.55;
}

/* Deliberately tiny and low-contrast, tucked beside the version badge --
   this is a customer-facing kiosk screen; the one person who ever needs
   this link is the staff member who set the display up, not a visitor. */
.logout-link {
  position: absolute;
  bottom: 18px;
  left: 24px;
  font-size: 13px;
  color: #fff;
  opacity: 0.4;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
.logout-link:hover { opacity: 0.8; }

/* ---- Login screen (SpaceBox is this app's only login method) --------- */

.login-screen {
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
  text-align: center;
}

.login-card {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  padding: 40px;
  max-width: 460px;
  width: 90vw;
}

.login-card h1 {
  font-size: 28px;
  margin: 0 0 6px;
}

.login-card .card-hint {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.85;
  margin: 0 0 24px;
}

.login-card .status-text {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  min-height: 1.4em;
}
.login-card .status-text.error { color: #ffb4b4; }
.login-card .status-text.ok { color: #b7f5c0; }

.login-card .btn-primary {
  background: #fff;
  color: var(--navy);
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.login-card .btn-primary:hover { background: var(--blue-light); }

.login-card .btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}
.login-card .btn-secondary:hover { background: rgba(255, 255, 255, 0.25); }

.login-card .row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.login-card .login-fallback {
  margin-top: 20px;
}
.login-card .login-fallback > summary {
  cursor: pointer;
  color: #fff;
  opacity: 0.65;
  font-size: 13px;
}
.login-card .login-fallback > .row-actions {
  margin-top: 12px;
}
.login-card input[type="text"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
  min-width: 0;
  flex: 1 1 220px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.login-card input[type="text"]::placeholder { color: rgba(255, 255, 255, 0.5); }

/* ---- SpaceBox QR scanner overlay (shared with the manual-entry card
   above -- kept visually neutral/light since it's a camera viewfinder,
   not part of the kiosk's own dark theme). ------------------------------ */

.qr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.qr-overlay[hidden] {
  display: none;
}

.qr-overlay-inner {
  background: #fff;
  color: var(--navy);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 90vw;
}

.qr-overlay video {
  width: 320px;
  max-width: 80vw;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
}

.qr-overlay .status-text {
  color: var(--navy);
}
.qr-overlay .status-text.error {
  color: #b00020;
}

.qr-overlay .card-hint {
  color: #444;
  opacity: 1;
  font-size: 13px;
}

#screen-revisit {
  background: linear-gradient(135deg, var(--amber), #c96a00);
}

.revisit-label {
  font-size: 5vh;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.revisit-fields {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.revisit-fields dt {
  font-size: 2.4vh;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.revisit-fields dd {
  margin: 0 0 8px;
  font-size: 4vh;
  font-family: "SF Mono", "Courier New", monospace;
  font-weight: 700;
  word-break: break-all;
}

.revisit-fields dd.points {
  font-size: 7vh;
}

.revisit-fields dd.shop {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  word-break: normal;
}

.revisit-fields dd.message {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 2.8vh;
  font-weight: 600;
  word-break: normal;
  max-width: 70vw;
}

.rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  max-width: 85vw;
}
.rewards:empty { display: none; }

.reward-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 22vh;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.reward-card img {
  width: 100%;
  height: 14vh;
  object-fit: cover;
  border-radius: 8px;
}

.reward-card .reward-description {
  font-size: 1.8vh;
  font-weight: 600;
}

.reward-card .reward-points {
  font-family: "SF Mono", "Courier New", monospace;
  font-size: 1.6vh;
  opacity: 0.85;
}

.reward-card button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  font-size: 1.8vh;
  cursor: pointer;
}

.reward-card button:disabled {
  background: rgba(255, 255, 255, 0.35);
  color: rgba(31, 56, 100, 0.6);
  cursor: not-allowed;
}
