/* ═══════════════════════════════════════════════════════════════════════════ */
/* FONTS — Kanit (self-hosted, matches Figma)                                 */
/* ═══════════════════════════════════════════════════════════════════════════ */
@import url('/assets/fonts/kanit.css');

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

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

body {
  font-family: 'Kanit', 'Inter', 'Helvetica Neue', Arial, 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;
  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-bg {
  position: absolute;
  inset: 0;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* HIT ZONES — buttons matching Figma design                                  */
/* ═══════════════════════════════════════════════════════════════════════════ */
.hit-zone {
  position: absolute;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 8;
  outline: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.hit-zone--press:active {
  transform: scale(0.94);
  opacity: 0.85;
}

/* ── Arrow + IZBERI: SVG image layers (purely decorative, z-index below hit-zones) */
.svg-arrows {
  position: absolute;
  left: 196px;
  top: 864px;
  width: 689px;
  height: 112px;
  z-index: 7;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.svg-izberi {
  position: absolute;
  left: 285px;
  top: 1444px;
  width: 511px;
  height: 141px;
  z-index: 7;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Hit-zone tap feedback ──────────────────────────────────────────────── */
#btn-prev-player:active ~ .svg-arrows,
#btn-next-player:active ~ .svg-arrows {
  opacity: 0.75;
}

#btn-prev-player:active,
#btn-next-player:active,
#btn-select-player:active {
  opacity: 0;  /* hit zone itself is invisible anyway */
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN 1 — TITLE (rendered in HTML so we can center it)                    */
/* Figma bbox: x=39 y=253  w=1002 h=266                                       */
/* ═══════════════════════════════════════════════════════════════════════════ */
.landing-title {
  position: absolute;
  left: 0;
  top: 220px;
  width: 1080px;
  padding: 0 40px;
  box-sizing: border-box;
  text-align: center;
  font-family: 'Kanit', sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: 118px;
  line-height: 1.12;
  color: #fff;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.55);
  z-index: 6;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN 1 — PLAYER SLIDER                                                   */
/* Slot:  540 wide × 717 tall                                                 */
/* Photo: 412 × 606  (centered horizontally, top of slot)                     */
/* Pill:  434 × 111  (centered, bottom of slot, white rounded corners)        */
/* Active player center sits at viewport x=540 → translateX = 270 - idx*540   */
/* Row has 3 copies of 4 players (12 slots total) for infinite loop           */
/* ═══════════════════════════════════════════════════════════════════════════ */
.player-slider {
  position: absolute;
  left: 0;
  top: 585px;
  width: 1080px;
  height: 720px;
  z-index: 5;
  overflow: visible;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.player-slider__row {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  width: max-content;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.player-slider__row.dragging {
  transition: none;
}

.player-slot {
  width: 540px;
  height: 717px;
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  filter: blur(7px);
  opacity: 0.65;
  transform: scale(0.88);
  transition: filter 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}

.player-slot.active {
  filter: blur(0);
  opacity: 1;
  transform: scale(1.1);
}

/* Suppresses per-slot transition during silent wrap teleport */
.player-slot.no-transition {
  transition: none !important;
}

.player-slot__img {
  width: 412px;
  height: 606px;
  object-fit: contain;
  object-position: center bottom;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
}

.player-slot__pill {
  width: 434px;
  height: 111px;
  background: #fff;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Kanit', sans-serif;
  font-size: 52px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.5px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* CAMERA / PREVIEW / RESULT WINDOWS                                           */
/* The gray placeholder rectangle in Figma fills 0,200 to 1080,1728 — we     */
/* overlay the live video / captured photo / generated photo at the same pos. */
/* ═══════════════════════════════════════════════════════════════════════════ */
.camera-window {
  position: absolute;
  left: 0;
  top: 200px;
  width: 1080px;
  height: 1528px;
  overflow: hidden;
  z-index: 4;
  background: transparent;
}

.camera-window video,
.camera-window img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-window video {
  transform: scaleX(-1);
  background: #000;
}

.camera-window video.rotated {
  transform: scaleX(-1) rotate(90deg);
  position: absolute;
  width: 1528px;
  height: 1080px;
  top: 50%;
  left: 50%;
  margin-top: -540px;
  margin-left: -764px;
}

.camera-window video[src=""],
.camera-window video:not([srcobject]) {
  /* video with no stream = fully transparent so the Figma "-KAMERA-" placeholder shows */
}

/* When stream is active: hide the Figma "-KAMERA-" placeholder by covering it */
.camera-window.has-stream video {
  background: transparent;
}

/* Video element when no stream: keep transparent so placeholder shows. */
.camera-window:not(.has-stream) video {
  visibility: hidden;
}

#preview-image,
#result-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#preview-image[src=""],
#preview-image:not([src]),
#result-image[src=""],
#result-image:not([src]) {
  visibility: hidden;
}

#result-window {
  /* Result has a slightly different inset (Figma renders the photo with rounded
     corners and small padding inside white frame). For simplicity full-bleed. */
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* COUNTDOWN OVERLAY                                                          */
/* ═══════════════════════════════════════════════════════════════════════════ */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
}

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

.countdown-overlay span {
  font-family: 'Kanit', sans-serif;
  font-size: 320px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  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; }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN 4 — LOADING                                                         */
/* The Figma bg already has the soccer ball + circular "GENERIRANJE POTEKA"  */
/* text rendered. We add a subtle red pulse around the ball to indicate AI is */
/* working. Ball position in bg: 347,771 size 387x378.                        */
/* ═══════════════════════════════════════════════════════════════════════════ */
.loading-pulse {
  position: absolute;
  left: 347px;
  top: 771px;
  width: 387px;
  height: 378px;
  z-index: 4;
  pointer-events: none;
  border-radius: 50%;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 24, 53, 0); }
  50%      { box-shadow: 0 0 80px 40px rgba(225, 24, 53, 0.55); }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCREEN 6 — QR CODE                                                         */
/* White card area: 187,611 size 706x706                                       */
/* ═══════════════════════════════════════════════════════════════════════════ */
.qr-window {
  position: absolute;
  left: 247px;
  top: 671px;
  width: 586px;
  height: 586px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-code {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#qr-code[src=""],
#qr-code:not([src]) { visibility: hidden; }

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

.flash-overlay.flash {
  animation: flash-anim 0.5s ease-out;
}

@keyframes flash-anim {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}
