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

body {
  font-family: "Arial", sans-serif;
  background: linear-gradient(135deg, #400160, #e60143, #8b023e, #ffbe98);
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
  min-height: 100vh;
  overflow-x: hidden;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  25% {
    background-position: 25% 75%;
  }
  50% {
    background-position: 100% 50%;
  }
  75% {
    background-position: 75% 25%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeInDown 1s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title {
  font-size: clamp(1.8rem, 4.5vw, 4rem);
  font-weight: bold;
  color: #fff;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
  margin-bottom: 10px;
  letter-spacing: -1px;
  line-height: 1.1;
}

.subtitle {
  font-size: clamp(0.9rem, 2.5vw, 1.5rem);
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  margin-bottom: 15px;
}

.hashtag {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: clamp(8px, 2vw, 12px) clamp(15px, 4vw, 20px);
  border-radius: 25px;
  display: inline-block;
  color: #fff;
  font-weight: bold;
  border: 2px solid rgba(255, 255, 255, 0.3);
  font-size: clamp(0.8rem, 2vw, 1rem);
}

.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 50px;
}

.can-container {
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
  animation: fadeInLeft 1s ease-out 0.3s both;
  cursor: pointer;
  position: relative;
}

/* Updated pause/play indicator for 3D can */
.can-container::after {
  content: "Click & Drag to rotate • Hover over to pause";
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: clamp(0.7rem, 1.5vw, 0.9rem);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  opacity: 0.8;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
  max-width: 90vw;
  padding: 0 10px;
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 3D Can Styling - Updated for image sequence */
.can {
  width: clamp(200px, 30vw, 300px);
  height: clamp(280px, 40vw, 400px);
  position: relative;
  transition: transform 0.3s ease;
  cursor: grab;
}

.can:active {
  cursor: grabbing;
}

/* 3D Can Image - Single image that changes via JavaScript */
.can-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.3));
  transition: all 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Hover effect for desktop */
.can-container:hover .can {
  transform: scale(1.05);
  animation-play-state: paused;
}

/* Loading state for 3D can */
.can-image[src=""] {
  background: linear-gradient(135deg, #400160, #e60143, #8b023e, #ffbe98);
  background-size: 400% 400%;
  animation: gradientShift 2s ease infinite;
  border-radius: 15px;
}

/* Can controls for 3D interaction */
.can-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 15px;
  position: absolute;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
}

.can-control-btn {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.can-control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.can-control-btn:active {
  transform: translateY(0);
}

/* Interactive states */
.can-paused {
  filter: drop-shadow(0 15px 35px rgba(255, 215, 0, 0.3));
}

.can-dragging {
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
  transform: scale(1.05);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.back-label {
  text-align: left;
  padding: clamp(15px, 3vw, 20px);
}

.info-section {
  animation: fadeInRight 1s ease-out 0.6s both;
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.info-card {
  background: rgba(255, 255, 255, 0.15);
  margin-top: 30px;
  backdrop-filter: blur(15px);
  border-radius: clamp(15px, 3vw, 20px);
  padding: clamp(20px, 4vw, 30px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.info-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: #fff;
  text-align: center;
  margin-bottom: clamp(10px, 2vw, 15px);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

.info-text {
  color: #fff;
  line-height: 1.6;
  margin-bottom: clamp(15px, 3vw, 20px);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  font-size: clamp(0.85rem, 2vw, 1rem);
}

.color-palette {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2vw, 15px);
  margin: clamp(15px, 3vw, 20px) 0;
  flex-wrap: wrap;
}

.color-swatch {
  width: clamp(45px, 8vw, 60px);
  height: clamp(60px, 10vw, 80px);
  border-radius: 15%;

  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.color-swatch:hover {
  transform: scale(1.05);
}

.voting-section {
  text-align: center;
  margin-top: clamp(30px, 6vw, 50px);
  padding: clamp(20px, 4vw, 30px);
  backdrop-filter: blur(10px);
  border-radius: clamp(15px, 3vw, 20px);
}

/* Desktop-only vote-section styling */
@media (min-width: 769px) {
  .voting-section {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
  }
}

.vote-title {
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  color: #fff;
  margin-bottom: clamp(8px, 1.5vw, 12px);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

.vote-buttons {
  display: flex;
  gap: clamp(10px, 2vw, 15px);
  justify-content: center;
  margin: clamp(20px, 4vw, 25px) 0;
  flex-wrap: wrap;
}

.vote-text {
  color: #fff;
  margin-bottom: clamp(20px, 4vw, 25px);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  font-size: clamp(0.85rem, 2vw, 1rem);
  line-height: 1.4;
}

.vote-btn {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: clamp(10px, 2vw, 15px) clamp(15px, 3vw, 25px);
  border-radius: 50px;
  font-size: clamp(0.85rem, 2vw, 1.1rem);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: clamp(5px, 1vw, 8px);
  min-width: clamp(100px, 20vw, 140px);
  justify-content: center;
}

.vote-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.3);
}

.vote-btn:active {
  transform: translateY(0);
}

.vote-icon {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.vote-label {
  font-size: clamp(0.8rem, 1.8vw, 1rem);
}

.vote-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.6s ease;
}

.vote-btn:active::before {
  width: 300px;
  height: 300px;
}

.vote-count {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: #fff;
  margin-top: clamp(15px, 3vw, 20px);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

.vote-item {
  margin: clamp(5px, 1vw, 8px) 0;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
}

.total-votes {
  margin-top: clamp(10px, 2vw, 15px);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: bold;
  padding-top: clamp(10px, 2vw, 15px);
  border-top: 2px solid rgba(255, 255, 255, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  body {
    background: linear-gradient(135deg, #400160, #e60143, #8b023e, #ffbe98);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
  }

  .container {
    padding: 15px;
  }

  .main-content {
    grid-template-columns: 1fr;
    gap: 25px;
    text-align: center;
  }

  .header {
    margin-bottom: 25px;
  }

  .can-container {
    order: -1;
  }

  /* Mobile interaction text */
  .can-container::after {
    content: "Drag to rotate • Tap to pause";
    bottom: -50px;
    font-size: clamp(0.75rem, 3vw, 0.85rem);
    opacity: 1;
    white-space: nowrap;
    max-width: 90vw;
    margin-bottom: 20px;
  }

  /* Remove tap highlight on mobile */
  .can-container {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }

  .can {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }

  .can-controls {
    bottom: -60px;
    gap: 8px;
  }

  .can-control-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* Mobile vote buttons - horizontal layout with half width */
  .vote-buttons {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .vote-btn {
    width: calc(50% - 4px);
    max-width: 140px;
    min-width: 120px;
    padding: 12px 8px;
    font-size: 0.8rem;
  }

  .info-card {
    margin-bottom: 20px;
  }

  .color-palette {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  .header {
    margin-bottom: 20px;
  }

  .main-content {
    gap: 20px;
    margin-bottom: 25px;
  }

  .voting-section {
    margin-top: 25px;
    padding: 15px;
  }

  .vote-buttons {
    gap: 6px;
    flex-direction: row;
    justify-content: center;
  }

  .vote-btn {
    width: calc(50% - 3px);
    max-width: 120px;
    min-width: 100px;
    font-size: 0.75rem;
    padding: 10px 6px;
  }

  .color-palette {
    gap: 8px;
  }

  .color-swatch {
    width: 40px;
    height: 50px;
  }

  .can-controls {
    bottom: -50px;
  }
}

/* Ultra-small screens */
@media (max-width: 320px) {
  .container {
    padding: 10px;
  }

  /* Preloader for 3D images */
  .image-preloader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    z-index: 9999;
    display: none;
  }

  .image-preloader.active {
    display: block;
  }

  .preload-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
  }

  .preload-bar {
    height: 100%;
    background: linear-gradient(90deg, #1e40af, #7c3aed, #dc2626, #fbbf24);
    width: 0%;
    transition: width 0.3s ease;
  }

  /* Falling can animation */
  @keyframes canFallAndBounce {
    0% {
      transform: translateY(-100vh) scale(0.8);
      opacity: 0.8;
    }
    70% {
      transform: translateY(20px) scale(1.1);
      opacity: 1;
    }
    85% {
      transform: translateY(-10px) scale(0.95);
    }
    95% {
      transform: translateY(5px) scale(1.02);
    }
    100% {
      transform: translateY(0) scale(1);
      opacity: 1;
    }
  }

  .can-falling {
    animation: canFallAndBounce 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94)
      forwards;
  }

  /* Hide can initially for the falling animation */
  .can-hidden {
    opacity: 0;
    transform: translateY(-100vh);
  }

  .title {
    line-height: 1.2;
  }

  .can {
    width: 160px;
    height: 220px;
  }

  .info-card {
    padding: 15px;
  }

  .voting-section {
    padding: 12px;
  }

  .vote-btn {
    padding: 10px 15px;
    font-size: 0.85rem;
  }
}

/* Desktop view - make everything 25% smaller */
@media (min-width: 1024px) {
  body {
    transform: scale(0.75);
    transform-origin: top center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100vw;
    overflow-x: hidden;
  }

  /* Ensure the scaled content container is properly centered */
  .container {
    transform-origin: center;
    width: 100%;
    max-width: 1200px;
  }
}

/* Preloader for 3D images */
.image-preloader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px;
  border-radius: 10px;
  z-index: 9999;
  display: none;
}

.image-preloader.active {
  display: block;
}

.preload-progress {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

.preload-bar {
  height: 100%;
  background: linear-gradient(90deg, #1e40af, #7c3aed, #dc2626, #fbbf24);
  width: 0%;
  transition: width 0.3s ease;
}

/* Falling can animation */
@keyframes canFallAndBounce {
  0% {
    transform: translateY(-150vh) scale(0.6);
    opacity: 0.9;
  }
  60% {
    transform: translateY(30px) scale(1.15);
    opacity: 1;
  }
  75% {
    transform: translateY(-15px) scale(0.9);
  }
  85% {
    transform: translateY(10px) scale(1.05);
  }
  95% {
    transform: translateY(-5px) scale(0.98);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.can-falling {
  animation: canFallAndBounce 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Hide can initially for the falling animation */
.can-hidden {
  opacity: 0;
  transform: translateY(-150vh) scale(0.6);
}

/* Mobile performance optimizations */
@media (max-width: 768px) {
  .can-image {
    /* Reduce filter complexity on mobile */
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
  }

  .can-falling {
    /* Faster animation on mobile */
    animation: canFallAndBounce 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  }

  /* Reduce transform complexity for mobile */
  .can-paused {
    filter: drop-shadow(0 10px 20px rgba(255, 215, 0, 0.2));
  }

  .can-dragging {
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.3));
    transform: scale(1.02);
  }
}

/* Performance hint for browsers */
.can-image {
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.can {
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
