* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: #000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  color: #fff;
}

/* =========================
   CAMERA CONTAINER
========================= */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* LIVE CAMERA */
#camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: 1;
}

/* FRAME OVERLAY */
#frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 2;
}

/* LIVE CAPTION
   Use % so it scales with the frame and stays visible.
   206px/1440px ≈ 14.3% (left)
   2122px/2560px ≈ 82.9% (top)
*/
#caption-live {
  position: absolute;
  left: 13%;
  top: 83.4%;
  transform: translateY(-50%);
  display: flex;
  gap: 6px;
  z-index: 5;
  font-size: 16px;
  color: #000;
  pointer-events: none;
}

#caption-text-1 {
  font-weight: 500;
}

#caption-country {
  font-weight: 900; /* Bold country in LIVE mode */
}

/* Fix live caption size to match preview */
#captionTextLive {
    font-size: 28px;     /* same as preview */
    line-height: 1.25;
    transform-origin: top left;
}

#captionCountryLive {
    font-size: 28px;     /* same as preview */
    font-weight: 700;    /* Bold */
    line-height: 1.25;
}

#captionFlagLive {
    width: 42px;         /* same as preview */
    height: auto;
    margin-left: 8px;
    vertical-align: middle;
}


/* =========================
   COUNTRY PILL
========================= */
.glass-pill {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.45);
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  font-size: 14px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* country pill attention pulse */
.glass-pill.attention {
  animation: pillPulse 0.9s ease-out;
}
@keyframes pillPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.9); }
  100% { box-shadow: 0 0 0 28px rgba(255,255,255,0); }
}

/* =========================
   GEO CONSENT MODAL
========================= */
.glass-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  max-width: 460px;
  padding: 20px;
  background: rgba(0,0,0,0.65);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  z-index: 20;
  text-align: center;
  font-size: 14px;
}

.geo-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.glass-btn-sm {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  font-size: 13px;
}

/* =========================
   COUNTRY MODAL
========================= */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 30;
}
.modal-overlay.hidden {
  display: none !important;
}

.modal-sheet {
  width: 100%;
  max-width: 430px;
  height: 70%;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: #fff;
}

#country-search {
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  outline: none;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.25);
  color: #fff;
}

#country-list-container {
  flex: 1;
  overflow-y: auto;
}

.country-item {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.45);
  margin-bottom: 8px;
  font-size: 14px;
}

/* =========================
   CAPTURE BUTTON
========================= */
.capture-btn {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #fff;
  z-index: 15;
}
.capture-btn.disabled {
  opacity: 0.35;
  /* DO NOT block pointer events — JS must capture the click */
  pointer-events: auto;
}

/* =========================
   PREVIEW PANEL
========================= */
#preview-panel {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 130px; /* room for buttons */
  z-index: 40;
}
#preview-panel.hidden {
  display: none !important;
}

/* Image preview (no black patch, full frame visible) */
#preview-img {
  width: auto;
  height: 80%;
  max-height: 80%;
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
}

/* PREVIEW BUTTONS */
.preview-actions {
  position: absolute;
  bottom: 26px;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.glass-btn {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: #fff;
  font-size: 14px;
}

/* =========================
   DSLR FLASH + SPARKLES
========================= */
#snap-overlay {
  position: absolute;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
}
#snap-overlay.hidden {
  display: none;
}

#flash-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle,
    rgba(255,255,255,0.92),
    rgba(255,170,0,0.48),
    rgba(255,140,0,0.14),
    rgba(255,140,0,0)
  );
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

/* Active flash */
#snap-overlay.flash #flash-overlay {
  opacity: 1;
}

/* DSLR glow ring */
.slr-ring {
  position: absolute;
  width: 160%;
  height: 160%;
  left: -30%;
  top: -30%;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle,
    rgba(255,255,255,0.88),
    rgba(255,165,0,0.45),
    rgba(255,140,0,0.12),
    transparent
  );
}
#snap-overlay.flash .slr-ring {
  animation: ringFlash 0.8s ease-out forwards;
}

@keyframes ringFlash {
  0% { transform: scale(0.6); opacity: 0; }
  20% { transform: scale(1.0); opacity: 1; }
  70% { transform: scale(1.2); opacity: 0.6; }
  100%{ transform: scale(1.4); opacity: 0; }
}

/* Soft upward sparkles */
.sparkles span {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  opacity: 0;
  animation: sparkleUp 1.4s ease-out forwards;
}

@keyframes sparkleUp {
  0%   { transform: translateY(30px) scale(0.3); opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translateY(-140px) scale(1); opacity: 0; }
}

/* =========================
   UTILS
========================= */
.hidden {
  display: none !important;
}

.tempMessage {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    padding: 14px 24px;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(10px);
    color: #fff;
    border-radius: 14px;
    font-size: 20px;
    opacity: 0;
    transition: 0.3s ease;
    z-index: 9999;
}
.tempMessage.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
