:root {
  --primary-color: #8bc34a;
  --primary-dark: #558b2f;
  --soil-color: #795548;
  --sky-color: #e0f7fa;
  --accent-color: #ff9800;
  --danger-color: #f44336;
  --text-color: #333;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  user-select: none;
}

body {
  background-color: var(--sky-color);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.game-container {
  background: white;
  width: 100%;
  max-width: 600px;
  height: 90vh;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 4px solid var(--primary-dark);
}

header {
  background-color: var(--primary-color);
  color: white;
  padding: 15px;
  text-align: center;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.stats-bar {
  display: flex;
  justify-content: space-between;
  background: rgba(255,255,255,0.2);
  padding: 8px 15px;
  border-radius: 10px;
  font-weight: bold;
}

#message-log {
  flex-grow: 1;
  text-align: right;
  font-size: 0.9rem;
  font-weight: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 10px;
  color: #fff;
}

.navigation {
  display: flex;
  background: #f1f8e9;
  border-bottom: 2px solid #ddd;
}

.nav-btn {
  flex: 1;
  padding: 15px;
  border: none;
  background: none;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 4px solid transparent;
}

.nav-btn:hover {
  background: #dcedc8;
}

.nav-btn.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary-dark);
  background: #fff;
}

#btn-neighbor:hover {
  color: var(--danger-color);
  background: #ffebee;
}

/* Farm Grid */
.farm-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  padding: 20px;
  background-color: #81c784;
  overflow-y: auto;
}

.farm-grid.neighbor-view {
  background-color: #ffcc80; /* Different ground color for neighbor */
}

.plot {
  background-color: var(--soil-color);
  border-radius: 10px;
  border: 4px solid #5d4037;
  position: relative;
  cursor: pointer;
  transition: transform 0.1s;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.plot:active {
  transform: scale(0.95);
}

.plot.locked {
  background-color: #aaa;
  border-color: #777;
  cursor: not-allowed;
}

/* Plant Styles */
.plant-emoji {
  font-size: 3rem;
  z-index: 2;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.3));
}

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

.growth-fill {
  height: 100%;
  width: 0%;
  background: #76ff03;
  transition: width 0.3s linear;
}

.ripe-indicator {
  position: absolute;
  top: -10px;
  right: -10px;
  background: yellow;
  border-radius: 50%;
  padding: 5px;
  font-size: 1.2rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  animation: bounce 0.6s infinite alternate;
  display: none;
}

.plot.ripe .ripe-indicator {
  display: block;
}

.plot.withered .plant-emoji {
  filter: grayscale(100%);
  opacity: 0.6;
}

/* Controls Footer */
footer {
  background: #f9f9f9;
  padding: 15px;
  border-top: 2px solid #ddd;
}

.seed-selector {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.seed-btn {
  flex: 0 0 auto;
  padding: 10px 15px;
  border: 2px solid #ccc;
  border-radius: 20px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.seed-btn:hover {
  border-color: var(--primary-color);
  background: #f1f8e9;
}

.seed-btn.selected {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-dark);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#action-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
}

/* Animations */
@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-5px); }
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.pop-anim {
  animation: pop 0.3s ease-out;
}

.stealing-cursor {
  cursor: crosshair !important;
}

/* Neighbor specific */
.neighbor-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 0, 0, 0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: bold;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}

.dog-alert {
  animation: flashRed 0.5s 2;
}

@keyframes flashRed {
  0%, 100% { background-color: var(--sky-color); }
  50% { background-color: #ffcdd2; }
}