:root {
  --bg-color: #0d0d0d;
  --ui-accent: #00ff41; /* CRT green */
  --shutter-bg: #e6e6e6;
  --shutter-active: #b3b3b3;
  --date-stamp: rgba(255, 140, 0, 0.9); /* Vintage orange stamp */
  --overlay-text-shadow: 0 0 4px rgba(0, 255, 65, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  font-family: 'VT323', monospace;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.camera-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
}

.viewfinder {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  border-bottom: 2px solid #222;
}

#camera-feed {
  display: none; /* hidden, we only show canvas */
}

#photo-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* UI Overlays */
.overlay-top-left, .overlay-top-right, .overlay-bottom-left {
  position: absolute;
  color: var(--ui-accent);
  text-shadow: var(--overlay-text-shadow);
  z-index: 10;
  font-size: 1.5rem;
  letter-spacing: 1px;
}

.overlay-top-left span,
.overlay-top-right span,
.overlay-bottom-left span,
.battery-icon {
  background-color: rgba(0, 0, 0, 0.5);
  padding: 4px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.overlay-top-left {
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-start;
}

.overlay-top-right {
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 20px;
}

.overlay-bottom-left {
  bottom: 20px;
  left: 20px;
}

/* Battery Icon */
.battery-icon {
  display: flex;
  align-items: center;
}
.battery-body {
  width: 24px;
  height: 12px;
  border: 2px solid var(--ui-accent);
  border-radius: 2px;
  position: relative;
  box-shadow: var(--overlay-text-shadow);
}
.battery-body::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  height: 6px;
  width: 16px;
  background: var(--ui-accent);
  box-shadow: 0 0 4px var(--ui-accent);
}
.battery-tip {
  width: 3px;
  height: 6px;
  background: var(--ui-accent);
  border-radius: 0 2px 2px 0;
  margin-left: 1px;
  box-shadow: var(--overlay-text-shadow);
}

/* Date text overlay on live preview */
#retro-date {
  position: absolute;
  bottom: 20px;
  right: 20px;
  color: var(--date-stamp);
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 3px;
  text-shadow: 0px 0px 6px rgba(255, 120, 0, 0.8), 2px 2px 0px rgba(0,0,0,0.5);
  z-index: 10;
  cursor: pointer;
  transition: opacity 0.2s;
}

/* Center crosshair */
.overlay-center-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  pointer-events: none;
  opacity: 0.6;
}
.crosshair-h {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-50%);
}
.crosshair-v {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.5);
  transform: translateX(-50%);
}
.overlay-center-crosshair::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  border: 1px solid rgba(255,255,255,0.8);
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

/* Controls */
.controls {
  height: 140px;
  background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 20px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.control-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}
.control-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.95);
}

.shutter-btn-wrapper {
  width: 100px;
  height: 100px;
  background: #333;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 3px solid #111;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5), inset 0 2px 5px rgba(255,255,255,0.2);
}

#shutter-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--shutter-bg) 0%, #aaa 100%);
  border: none;
  cursor: pointer;
  box-shadow: inset 0 -2px 5px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.4);
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

#shutter-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.2) 100%);
  border: 1px solid rgba(255,255,255,0.5);
}

#shutter-btn:active {
  transform: scale(0.92);
  background: radial-gradient(circle, var(--shutter-active) 0%, #888 100%);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

#gallery-thumb {
  width: 34px;
  height: 34px;
  background: #222;
  border: 2px solid #555;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
}

#image-viewer {
  position: absolute;
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  cursor: pointer;
}

#image-viewer.hidden {
  display: none;
}

#viewer-img {
  max-width: 95%; 
  max-height: 95%;
  object-fit: contain;
  border: 4px solid #111;
  background: #000;
  box-shadow: 0px 4px 15px rgba(0,0,0,0.8);
}

#about-modal {
  position: absolute;
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  background: rgba(0,0,0,0.2);
  z-index: 105;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(3px);
}

#about-modal.hidden {
  display: none;
}

.about-content {
  background: #111;
  border: 2px solid #555;
  padding: 30px;
  text-align: center;
  border-radius: 8px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.2rem;
  color: #ddd;
  box-shadow: 0px 4px 15px rgba(0,0,0,0.8);
}

/* Flash Effect */
#flash-effect {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: white;
  z-index: 100;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.4s ease-out;
}
#flash-effect.hidden {
  opacity: 0;
}

/* Landscape orientation support */
@media screen and (orientation: landscape) {
  .camera-container {
    flex-direction: row;
  }
  .viewfinder {
    border-bottom: none;
    border-right: 2px solid #222;
  }
  .controls {
    flex-direction: column;
    height: 100%;
    width: 140px;
  }
}
