:root{
  --bg:#071f2a;
  --panel:rgba(255,255,255,0.06);
  --border:rgba(255,255,255,0.14);
  --accent:#ffb45a;
  --muted:#ffd9b0;
  --text:#fff;
}

*{box-sizing:border-box}
html,body{height:100%;width:100%}
body{
  margin:0;
  font-family:Arial,system-ui;
  background:radial-gradient(1200px 800px at 30% 20%, #0b3040 0%, #061821 60%, #031018 100%);
  background-color:#000;
  background-repeat:no-repeat;
  background-size:cover;
  background-attachment:fixed;
  color:var(--text);
  text-align:center;
  user-select:none;
  -webkit-user-select:none;
  touch-action:manipulation;
}
.hidden{display:none !important;}
.screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  padding:16px;
  background:#000;
}

/* iOS safe fullscreen fallback */
html.pseudo-fs, html.pseudo-fs body{
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  overflow:hidden;
}
@supports (-webkit-touch-callout: none) {
  .screen{min-height:100dvh}
  body{min-height:100dvh}
}

/* INTRO */
.introMedia{position:absolute; inset:0; overflow:hidden;}
.introMedia video,.introMedia img{width:100%;height:100%;object-fit:contain;background:#000;}
#introFallback{display:none;} /* <- STOP scritta "intro" */
.brandTop{
  position:absolute; top:18px; left:18px;
  display:flex; gap:12px; align-items:center;
  background:rgba(0,0,0,0.25);
  border:1px solid rgba(255,255,255,0.12);
  backdrop-filter:blur(10px);
  padding:12px 14px;
  border-radius:18px;
}
.brandTop .btnIcon{
  width:40px;height:40px;
  background:rgba(255,255,255,0.10);
}
.logo{width:64px;height:64px;border-radius:18px}
.brand{font-weight:900;color:var(--accent);font-size:20px}
.slogan{color:var(--muted);font-size:13px;margin-top:2px}
.hint{color:rgba(255,255,255,0.85);font-size:12px;margin-top:8px}

/* BOOTH */
.stage{
  width:min(1100px, 100%);
  aspect-ratio:3/2;
  position:relative;
  border-radius:22px;
  overflow:hidden;
  background:#000;
  border:1px solid rgba(255,255,255,0.12);
  box-shadow:0 24px 70px rgba(0,0,0,0.45);
}
.stage video{
  width:100%;
  height:100%;
  object-fit:cover;
}
.stage img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.stage.mirror video{transform:scaleX(-1)}

.rotateSticker{
  display:none;
  margin-top:12px;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(151, 199, 236, 0.22);
  backdrop-filter:blur(8px);
  color:#e9f5ff;
  font-size:13px;
  font-weight:500;
  letter-spacing:0.2px;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.rotateIcon{
  width:22px;
  height:22px;
  display:inline-flex;
  color:#e9f5ff;
  opacity:0.95;
}
.rotateIcon svg{
  width:100%;
  height:100%;
}

@media (orientation: portrait) and (pointer: coarse) and (max-width: 900px){
  #booth{
    flex-direction:column;
    justify-content:flex-start;
    padding-top:16px;
  }
  .stage{
    width:100%;
    max-width:100%;
  }
  #booth .stage{margin-top:6px}
  #booth .rotateSticker{
    display:inline-flex;
  }
  #booth .exitBtn{
    position:static;
    transform:none;
    margin-top:10px;
    align-self:center;
    order:6;
    width:44px;
    height:44px;
  }
}

.countBrand{
  position:absolute; left:18px; top:18px;
  display:flex; align-items:center; gap:10px;
  background:rgba(0,0,0,0.25);
  border:1px solid rgba(255,255,255,0.12);
  backdrop-filter:blur(10px);
  padding:10px 12px;
  border-radius:16px;
}
.eventName{color:var(--accent);font-weight:900;font-size:16px}

@media (max-width: 480px){
  .countBrand{
    position:static;
    margin-top:12px;
    align-self:center;
  }
  #booth{flex-direction:column}
}
.flash{
  position:absolute; inset:0;
  background:rgba(255,255,255,0.9);
  pointer-events:none;
  z-index:10;
}

/* COUNTDOWN */
.countdown{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
}
.ring{width:210px;height:210px;transform:rotate(-90deg)}
.track{fill:none;stroke:rgba(255,255,255,0.18);stroke-width:10}
.progress{
  fill:none;
  stroke:var(--accent);
  stroke-width:10;
  stroke-linecap:round;
  stroke-dasharray:326.7;
  stroke-dashoffset:0;
  transition:stroke-dashoffset .18s linear;
}
.countNum{
  position:absolute;
  font-size:74px;
  font-weight:900;
  text-shadow:0 12px 40px rgba(0,0,0,0.55);
}

/* SHARE */
.screen#share{
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  touch-action:pan-y;
}
.shareWrap{width:min(980px,100%);display:flex;flex-direction:column;gap:14px}
.shareHeader{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.12);
  border-radius:16px;
  padding:10px 12px;
}
.logoSmall{width:44px;height:44px;border-radius:14px}
.brandSmall{font-weight:900;color:var(--accent);font-size:16px}
.sloganSmall{color:var(--muted);font-size:12px;margin-top:2px}

