/* Local Fonts: Arpona (Light 300 & Regular 400) & Digital7 */
@font-face {
  font-family: 'Arpona';
  src: url('font/Arpona-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Arpona';
  src: url('font/Arpona-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Digital7';
  src: url('font/digital-7 (mono).ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

/* Global Reset for Fullscreen App */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  color-scheme: dark;
  --font-body: 'Arpona', Georgia, serif;
  --font-title: 'Arpona', Georgia, serif;
  --primary-font: var(--font-body);

  /* Tone and Manner Palette (Nadya & Rifqi Wedding Theme) */
  --color-olive: #474E23;
  --color-olive-dark: #373D19;
  --color-olive-deep: #252A10;
  --color-olive-light: #5B6430;

  --color-cream: #FBF6E1;
  --color-cream-muted: #D8D2BC;
  --color-cream-border: rgba(251, 246, 225, 0.35);

  --color-maroon: #8C3F4F;
  --color-maroon-hover: #793442;
  --color-maroon-active: #672935;

  --color-pink: #F0AECC;
  --color-blue: #B1D0E4;
  --color-rust: #C55C3F;

  --color-camera-black: #1E220E;
  --color-camera-body: #252A10;
  --color-camera-panel: #373D19;
  --color-camera-surface: #474E23;
  --color-camera-border: rgba(251, 246, 225, 0.35);

  --color-text-main: var(--color-cream);
  --color-text-muted: var(--color-cream-muted);
  --color-light: #ffffff;

  /* Theme mappings for existing selectors */
  --color-green: var(--color-maroon);
  --color-gold: var(--color-cream);
  --color-cyan: var(--color-cream);
  --color-cyan-light: var(--color-cream);
  --color-cyan-dark: var(--color-olive-dark);
  --color-cyan-glow: transparent;

  --color-red-window: #672935;
  --color-red-bright: var(--color-cream);
  --color-red-glow: transparent;

  --color-dark-gold: var(--color-olive-light);
  --color-dark: var(--color-olive-deep);
  --bg-warm-1: var(--color-olive);
  --bg-warm-2: var(--color-olive-dark);
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  background-color: var(--color-camera-black);
  color: var(--color-text-main);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  overflow: hidden;
  position: fixed;
  width: 100%;
  overscroll-behavior: none;
}

h1, h2, h3, h4, .camera-title, .gallery-modal-title, .film-reload-text {
  font-family: var(--font-title);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* Fullscreen Camera Layout */
.camera-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--color-olive-dark);
  background: var(--color-olive-dark);
  display: flex;
  justify-content: center;
  align-items: center;
}

#video-preview {
  display: none !important;
}

#live-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Fill the viewfinder container completely */
  z-index: 1;
}

/* Flash Animation Overlay */
.flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  opacity: 0;
  z-index: 99;
  pointer-events: none;
}

.flash-overlay.active {
  animation: camera-flash 0.3s ease-out forwards;
}

/* Film Roll Reload Overlay */
.film-reload-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(37, 42, 16, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.film-reload-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.film-reload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background-color: var(--color-olive-dark);
  border: 1px solid var(--color-cream-border);
  padding: 32px 24px;
  border-radius: 12px;
}

.film-reload-gif {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.film-reload-text {
  font-family: var(--font-title);
  font-size: clamp(16px, 5vw, 22px);
  color: var(--color-cream);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 1rem;
  font-weight: 400;
}

.film-reload-timer {
  font-family: 'Digital7', monospace;
  font-size: clamp(28px, 9vw, 42px);
  color: var(--color-cream);
  font-weight: normal;
}

@keyframes camera-flash {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/* UI Overlay / Main App Layout Flex Column */
.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: max(env(safe-area-inset-top), 24px) 0 0 0;
  box-sizing: border-box;
  z-index: 10;
  pointer-events: none;
}

/* Top Action Bar */
.camera-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 clamp(8px, 4vw, 20px);
  box-sizing: border-box;
  flex-shrink: 0;
  pointer-events: auto;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: transparent;
  border: 1px solid var(--color-cream);
  color: var(--color-cream);
  padding: 6px clamp(12px, 3vw, 16px);
  border-radius: 9999px;
  font-family: var(--font-title);
  font-size: clamp(13px, 3.8vw, 15px);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
  box-shadow: none;
}

