html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
  background: #222;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow-x: hidden;
}

.screen {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  background: #222;
  transition: opacity 0.8s ease;
  overflow: hidden;
}

#splash {
  z-index: 2;
  background: #222;
}

#logo {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

#camera {
  background: #f5f5f5;
  color: #222;
  z-index: 1;
  flex-direction: column;
  width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}

.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Camera preview container */
.camera-preview-container {
  flex: 1 1 auto;
  width: 100vw;
  height: 60vh;
  min-height: 320px;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
  overflow: hidden;
}

#video, #canvas, #filterCanvas {
  width: 100vw;
  height: 100%;
  object-fit: cover;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  background: #000;
  display: block;
}

#filterCanvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 2;
}

/* --- Camera Bottom Button Row --- */
.camera-buttons {
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 16px 0 24px 0;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 -2px 16px rgba(127,83,172,0.08);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  gap: 10px;
}
.camera-buttons button {
  background: #fff;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 2rem;
  box-shadow: 0 2px 8px rgba(127,83,172,0.10);
  margin: 0 2px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.camera-buttons button:active {
  background: #eee;
  box-shadow: 0 1px 4px rgba(127,83,172,0.15);
}
.animal-btn img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 2px 8px rgba(127,83,172,0.10);
  padding: 4px;
  border: 2px solid #7f53ac;
}
.animal-btn:active img, .animal-btn:hover img {
  box-shadow: 0 4px 24px rgba(249,83,198,0.18);
  transform: scale(1.08);
}
.reset-btn {
  background: #fff;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(127,83,172,0.10);
  margin: 0 2px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  outline: none;
}
.reset-btn:active, .reset-btn:hover {
  box-shadow: 0 4px 24px rgba(249,83,198,0.18);
  transform: scale(1.08);
}
.reset-icon {
  font-size: 2rem;
  color: #7f53ac;
  display: block;
  line-height: 1;
}

/* --- Animal Filters Slider --- */
.animal-filters-slider {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 18px;
  padding: 10px 8px 8px 8px;
  background: rgba(255,255,255,0.98);
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(127,83,172,0.10);
  position: absolute;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) scaleY(0.8);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  min-width: 240px;
  max-width: 95vw;
  transition: opacity 0.35s cubic-bezier(.4,0,.2,1), transform 0.35s cubic-bezier(.4,0,.2,1);
  scrollbar-width: thin;
  scrollbar-color: #7f53ac #fff;
  align-items: center;
}
.animal-filters-slider.show {
  opacity: 1;
  transform: translateX(-50%) scaleY(1);
  pointer-events: auto;
}
.animal-filters-slider::-webkit-scrollbar {
  height: 8px;
  background: #fff;
}
.animal-filters-slider::-webkit-scrollbar-thumb {
  background: #7f53ac;
  border-radius: 8px;
}
.animal-filter {
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  font-size: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: linear-gradient(135deg, #7f53ac 0%, #f953c6 100%);
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(127,83,172,0.10);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s, filter 0.2s, background 0.2s;
  outline: none;
  position: relative;
  touch-action: manipulation;
}
.animal-filter:hover, .animal-filter:focus {
  box-shadow: 0 0 0 6px rgba(127, 83, 172, 0.18), 0 4px 16px rgba(249,83,198,0.18);
  transform: scale(1.08);
  filter: brightness(1.08) saturate(1.2);
  outline: 2px solid #7f53ac;
  z-index: 2;
  background: linear-gradient(135deg, #f953c6 0%, #7f53ac 100%);
}
.animal-filter.selected {
  outline: 3px solid #f953c6;
  filter: brightness(1.15) saturate(1.3);
  box-shadow: 0 0 0 8px rgba(249,83,198,0.18);
}
.animal-filter .emoji {
  font-size: 2rem;
  margin-top: 8px;
}
.animal-filter .label {
  font-size: 0.85rem;
  margin-top: 2px;
  margin-bottom: 6px;
  padding: 1px 6px;
  color: #7f53ac;
  background: rgba(255,255,255,0.8);
  border-radius: 8px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
}
@media (max-width: 600px) {
  .animal-filters-slider {
    gap: 10px;
    padding: 8px 2px 6px 2px;
    border-radius: 4px;
    min-width: 160px;
    bottom: 62px;
  }
  .animal-filter {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }
  .animal-filter .emoji {
    font-size: 1.1rem;
    margin-top: 4px;
  }
  .animal-filter .label {
    font-size: 0.6rem;
    padding: 0 2px;
  }
}
@media (min-width: 700px) {
  .animal-filters-slider {
    gap: 24px;
    border-radius: 8px;
    font-size: 1.1rem;
    min-width: 320px;
    bottom: 110px;
  }
  .animal-filter {
    width: 72px;
    height: 72px;
    font-size: 1.2rem;
  }
  .animal-filter .emoji {
    font-size: 2.2rem;
  }
  .animal-filter .label {
    font-size: 1.1rem;
    padding: 3px 10px;
  }
}

/* --- Modal for photo preview --- */
.modal {
  position: fixed;
  z-index: 100;
  left: 0; top: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}
.modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 16px 16px 8px 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
}
#photoPreview {
  max-width: 80vw;
  max-height: 60vh;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.modal-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  width: 100%;
}
.download-btn, .close-btn {
  background: #222;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.download-btn:hover, .close-btn:hover {
  background: #ff4e50;
}

