:root {
  --cream: #fff3d6;
  --ink: #4a1a12;
  --red: #c8323c;
  --red-dark: #7d1626;
  --gold: #ffc233;
  --display: 'Chango', 'Baloo 2', sans-serif;
  --body: 'Baloo 2', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

html, body { height: 100%; overflow: hidden; background: #3b1d56; overscroll-behavior: none; }
body { font: 700 17px/1.3 var(--body); color: var(--cream); user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }

button {
  font: inherit; color: var(--ink); cursor: pointer; border: 0; border-radius: 14px; padding: 9px 16px 8px;
  background: linear-gradient(#fff6df, #f3d59b); box-shadow: 0 4px 0 #a5713a, 0 7px 14px rgba(20, 0, 20, .35);
  transition: transform .08s, box-shadow .08s;
}
button:hover { filter: brightness(1.06); }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #a5713a, 0 2px 6px rgba(20, 0, 20, .35); }
button:disabled { color: #8d6a55; background: #cdb089; box-shadow: 0 4px 0 #8a6a48; cursor: default; filter: none; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
button.big { color: #fff; background: linear-gradient(#ee5a4f, var(--red)); box-shadow: 0 5px 0 var(--red-dark), 0 9px 18px rgba(20, 0, 20, .4); }
button.round { width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 26px; line-height: 1; flex: none; }
#muteBtn.off { text-decoration: line-through; opacity: .7; }

.screen { position: fixed; inset: 0; padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
.screen header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-family: var(--display); font-weight: 400; } /* Chango nu are ș și ț, deci doar pentru AGAVE */
h2 { font-weight: 800; }

.title { display: flex; flex-direction: column; align-items: center; gap: 2vh; padding-top: 7vh; text-align: center; }
.title h1 {
  font-size: min(21vw, 21vh); line-height: 1; letter-spacing: .02em; color: var(--gold);
  text-shadow: 0 .03em 0 #f07a2b, 0 .06em 0 var(--red), 0 .09em 0 var(--red-dark), 0 .16em .18em rgba(30, 0, 30, .5);
}
.title p { font-size: clamp(17px, 2.6vh, 24px); text-shadow: 0 2px 6px rgba(40, 0, 30, .8); }
.title .big { font-size: clamp(22px, 3.6vh, 32px); padding: 10px 46px 8px; border-radius: 20px; }

.levels { display: flex; flex-direction: column; gap: 14px; background: rgba(35, 8, 40, .5); }
.levels h2 { font-size: clamp(20px, 4vw, 30px); }
.stars-total { white-space: nowrap; color: var(--gold); font-size: 20px; }
.worlds { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #e2b97a transparent; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); align-content: safe center; width: min(1000px, 100%); margin: 0 auto; padding: 4px 4px 12px; }
.world { border-radius: 20px; padding: 12px 14px 16px; background-size: cover; background-position: center; box-shadow: inset 0 0 0 3px rgba(255, 235, 190, .55), 0 8px 20px rgba(10, 0, 20, .4); }
.world h3 { font: 800 23px/1.2 var(--body); margin-bottom: 8px; text-shadow: 0 2px 0 rgba(50, 0, 30, .8), 0 0 12px rgba(50, 0, 30, .8); }
.world ol { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 11px 8px; }
.world button { width: 100%; padding: 6px 0 5px; font-size: 20px; line-height: 1.1; }

.world button:disabled small { visibility: hidden; }
.world button small { display: block; font-size: 13px; letter-spacing: 1px; color: #c9a36a; }
.world button small b { color: #e0801a; }

.play { pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; }
.play button { pointer-events: auto; }
.info { display: flex; flex-direction: column; align-items: center; padding: 3px 20px; border-radius: 16px; background: rgba(40, 6, 34, .62); text-align: center; line-height: 1.2; }
.info b { font: 800 20px/1.2 var(--body); color: var(--gold); }
.info span { font-variant-numeric: tabular-nums; }
.play footer { display: flex; justify-content: center; gap: 10px; padding-bottom: 6px; }

dialog { margin: auto; border: 0; border-radius: 26px; padding: 22px 26px 26px; width: min(430px, 92vw); text-align: center; color: var(--ink); background: linear-gradient(#fffaf0, #fbe3b4); box-shadow: inset 0 0 0 5px var(--red), inset 0 0 0 9px var(--gold), 0 20px 50px rgba(10, 0, 20, .6); }
dialog::backdrop { background: rgba(30, 5, 35, .35); }
dialog h2 { color: var(--red); font-size: 30px; }
.win-stars { font-size: 58px; line-height: 1.15; color: #dcc190; }
.win-stars span { display: inline-block; }
.win-stars .on { color: #f7a81b; text-shadow: 0 3px 0 #b5650a; animation: pop .45s cubic-bezier(.2, 2, .5, 1) backwards; }
.win-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }
.win-buttons .big { flex-basis: 100%; font-size: 22px; }

@keyframes pop { from { transform: scale(0) rotate(-90deg); } }
@media (max-width: 480px) { .play footer button { padding-inline: 11px; font-size: 15px; } }
@media (prefers-reduced-motion: reduce) { .win-stars .on { animation: none; } button { transition: none; } }
