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

body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, #dbeafe 0%, #e0f2fe 30%, #dcfce7 70%, #bbf7d0 100%);
  background-attachment: fixed;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 60px;
}

h1 {
  margin: 20px 0 4px;
  font-size: 2.2rem;
  color: #1e293b;
  font-weight: 800;
}

h1 span { color: #3b82f6; }

.subtitle {
  color: #64748b;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* ========== Stats bar (HUD) ========== */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 10px 28px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.stat {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: #cbd5e1;
}

.stat-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
}

.money-amount { color: #16a34a; }
.xp-amount { color: #8b5cf6; }

/* ========== Scene containers ========== */
.scene {
  position: relative;
  max-width: 600px;
  width: 95%;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 20px;
  overflow: hidden;
}

.scene-header {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 14px;
  text-align: center;
}

.scene-deco {
  position: absolute;
  font-size: 2rem;
  opacity: 0.5;
  pointer-events: none;
  z-index: 1;
}

/* ========== FARM SCENE ========== */
.scene-farm {
  background: linear-gradient(180deg, #a7f3d0 0%, #6ee7b7 40%, #4ade80 100%);
  border: 3px solid #86efac;
  box-shadow:
    0 4px 16px rgba(34, 197, 94, 0.15),
    inset 0 -8px 20px rgba(22, 163, 74, 0.1);
}

.scene-farm .scene-header {
  color: #14532d;
  text-shadow: 0 1px 2px rgba(255,255,255,0.4);
}

.deco-sun {
  top: 8px;
  right: 16px;
  font-size: 2.4rem;
  opacity: 0.7;
  animation: sun-glow 3s ease-in-out infinite alternate;
}

.deco-cloud1 {
  top: 12px;
  left: 20px;
  font-size: 1.6rem;
  animation: cloud-drift 12s ease-in-out infinite alternate;
}

.deco-cloud2 {
  top: 6px;
  left: 140px;
  font-size: 1.2rem;
  opacity: 0.35;
  animation: cloud-drift 16s ease-in-out infinite alternate-reverse;
}

@keyframes sun-glow {
  from { transform: scale(1); opacity: 0.6; }
  to   { transform: scale(1.1); opacity: 0.8; }
}

@keyframes cloud-drift {
  from { transform: translateX(0); }
  to   { transform: translateX(20px); }
}

/* --- Inventory (inside farm) --- */
.inventory {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 14px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.5);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.6);
}

.inv-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.7);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  min-width: 80px;
  justify-content: center;
}

.inv-item .emoji { font-size: 1.2rem; }
.inv-item .count { font-weight: bold; color: #15803d; }

/* --- Field (farm plots) --- */
.field {
  display: grid;
  grid-template-columns: repeat(auto-fill, 90px);
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: rgba(101, 67, 33, 0.25);
  border-radius: 14px;
  border: 2px solid rgba(101, 67, 33, 0.3);
}

.plot {
  width: 90px;
  height: 90px;
  background: #92662e;
  border-radius: 10px;
  border: 2px solid #7a5524;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  user-select: none;
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.15);
}

.plot > * { pointer-events: none; }

.plot:hover {
  background: #a87b3e;
  border-color: #c49a4a;
  transform: scale(1.05);
}

.plot.empty::after {
  content: '🌱';
  font-size: 1.4rem;
  opacity: 0.4;
}

.plot-buy::after { content: none; }

.plot .plant-emoji {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.plot .plant-label {
  font-size: 0.6rem;
  color: #fef3c7;
  margin-top: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.plot .progress-bar {
  position: absolute;
  bottom: 4px;
  left: 6px;
  right: 6px;
  height: 5px;
  background: rgba(0,0,0,0.3);
  border-radius: 3px;
  overflow: hidden;
}

.plot .progress-fill {
  height: 100%;
  background: #4ade80;
  border-radius: 3px;
  transition: width 0.25s linear;
  box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
}

.plot.ready {
  border-color: #4ade80;
  border-width: 3px;
  animation: pulse 0.8s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { box-shadow: inset 0 3px 8px rgba(0,0,0,0.25), 0 0 6px rgba(74, 222, 128, 0.3); }
  to   { box-shadow: inset 0 3px 8px rgba(0,0,0,0.25), 0 0 16px rgba(74, 222, 128, 0.6); }
}

/* --- Buy plot tile --- */
.plot-buy {
  background: rgba(255,255,255,0.15);
  border: 2px dashed rgba(255,255,255,0.4);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.plot-buy:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.6);
  box-shadow: none;
}

.plot-buy .buy-icon {
  font-size: 1.8rem;
  color: rgba(255,255,255,0.7);
  font-weight: 300;
  line-height: 1;
}

.plot-buy .buy-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
}

.plot-buy.cant-afford {
  opacity: 0.4;
  cursor: not-allowed;
}

.plot-buy.cant-afford:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.4);
  transform: none;
}

/* ========== KITCHEN SCENE ========== */
.scene-kitchen {
  background:
    repeating-conic-gradient(#fef9ef 0% 25%, #fdf6e3 0% 50%) 0 0 / 30px 30px;
  border: 3px solid #e8d5b7;
  box-shadow: 0 4px 16px rgba(180, 140, 80, 0.12);
}

.scene-kitchen .scene-header {
  color: #78350f;
}

/* --- Crafted dishes bar --- */
.crafted-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 14px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
}

