:root {
  --bg: #0f1420;
  --panel: #171d2b;
  --panel-2: #1e2536;
  --border: #2a3348;
  --text: #e7ecf5;
  --muted: #8b96ab;
  --accent: #4f8cff;
  --accent-2: #2fbf85;
  --danger: #ff5d5d;
  --warn: #ffb450;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Assumes the viewport itself already reports portrait dimensions — see
   the note in kiosk-register about rotating the physical display in
   Windows settings rather than relying on CSS to fake it. */
#app {
  width: 100vw;
  height: 100dvh;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 32px 24px;
  background: var(--bg);
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.32s ease, transform 0.32s ease;
}
.screen.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  z-index: 2;
}

.scan-header { text-align: center; margin-bottom: 20px; }
h1 { font-size: 32px; margin: 0 0 8px; }
.subtitle { font-size: 16px; color: var(--muted); margin: 0; }

.camera-stage {
  flex: 1;
  border-radius: 20px;
  overflow: hidden;
  background: black;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
#scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hidden { display: none !important; }

.scan-frame {
  position: absolute;
  width: 68%;
  aspect-ratio: 1 / 1;
  border: 3px solid var(--accent);
  border-radius: 24px;
  box-shadow: 0 0 0 2000px rgba(0,0,0,0.35);
  pointer-events: none;
}

.camera-error {
  position: absolute;
  padding: 16px;
  text-align: center;
  color: var(--danger);
  background: rgba(0,0,0,.6);
  border-radius: 12px;
  margin: 0 24px;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 16px;
  min-height: 20px;
}

.result-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.result-icon {
  width: 120px; height: 120px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px;
  margin-bottom: 12px;
}
.result-icon.granted { background: rgba(47,191,133,.15); color: var(--accent-2); }
.result-icon.denied { background: rgba(255,93,93,.15); color: var(--danger); }

.result-name { font-size: 20px; font-weight: 600; margin: 4px 0; }
.result-sub { font-size: 15px; color: var(--muted); margin: 0; }
.result-note {
  margin-top: 18px;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255,180,80,.15);
  color: var(--warn);
}
.result-note:empty { display: none; }

#screen-result.granted .result-title-color { color: var(--accent-2); }
#screen-result.denied h1 { color: var(--danger); }

/* ---------- denied / not-recognized / connection-error: bigger, clearer text ---------- */
/* No card to show for these, so the message itself needs to carry the
   screen — sized to read comfortably from a step or two back at the kiosk. */

.result-denied-view {
  max-width: 480px;
  padding: 0 24px;
}
.result-denied-view .result-icon {
  width: 140px; height: 140px;
  font-size: 76px;
}
.result-denied-view #result-title {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.15;
}
.result-denied-view .result-name {
  font-size: 24px;
}
.result-denied-view .result-sub {
  font-size: 20px;
  line-height: 1.4;
  color: var(--text);
}
.result-denied-view .result-note {
  font-size: 16px;
  padding: 10px 20px;
}

/* ---------- granted view: card + scan time ---------- */

.result-granted-view {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.granted-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.granted-badge-row h1 { color: var(--accent-2); font-size: 28px; }
.granted-tick {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(47,191,133,.2);
  color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  font-weight: 800;
  flex-shrink: 0;
  animation: tick-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tick-pop {
  0%   { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.result-card-wrap {
  width: 78%;
  max-width: 320px;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid var(--accent-2);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(47, 191, 133, 0.12);
  opacity: 0;
  transform: scale(0.8) translateY(20px);
}
.result-card-wrap.reveal {
  animation: card-reveal-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
#result-card-img { width: 100%; display: block; }

@keyframes card-reveal-pop {
  0%   { opacity: 0; transform: scale(0.8) translateY(20px) rotate(-2deg); }
  60%  { opacity: 1; transform: scale(1.03) translateY(-4px) rotate(0.5deg); }
  100% { opacity: 1; transform: scale(1) translateY(0) rotate(0deg); }
}

.result-granted-view .result-name {
  font-size: 19px;
  font-weight: 700;
  margin: 16px 0 2px;
}
.result-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-2);
  background: rgba(47, 191, 133, 0.12);
  padding: 6px 16px;
  border-radius: 999px;
  margin-top: 6px;
  opacity: 0;
  animation: fade-slide-in 0.4s ease-out 0.4s forwards;
}
@keyframes fade-slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