.btn-back:active {
  transform: scale(0.96);
  background-color: var(--color-maroon);
  border-color: var(--color-maroon);
  color: var(--color-cream);
}

.camera-title {
  font-family: var(--font-title);
  font-size: clamp(16px, 4.5vw, 22px);
  font-weight: 400;
  color: var(--color-cream);
  text-shadow: none;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  flex-grow: 1;
}

/* Status / Alert Bar */
.camera-status {
  pointer-events: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  background-color: var(--color-olive-dark);
  border: 1px solid var(--color-cream-border);
  color: var(--color-cream);
  box-shadow: none;
  padding: 10px 22px;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.04em;
  text-align: center;
  max-width: 90%;
  white-space: normal;
  word-wrap: break-word;
  font-family: var(--font-body);
}

.camera-status.hidden {
  display: none;
}

/* Viewfinder Flex Area (Vertical space centerer) */
.viewfinder-flex-area {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 12px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Viewfinder Card Wrapper */
.viewfinder-wrapper {
  position: relative;
  /* Anchors absolute-positioned children (watermark, pill selector) */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  /* Toggled dynamically via JS to '9 / 16' or '4 / 5' */
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid var(--color-cream-border);
  box-shadow: none;
  background-color: #15180a;
  transition: aspect-ratio 0.25s ease-in-out;
  pointer-events: auto;
}

/* Bottom Control Panel sheet */
.bottom-control-panel {
  width: 100%;
  min-height: 140px;
  background: var(--color-olive-dark);
  border-top: 1px solid var(--color-cream-border);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 8px clamp(12px, 6vw, 32px) max(env(safe-area-inset-bottom, 0px), 10px) clamp(12px, 6vw, 32px);
  box-sizing: border-box;
  pointer-events: auto;
  flex-shrink: 0;
  overflow: hidden;
}

/* Row 1: Sub Controls (Switch, Zoom, Flash) */
.sub-controls-row {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
}

.btn-sub-control {
  background: none;
  border: none;
  color: var(--color-cream);
  font-size: clamp(20px, 6vw, 24px);
  cursor: pointer;
  width: clamp(38px, 11vw, 48px);
  height: clamp(38px, 11vw, 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  user-select: none;
  flex-shrink: 0;
  overflow: hidden;
  filter: none;
}

.btn-sub-control:active {
  transform: scale(0.88);
}

.btn-icon-img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

.btn-zoom-pill {
  background: rgba(37, 42, 16, 0.85);
  border: 1px solid var(--color-cream-border);
  color: var(--color-cream);
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
  flex-shrink: 0;
  box-shadow: none;
}

.btn-zoom-pill:active {
  transform: scale(0.92);
  background-color: var(--color-maroon);
  border-color: var(--color-maroon);
  color: var(--color-cream);
}

/* Row 2: Shutter and Gallery */
.primary-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 clamp(4px, 3vw, 16px);
}

/* Film Canister Placeholder (Retro Kodak style) */
.btn-film-roll {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: clamp(48px, 15vw, 64px);
  height: clamp(48px, 15vw, 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  overflow: hidden;
}

.btn-film-roll:active {
  transform: scale(0.9);
}

.film-roll-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.btn-film-roll:active .film-roll-icon-img {
  transform: scale(0.88) rotate(-6deg);
}

/* Shutter Button (Nadya & Rifqi Plum & Cream) */
.btn-shutter-new {
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  width: clamp(68px, 20vw, 84px);
  height: clamp(68px, 20vw, 84px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  flex-shrink: 0;
  box-shadow: none;
}

.btn-shutter-new:active {
  transform: scale(0.92);
}

.shutter-outer-ring {
  width: 90%;
  height: 90%;
  border-radius: 50%;
  border: 2px solid var(--color-cream);
  box-shadow: none;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.shutter-inner-dot {
  width: 82%;
  height: 82%;
  border-radius: 50%;
  background-color: var(--color-maroon);
  border: 1px solid var(--color-cream);
  transition: transform 0.15s ease, background-color 0.15s ease;
  box-shadow: none;
}

.btn-shutter-new:active .shutter-inner-dot {
  transform: scale(0.92);
  background-color: var(--color-maroon-hover);
  box-shadow: none;
}

/* Gallery Folder Icon Button */
.btn-gallery-new {
  background: var(--color-olive-dark);
  border: 1.5px solid var(--color-cream-border);
  border-radius: 12px;
  width: clamp(48px, 15vw, 64px);
  height: clamp(48px, 15vw, 64px);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
  box-shadow: none;
}

.btn-gallery-new:active {
  transform: scale(0.92);
  border-color: var(--color-cream);
}

.btn-gallery-new:active {
  transform: scale(0.92);
}

.gallery-preview-thumb-new {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

.thumb-icon-new {
  font-size: 24px;
}

/* Upload Loader Overlay */
.upload-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.upload-overlay.hidden {
  display: none !important;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.upload-text {
  font-size: 22px;
  color: white;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Native Modal Dialog - Gallery Overlay */
dialog#gallery-dialog {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

dialog#gallery-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Modal Content Structure */
.gallery-modal-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--color-olive-dark);
  color: var(--color-text-main);
  padding: env(safe-area-inset-top, 20px) 20px env(safe-area-inset-bottom, 24px) 20px;
}

.gallery-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-cream-border);
}

.gallery-modal-title {
  font-family: var(--font-title);
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: 400;
  text-transform: uppercase;
  color: var(--color-cream);
  letter-spacing: 0.14em;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--color-cream);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease;
  outline: none;
}

.btn-close-modal:active {
  transform: scale(0.9);
}

/* Gallery Instructions */
.gallery-instruction {
  text-align: center;
  padding: 12px 16px;
  background-color: rgba(251, 246, 225, 0.08);
  border: 1px solid var(--color-cream-border);
  border-radius: 8px;
  margin: 12px 0;
}

.instruction-main {
  font-family: var(--font-title);
  font-size: clamp(16px, 4.5vw, 20px);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-cream);
  margin-bottom: 4px;
}

.instruction-sub {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 300;
  color: var(--color-cream-muted);
  letter-spacing: 0.02em;
}

/* Scrollable Gallery Area */
.gallery-scroll-container {
  flex-grow: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 30px;
}

/* 2-Column Grid Layout */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}

