:root {
  --forest-dark: #1B3A2B;
  --forest: #2E5E45;
  --forest-light: #4A8A63;
  --wood: #8C5A3C;
  --wood-light: #C68B5C;
  --gold: #FFD166;
  --cream: #FBF4E6;
  --text-dark: #23291F;
  --text-soft: #5A6B57;
  --danger: #E4573D;
  --radius: 16px;
  --shadow: 0 6px 18px rgba(27, 58, 43, 0.18);
  --font-display: 'Baloo 2', 'Nunito Sans', sans-serif;
  --font-body: 'Nunito Sans', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: linear-gradient(180deg, #E8F3EA 0%, #F6EFDD 100%);
  color: var(--text-dark);
  min-height: 100vh;
}

.game-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--forest-dark);
}

.level-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
  color: var(--forest-dark);
}

.xp-track {
  width: 90px;
  height: 8px;
  background: #E4E9DD;
  border-radius: 999px;
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--wood-light));
  transition: width 0.25s ease;
}
.xp-label { font-size: 11px; color: var(--text-soft); font-weight: 600; }

.stat-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.stat-pill {
  background: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--shadow);
  color: var(--forest-dark);
  flex: 1;
  min-width: 90px;
  text-align: center;
}

.board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 620px) {
  .board { grid-template-columns: 1fr 1fr; }
  .sell-card, .locked-card, .pedido-card, .missions-card, .daily-card { grid-column: 1 / -1; }
}

.building-card, .worker-card, .sell-card, .locked-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.building-icon, .worker-avatar {
  font-size: 34px;
  background: var(--cream);
  border-radius: 14px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.building-body { flex: 1; min-width: 0; }
.building-body h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--forest-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.level-tag {
  font-size: 11px;
  background: var(--forest);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
}
.building-desc { margin: 0 0 10px; font-size: 13px; color: var(--text-soft); }
.worker-quote {
  margin: 0 0 6px;
  font-size: 13px;
  font-style: italic;
  color: var(--wood);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-upgrade {
  background: var(--forest);
  color: #fff;
}
.btn-upgrade:hover:not(:disabled) { background: var(--forest-light); }

.btn-sell {
  background: var(--gold);
  color: var(--text-dark);
  font-size: 15px;
  padding: 14px 20px;
  width: 100%;
}
.btn-sell:hover:not(:disabled) { filter: brightness(1.05); }

.sell-card {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.sell-icon { font-size: 30px; }
#sell-preview { margin: 0; font-size: 13px; color: var(--text-soft); font-weight: 600; }

.pedido-card {
  flex-direction: column;
  background: linear-gradient(135deg, #FFF7E4, #FFEFC7);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  gap: 10px;
}
.pedido-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--wood);
}
#pedido-text { margin: 0; font-size: 13px; color: var(--text-dark); font-weight: 600; }
.pedido-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.btn-pedido-wait { background: var(--wood); }
.btn-pedido-wait:hover:not(:disabled) { background: var(--wood-light); }

.daily-card {
  flex-direction: column;
  background: linear-gradient(135deg, #EAF6EE, #DCF0E3);
  border: 1.5px solid var(--forest-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  gap: 10px;
  display: flex;
}
.daily-pips {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.daily-pip {
  aspect-ratio: 1;
  border-radius: 10px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-soft);
  border: 1.5px solid #E4E9DD;
  gap: 2px;
}
.daily-pip .pip-icon { font-size: 13px; }
.daily-pip.is-done { background: var(--forest); color: #fff; border-color: var(--forest); }
.daily-pip.is-current { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); background: #fff; color: var(--text-dark); }
#daily-text { margin: 0; font-size: 13px; color: var(--text-dark); font-weight: 600; }

.missions-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.missions-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--forest-dark);
}
.mission-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid #EFEBE0;
}
.mission-row:first-child { border-top: none; }
.mission-icon { font-size: 20px; flex-shrink: 0; width: 26px; text-align: center; }
.mission-body { flex: 1; min-width: 0; }
.mission-text { font-size: 13px; font-weight: 600; color: var(--text-dark); margin-bottom: 4px; }
.mission-text.is-claimed { color: var(--text-soft); text-decoration: line-through; }
.mission-progress-track { height: 6px; background: #E4E9DD; border-radius: 999px; overflow: hidden; }
.mission-progress-fill { height: 100%; background: var(--forest); border-radius: 999px; transition: width 0.25s ease; }
.mission-reward { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.mission-claim-btn {
  flex-shrink: 0;
  background: var(--gold);
  color: var(--text-dark);
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.mission-claim-btn:hover { filter: brightness(1.05); }
.mission-done-check { flex-shrink: 0; font-size: 18px; }

.locked-card {
  flex-direction: column;
  background: #F1EDE1;
  box-shadow: none;
  border: 1.5px dashed #C9C2AC;
}
.locked-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.locked-card p { margin: 0; font-size: 12.5px; color: var(--text-soft); }

.footer-note {
  text-align: center;
  margin-top: 8px;
}
.footer-note a {
  font-size: 12px;
  color: var(--text-soft);
  text-decoration: underline;
}

.toast-area {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 50;
  pointer-events: none;
}
.toast {
  background: var(--forest-dark);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 58, 43, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.tutorial-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow);
}
.tutorial-emoji { font-size: 42px; margin-bottom: 10px; }
.tutorial-card p {
  font-size: 15px;
  color: var(--text-dark);
  line-height: 1.5;
  margin: 0 0 18px;
}
.tutorial-skip {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px;
}

.welcome-back-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--forest-dark);
  margin: 0 0 6px;
}
.welcome-back-away {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0 0 16px;
}
.welcome-back-gains {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.welcome-back-gain-row {
  display: flex;
  justify-content: space-between;
  background: var(--cream);
  border-radius: 10px;
  padding: 8px 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--forest-dark);
}