.crafted-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.8);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.crafted-item .emoji { font-size: 1.2rem; }
.crafted-item .count { font-weight: bold; color: #b45309; }

/* --- Recipes --- */
.recipes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.recipe-card {
  background: rgba(255,255,255,0.85);
  border: 1px solid #e8d5b7;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.recipe-card.can-cook {
  border-color: #22c55e;
  box-shadow: 0 0 0 1px #bbf7d0;
}

.recipe-card .dish-emoji { font-size: 1.8rem; }

.recipe-card .dish-name {
  font-size: 0.8rem;
  font-weight: bold;
  color: #78350f;
}

.recipe-card .ingredients {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.recipe-card .ingredient {
  font-size: 0.7rem;
  display: flex;
  justify-content: space-between;
  padding: 2px 4px;
  border-radius: 4px;
}

.recipe-card .ingredient.has { color: #16a34a; }
.recipe-card .ingredient.missing { color: #dc2626; }

.cook-btn {
  margin-top: auto;
  padding: 5px 14px;
  background: #f59e0b;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: bold;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

.cook-btn:hover:not(:disabled) { background: #d97706; }

.cook-btn:disabled {
  background: #d6cfc3;
  color: #a39583;
  cursor: not-allowed;
  text-shadow: none;
}

.recipe-card.cooking { border-color: #f59e0b; box-shadow: 0 0 0 1px #fde68a; }

.cook-progress {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: auto;
}

.cook-progress-bar {
  width: 100%;
  height: 8px;
  background: #e8d5b7;
  border-radius: 4px;
  overflow: hidden;
}

.cook-progress-fill {
  height: 100%;
  background: #f59e0b;
  border-radius: 4px;
  transition: width 0.25s linear;
}

.cook-time-left { font-size: 0.7rem; color: #b45309; }

/* ========== MARKET SCENE ========== */
.scene-market {
  background: #fefce8;
  border: 3px solid #fde68a;
  box-shadow: 0 4px 16px rgba(234, 179, 8, 0.12);
  padding-top: 0;
  overflow: visible;
}

.market-awning {
  width: calc(100% + 6px);
  margin: -3px -3px 0 -3px;
  height: 28px;
  background: repeating-linear-gradient(
    90deg,
    #ef4444 0px, #ef4444 24px,
    #fff 24px, #fff 48px
  );
  border-radius: 20px 20px 0 0;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  position: relative;
}

.market-awning::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    135deg,
    transparent 0px, transparent 6px,
    rgba(239,68,68,0.15) 6px, rgba(239,68,68,0.15) 12px
  );
}

.scene-market .scene-header {
  color: #92400e;
  margin-top: 14px;
}

/* --- Market cards --- */
.market {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.market-card {
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.market-card.has-stock {
  border-color: #16a34a;
  box-shadow: 0 0 0 1px #bbf7d0;
}

.market-card .dish-emoji { font-size: 1.4rem; }
.market-card .dish-name { font-size: 0.75rem; font-weight: 600; color: #1e293b; }

.market-card .sell-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  background: #16a34a;
  padding: 2px 10px;
  border-radius: 6px;
}

.market-card .stock-count { font-size: 0.65rem; color: #94a3b8; }

.sell-btn {
  margin-top: auto;
  padding: 5px 14px;
  background: #eab308;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: bold;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

.sell-btn:hover:not(:disabled) { background: #ca8a04; }

.sell-btn:disabled {
  background: #e5e2d5;
  color: #a39583;
  cursor: not-allowed;
  text-shadow: none;
}

/* ========== Seed picker modal ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10;
  justify-content: center;
  align-items: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.modal h2 {
  margin-bottom: 16px;
  font-size: 1.2rem;
  color: #1e293b;
}

.seed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seed-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #1e293b;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s;
}

.seed-btn:hover {
  background: #ecfdf5;
  border-color: #22c55e;
}

.seed-btn .emoji { font-size: 1.4rem; }
.seed-btn .seed-cost { margin-left: auto; color: #16a34a; font-weight: 700; font-size: 0.85rem; }
.seed-btn .grow-time { color: #94a3b8; font-size: 0.8rem; }

.seed-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cancel-btn {
  margin-top: 14px;
  padding: 8px 24px;
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  font-size: 0.9rem;
}

.cancel-btn:hover { background: #f1f5f9; }

/* ========== Mouse character ========== */
.mouse-character {
  position: fixed;
  bottom: 20px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
  pointer-events: none;
}

.mouse-body {
  transition: transform 0.15s;
}

.mouse-emoji {
  font-size: 6rem;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
}

.speech-bubble {
  background: #1e293b;
  color: #fff;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: bold;
  margin-bottom: 6px;
  position: relative;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px) scale(0.8);
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #1e293b;
}

.speech-bubble.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Mouse animations */
.mouse-body.bounce { animation: mouse-bounce 0.5s ease; }
.mouse-body.dance  { animation: mouse-dance 0.6s ease; }
.mouse-body.sniff  { animation: mouse-sniff 0.8s ease; }
.mouse-body.wiggle { animation: mouse-wiggle 0.5s ease; }

@keyframes mouse-bounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-14px); }
  50% { transform: translateY(-4px); }
  70% { transform: translateY(-10px); }
}

@keyframes mouse-dance {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-12deg) translateY(-4px); }
  40% { transform: rotate(12deg) translateY(-8px); }
  60% { transform: rotate(-8deg) translateY(-4px); }
  80% { transform: rotate(8deg) translateY(-2px); }
}

@keyframes mouse-sniff {
  0%, 100% { transform: translateX(0) scale(1); }
  15% { transform: translateX(3px) scale(1.03); }
  30% { transform: translateX(-3px) scale(1); }
  45% { transform: translateX(3px) scale(1.03); }
  60% { transform: translateX(-2px) scale(1); }
  75% { transform: translateX(2px) scale(1.02); }
}

@keyframes mouse-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
  75% { transform: rotate(-4deg); }
}