/* --- Filter toggle switch --- */
.filter-toggle-row {
  width: 100vw;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 18px 0 0;
  margin-top: 6px;
  margin-bottom: -8px;
}
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  user-select: none;
}
.filter-toggle input[type="checkbox"] {
  display: none;
}
.filter-toggle .slider {
  width: 38px;
  height: 22px;
  background: #ccc;
  border-radius: 22px;
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
}
.filter-toggle .slider:before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.filter-toggle input[type="checkbox"]:checked + .slider {
  background: #f9d423;
}
.filter-toggle input[type="checkbox"]:checked + .slider:before {
  transform: translateX(16px);
}
.filter-toggle .toggle-label {
  font-size: 0.98rem;
  color: #444;
  margin-left: 4px;
}

/* --- Splash Screen --- */
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  background: transparent;
}
.splash-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  margin: 32px 0 24px 0;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.18);
  text-align: center;
}
.start-btn {
  font-size: 1.5rem;
  font-weight: 700;
  padding: 18px 48px;
  border-radius: 32px;
  border: none;
  background: #7f53ac;
  color: #fff;
  box-shadow: 0 4px 24px rgba(100, 125, 222, 0.10);
  cursor: pointer;
  margin-top: 12px;
  margin-bottom: 0;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  outline: none;
  letter-spacing: 0.03em;
  position: relative;
  background: linear-gradient(90deg, #7f53ac 0%, #f953c6 100%);
}
.start-btn:hover, .start-btn:focus {
  background: linear-gradient(90deg, #f953c6 0%, #7f53ac 100%);
  box-shadow: 0 6px 32px rgba(249, 83, 198, 0.18);
  transform: scale(1.04);
}

#splash, #camera {
  opacity: 1;
  transition: opacity 0.7s cubic-bezier(.4,0,.2,1);
}
#splash.fade-out {
  opacity: 0;
  pointer-events: none;
}
#camera.fade-in {
  opacity: 1;
  z-index: 1;
}
#camera {
  opacity: 0;
  z-index: 0;
}

/* --- Responsive tweaks for mobile/tablet --- */
@media (max-width: 900px) {
  .modal-content {
    max-width: 98vw;
    max-height: 98vh;
  }
  #photoPreview {
    max-width: 95vw;
    max-height: 60vh;
  }
}
@media (max-width: 600px) {
  .camera-preview-container {
    height: 60vh;
    min-height: 220px;
    max-height: 70vh;
  }
  .camera-buttons {
    padding: 10px 0 12px 0;
    gap: 4px;
  }
  #video, #canvas, #filterCanvas {
    height: 100%;
    min-height: 220px;
    max-height: 70vh;
  }
  .animal-filters-row {
    gap: 10px;
    padding: 10px 4px 4px 4px;
    top: 52px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
  }
  .animal-filter {
    width: 40px;
    height: 40px;
  }
  .animal-filter .emoji {
    font-size: 1.1rem;
  }
  .animal-filter .label {
    font-size: 0.6rem;
    padding: 0 2px;
  }
  .modal-content {
    padding: 8px 4px 4px 4px;
  }
  .download-btn, .close-btn {
    padding: 8px 10px;
    font-size: 0.95rem;
  }
  .splash-title {
    font-size: 1.3rem;
    margin: 18px 0 16px 0;
  }
  .start-btn {
    font-size: 1.1rem;
    padding: 12px 24px;
    border-radius: 24px;
  }
  .splash-content {
    min-height: 100vh;
    padding: 0 8vw;
  }
  .open-filters-btn-container {
    top: 8px;
    right: 8px;
  }
  #openFilters {
    width: 36px;
    height: 36px;
    padding: 4px;
  }
}

@media (max-width: 400px) {
  .animal-filter {
    width: 40px;
    height: 40px;
  }
  .animal-filter .emoji {
    font-size: 1.1rem;
  }
  .animal-filter .label {
    font-size: 0.6rem;
    padding: 0 2px;
  }
  .camera-preview-container {
    min-height: 120px;
    height: 40vh;
  }
  #video, #canvas, #filterCanvas {
    min-height: 120px;
    height: 100%;
  }
}

