/* Build a Cow Farm - Authentic Roblox-style */
:root {
  --roblox-panel: #2d2d2d;
  --roblox-panel-light: #363636;
  --roblox-border: #1a1a1a;
  --roblox-text: #ffffff;
  --roblox-text-dim: #b3b3b3;
  --roblox-green: #00b341;
  --roblox-green-hover: #00d94f;
  --roblox-blue: #00a2ff;
  --roblox-orange: #ff6b35;
  --roblox-sky-top: #87ceeb;
  --roblox-sky-bottom: #e0f6ff;
  --roblox-ground: #5a9c3a;
  --roblox-ground-dark: #4a7d2e;
}

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

body {
  font-family: 'Source Sans 3', 'Gotham', -apple-system, sans-serif;
  background: var(--roblox-sky-top);
  min-height: 100vh;
  overflow: hidden;
  user-select: none;
}

#game-wrapper {
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* HUD - Roblox dark GUI panels */
#hud {
  position: fixed;
  top: 60px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.hud-money, .hud-milk {
  background: var(--roblox-panel);
  padding: 12px 18px;
  border-radius: 8px;
  border: 2px solid var(--roblox-border);
  box-shadow: 0 4px 0 var(--roblox-border);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--roblox-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-money {
  border-left: 4px solid var(--roblox-green);
}

.hud-milk {
  border-left: 4px solid var(--roblox-blue);
}

.money-icon, .milk-icon {
  font-size: 1.5rem;
}

/* Farm area - Roblox sky + ground */
#farm-area {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    var(--roblox-sky-top) 0%,
    #a8d8f0 30%,
    #c4e8f5 55%,
    var(--roblox-ground) 70%,
    var(--roblox-ground-dark) 100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Grass grid - brick/stud style */
#grass-grid {
  display: grid;
  grid-template-columns: repeat(6, 64px);
  grid-template-rows: repeat(4, 64px);
  gap: 6px;
  padding: 24px;
  background: var(--roblox-panel);
  border-radius: 12px;
  border: 2px solid var(--roblox-border);
  box-shadow: 0 6px 0 var(--roblox-border), inset 0 1px 0 rgba(255,255,255,0.1);
}

.grass-tile {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  position: relative;
  /* Brick bevel - lighter top/left, darker bottom/right */
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,0.25),
    inset -2px -2px 0 rgba(0,0,0,0.2),
    0 3px 0 rgba(0,0,0,0.15);
}

.grass-tile.empty {
  background: #6b5344;
  border: 2px solid #5a4538;
}

.grass-tile:not(.empty) {
  cursor: pointer;
}

.grass-tile.empty:hover {
  transform: scale(1.05);
}

.grass-tile.placeable {
  outline: 3px solid var(--roblox-green);
  outline-offset: 2px;
  animation: placeable-pulse 1s ease-in-out infinite;
}

@keyframes placeable-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Grass types - flat Roblox brick colors */
.grass-tile.normal {
  background: #4caf50;
  border: 2px solid #3d8b40;
}
.grass-tile.crabgrass {
  background: #8bc34a;
  border: 2px solid #7cb342;
}
.grass-tile.clover {
  background: #66bb6a;
  border: 2px solid #43a047;
}
.grass-tile.alfalfa {
  background: #2e7d32;
  border: 2px solid #1b5e20;
}
.grass-tile.golden {
  background: #ffb300;
  border: 2px solid #ff8f00;
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,0.4),
    inset -2px -2px 0 rgba(0,0,0,0.15),
    0 3px 0 rgba(0,0,0,0.2);
}

/* Cows container */
#cows-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cow {
  position: absolute;
  width: 48px;
  height: 48px;
  font-size: 2.5rem;
  animation: cow-bounce 2s ease-in-out infinite;
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.4));
}

.cow.milking {
  animation: cow-milk 0.5s ease-out;
}

