/* ═══════════════════════════════════════════════════════════════════════════ */
/* FONTS                                                                      */
/* ═══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&display=swap');

/* ═══════════════════════════════════════════════════════════════════════════ */
/* THEME VARIABLES (overridden dynamically via JS)                            */
/* ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --color-primary: #D7C176;
  --color-primary-dark: #c8a94e;
  --color-btn-text: #000000;
  --color-loader-text: #c8a94e;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* RESET & BASE                                                               */
/* ═══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Montserrat', 'Arial Black', sans-serif;
  -webkit-user-select: none;
  user-select: none;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* APP ROOT — Fixed 1080x1920 canvas, auto-scaled to fit viewport            */
/* ═══════════════════════════════════════════════════════════════════════════ */
#app-root {
  width: 1080px;
  height: 1920px;
  position: relative;
  overflow: hidden;
  background: #000;
  transform-origin: center center;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN SYSTEM                                                              */
/* ═══════════════════════════════════════════════════════════════════════════ */
.screen {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.screen.transitions-enabled {
  transition: opacity 0.4s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 10;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN 1: LANDING                                                          */
/* ═══════════════════════════════════════════════════════════════════════════ */
.landing-bg {
  width: 100%;
  height: 100%;
  background: #000 center/cover no-repeat;
  position: relative;
}

.choice-menu {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  width: 750px;
}

.choice-title {
  font-family: 'Montserrat', 'Arial Black', sans-serif;
  font-size: 72px;
  font-weight: 900;
  color: #fff;
  text-align: center;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
}

.choice-btn {
  width: 100%;
  padding: 36px 40px;
  border: none;
  border-radius: 85px;
  background: var(--color-primary);
  color: var(--color-btn-text);
  font-family: 'Montserrat', 'Arial Black', sans-serif;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s ease;
  filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.4));
}

.choice-btn:active {
  transform: scale(0.95);
  opacity: 0.85;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.6));
}

/* SVG button color overrides */
.restart-svg-button svg rect { fill: var(--color-primary); }
.restart-svg-button svg path { fill: var(--color-btn-text); }

.capture-svg-button svg circle { fill: var(--color-primary); }
.capture-svg-button svg circle:first-child { fill: var(--color-primary); opacity: 0.25; }
.capture-svg-button svg path { fill: var(--color-btn-text); }

.preview-svg-button svg circle { fill: var(--color-primary); }
.preview-svg-button svg path { fill: var(--color-btn-text); }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN 2: CAMERA                                                           */
/* ═══════════════════════════════════════════════════════════════════════════ */
#screen-camera,
#screen-preview,
#screen-loading {
  background: #000 center/cover no-repeat;
}

#screen-result {
  background: #000 center/cover no-repeat;
}

.camera-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.camera-container {
  position: absolute;
  left: 88px;
  top: 296px;
  width: 904px;
  height: 1281px;
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
  border: none;
  filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.5));
}

.camera-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-container video.rotated {
  transform: scaleX(-1) rotate(90deg);
  object-fit: cover;
  position: absolute;
  width: 1281px;
  height: 904px;
  top: 50%;
  left: 50%;
  margin-top: -452px;
  margin-left: -640.5px;
}

.camera-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 5;
}

.countdown-overlay.hidden {
  display: none;
}

.countdown-overlay span {
  font-family: 'Montserrat', serif;
  font-size: 260px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  text-shadow: none;
  animation: countdown-pop 1s ease-in-out;
}

@keyframes countdown-pop {
  0% { transform: scale(2); opacity: 0; }
  30% { transform: scale(1); opacity: 1; }
  80% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0; }
}

.capture-svg-button {
  position: absolute;
  left: 421px;
  top: 1629px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  transition: all 0.15s ease;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.4));
}

.capture-svg-button svg {
  width: 239px;
  height: 239px;
  display: block;
}

.capture-svg-button:active {
  transform: scale(0.9);
  opacity: 0.85;
}

.capture-svg-button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* BUTTONS (shared)                                                           */
/* ═══════════════════════════════════════════════════════════════════════════ */
.action-button {
  border: none;
  border-radius: 60px;
  padding: 30px 80px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.action-button span {
  font-family: 'Montserrat', 'Arial Black', sans-serif;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.action-button:active {
  transform: scale(0.94);
  opacity: 0.85;
}

.capture-button {
  background: linear-gradient(180deg, #c4102e 0%, #9b0c24 100%);
  border: 3px solid #e0384f;
}

.capture-button span { color: #fff; }

.confirm-button {
  background: linear-gradient(180deg, #d4a843 0%, #b8922b 100%);
  border: 3px solid #e8c55a;
}

.confirm-button span { color: #1a0a00; }

.secondary-button {
  background: rgba(255, 255, 255, 0.1);
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.secondary-button span { color: #fff; }

.restart-svg-button {
  position: absolute;
  left: 309px;
  top: 1731px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  transition: all 0.15s ease;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.4));
}

.restart-svg-button svg {
  width: 463px;
  height: 112px;
  display: block;
}

.restart-svg-button:active {
  transform: scale(0.93);
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN 3: PREVIEW                                                          */
/* ═══════════════════════════════════════════════════════════════════════════ */
.preview-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.preview-svg-button {
  position: absolute;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  transition: all 0.15s ease;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.4));
}

.preview-svg-button svg {
  width: 189px;
  height: 189px;
  display: block;
}

.preview-svg-button:active {
  transform: scale(0.9);
  opacity: 0.85;
}

#btn-retake {
  left: 305.5px;
  top: 1629px;
}

#btn-confirm {
  left: 585.5px;
  top: 1629px;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN 3.5: LOADING                                                        */
/* ═══════════════════════════════════════════════════════════════════════════ */
.loading-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

.loader-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 8px solid color-mix(in srgb, var(--color-primary-dark) 15%, transparent);
  border-top-color: var(--color-primary-dark);
  border-right-color: var(--color-primary);
  animation: spin 1.2s linear infinite;
  position: relative;
}

.loader-ring-inner {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 6px solid color-mix(in srgb, var(--color-primary-dark) 10%, transparent);
  border-bottom-color: var(--color-primary);
  border-left-color: var(--color-primary-dark);
  animation: spin 0.8s linear infinite reverse;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: 'Montserrat', 'Arial Black', sans-serif;
  font-size: 44px;
  color: var(--color-loader-text);
  text-align: center;
}

.loading-subtext {
  font-family: 'Montserrat', 'Arial Black', sans-serif;
  font-size: 28px;
  color: #fff;
}


/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN 4: RESULT                                                           */
/* ═══════════════════════════════════════════════════════════════════════════ */
.result-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.result-image-container {
  position: absolute;
  left: 184px;
  top: 414px;
  width: 711px;
  height: 1008px;
  border-radius: 16px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 12px 48px rgba(50, 50, 50, 0.7);
}

.result-image-container #result-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 20;
  pointer-events: none;
}

.qr-section {
  position: absolute;
  left: 50%;
  top: 1235px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.qr-circle {
  width: 375px;
  height: 375px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-circle img {
  width: 211px;
  height: 211px;
  object-fit: contain;
  border-radius: 0;
}

.qr-label {
  font-family: 'Montserrat', 'Arial Black', sans-serif;
  font-size: 26px;
  color: rgba(255, 255, 255, 0.7);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* FLASH OVERLAY                                                              */
/* ═══════════════════════════════════════════════════════════════════════════ */
.flash-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.flash-overlay.flash {
  opacity: 1;
  transition: opacity 0.05s ease;
}
