:root {
  --bg: #e8f4e5;
  --card: #fffef8;
  --primary: #2d5a3d;
  --primary-light: #4a8c5c;
  --accent: #f4a261;
  --text: #1a2e1f;
  --muted: #5c6b5f;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(45, 90, 61, 0.12);
  --touch: 52px;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding: 1rem; }

.screen { display: none; flex-direction: column; gap: 1rem; min-height: calc(100dvh - 2rem); }
.screen.active { display: flex; }

.hero { text-align: center; padding-top: 1rem; }
.owl { font-size: 4rem; line-height: 1; }
.hero h1 { font-size: 1.75rem; color: var(--primary); margin-top: 0.5rem; }
.subtitle { color: var(--muted); font-size: 0.95rem; margin-top: 0.25rem; }

.build-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  min-height: 80px;
  padding: 1rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.brick {
  width: 28px; height: 14px;
  background: linear-gradient(180deg, #c97b4a 0%, #a65d32 100%);
  border-radius: 3px;
  animation: pop 0.3s ease;
}
@keyframes pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.btn {
  min-height: var(--touch);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-light); }
.btn.ghost { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-icon {
  width: var(--touch); height: var(--touch);
  border: none; border-radius: 50%;
  background: var(--card);
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.luna-bubble {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
  font-size: 1.05rem;
  line-height: 1.45;
}

.mood-row { display: flex; justify-content: center; gap: 1.5rem; margin: 2rem 0; }
.mood-btn {
  font-size: 3rem;
  background: var(--card);
  border: 3px solid transparent;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  min-width: 80px; min-height: 80px;
}
.mood-btn:active, .mood-btn.selected { border-color: var(--primary); transform: scale(1.05); }

.mission-grid { display: flex; flex-direction: column; gap: 0.75rem; flex: 1; }
.mission-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 2px solid transparent;
  min-height: var(--touch);
}
.mission-card:active { border-color: var(--primary); }
.mission-card .icon { font-size: 2rem; }
.mission-card .meta { flex: 1; }
.mission-card h3 { font-size: 1rem; color: var(--primary); }
.mission-card p { font-size: 0.85rem; color: var(--muted); }
.mission-card .stars-done { color: var(--accent); }

.play-header { display: flex; justify-content: space-between; align-items: center; }
.play-header span { font-weight: 700; color: var(--primary); }
.play-area {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  min-height: 280px;
  touch-action: none;
}
.play-footer { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
#attempt-hint { font-size: 0.85rem; color: var(--muted); }

/* Place value */
.pv-board { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; height: 100%; }
.pv-col {
  border: 2px dashed #b8d4b8;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  min-height: 200px;
}
.pv-col h4 { font-size: 0.75rem; color: var(--muted); margin-bottom: 8px; }
.pv-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 8px;
  background: #f0f7ee;
  border-radius: 12px;
  margin-top: auto;
  width: 100%;
}
.pv-item {
  cursor: grab;
  touch-action: none;
  font-size: 1.5rem;
  padding: 4px;
}
.pv-item.dragging { opacity: 0.5; }
.pv-drop { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; width: 100%; }

.target-display {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* Coins */
.coin-table { text-align: center; }
.coin-target { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }
.coin-tray, .coin-selected {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  padding: 1rem; min-height: 70px;
}
.coin-tray { background: #f0f7ee; border-radius: 12px; margin-bottom: 1rem; }
.coin {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.coin.euro { background: linear-gradient(135deg, #ffd54f, #ffb300); }
.coin.cent { background: linear-gradient(135deg, #e0e0e0, #bdbdbd); font-size: 0.65rem; }
.coin-sum { font-size: 1.1rem; margin-top: 0.5rem; }

/* Story */
.story-box {
  background: #f0f7ee;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 1.05rem;
  line-height: 1.5;
}
.story-cards { display: flex; flex-direction: column; gap: 8px; }
.story-card {
  padding: 0.75rem 1rem;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 12px;
  cursor: pointer;
  min-height: var(--touch);
  display: flex; align-items: center;
}
.story-card.selected { border-color: var(--primary); background: #e8f4e5; }
.story-prompt { font-weight: 600; margin-bottom: 0.5rem; color: var(--primary); }

/* Clock simplified */
.clock-face {
  width: 180px; height: 180px;
  border: 4px solid var(--primary);
  border-radius: 50%;
  margin: 0 auto 1rem;
  position: relative;
  background: #fff;
}
.clock-hand {
  position: absolute;
  bottom: 50%; left: 50%;
  transform-origin: bottom center;
  background: var(--primary);
  border-radius: 4px;
}
.clock-hand.hour { width: 6px; height: 45px; margin-left: -3px; }
.clock-hand.minute { width: 4px; height: 65px; margin-left: -2px; background: var(--accent); }
.clock-center {
  position: absolute;
  width: 12px; height: 12px;
  background: var(--primary);
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.clock-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.clock-presets button {
  min-height: 44px; padding: 0.5rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-size: 0.95rem;
}

.choice-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.choice-btn {
  min-height: var(--touch);
  min-width: 80px;
  padding: 0.5rem 1rem;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
}
.choice-btn:active { background: #e8f4e5; }

.hidden { display: none !important; }

.reward-animation { font-size: 4rem; text-align: center; animation: pop 0.5s ease; }
#reward-text { text-align: center; color: var(--muted); }
.stars { text-align: center; font-size: 2rem; letter-spacing: 4px; margin: 1rem 0; }
.sticker-reveal {
  text-align: center;
  font-size: 3rem;
  padding: 1rem;
  background: var(--card);
  border-radius: var(--radius);
}

.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.overlay-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 320px;
  width: 100%;
  display: flex; flex-direction: column; gap: 1rem;
}

#screen-parent input {
  width: 100%;
  min-height: var(--touch);
  font-size: 1.25rem;
  text-align: center;
  border: 2px solid #ccc;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
#session-list { list-style: none; font-size: 0.9rem; }
#session-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}
#progress-dump {
  font-size: 0.75rem;
  background: #f5f5f5;
  padding: 0.5rem;
  border-radius: 8px;
  overflow: auto;
}
.hint { font-size: 0.85rem; color: var(--muted); }
code { background: #eee; padding: 2px 6px; border-radius: 4px; }

.check-btn {
  margin-top: 1rem;
  width: 100%;
}
