:root {
  --soil-dark: #2C1810;
  --soil: #3E2723;
  --soil-mid: #5D4037;
  --brown: #8B4513;
  --sienna: #D2691E;
  --sand: #F5DEB3;
  --cream: #FFF8E7;
  --leaf: #4CAF50;
  --leaf-dark: #2E7D32;
  --fire-red: #D32F2F;
  --sugar: #FFD54F;
  --sugar-glow: #FFF176;
  --tunnel-bg: #4A3228;
}

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

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

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(139,69,19,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(93,64,55,0.2) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(62,39,35,0.3) 0%, transparent 50%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(139,69,19,0.03) 2px,
      rgba(139,69,19,0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 3px,
      rgba(93,64,55,0.02) 3px,
      rgba(93,64,55,0.02) 6px
    );
  pointer-events: none;
  z-index: 0;
}

#root {
  position: relative;
  z-index: 1;
}

.font-caveat {
  font-family: 'Caveat', cursive;
}

/* Marching ants border */
@keyframes marchingAnts {
  0% { background-position: 0 0, 100% 0, 100% 100%, 0 100%; }
  100% { background-position: 40px 0, calc(100%) 40px, calc(100% - 40px) 100%, 0 calc(100% - 40px); }
}

.marching-ants-border {
  background-image: 
    linear-gradient(90deg, var(--sienna) 50%, transparent 50%),
    linear-gradient(0deg, var(--sienna) 50%, transparent 50%),
    linear-gradient(90deg, var(--sienna) 50%, transparent 50%),
    linear-gradient(0deg, var(--sienna) 50%, transparent 50%);
  background-size: 20px 2px, 2px 20px, 20px 2px, 2px 20px;
  background-position: 0 0, 100% 0, 100% 100%, 0 100%;
  background-repeat: repeat-x, repeat-y, repeat-x, repeat-y;
  animation: marchingAnts 1s linear infinite;
}

/* Ant walking animation */
@keyframes antWalk {
  0%, 100% { transform: translateX(0) scaleX(1); }
  25% { transform: translateX(5px) scaleX(1); }
  50% { transform: translateX(10px) scaleX(1); }
  75% { transform: translateX(5px) scaleX(1); }
}

@keyframes antParade {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100vw); }
}

.ant-parade {
  animation: antParade 15s linear infinite;
  white-space: nowrap;
}

/* Wiggle antenna on hover */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

.hover-wiggle:hover {
  animation: wiggle 0.3s ease-in-out 2;
}

/* Loading dots */
@keyframes marchDots {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  80%, 100% { opacity: 0; }
}

.march-dot:nth-child(1) { animation: marchDots 1.4s ease-in-out infinite 0s; }
.march-dot:nth-child(2) { animation: marchDots 1.4s ease-in-out infinite 0.2s; }
.march-dot:nth-child(3) { animation: marchDots 1.4s ease-in-out infinite 0.4s; }

/* Sugar crystal pulse */
@keyframes sugarPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.sugar-pulse {
  animation: sugarPulse 0.3s ease-out;
}

/* Smooth zoom transition */
.zoom-transition {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Ant view */
.ant-view {
  transform: scale(0.65);
  transform-origin: top center;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='none' stroke='%23D2691E' stroke-width='2'/%3E%3Ccircle cx='16' cy='16' r='6' fill='none' stroke='%23D2691E' stroke-width='1.5'/%3E%3Cline x1='16' y1='2' x2='16' y2='6' stroke='%23D2691E' stroke-width='1.5'/%3E%3Cline x1='16' y1='26' x2='16' y2='30' stroke='%23D2691E' stroke-width='1.5'/%3E%3Cline x1='2' y1='16' x2='6' y2='16' stroke='%23D2691E' stroke-width='1.5'/%3E%3Cline x1='26' y1='16' x2='30' y2='16' stroke='%23D2691E' stroke-width='1.5'/%3E%3C/svg%3E") 16 16, auto;
}

/* Post card */
.post-card {
  background: linear-gradient(135deg, rgba(93,64,55,0.6) 0%, rgba(62,39,35,0.8) 100%);
  border: 1px solid rgba(139,69,19,0.3);
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.post-card:hover {
  border-color: rgba(210,105,30,0.5);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--soil-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--brown);
  border-radius: 3px;
}

/* Notification badge bounce */
@keyframes crumbBounce {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.2) translateY(-2px); }
}

.crumb-bounce {
  animation: crumbBounce 0.6s ease-in-out infinite;
}

/* Leaf progress */
.leaf-progress {
  transition: width 0.15s ease;
}

/* Toast */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.toast-in {
  animation: slideInRight 0.3s ease-out forwards;
}

.toast-out {
  animation: slideOutRight 0.3s ease-in forwards;
}

/* Input styling */
input, textarea {
  font-family: 'Nunito', sans-serif;
}

/* Tab indicator */
.tab-active {
  position: relative;
}
.tab-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--sienna);
  border-radius: 2px;
}

/* Dirt texture on cards */
.dirt-texture {
  background-image: 
    radial-gradient(circle at 30% 40%, rgba(139,69,19,0.08) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(93,64,55,0.06) 0%, transparent 40%);
}