* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #0a0a0a;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
}

.topbar {
  padding: 20px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(12px);
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.handle {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
}

/* Dialog */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  animation: fadeIn 0.25s forwards;
}
.backdrop.hide { animation: fadeOut 0.2s forwards; }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }

.dialog {
  background: rgba(20,20,20,0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  max-width: 360px;
  width: 100%;
  padding: 26px 22px 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: translateY(6px) scale(0.96);
  animation: pop 0.28s cubic-bezier(.2,.9,.3,1.2) forwards;
  position: relative;
}
@keyframes pop { to { transform: translateY(0) scale(1); } }

.dialog-icon {
  width: 48px; height: 48px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
}
.dialog-icon svg { width: 24px; height: 24px; }

.dialog h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
  color: #fff;
}
.dialog p {
  font-size: 13.5px;
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
  margin-bottom: 20px;
}
.btn-got {
  width: 100%;
  background: #fff;
  color: #0a0a0a;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.btn-got:hover { transform: scale(1.02); }
.btn-got:active { opacity: 0.8; }

.btn-camera {
  width: 100%;
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, background 0.15s;
}
.btn-camera:hover { background: #dc2626; transform: scale(1.02); }
.btn-camera:disabled { opacity: 0.7; cursor: wait; }
.btn-camera svg { width: 18px; height: 18px; }

.cam-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  display: none;
}
.cam-wrap.on { display: block; }
.cam-wrap video { width: 100%; height: 100%; object-fit: cover; }
.cam-capture {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255,255,255,0.4);
  cursor: pointer;
  transition: transform 0.15s;
}
.cam-capture:hover { transform: translateX(-50%) scale(1.05); }
.cam-error {
  font-size: 13px;
  color: #ef4444;
  margin-bottom: 10px;
  display: none;
}
.cam-error.on { display: block; }

/* Loading spinner */
.loader {
  position: relative;
  width: 64px; height: 64px;
  margin: 4px auto 18px;
}
.loader::before, .loader::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.loader::before {
  border-top-color: #ef4444;
  border-right-color: #ef4444;
  animation: spin 1s cubic-bezier(.6,.2,.4,.8) infinite;
}
.loader::after {
  inset: 8px;
  border-bottom-color: rgba(239,68,68,0.5);
  border-left-color: rgba(239,68,68,0.5);
  animation: spin 1.4s linear infinite reverse;
}
.loader-glow {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239,68,68,0.25), transparent 65%);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50%      { opacity: 1;   transform: scale(1.05); }
}

.loading-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
  position: relative;
}
.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ef4444, #f97316, #ef4444);
  background-size: 200% 100%;
  transition: width 8s linear;
  animation: shimmer 1.5s linear infinite;
  box-shadow: 0 0 12px rgba(239,68,68,0.6);
}
.loading-bar-fill.go { width: 100%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.loading-dots {
  display: inline-block;
  min-width: 20px;
  text-align: left;
}
.loading-dots::after {
  content: '';
  animation: dots 1.4s steps(4) infinite;
}
@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* Success checkmark */
.check-wrap {
  position: relative;
  width: 68px; height: 68px;
  margin: 4px auto 16px;
}
.check-circle {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: rgba(34,197,94,0.15);
  border: 2px solid rgba(34,197,94,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop-in 0.5s cubic-bezier(.2,.9,.3,1.4) both;
}
.check-circle::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid #22c55e;
  animation: ring-out 1.2s ease-out infinite;
}
.check-circle::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid #22c55e;
  animation: ring-out 1.2s ease-out 0.4s infinite;
}
@keyframes ring-out {
  0%   { transform: scale(0.8); opacity: 0.7; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes pop-in {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.check-svg {
  width: 34px; height: 34px;
  stroke: #22c55e;
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.check-svg path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw 0.5s ease-out 0.25s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Enhanced dialog entrance */
.dialog.big-pop {
  transform: translateY(20px) scale(0.85);
  animation: bigpop 0.45s cubic-bezier(.2,.9,.3,1.35) forwards;
}
@keyframes bigpop {
  0%   { transform: translateY(20px) scale(0.85); opacity: 0; }
  60%  { transform: translateY(-4px) scale(1.02); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

.btn-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.btn-close:hover { background: rgba(255,255,255,0.12); color: #fff; }
.btn-close svg { width: 14px; height: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px;
}

.card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #1a1a1a;
}
.card.unlocked .photo { filter: none; transform: none; transition: filter 0.6s, transform 0.6s; }
.card.unlocked .veil,
.card.unlocked .center { display: none; }

.photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(14px);
  transform: scale(1.1);
}

.veil {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
}

.center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-open {
  background: rgba(20,20,20,0.55);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 11px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.btn-open:hover {
  transform: scale(1.06);
  background: rgba(30,30,30,0.7);
  border-color: rgba(255,255,255,0.28);
}

.warning-box {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: rgba(255,165,0,0.9);
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.warning-box svg {
  width: 16px;
  height: 16px;
  color: #f97316;
  flex-shrink: 0;
  margin-top: 1px;
}
.warning-box span { flex: 1; }