@media (min-width: 700px) {
  .camera-preview-container {
    height: 70vh;
    min-height: 400px;
    max-height: 80vh;
  }
  #video, #canvas, #filterCanvas {
    height: 70vh;
    min-height: 400px;
    max-height: 80vh;
  }
  .animal-filters-row {
    top: 90px;
    gap: 24px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    font-size: 1.1rem;
  }
  .animal-filter {
    width: 72px;
    height: 72px;
  }
  .animal-filter .emoji {
    font-size: 2.2rem;
  }
  .animal-filter .label {
    font-size: 1.1rem;
    padding: 3px 10px;
  }
}

/* --- Reset Filter Floating Button --- */
.reset-filter-btn-container {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  width: 100vw;
}
#resetFilter {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  padding: 7px;
  cursor: pointer;
  pointer-events: auto;
  transition: box-shadow 0.18s, transform 0.15s;
  border: 2px solid #f9d423;
  object-fit: contain;
}
#resetFilter:hover, #resetFilter:focus {
  box-shadow: 0 4px 24px rgba(255,78,80,0.18);
  transform: scale(1.08);
  outline: none;
}
@media (max-width: 600px) {
  .reset-filter-btn-container {
    top: 8px;
    right: 8px;
  }
  #resetFilter {
    width: 36px;
    height: 36px;
    padding: 4px;
  }
} 

/* --- Open Filters Floating Button --- */
.open-filters-btn-container {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  width: 100vw;
}
#openFilters {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  padding: 7px;
  cursor: pointer;
  pointer-events: auto;
  transition: box-shadow 0.18s, transform 0.15s;
  border: 2px solid #f9d423;
  object-fit: contain;
}
#openFilters:hover, #openFilters:focus {
  box-shadow: 0 4px 24px rgba(255,78,80,0.18);
  transform: scale(1.08);
  outline: none;
}

/* --- Animal Filters Menu Animation --- */
.animal-filters-row {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 16px;
  padding: 16px 12px 8px 12px;
  justify-content: flex-start;
  align-items: flex-end;
  background: rgba(255,255,255,0.97);
  width: 100vw;
  box-sizing: border-box;
  position: absolute;
  top: 70px;
  left: 0;
  z-index: 20;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  opacity: 0;
  transform: translateY(-30px);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(.4,0,.2,1), transform 0.35s cubic-bezier(.4,0,.2,1);
}
.animal-filters-row.slideIn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
@media (max-width: 600px) {
  .open-filters-btn-container {
    top: 8px;
    right: 8px;
  }
  #openFilters {
    width: 36px;
    height: 36px;
    padding: 4px;
  }
  .animal-filters-row {
    gap: 10px;
    padding: 10px 4px 4px 4px;
    top: 52px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
  }
} 

/* --- Splash Logo as Circle Button --- */
.logo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7f53ac 0%, #647dee 100%);
  box-shadow: 0 8px 32px rgba(100, 125, 222, 0.22);
  border: none;
  margin: 0 auto 28px auto;
  padding: 0;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
}
.logo-btn img#logo {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 4px 16px rgba(100, 125, 222, 0.16);
}
.emersing-logo {
  animation: emersing 2.2s cubic-bezier(.4,0,.2,1) infinite alternate;
  box-shadow: 0 0 32px 8px rgba(127,83,172,0.18), 0 8px 32px rgba(100, 125, 222, 0.22);
}
@keyframes emersing {
  0% { transform: scale(1) rotate(-2deg); box-shadow: 0 0 32px 8px rgba(127,83,172,0.18), 0 8px 32px rgba(100, 125, 222, 0.22); }
  50% { transform: scale(1.12) rotate(2deg); box-shadow: 0 0 48px 16px rgba(249,83,198,0.18), 0 12px 48px rgba(127,83,172,0.18); }
  100% { transform: scale(1) rotate(-2deg); box-shadow: 0 0 32px 8px rgba(127,83,172,0.18), 0 8px 32px rgba(100, 125, 222, 0.22); }
}
@media (max-width: 600px) {
  .logo-btn {
    width: 110px;
    height: 110px;
    margin-bottom: 18px;
  }
  .logo-btn img#logo {
    width: 70px;
    height: 70px;
  }
}
@media (min-width: 700px) {
  .logo-btn {
    width: 220px;
    height: 220px;
  }
  .logo-btn img#logo {
    width: 160px;
    height: 160px;
  }
}
.logo-popup {
  position: absolute;
  left: 50%;
  top: 110px;
  transform: translateX(-50%);
  background: #fff;
  color: #7f53ac;
  font-size: 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(100, 125, 222, 0.12);
  padding: 8px 18px;
  z-index: 20;
  min-width: 180px;
  text-align: center;
  animation: fadeInPop 0.4s;
}
@keyframes fadeInPop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.8); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
} 