@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --sand-50: #fefdfb;
  --sand-100: #fdf8f0;
  --sand-200: #f9edd9;
  --sand-300: #f0dbb5;
  --sand-400: #e4c48a;
  --sand-500: #d4a960;
  --sand-600: #c08d3c;
  --sand-700: #9a6f2e;
  --sand-800: #6b4d21;
  --sand-900: #3d2c13;
  --ocean-400: #38bdf8;
  --ocean-500: #0ea5e9;
  --ocean-600: #0284c7;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Crimson Pro', serif;
  margin: 0;
  padding: 0;
}

.font-bangers {
  font-family: 'Bangers', cursive;
  letter-spacing: 0.05em;
}

.font-crimson {
  font-family: 'Crimson Pro', serif;
}

.app-bg {
  background: linear-gradient(180deg, 
    #87CEEB 0%, 
    #B0E0E6 30%, 
    #F5DEB3 60%, 
    #DEB887 100%
  );
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.app-bg::before {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, transparent 0%, rgba(222, 184, 135, 0.5) 100%);
  pointer-events: none;
}

.header-container {
  position: relative;
  text-align: center;
  padding: 3rem 1rem 2rem;
  overflow: hidden;
}

.wave-decoration {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(14, 165, 233, 0.3) 25%, 
    rgba(14, 165, 233, 0.5) 50%, 
    rgba(14, 165, 233, 0.3) 75%, 
    transparent 100%
  );
  animation: wave 3s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: translateX(-5%); }
  50% { transform: translateX(5%); }
}

.palm-left, .palm-right {
  position: absolute;
  font-size: 4rem;
  top: 20%;
  opacity: 0.3;
  animation: sway 4s ease-in-out infinite;
}

.palm-left {
  left: 5%;
  animation-delay: 0s;
}

.palm-right {
  right: 5%;
  animation-delay: 2s;
}

@keyframes sway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.crate-container {
  background: linear-gradient(145deg, #8B4513 0%, #654321 50%, #4a2f17 100%);
  border: 4px solid #3d2c13;
  border-radius: 12px;
  box-shadow: 
    inset 0 2px 10px rgba(255, 255, 255, 0.1),
    0 10px 30px rgba(0, 0, 0, 0.3),
    0 5px 15px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.crate-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 30px,
      rgba(0, 0, 0, 0.1) 30px,
      rgba(0, 0, 0, 0.1) 32px
    );
  pointer-events: none;
}

.crate-lid {
  background: linear-gradient(180deg, #9a6f2e 0%, #8B4513 100%);
  padding: 0.75rem;
  border-bottom: 3px solid #3d2c13;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #fdf8f0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.crate-shake {
  animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-5px) rotate(-1deg); }
  75% { transform: translateX(5px) rotate(1deg); }
}

.item-card {
  background: linear-gradient(180deg, #fefdfb 0%, #f9edd9 100%);
  border: 2px solid #d4a960;
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  transform: translateY(20px) scale(0.9);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
}

.item-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: 6px;
}

.item-revealed {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.legendary-item {
  background: linear-gradient(180deg, #fff9e6 0%, #ffd700 100%);
  border-color: #b8860b;
  animation: legendaryGlow 2s ease-in-out infinite;
}

@keyframes legendaryGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
  50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.8); }
}

.generate-btn {
  background: linear-gradient(180deg, #e4c48a 0%, #c08d3c 50%, #9a6f2e 100%);
  border: 3px solid #6b4d21;
  border-radius: 12px;
  padding: 1rem 2.5rem;
  font-family: 'Bangers', cursive;
  font-size: 1.5rem;
  color: #3d2c13;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 
    0 4px 0 #6b4d21,
    0 6px 10px rgba(0, 0, 0, 0.2);
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 0 #6b4d21,
    0 8px 15px rgba(0, 0, 0, 0.25);
}

.generate-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 
    0 2px 0 #6b4d21,
    0 3px 5px rgba(0, 0, 0, 0.2);
}

.generate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.loading-palm {
  font-size: 4rem;
  animation: palmSpin 1s ease-in-out infinite;
}

@keyframes palmSpin {
  0%, 100% { transform: rotate(-10deg) scale(1); }
  50% { transform: rotate(10deg) scale(1.1); }
}

.rating-section {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.8) 0%, rgba(30, 64, 175, 0.9) 100%);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.survival-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.survival-btn:hover {
  transform: scale(1.05);
  border-color: white;
}

.verdict-container {
  background: linear-gradient(180deg, rgba(30, 64, 175, 0.9) 0%, rgba(17, 24, 39, 0.95) 100%);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  animation: verdictReveal 0.6s ease-out;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@keyframes verdictReveal {
  0% { 
    opacity: 0; 
    transform: scale(0.8) rotateX(20deg); 
  }
  100% { 
    opacity: 1; 
    transform: scale(1) rotateX(0); 
  }
}

.reroll-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ffd700;
  border: 2px solid #b8860b;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.reroll-btn:hover {
  transform: scale(1.2) rotate(180deg);
}

.share-btn {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.stats-panel {
  background: rgba(59, 44, 19, 0.9);
  border-radius: 12px;
  margin-top: 2rem;
  overflow: hidden;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.achievement.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

.achievement.unlocked {
  background: rgba(255, 215, 0, 0.2);
}

.achievement-popup {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ffd700 0%, #b8860b 100%);
  color: #3d2c13;
  padding: 1rem 2rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes popIn {
  0% { 
    opacity: 0; 
    transform: translateX(-50%) translateY(-50px) scale(0.5); 
  }
  100% { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0) scale(1); 
  }
}

.footer-container {
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 2rem;
}

/* Tailwind color overrides */
.text-sand-100 { color: var(--sand-100); }
.text-sand-300 { color: var(--sand-300); }
.text-sand-400 { color: var(--sand-400); }
.text-sand-500 { color: var(--sand-500); }
.text-sand-600 { color: var(--sand-600); }
.text-sand-700 { color: var(--sand-700); }
.text-sand-900 { color: var(--sand-900); }
.bg-sand-800\/50 { background: rgba(107, 77, 33, 0.5); }

@media (max-width: 640px) {
  .header-container h1 {
    font-size: 2rem;
  }
  
  .palm-left, .palm-right {
    display: none;
  }
  
  .generate-btn {
    font-size: 1.2rem;
    padding: 0.75rem 1.5rem;
  }
  
  .survival-btn {
    min-width: 60px;
    padding: 0.5rem 0.75rem;
  }
  
  .verdict-container {
    padding: 1rem;
  }
}