* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #dff0d0;
  color: #2f3b23;
  image-rendering: pixelated;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #4c7a3a;
  color: #fff;
  padding: 14px 20px;
  border-bottom: 4px solid #2f5122;
}

.brand { font-size: 1.3em; font-weight: bold; letter-spacing: 1px; }

.stats { font-size: 0.95em; display: flex; gap: 16px; }

.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  padding: 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.panel {
  background: #fdf6e3;
  border: 4px solid #8a6d3b;
  border-radius: 6px;
  padding: 16px;
}

.panel-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }

.xp-bar-wrap {
  position: relative;
  width: 200px;
  height: 16px;
  background: #ddd;
  border: 2px solid #8a6d3b;
  border-radius: 4px;
  overflow: hidden;
}

.xp-bar { height: 100%; background: #6fbf3f; width: 0%; transition: width 0.3s; }

.xp-label {
  position: absolute; top: 0; left: 0; right: 0; text-align: center;
  font-size: 0.7em; line-height: 16px; color: #2f3b23;
}

.plot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.plot {
  aspect-ratio: 1;
  background: #b98a4b;
  border: 3px solid #7a5a2e;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
  cursor: pointer;
  position: relative;
  user-select: none;
}

.plot.empty { background: #8a5a2e; }
.plot.growing { background: #a97c3f; }
.plot.ready { background: #6fbf3f; animation: pulse 1.2s infinite; }

.plot .timer {
  position: absolute;
  bottom: 4px;
  font-size: 0.35em;
  color: #fff;
  background: rgba(0,0,0,0.4);
  padding: 1px 4px;
  border-radius: 3px;
}

@keyframes pulse {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
  100% { filter: brightness(1); }
}

.animal-section { margin-top: 20px; border-top: 2px dashed #8a6d3b; padding-top: 12px; }

.animal-grid { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }

.animal {
  background: #fff3d6;
  border: 3px solid #8a6d3b;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
  font-size: 0.85em;
  min-width: 90px;
  cursor: pointer;
}

.animal .em { font-size: 1.8em; display: block; }

.sidebar { display: flex; flex-direction: column; gap: 16px; }

.sidebar-block { border-top: 2px dashed #8a6d3b; padding-top: 10px; }
.sidebar-block:first-child { border-top: none; padding-top: 0; }

.crop-picker { display: flex; gap: 8px; flex-wrap: wrap; }

.crop-btn {
  border: 2px solid #8a6d3b;
  background: #fff3d6;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.85em;
  text-align: center;
}

.crop-btn.selected { background: #6fbf3f; color: #fff; }
.crop-btn.locked { opacity: 0.4; cursor: not-allowed; }

.hint { font-size: 0.78em; color: #6b6b52; margin: 4px 0; }

.inventory-list, .tx-list { font-size: 0.85em; max-height: 160px; overflow-y: auto; }

.inv-item, .tx-item {
  display: flex; justify-content: space-between;
  padding: 4px 0; border-bottom: 1px solid #e5d9b6;
}

.exchange-row { display: flex; gap: 6px; margin: 6px 0; }
.exchange-row input {
  flex: 1; padding: 6px; border: 2px solid #8a6d3b; border-radius: 4px;
}

.btn {
  display: inline-block;
  background: #6fbf3f;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
}

.btn.small { padding: 6px 10px; font-size: 0.85em; }
.btn:hover { filter: brightness(1.1); }

.login-gate {
  max-width: 480px;
  margin: 80px auto;
  text-align: center;
  background: #fdf6e3;
  border: 4px solid #8a6d3b;
  border-radius: 8px;
  padding: 30px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #2f3b23;
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.9em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.toast.show { opacity: 1; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
}
