* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #6cc23a; font-family: "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
.hidden { display: none !important; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#scene .item { cursor: grab; }
#scene .item.done { pointer-events: none; }
#scene .item:active { cursor: grabbing; }
#scene .tap { cursor: pointer; }

#topbar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 14px 0; pointer-events: none; z-index: 5; }
#topbar > * { pointer-events: auto; }
.round { width: 64px; height: 64px; border-radius: 50%; border: 5px solid #fff; background: #ff8a1f; font-size: 30px; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2); cursor: pointer; }
.round:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); }
#progress { display: flex; gap: 8px; }
#progress span { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); border: 4px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; transition: transform 0.3s; }
#progress span.on { background: #ffd23f; transform: scale(1.15); }

.overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(40, 90, 30, 0.45); }
.menu-box { width: min(1000px, 100%); max-height: 100%; overflow: auto; text-align: center; }
.menu-box h1 { margin: 0; color: #fff; font-size: clamp(34px, 6vw, 64px); text-shadow: 0 5px 0 #c0392b, 0 8px 12px rgba(0, 0, 0, 0.3); }
.sub { color: #fff; font-size: clamp(18px, 3vw, 28px); font-weight: 900; margin: 6px 0 18px; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
#cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.card { border: 6px solid #fff; border-radius: 28px; background: #fffbe8; padding: 12px 10px 10px; cursor: pointer; box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18); font-family: inherit; transition: transform 0.15s; }
.card:hover { transform: translateY(-4px) rotate(-1deg); }
.card:active { transform: translateY(3px); }
.card svg { width: 120px; height: 120px; display: block; margin: 0 auto; }
.card b { display: block; font-size: 24px; color: #5e3b1f; margin-top: 4px; }
.card .stars { font-size: 16px; min-height: 22px; letter-spacing: 1px; }
.adult { display: inline-block; margin-top: 18px; color: #fff; font-weight: 900; opacity: 0.8; }

.done-box { background: #fffbe8; border: 8px solid #fff; border-radius: 36px; padding: 24px 30px; text-align: center; box-shadow: 0 12px 0 rgba(0, 0, 0, 0.18); animation: pop 0.4s cubic-bezier(.2, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(0.3); } }
.big-star { font-size: 90px; animation: spin 1.5s ease-in-out infinite; }
@keyframes spin { 50% { transform: rotate(15deg) scale(1.1); } }
.done-box h2 { margin: 6px 0 16px; font-size: 44px; color: #c0392b; }
.done-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.big-btn { border: 5px solid #fff; border-radius: 26px; background: #43a047; color: #fff; font-family: inherit; font-weight: 900; font-size: 28px; padding: 16px 26px; cursor: pointer; box-shadow: 0 7px 0 #2a7a36; }
.big-btn.alt { background: #ff8a1f; box-shadow: 0 7px 0 #c65f0b; }
.big-btn:active { transform: translateY(4px); box-shadow: 0 3px 0 #2a7a36; }

#rotate { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 6; background: rgba(0, 0, 0, 0.6); color: #fff; padding: 8px 16px; border-radius: 16px; font-weight: 900; }

/* Niveles */
.menu-main { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 12px 0 4px; }
.play-big { border: 7px solid #fff; border-radius: 36px; background: #43a047; color: #fff; font-family: inherit; font-weight: 900; font-size: clamp(30px, 5vw, 46px);
  padding: 14px 36px; cursor: pointer; box-shadow: 0 9px 0 #2a7a36; animation: breathe 1.6s ease-in-out infinite; display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.play-big small { font-size: 18px; opacity: .9; }
@keyframes breathe { 50% { transform: scale(1.05); } }
.sub.small { font-size: 18px; margin: 4px 0 10px; }
.big-btn.alt2 { background: #3fa9f5; box-shadow: 0 7px 0 #1f78b8; }
.done-stars { font-size: 52px; letter-spacing: 6px; margin: -6px 0 12px; }
.mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#level-badge { background: #fff; color: #c0392b; font-weight: 900; font-size: 20px; padding: 2px 14px; border-radius: 999px; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.map-box { width: min(1000px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.map-head { display: flex; align-items: center; gap: 14px; }
.map-head h2 { margin: 0; color: #fff; font-size: 40px; text-shadow: 0 4px 0 #c0392b; }
#world-tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#world-tabs button { border: 5px solid #fff; border-radius: 20px; background: #fffbe8; font-family: inherit; font-size: 28px; padding: 6px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; min-width: 96px; }
#world-tabs button small { font-size: 14px; font-weight: 900; color: #5e3b1f; }
#world-tabs button.sel { background: #ffd23f; transform: scale(1.06); }
#world-tabs button.locked { opacity: .45; }
#level-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 10px; overflow-y: auto; padding: 6px; }
.lvl { aspect-ratio: 1; border: 5px solid #fff; border-radius: 50%; background: #ff8a1f; color: #fff; font-family: inherit; font-weight: 900; font-size: clamp(18px, 2.6vw, 28px);
  cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,.2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 0; }
.lvl small { font-size: 10px; min-height: 12px; }
.lvl.locked { background: #b8b8b8; cursor: default; }
.lvl.next { background: #43a047; animation: breathe 1.2s infinite; }
@media (max-width: 700px) { #level-grid { grid-template-columns: repeat(5, 1fr); } }