/* Empty State Styling */
.gallery-empty-state {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--color-cream-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.gallery-empty-state p {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 300;
  margin-bottom: 4px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 3 / 4;
  /* Portrait camera layout */
  background-color: var(--color-olive-deep);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-cream-border);
  transition: border-color 0.2s ease;
  box-shadow: none;
  /* Fix iOS Safari overflow:hidden clipping bug with GPU-accelerated children */
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

.gallery-item:hover {
  border-color: var(--color-cream);
}

/* The actual image inside the card - pointer events must be enabled for mobile long press save */
.gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: auto !important;
  /* Critical: allow iOS/Android long press save */
}

/* Image overlay panel for desktop downloads & labels */
.gallery-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 10px;
  display: flex;
  align-items: center;
  pointer-events: none;
  box-sizing: border-box;
}

.gallery-item-name {
  position: absolute;
  top: 8px;
  left: 8px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.95);
  z-index: 10;
  pointer-events: none;
  font-family: var(--primary-font);
}

.btn-download-fallback {
  pointer-events: auto;
  /* Allow tapping the manual download link */
  background-color: var(--color-maroon);
  border: 1px solid var(--color-cream);
  border-radius: 9999px;
  color: var(--color-cream);
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 14px;
  text-decoration: none;
  transition: background-color 0.15s ease;
  margin-left: auto;
  box-shadow: none;
}