@keyframes cow-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes cow-milk {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Bucket - blocky Roblox prop */
#bucket-zone {
  position: absolute;
  bottom: 120px;
  right: 40px;
}

#bucket {
  width: 80px;
  height: 70px;
  background: #6d4c41;
  border-radius: 4px;
  border: 2px solid #4e342e;
  position: relative;
  cursor: default;
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,0.15),
    0 4px 0 #3e2723;
  overflow: hidden;
}

#bucket::before {
  content: '';
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 22px;
  background: #6d4c41;
  border: 2px solid #4e342e;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.1);
}

#bucket-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(180deg, #fffde7 0%, #fff8e1 50%, #ffecb3 100%);
  transition: height 0.3s ease;
}

/* Sell button - Roblox green primary button */
#sell-zone {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
}

#sell-btn {
  background: var(--roblox-green);
  color: white;
  border: none;
  padding: 16px 36px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #008c33;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.1s, box-shadow 0.1s;
}

#sell-btn:hover:not(:disabled) {
  background: var(--roblox-green-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #008c33;
}

#sell-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #008c33;
}

#sell-btn:disabled {
  background: #555;
  cursor: not-allowed;
  box-shadow: 0 4px 0 #333;
}

#sell-btn:disabled:hover {
  transform: none;
}

.sell-icon {
  font-size: 1.4rem;
}

/* Grass shop - Roblox dark GUI */
#grass-shop {
  position: fixed;
  top: 60px;
  right: 16px;
  background: var(--roblox-panel);
  border-radius: 12px;
  border: 2px solid var(--roblox-border);
  box-shadow: 0 6px 0 var(--roblox-border);
  padding: 16px;
  z-index: 50;
  min-width: 200px;
}

#grass-shop h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--roblox-text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--roblox-panel-light);
}

#grass-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.grass-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--roblox-panel-light);
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--roblox-text);
}

.grass-item:hover:not(.disabled) {
  background: #404040;
  border-color: var(--roblox-green);
}

.grass-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.grass-item.selected {
  background: #404040;
  border-color: var(--roblox-green);
  box-shadow: inset 0 0 0 1px var(--roblox-green);
}

.grass-item .grass-emoji {
  font-size: 1.75rem;
  width: 36px;
  text-align: center;
}

.grass-item .grass-info {
  flex: 1;
}

.grass-item .grass-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.grass-item .grass-rarity {
  font-size: 0.7rem;
  color: var(--roblox-text-dim);
}

.grass-item .grass-price {
  font-weight: 700;
  color: var(--roblox-green);
}

/* Start overlay - Roblox modal */
#start-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#start-overlay.hidden {
  display: none;
}

.overlay-content {
  background: var(--roblox-panel);
  padding: 36px;
  border-radius: 12px;
  border: 2px solid var(--roblox-border);
  box-shadow: 0 8px 0 var(--roblox-border);
  max-width: 420px;
  text-align: center;
}

.overlay-content h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--roblox-text);
}

.overlay-content p {
  margin-bottom: 24px;
  line-height: 1.5;
  color: var(--roblox-text-dim);
  font-size: 0.95rem;
}

#start-btn {
  background: var(--roblox-green);
  color: white;
  border: none;
  padding: 14px 36px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #008c33;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}

#start-btn:hover {
  background: var(--roblox-green-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #008c33;
}

#start-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #008c33;
}

/* Money popup */
.money-popup {
  position: fixed;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--roblox-green);
  animation: moneyFloat 1.5s ease-out forwards;
  pointer-events: none;
  z-index: 200;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

@keyframes moneyFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-80px) scale(1.2);
  }
}

.milk-collect {
  position: fixed;
  font-size: 1.25rem;
  animation: milkFloat 1s ease-out forwards;
  pointer-events: none;
  z-index: 200;
}

@keyframes milkFloat {
  0% { opacity: 1; transform: translate(0, 0); }
  100% { opacity: 0; transform: translate(100px, -100px); }
}
