* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background: #111;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  -webkit-user-select: none;
  user-select: none;
}
#viewfinder {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#camera {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  visibility: hidden;
}
#filmCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}
.vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 35%,
    rgba(0, 0, 0, 0.12) 55%,
    rgba(0, 0, 0, 0.4) 75%,
    rgba(0, 0, 0, 0.65) 100%
  );
}
.grain {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  z-index: 4;
  pointer-events: none;
  opacity: 0.12;
  animation: grainShift 0.08s steps(1) infinite;
}
@keyframes grainShift {
  0% {
    transform: translate(0, 0);
  }
  10% {
    transform: translate(-2%, -3%);
  }
  20% {
    transform: translate(3%, 1%);
  }
  30% {
    transform: translate(-1%, 2%);
  }
  40% {
    transform: translate(2%, -2%);
  }
  50% {
    transform: translate(-3%, 3%);
  }
  60% {
    transform: translate(1%, -1%);
  }
  70% {
    transform: translate(-2%, 2%);
  }
  80% {
    transform: translate(3%, -3%);
  }
  90% {
    transform: translate(-1%, 1%);
  }
  100% {
    transform: translate(2%, -2%);
  }
}
.color-filter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 200, 120, 0.06) 0%,
    rgba(200, 180, 160, 0.04) 50%,
    rgba(100, 140, 180, 0.06) 100%
  );
  mix-blend-mode: overlay;
}
.light-leak {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  opacity: 0.07;
  background: linear-gradient(
    135deg,
    rgba(255, 120, 50, 0.4) 0%,
    transparent 40%,
    transparent 60%,
    rgba(255, 180, 80, 0.2) 100%
  );
}
.controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.camera-info {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 6px;
  font-weight: 300;
}
.exposure-info {
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 12px;
  text-align: center;
}
.exposure-info .warn {
  color: rgba(255, 100, 100, 0.8);
}
.exposure-info .ok {
  color: rgba(100, 255, 100, 0.7);
}
.exposure-info .mid {
  color: rgba(255, 220, 100, 0.8);
}
.btn-row {
  display: flex;
  align-items: center;
  gap: 32px;
  width: 100%;
  justify-content: center;
}
.shutter-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.8);
  background: transparent;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}
.shutter-btn:active {
  transform: scale(0.92);
}
.shutter-btn::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}
.iso-btn,
.flash-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-width: 72px;
  text-align: center;
}
.iso-btn {
  font-weight: 500;
  letter-spacing: 0.5px;
}
.iso-btn:active {
  background: rgba(255, 255, 255, 0.25);
}
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 20px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(rgba(0, 0, 0, 0.5), transparent);
}
.camera-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}
.flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.05s;
}
.flash-overlay.active {
  opacity: 1;
}
.preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 50;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.preview-overlay.active {
  display: flex;
}
.preview-overlay canvas {
  max-width: 92%;
  max-height: 70vh;
  border-radius: 4px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}
.preview-actions {
  display: flex;
  gap: 20px;
  margin-top: 24px;
}
.preview-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 12px 28px;
  border-radius: 25px;
  font-size: 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.preview-btn.save {
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  font-weight: 600;
}
.permission-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #111;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}
.permission-screen.hidden {
  display: none;
}
.permission-screen h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.permission-screen p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 32px;
  line-height: 1.6;
}
.start-btn {
  background: #fff;
  color: #111;
  border: none;
  padding: 14px 40px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 1px;
}
.film-spec {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
  margin-top: 6px;
}