.btn-download-fallback:active {
  background-color: var(--color-maroon-hover);
}

/* Custom Scrollbar for premium vibe */
.gallery-scroll-container::-webkit-scrollbar {
  width: 6px;
}

.gallery-scroll-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.gallery-scroll-container::-webkit-scrollbar-thumb {
  background: var(--color-olive-light);
  border-radius: 3px;
}

/* Toast Message */
.toast {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-maroon);
  border: 1px solid var(--color-cream);
  color: var(--color-cream);
  padding: 8px 22px;
  border-radius: 9999px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  z-index: 110;
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
  box-shadow: none;
}

.toast.hidden {
  opacity: 0;
}

/* Fullscreen Image Preview Dialog */
dialog#preview-dialog {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 100%;
  max-height: 100%;
  z-index: 200;
  box-sizing: border-box;
}

dialog#preview-dialog::backdrop {
  background-color: rgba(29, 33, 14, 0.95);
}

.preview-modal-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 40px 20px;
  box-sizing: border-box;
}

.btn-close-preview {
  position: absolute;
  top: max(env(safe-area-inset-top), 24px);
  right: 20px;
  z-index: 210;
  color: var(--color-cream);
  font-size: 36px;
  cursor: pointer;
  background: none;
  border: none;
}

.preview-image-container {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-height: 80%;
  margin: auto;
  overflow: hidden;
  /* Clip slide animation within container bounds */
}

#preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  pointer-events: auto !important;
  /* Critical for long press save */
  will-change: transform, opacity;
  /* GPU acceleration hint for swipe animation */
  touch-action: none;
  /* Disable default browser touch actions to allow custom swipe */
}

.preview-modal-footer {
  margin-top: 20px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  z-index: 210;
}

.btn-save-preview {
  background-color: var(--color-maroon) !important;
  border: 1px solid var(--color-cream) !important;
  border-radius: 9999px !important;
  color: var(--color-cream) !important;
  font-family: var(--font-title) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  padding: 10px 36px !important;
  text-decoration: none !important;
  box-shadow: none !important;
  transition: transform 0.15s ease, background-color 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  outline: none !important;
  margin: 0 !important;
}

.btn-save-preview:active {
  transform: scale(0.95) !important;
  background-color: var(--color-maroon-hover) !important;
}

/* Delete item button in grid overlay */
.btn-delete-item {
  pointer-events: auto;
  background-color: var(--color-maroon);
  border: 1px solid var(--color-cream);
  border-radius: 4px;
  color: var(--color-cream);
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  padding: 2px 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  box-shadow: none;
}

.btn-delete-item:active {
  transform: scale(0.9);
  background-color: var(--color-maroon-hover);
}

/* Delete button in preview footer */
.btn-delete-preview-btn {
  background-color: transparent !important;
  border: 1px solid var(--color-cream-border) !important;
  border-radius: 9999px !important;
  color: var(--color-cream) !important;
  font-family: var(--font-title) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  padding: 10px 18px !important;
  box-shadow: none !important;
  transition: transform 0.15s ease, background-color 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  outline: none !important;
  margin: 0 !important;
  cursor: pointer;
}

.btn-delete-preview-btn:active {
  transform: scale(0.95) !important;
  background-color: var(--color-maroon) !important;
  border-color: var(--color-maroon) !important;
}

.btn-delete-preview-btn.hidden {
  display: none !important;
}

/* Centered Aspect Ratio Watermark Overlay inside Viewfinder */
.ratio-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-title);
  font-size: 64px;
  font-weight: 400;
  color: rgba(251, 246, 225, 0.4);
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
  user-select: none;
}

