/* OBJECT SORT UNIVERSE — EmpreenderTHZ Games · interface mobile-first */
:root {
  --bg1: #ffb3d1; --bg2: #ffd6e8; --bg3: #fff0c9; --accent: #ff4f9a;
  --ink: #2a1846; --card: rgba(255,255,255,0.92); --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  transition: background .6s; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
body[data-world="gem"], body[data-world="factory"] { --ink: #f2f0ff; --card: rgba(30,22,70,0.94); }
body[data-world="factory"] { --card: rgba(28,40,52,0.95); }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* botões */
.btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 14px; padding: 13px 18px; cursor: pointer;
  background: var(--card); color: var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.15), 0 6px 18px rgba(0,0,0,.12);
  transition: transform .08s, box-shadow .08s; min-height: 48px;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #ffe066, #ffb703); color: #3b2300; }
.btn.danger { background: #ff5d73; color: #fff; }
.btn.big { font-size: 1.3rem; padding: 16px 22px; display: flex; flex-direction: column; align-items: center; }
.btn.big small { font-size: .78rem; opacity: .75; font-weight: 600; }
.btn.sm { padding: 8px 12px; min-height: 38px; font-size: .9rem; }
.btn:focus-visible, .icon:focus-visible, .ctl:focus-visible, .lvl:focus-visible { outline: 3px solid #3b7bff; outline-offset: 2px; }
.icon { font: inherit; font-size: 1.3rem; width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--card); color: var(--ink); cursor: pointer; }

/* home */
#view { flex: 1; overflow-y: auto; padding: calc(12px + var(--safe-top)) 14px calc(16px + var(--safe-bottom)); }
.home { max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; text-align: center; padding-top: 2vh; }
.brand { font-weight: 800; letter-spacing: .5px; opacity: .8; }
.brand b { color: var(--accent); }
.logo { margin: 4px 0 0; line-height: .9; font-weight: 900; display: flex; flex-direction: column; }
.logo span { font-size: clamp(2.6rem, 13vw, 4rem); background: linear-gradient(90deg, #ff3b5c, #ffd23f, #3ddc84, #3b7bff, #a25bff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 rgba(0,0,0,.15)); }
.logo em { font-style: normal; font-size: clamp(1.3rem, 6vw, 1.8rem); letter-spacing: 6px; color: var(--accent); }
.tag { margin: 0; opacity: .8; }
.stats-row { display: flex; justify-content: center; gap: 16px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
footer { opacity: .6; font-size: .8rem; margin-top: 6px; }

/* páginas */
.page { max-width: 760px; margin: 0 auto; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.bar h2 { margin: 0; font-size: 1.25rem; text-align: center; flex: 1; }
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.world-card { font: inherit; border: 0; border-radius: var(--radius); padding: 16px; min-height: 150px; display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer; color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.world-card:disabled { filter: grayscale(.7); opacity: .7; cursor: default; }
.w-candy { background: linear-gradient(140deg, #ff4f9a, #ffb347); }
.w-fruit { background: linear-gradient(140deg, #3fae5a, #f9d423); }
.w-gem { background: linear-gradient(140deg, #2d1b69, #9d7bff); }
.w-factory { background: linear-gradient(140deg, #2b3a4a, #38d0ff); }
.world-card.soon { background: rgba(0,0,0,.18); cursor: default; }
.wemoji { font-size: 2rem; } .wname { font-weight: 800; font-size: 1.1rem; } .wdesc { font-size: .82rem; opacity: .9; } .wstars { margin-top: auto; font-weight: 700; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 9px; }
.lvl { font: inherit; border: 0; border-radius: 14px; aspect-ratio: 1; background: var(--card); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.lvl b { font-size: 1.15rem; } .lvl i { font-style: normal; color: #ffb703; font-size: .72rem; letter-spacing: -1px; }
.lvl:disabled { opacity: .45; cursor: default; }
.lvl.special { box-shadow: 0 3px 0 var(--accent); }
.lvl.boss { background: linear-gradient(180deg, #ffe066, #ffb703); color: #3b2300; }
.panel { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.panel.center { text-align: center; }
.panel.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.big-date { font-size: 1.8rem; font-weight: 900; margin: 4px 0; }
.sub { opacity: .75; font-size: .88rem; }
.tabs { display: flex; gap: 8px; justify-content: center; }
.tab { font-size: 1.5rem; border: 0; border-radius: 12px; padding: 6px 14px; background: rgba(255,255,255,.35); cursor: pointer; }
.tab.on { background: var(--card); box-shadow: 0 0 0 3px var(--accent); }
.atlas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.atlas-cell { background: var(--card); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.atlas-cell canvas { width: 72px; height: 72px; }
.atlas-cell.locked { opacity: .6; }
.atlas-cell small { font-size: .74rem; opacity: .8; }
.shop { display: grid; gap: 8px; }
.shop-item { display: flex; align-items: center; justify-content: space-between; background: var(--card); padding: 8px 12px; border-radius: 12px; }
.achs { display: grid; gap: 8px; }
.ach { display: flex; align-items: center; gap: 12px; background: var(--card); padding: 10px 12px; border-radius: 14px; opacity: .6; }
.ach.got { opacity: 1; box-shadow: 0 0 0 2px #ffd23f inset; }
.ach .ai { font-size: 1.6rem; } .ach div { flex: 1; display: flex; flex-direction: column; } .ach small { opacity: .75; } .ach em { font-style: normal; font-weight: 700; }

/* jogo */
#game { flex: 1; display: flex; flex-direction: column; padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); min-height: 0; }
.hud { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; }
.hud-mid { flex: 1; text-align: center; min-width: 0; }
.hud-title { font-weight: 800; }
.hud-goal { font-size: .85rem; font-weight: 600; opacity: .9; }
.hud-chips { font-size: .74rem; opacity: .8; min-height: 1em; }
.hud-moves { background: var(--card); border-radius: 12px; padding: 4px 10px; text-align: center; min-width: 64px; }
.hud-moves b { display: block; font-size: 1.05rem; } .hud-moves small { font-size: .62rem; opacity: .75; }
.progress { position: relative; margin: 2px 14px 0; height: 12px; border-radius: 8px; background: rgba(0,0,0,.15); overflow: hidden; }
.progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #3ddc84, #ffd23f); transition: width .4s; }
.progress span { position: absolute; inset: 0; font-size: .64rem; font-weight: 800; text-align: center; line-height: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.board-wrap { flex: 1; position: relative; min-height: 0; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; outline: none; }
.coach { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(0,0,0,.75); color: #fff; padding: 10px 14px; border-radius: 14px; font-weight: 600; max-width: 90%; text-align: center; pointer-events: none; }
.controls { display: flex; justify-content: center; gap: 14px; padding: 8px 10px 12px; }
.ctl { font: inherit; border: 0; border-radius: 16px; background: var(--card); color: var(--ink); min-width: 86px; padding: 8px 10px; display: flex; flex-direction: column; align-items: center; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.ctl b { font-size: 1.4rem; } .ctl span { font-size: .75rem; font-weight: 700; }
.ctl:disabled { opacity: .45; }
.ctl.hint { background: linear-gradient(180deg, #ffe066, #ffb703); color: #3b2300; }

/* modais */
.modal { position: fixed; inset: 0; background: rgba(10,5,30,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; animation: fade .2s; }
.card { background: var(--card); color: var(--ink); border-radius: 22px; padding: 20px; width: min(420px, 100%); max-height: 92vh; overflow-y: auto; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.35); animation: pop .28s cubic-bezier(.2,1.4,.4,1); }
.card h2 { margin: 4px 0 10px; }
.btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.btns.col { flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(127,127,127,.2); text-align: left; }
.row select, .row input[type=range] { max-width: 55%; }
.row input[type=checkbox] { width: 24px; height: 24px; }
.stars { font-size: 3rem; letter-spacing: 6px; }
.stars span { color: rgba(127,127,127,.35); display: inline-block; }
.stars span.on { color: #ffc300; animation: starpop .5s both; text-shadow: 0 0 12px rgba(255,200,0,.7); }
.score { text-align: left; margin: 8px 0; }
.sl { display: flex; justify-content: space-between; padding: 3px 4px; font-size: .9rem; }
.sl.total { border-top: 2px solid rgba(127,127,127,.3); margin-top: 4px; font-size: 1.05rem; font-weight: 800; }
.coins { font-weight: 800; font-size: 1.1rem; }
.badge { display: inline-block; background: #ffd23f; color: #3b2300; padding: 4px 10px; border-radius: 20px; font-weight: 700; }
.newach { background: rgba(255,210,63,.25); border-radius: 12px; padding: 8px; font-weight: 700; }
.mech-icon { font-size: 3rem; }
.win-title { font-size: 1.6rem; }
#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(-50%, 220%); background: rgba(20,10,40,.9); color: #fff; padding: 10px 16px; border-radius: 14px; font-weight: 600; z-index: 30; max-width: 92%; text-align: center; transition: transform .25s, opacity .25s; pointer-events: none; opacity: 0; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#intro { position: fixed; inset: 0; z-index: 40; background: #22124f; }
#introCanvas { width: 100%; height: 100%; display: block; }
#introSkip { position: absolute; right: 14px; bottom: calc(18px + var(--safe-bottom)); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes starpop { 0% { transform: scale(0) rotate(-30deg); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
body.reduced *, body.reduced *::before { animation-duration: .01ms !important; transition-duration: .01ms !important; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (min-width: 900px) { .home { padding-top: 6vh; } }
