:root {
  --chill: #38bdf8;
  --warming: #fbbf24;
  --party: #ec4899;
  --legendary: #ffd700;
  --bg-dark: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.05);
  --border-glow: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-dark);
  min-height: 100vh;
  color: white;
  overflow-x: hidden;
}

.app-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a0a2e 50%, #0a0a1f 100%);
  padding: 20px;
  padding-bottom: 120px;
  position: relative;
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-particle {
  position: absolute;
  top: -20px;
  border-radius: 50%;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Special message */
.special-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  padding: 30px 50px;
  border-radius: 20px;
  font-size: 2rem;
  font-weight: 900;
  z-index: 1001;
  animation: pop-in 0.3s ease-out;
  text-align: center;
}

@keyframes pop-in {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* Header */
.app-header {
  text-align: center;
  padding: 20px 0;
  position: relative;
}

.app-title {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(90deg, #ec4899, #8b5cf6, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(236, 72, 153, 0.5);
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}

.app-subtitle {
  color: #a78bfa;
  margin-top: 8px;
  font-size: 0.9rem;
}

.sound-toggle {
  position: absolute;
  right: 0;
  top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sound-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Main section */
.main-section {
  max-width: 500px;
  margin: 0 auto;
}

.counter-container {
  text-align: center;
  padding: 40px 0;
  cursor: pointer;
  user-select: none;
}

.counter-number {
  font-size: clamp(120px, 30vw, 200px);
  font-weight: 900;
  line-height: 1;
  transition: all 0.3s ease;
  animation: bounce-in 0.4s ease-out;
}

.counter-number.legendary {
  animation: legendary-glow 0.5s ease-out, bounce-in 0.4s ease-out;
}

@keyframes bounce-in {
  0% { transform: scale(1.3); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes legendary-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5) saturate(1.5); }
}

.counter-label {
  font-size: 1.2rem;
  color: #a78bfa;
  font-weight: 600;
  letter-spacing: 4px;
  margin-top: 10px;
}

/* Drink buttons */
.drink-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.drink-btn {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  color: white;
}

.drink-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 0 20px var(--btn-color, #ec4899);
}

.drink-btn.pressed {
  transform: scale(0.95);
}

.oops-btn {
  width: 100%;
  padding: 14px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  color: #fca5a5;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 30px;
}

.oops-btn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
}

.oops-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 30px;
}

.stats-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.breakdown-mini {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

/* Timeline */
.timeline-section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #a78bfa;
  margin-bottom: 12px;
}

.timeline-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-item {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  padding: 12px 16px;
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
}

.flex-btn, .history-btn {
  flex: 1;
  padding: 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.flex-btn {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: white;
}

.flex-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(236, 72, 153, 0.4);
}

.history-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  color: white;
}

.history-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 20px 0;
}

.water-reminder {
  color: #38bdf8;
  font-weight: 600;
  margin-bottom: 16px;
}

.reset-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
  padding: 10px 24px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.disclaimer {
  font-size: 0.75rem;
  color: #6b7280;
  max-width: 300px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

.berrry-link {
  color: #ec4899;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.berrry-link:hover {
  color: #f472b6;
}

/* Share overlay */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.share-card {
  width: 100%;
  max-width: 360px;
}

.share-card-inner {
  background: linear-gradient(135deg, #1a0a2e 0%, #2d1b4e 50%, #1a1a3e 100%);
  border-radius: 24px;
  padding: 30px;
  text-align: center;
  border: 2px solid rgba(236, 72, 153, 0.3);
  box-shadow: 0 0 50px rgba(139, 92, 246, 0.3);
}

.party-name-input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 16px;
  color: white;
  text-align: center;
  width: 100%;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.party-name-input:focus {
  outline: none;
  border-color: #ec4899;
}

.share-total {
  font-size: 100px;
  font-weight: 900;
  background: linear-gradient(135deg, #ec4899, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.share-drinks-label {
  font-size: 1.5rem;
  color: #a78bfa;
  font-weight: 700;
  letter-spacing: 6px;
  margin-bottom: 16px;
}

.share-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffd700;
  margin-bottom: 16px;
}

.share-breakdown {
  display: flex;
  gap: 12px;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.share-duration {
  color: #a78bfa;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.share-footer {
  font-size: 0.8rem;
  color: #6b7280;
}

.close-share-btn {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.close-share-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* History modal */
.history-modal {
  background: linear-gradient(135deg, #0a0a0f 0%, #1a0a2e 100%);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border-glow);
}

.hall-of-fame {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hall-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--bg-card);
}

.hall-item.rank-1 {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.2), transparent);
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.hall-item.rank-2 {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.2), transparent);
  border: 1px solid rgba(192, 192, 192, 0.3);
}

.hall-item.rank-3 {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.2), transparent);
  border: 1px solid rgba(205, 127, 50, 0.3);
}

.hall-item .medal {
  font-size: 1.5rem;
}

.hall-item .count {
  font-size: 1.5rem;
  font-weight: 900;
  color: white;
}

.hall-item .date {
  font-size: 0.8rem;
  color: #6b7280;
  margin-left: auto;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-glow);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.5);
}

/* Mobile optimizations */
@media (max-width: 400px) {
  .drink-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .counter-number {
    font-size: 100px;
  }
  
  .share-total {
    font-size: 80px;
  }
}