/* Aspect Ratio Selector Container */
.ratio-selector-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  user-select: none;
  pointer-events: auto;
}

/* Date Stamp Toggle Button */
.btn-date-toggle {
  position: absolute;
  left: 9px;
  bottom: 9px;
  height: 28px;
  border-radius: 9999px;
  background: rgba(37, 42, 16, 0.9);
  border: 1px solid var(--color-cream-border);
  color: var(--color-cream);
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  z-index: 5;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
  box-sizing: border-box;
  outline: none;
  box-shadow: none;
}

.btn-date-toggle:active {
  transform: scale(0.92);
}

.btn-date-toggle.active {
  background: var(--color-maroon);
  border-color: var(--color-maroon);
  color: var(--color-cream);
  box-shadow: none;
}

.ratio-selector {
  position: relative;
  display: flex;
  background: rgba(37, 42, 16, 0.9);
  border: 1px solid var(--color-cream-border);
  border-radius: 9999px;
  padding: 2px;
  width: 104px;
  height: 28px;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
  transform: translate3d(0, 0, 0);
  z-index: 1;
  box-shadow: none;
}

.ratio-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-cream-muted);
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s ease;
  height: 100%;
  box-sizing: border-box;
}

.ratio-option.active {
  color: var(--color-cream);
  font-weight: 400;
}

.ratio-slider-bg {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 49px;
  height: 22px;
  background: var(--color-maroon);
  box-shadow: none;
  border-radius: 9999px;
  z-index: 1;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

/* Slide transform states */
.ratio-selector[data-active="16:9"] .ratio-slider-bg {
  transform: translateX(49px);
}

/* ---- Pull-to-Refresh Indicator ---- */
.ptr-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  opacity: 0;
  color: var(--color-cream);
  font-family: var(--font-title);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  will-change: height, opacity;
  padding-bottom: 14px;
  box-sizing: border-box;
}

.ptr-spinner {
  display: inline-block;
  font-size: 20px;
  line-height: 1;
  transform-origin: center;
  transition: transform 0.1s ease;
}

.ptr-label {
  font-size: 13px;
  color: var(--color-cream);
  opacity: 0.85;
}

@keyframes ptr-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ---- Background Uploading State (Optimistic UI) ---- */
.gallery-image.uploading {
  filter: brightness(0.65) blur(1px);
}

.gallery-item-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  color: var(--color-cream);
  animation: gallery-item-spin 1.2s linear infinite;
  pointer-events: none;
  z-index: 12;
  user-select: none;
}

@keyframes gallery-item-spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* ---- Highlight for Flash Button (active state) ---- */
.btn-sub-control#btn-flash.active {
  filter: sepia(1) saturate(5) hue-rotate(300deg);
  transform: scale(1.1);
}

/* ---- CAMERA COVER / LANDING OVERLAY ---- */
.camera-cover-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-pink) url('assets/Cover.jpg') no-repeat center center;
  background-size: auto 100%; /* Height always matches viewport height */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: clamp(32px, 10vh, 72px);
  box-sizing: border-box;
  z-index: 2000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.btn-start-camera {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: min(200px, 50vw);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-start-camera:hover {
  transform: scale(1.04);
}

.btn-start-camera:active {
  transform: scale(0.96);
}

.btn-start-camera img {
  width: 100%;
  height: auto;
  display: block;
  filter: none !important;
}

.back-to-cover-btn {
  position: fixed;
  top: 24px;
  left: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--color-maroon);
  border: 1px solid var(--color-cream);
  cursor: pointer;
  z-index: 2001;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: none;
  transition: transform 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.back-to-cover-btn:hover {
  transform: scale(1.06);
  background-color: var(--color-maroon-hover);
}

.back-to-cover-btn:active {
  transform: scale(0.95);
  background-color: var(--color-maroon-active);
}

.back-btn-icon {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 20px;
  color: var(--color-cream);
  font-weight: 400;
  line-height: 1;
}