.photoCard{
  background:rgba(140, 198, 235, 0.22);
  border:1px solid rgba(184, 222, 246, 0.45);
  backdrop-filter:blur(12px) saturate(130%);
  border-radius:20px;
  padding:12px;
  box-shadow:0 12px 32px rgba(3, 19, 31, 0.28), inset 0 1px 0 rgba(255,255,255,0.14);
}
.sharePhoto{width:100%;height:auto;border-radius:14px;display:block}
.hdBadge{
  display:inline-block;
  margin-top:8px;
  padding:4px 10px;
  border-radius:999px;
  background:rgba(255,255,255,0.12);
  border:1px solid rgba(255,255,255,0.18);
  color:#fff;
  font-weight:900;
  font-size:12px;
  letter-spacing:0.5px;
}

.qrRow{display:flex;gap:14px;align-items:center;justify-content:center;flex-wrap:wrap}
#qr{background:#fff;border-radius:18px;padding:10px}
.qrText{max-width:360px;text-align:left}
.qrTitle{font-weight:900;color:var(--accent);font-size:18px}
.qrSub{color:var(--muted);font-size:13px;margin-top:6px}
.saveStatus{color:rgba(255,255,255,0.9);font-size:12px;margin-top:10px}
.saveStatus:empty{display:none}

.shareActions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.btnPill{
  background:rgba(255,255,255,0.10);
  border:1px solid rgba(255,255,255,0.18);
  color:#fff;
  padding:12px 16px;
  border-radius:999px;
  text-decoration:none;
  font-size:15px;
  font-weight:500;
  line-height:1.2;
  min-width:120px;
  transition:background .2s ease, border-color .2s ease;
}
.btnPill:hover{background:rgba(255,255,255,0.16);border-color:rgba(255,255,255,0.28)}
.btnPill:disabled{opacity:.5;pointer-events:none}
.btnPill.isDisabled{opacity:.5;pointer-events:none;background:rgba(255,255,255,0.10);border-color:rgba(255,255,255,0.18);color:#fff}
.btnPill.subtle{background:rgba(255,255,255,0.06);color:rgba(255,255,255,0.9)}

/* Controls */
.controls{
  position:fixed; right:16px; top:16px;
  display:flex; gap:8px; z-index:50;
}
.btnIcon{
  width:44px; height:44px; border-radius:999px;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(255,255,255,0.10);
  color:#fff; font-size:18px; font-weight:900;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
  line-height:1;
}
.btnIcon svg{
  width:20px;
  height:20px;
  display:block;
  margin:auto;
  pointer-events:none;
}
.exitBtn{
  position:fixed; top:16px; left:50%;
  transform:translateX(-50%);
  width:40px; height:40px;
  z-index:70;
}
.camSwitch{
  position:fixed; top:16px; right:16px;
  width:40px; height:40px;
  z-index:70;
  display:flex;
  align-items:center;
  justify-content:center;
}
.camSwitch svg{
  width:21px;
  height:21px;
  fill:none;
  stroke:#ffffff;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

/* Privacy modal */
.modal{
  position:fixed; inset:0; z-index:60;
  background:rgba(0,0,0,0.65);
  display:flex; align-items:center; justify-content:center;
  padding:16px;
}
.modalCard{
  width:min(980px,100%);
  background:rgba(7,31,42,0.98);
  border:1px solid rgba(255,255,255,0.12);
  border-radius:18px;
  padding:16px;
  text-align:left;
}
.modalCard.qrCard{
  width:fit-content;
  max-width:90vw;
  text-align:center;
}
.modalCard.pinCard{
  width:min(420px,100%);
  text-align:left;
}
.modalTitle{color:var(--accent);font-weight:900;font-size:18px;margin-bottom:10px}
.pinHint{
  color:rgba(255,255,255,0.85);
  font-size:13px;
  margin-bottom:10px;
}
.pinInput{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(0,0,0,0.25);
  color:#fff;
  font-size:24px;
  font-weight:600;
  letter-spacing:10px;
  text-align:center;
}
.pinInput:focus{outline:2px solid rgba(255,180,90,0.6);outline-offset:2px}
.pinError{
  margin-top:10px;
  color:#ffb4b4;
  font-size:13px;
}
.privacyText{
  max-height:50vh; overflow:auto;
  white-space:normal; margin:0;
  color:#fff; font-size:13px; line-height:1.4;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(0,0,0,0.2);
  border-radius:12px; padding:12px;
}
.privacyText p{margin:0 0 10px 0}
.privacyText p:last-child{margin-bottom:0}
.modalActions{display:flex;gap:10px;justify-content:flex-end;margin-top:12px}

@media (orientation: landscape) and (pointer: coarse) and (max-height: 560px){
  .screen#share{
    align-items:flex-start;
    padding-top:10px;
    padding-bottom:16px;
  }
  .shareWrap{
    gap:10px;
  }
  .shareActions{
    padding-bottom:4px;
  }
}
