/* Horta dos Números — verde de horta, letra grande, alvos grandes para o dedo. */
:root {
  --green: #2E7D32;
  --green-d: #1B5E20;
  --leaf: #8BC34A;
  --soil: #6D4C41;
  --cream: #FFFDE7;
  --sky: #81D4FA;
  --sun: #FFCA28;
  --red: #E53935;
  --ink: #263238;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: #C5E1A5;
}
body {
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(#B3E5FC, #DCEDC8 420px, #C5E1A5);
}

button {
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
button:disabled { cursor: default; }

.primary, .secondary, .danger {
  padding: 0.75em 1.2em;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}
.primary { background: var(--green); color: #fff; }
.secondary { background: #fff; color: var(--green-d); border: 2px solid var(--leaf); }
.danger { background: #fff; color: var(--red); border: 2px solid #EF9A9A; }
.primary:active, .secondary:active, .danger:active { transform: translateY(2px); box-shadow: none; }

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 14px)
    calc(env(safe-area-inset-bottom) + 18px) calc(env(safe-area-inset-left) + 14px);
  max-width: 760px;
  margin: 0 auto;
}
.screen.active { display: block; }

/* ── Horta ─────────────────────────────────────────── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.garden-title {
  font-size: clamp(1.4rem, 5.5vw, 2rem);
  color: var(--green-d);
}
.garden-title::before { content: "🌻 "; }
.top-stats { display: flex; align-items: center; gap: 8px; }
.drops {
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 1.15rem;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}
#settings-btn { font-size: 1.5rem; padding: 6px; opacity: 0.7; }

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 6px;
}
.big-btn {
  border-radius: 18px;
  padding: 12px 10px;
  font-size: 1.6rem;
  display: grid;
  justify-items: center;
  gap: 2px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}
.big-btn span { font-size: 1.05rem; font-weight: 700; }
.big-btn small { font-size: 0.8rem; opacity: 0.85; }
.big-btn.sun { background: var(--sun); color: #5D4037; }
.big-btn.sun.done { background: #FFF59D; }
.big-btn.sky { background: var(--sky); color: #01579B; }
.big-btn:active { transform: translateY(3px); box-shadow: none; }

.next-bird { text-align: center; font-size: 0.95rem; color: var(--green-d); margin: 6px 0 12px; }

.beds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 380px) {
  .beds { grid-template-columns: repeat(2, 1fr); }
}
.bed {
  position: relative;
  background: linear-gradient(#fff 0 58%, #8D6E63 58% 100%);
  border: 3px solid var(--c);
  border-radius: 18px;
  padding: 8px 6px 10px;
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 150px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}
.bed:active { transform: translateY(3px); box-shadow: none; }
.bed-plant { font-size: 2.6rem; line-height: 1.1; }
.stage-0 { font-size: 1.7rem; opacity: 0.55; padding-top: 0.5rem; }
.stage-4 { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-4deg); } }
.bed-name {
  background: #fff;
  border-radius: 8px;
  padding: 2px 6px;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.15;
}
.bed-level { color: #FFD54F; font-size: 0.95rem; letter-spacing: 1px; text-shadow: 0 1px 0 #5D4037; }
.bed-bar {
  width: 80%;
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
}
.bed-bar i { display: block; height: 100%; background: #4FC3F7; }
.bed-harvest {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.8rem;
  background: #FFF8E1;
  border-radius: 8px;
  padding: 0 4px;
}
.home-version, .settings-version { text-align: center; font-size: 0.75rem; opacity: 0.55; margin-top: 16px; }

/* ── Ronda ─────────────────────────────────────────── */
.play-top {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
}
.play-top button { font-size: 1.5rem; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, 0.7); }
.play-title { text-align: center; font-weight: 800; font-size: 1.15rem; color: var(--green-d); }
.dots { display: flex; justify-content: center; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.8); border: 2px solid var(--leaf); }
.dots i.now { background: var(--sun); border-color: #F9A825; }
.dots i.good { background: var(--leaf); border-color: var(--green); }
.dots i.bad { background: #EF9A9A; border-color: var(--red); }

.card {
  background: var(--cream);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
  border: 3px solid #DCE775;
}
.level-tag { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #689F38; margin-bottom: 6px; }
.q-text { font-size: clamp(1.15rem, 4.6vw, 1.45rem); line-height: 1.45; }
.q-text .big { display: block; text-align: center; font-size: 1.5em; margin-top: 10px; white-space: nowrap; }
.hl { color: #D84315; background: #FFE0B2; border-radius: 4px; padding: 0 2px; }
.blank {
  display: inline-block;
  min-width: 1.6em;
  text-align: center;
  border-bottom: 3px dashed #D84315;
  color: #D84315;
}
.frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  line-height: 1.1;
  margin: 0 2px;
  font-weight: 700;
}
.frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 3px; }
.frac .blank { border-bottom: 3px dashed #D84315; }

.q-visual { margin-top: 12px; text-align: center; }
.q-visual:empty { display: none; }
.vis { max-width: 100%; height: auto; }
svg.vis { width: 340px; }
svg.clock { width: 180px; }
svg.angle { width: 210px; }
svg.grid { width: auto; max-width: 100%; max-height: 220px; }
.picto table { margin: 0 auto; border-collapse: collapse; font-size: 1.1rem; }
.picto th { text-align: right; padding: 4px 10px; font-size: 0.95rem; }
.picto td { text-align: left; padding: 4px; letter-spacing: 2px; }
.picto tr:nth-child(odd) { background: #F1F8E9; }
.picto p { margin-top: 8px; font-size: 0.95rem; }

.q-hint {
  margin-top: 12px;
  background: #FFF8E1;
  border-left: 5px solid var(--sun);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1.02rem;
  line-height: 1.45;
}
.conta {
  display: block;
  width: max-content;
  margin: 8px auto 0;
  font-family: ui-monospace, "Consolas", monospace;
  font-size: 1.35rem;
  text-align: right;
  letter-spacing: 0.15em;
}
.conta > div:last-child { border-bottom: 3px solid var(--ink); padding-bottom: 2px; }
.conta span { float: left; margin-right: 0.6em; }

.q-feedback { margin-top: 12px; border-radius: 12px; padding: 10px 12px; font-size: 1.05rem; line-height: 1.45; }
.q-feedback.good { background: #DCEDC8; border: 2px solid var(--leaf); }
.q-feedback.try { background: #FFF3E0; border: 2px solid #FFB74D; }
.q-feedback.bad { background: #FFEBEE; border: 2px solid #EF9A9A; }

.answer { margin-top: 14px; }
.num-display {
  background: #fff;
  border: 3px solid var(--leaf);
  border-radius: 14px;
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  padding: 6px;
  min-height: 60px;
}
.num-display.empty .num-value { color: #BDBDBD; }
.num-unit { font-size: 1.2rem; color: #689F38; }
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.keypad button {
  background: #fff;
  border-radius: 14px;
  font-size: 1.7rem;
  font-weight: 700;
  padding: 10px 0;
  box-shadow: 0 3px 0 #AED581;
}
.keypad button:active { transform: translateY(2px); box-shadow: none; background: #F1F8E9; }

.choice-area { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-area.signs { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
.choice {
  background: #fff;
  border: 3px solid var(--leaf);
  border-radius: 16px;
  padding: 14px 8px;
  font-size: 1.35rem;
  font-weight: 700;
  min-height: 64px;
  box-shadow: 0 3px 0 #AED581;
}
.choice.right { background: #C5E1A5; border-color: var(--green); }
.choice.wrong { background: #FFCDD2; border-color: var(--red); opacity: 0.75; }
.choice:disabled:not(.right):not(.wrong) { opacity: 0.6; }

.play-actions { display: flex; gap: 10px; margin-top: 12px; }
.play-actions button { flex: 1; }
.play-actions [hidden] { display: none; }
[hidden] { display: none !important; }

/* ── Resultado ─────────────────────────────────────── */
.result-box {
  background: var(--cream);
  border-radius: 24px;
  padding: 26px 18px;
  text-align: center;
  margin-top: 8vh;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}
.result-plant { font-size: 5rem; animation: pop 0.6s ease-out; }
@keyframes pop { from { transform: scale(0.3); } 70% { transform: scale(1.15); } }
.result-title { color: var(--green-d); margin: 8px 0; font-size: 1.7rem; }
.result-text { font-size: 1.15rem; }
.result-extra { margin-top: 8px; font-size: 1.05rem; color: #5D4037; }
.result-actions { display: grid; gap: 10px; margin-top: 20px; }

/* ── Pássaros ──────────────────────────────────────── */
.birds-info { text-align: center; margin: 10px 0; color: var(--green-d); }
.bird-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.bird-card {
  background: #fff;
  border-radius: 16px;
  padding: 8px;
  display: grid;
  justify-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
}
.bird-card.locked { background: rgba(255, 255, 255, 0.55); color: #757575; font-weight: 500; }
.bird { width: 100%; max-width: 160px; height: auto; }
.bird.locked { opacity: 0.6; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(27, 94, 32, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 10;
}
.modal-box {
  background: var(--cream);
  border-radius: 24px;
  padding: 20px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: pop 0.5s ease-out;
}
.modal-kicker { font-weight: 700; color: #EF6C00; }
.modal-bird .bird { max-width: 240px; }
.modal-name { color: var(--green-d); margin: 4px 0 8px; }
.modal-fact { font-size: 1.1rem; line-height: 1.45; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions button { flex: 1; }

/* ── Código e área dos pais ────────────────────────── */
.pin-box { max-width: 340px; margin: 10vh auto 0; text-align: center; }
.pin-title { font-size: 1.3rem; font-weight: 700; color: var(--green-d); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--green); }
.pin-dots i.on { background: var(--green); }
.pin-dots.wrong { animation: shake 0.4s; }
.pin-dots.wrong i { border-color: var(--red); }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button { background: #fff; border-radius: 50%; aspect-ratio: 1; font-size: 1.6rem; box-shadow: 0 3px 0 #AED581; }

.settings-box {
  background: #fff;
  border-radius: 20px;
  padding: 18px;
  display: grid;
  gap: 12px;
}
.settings-box h2 { color: var(--green-d); }
.settings-box h3 { color: var(--green-d); margin-top: 8px; }
.settings-box label { display: grid; gap: 4px; font-weight: 600; }
.settings-box label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.settings-box input:not([type="checkbox"]), .settings-box select, .settings-box textarea {
  font: inherit;
  padding: 8px 10px;
  border: 2px solid #C5E1A5;
  border-radius: 10px;
}
.settings-box input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--green); }
.settings-box small { color: #616161; font-weight: 400; }
.topics-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.topics-table th, .topics-table td { padding: 6px 4px; border-bottom: 1px solid #E8F5E9; text-align: left; }
.topics-table td:nth-child(2), .topics-table th:nth-child(2) { text-align: center; }
.topics-table select { padding: 4px 6px; }
.errors-list { padding-left: 20px; display: grid; gap: 8px; font-size: 0.92rem; }
.errors-list li.none { list-style: none; margin-left: -20px; color: #757575; }
.err-ans { color: #C62828; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-actions button { flex: 1; }
.settings-saved { color: var(--green); font-weight: 700; text-align: center; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  transform: translateX(-50%);
  background: var(--green-d);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 700;
  z-index: 20;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* ── Festa quando acerta ───────────────────────────── */
.q-feedback .praise { font-size: 1.5rem; font-weight: 800; color: var(--green-d); margin-bottom: 2px; }
.q-feedback .drop-won { font-weight: 700; color: #0277BD; margin-bottom: 6px; }
.card.celebrate { animation: glow 0.9s ease-out; }
@keyframes glow {
  0% { box-shadow: 0 0 0 0 rgba(139, 195, 74, 0.9); transform: scale(1); }
  30% { transform: scale(1.03); }
  100% { box-shadow: 0 0 0 26px rgba(139, 195, 74, 0); transform: scale(1); }
}
.streak {
  text-align: center;
  font-weight: 800;
  color: #E65100;
  margin: -4px 0 8px;
  font-size: 1.05rem;
}

#celebrate {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255, 253, 231, 0.75), rgba(46, 125, 50, 0.45));
  overflow: hidden;
  animation: fade-in 0.15s ease-out;
}
#celebrate.streak { background: radial-gradient(circle, rgba(255, 236, 179, 0.85), rgba(239, 108, 0, 0.45)); }
@keyframes fade-in { from { opacity: 0; } }
.cel-box {
  background: #fff;
  border: 5px solid var(--leaf);
  border-radius: 28px;
  padding: 22px 26px;
  text-align: center;
  max-width: 88vw;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
  position: relative;
  z-index: 1;
}
#celebrate.streak .cel-box { border-color: #FFA000; }
.cel-icon { font-size: 5rem; line-height: 1; animation: spin-in 0.7s ease-out; }
@keyframes spin-in { from { transform: scale(0) rotate(-180deg); } }
.cel-msg { font-size: clamp(1.5rem, 6.5vw, 2.3rem); font-weight: 900; color: var(--green-d); margin-top: 10px; line-height: 1.2; }
#celebrate.streak .cel-msg { color: #E65100; }
.cel-drop { font-size: 1.4rem; font-weight: 800; color: #0277BD; margin-top: 8px; animation: drop 1s ease-in 0.3s both; }
@keyframes drop { from { opacity: 0; transform: translateY(-30px); } 60% { opacity: 1; transform: translateY(6px); } }
.cel-burst { position: absolute; inset: 0; pointer-events: none; }
.cel-burst span {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 2rem;
  opacity: 0;
  animation: burst 1.5s ease-out forwards;
}
@keyframes burst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.3); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y) + 12vmin)) rotate(var(--r)) scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .cel-burst span, .cel-box, .cel-icon, .card.celebrate { animation: none; }
  .cel-burst span { opacity: 0; }
}
.settings-box select, .settings-box textarea { width: 100%; max-width: 100%; min-width: 0; }
.settings-box textarea { resize: vertical; line-height: 1.4; }
