:root { --azul: #1E88FF; --amarelo: #FFD60A; --creme: #FFF3C4; --btn: 64px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  position: fixed; inset: 0; width: 100%;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  background: linear-gradient(#9fdcff, #e8f8ff);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.screen {
  position: absolute; inset: 0; display: flex;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}

.btn {
  width: var(--btn); height: var(--btn); min-width: var(--btn);
  border: 4px solid #fff; border-radius: 20px; background: var(--creme);
  box-shadow: 0 3px 0 rgba(0,0,0,.18); font-size: 32px; line-height: 1; color: #1b3a63;
  display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
  transition: transform .08s;
}
.btn:active { transform: scale(.88); }
.btn.on { background: var(--amarelo); border-color: var(--azul); }
.btn:disabled { opacity: .4; }
.btn svg { width: 34px; height: 34px; }
.dot { display: block; border-radius: 50%; background: #222; }
.d0 { width: 10px; height: 10px; } .d1 { width: 20px; height: 20px; } .d2 { width: 34px; height: 34px; }

/* início */
#home { flex-direction: row; align-items: center; justify-content: center; gap: 5vmin; flex-wrap: wrap; }
.fsb.btn { }
#hFull { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
.big {
  width: min(42vmin, 320px); height: min(42vmin, 320px); min-width: 150px; min-height: 150px;
  border: 8px solid #fff; border-radius: 15%; background: #FF9500; color: #fff;
  box-shadow: 0 10px 0 rgba(0,0,0,.2); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; animation: bob 2.4s ease-in-out infinite;
}
.big.alt { background: #1E88FF; animation-delay: -1.2s; }
.big .ico { font-size: min(20vmin, 150px); line-height: 1; }
.big .lbl { font-size: min(6vmin, 40px); font-weight: 800; }
.big:active { transform: scale(.94); animation: none; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-1.5deg); } }
.deco { position: absolute; top: 3vmin; left: 0; right: 0; display: flex; justify-content: space-around; font-size: 9vmin; pointer-events: none; }
.deco span { animation: bob 3s ease-in-out infinite; }
.deco span:nth-child(even) { animation-delay: -1.5s; }

/* galeria */
#gallery { flex-direction: column; gap: 10px; }
.back { flex: none; }
.grid {
  flex: 1; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; align-content: start; align-items: start; padding: 4px; min-height: 0;
}
.card { position: relative; display: block; width: 100%; height: 0; padding: 0 0 75% 0; border: 6px solid #fff; border-radius: 24px; background: #fff; cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,.18); overflow: hidden; box-sizing: border-box; }
.card:active { transform: scale(.94); }
.card img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

/* editor: o desenho é o principal; ferramentas numa faixa fina com rolagem */
#editor {
  flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.area { flex: 1; min-height: 0; min-width: 0; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.stage {
  position: relative; background: #fff; border: 4px solid #fff; border-radius: 12px;
  box-shadow: 0 0 0 3px var(--azul); touch-action: none; transform-origin: 50% 50%;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#lines { pointer-events: none; }
#tmp { pointer-events: none; opacity: .55; }

.bar { flex: none; background: rgba(255,255,255,.9); box-shadow: 0 0 10px rgba(0,0,0,.15); z-index: 3; }
.bar.off { display: none !important; }
.strip {
  display: flex; gap: 8px; padding: 7px; align-items: center;
  overflow-x: auto; overflow-y: hidden; touch-action: pan-x; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip > * { flex: none; }
.colors { display: flex; gap: 8px; align-items: center; }
.colors .sw { flex: none; }
[data-layout="a"] .colors { display: contents; }
.sep { width: 6px; height: 40px; border-radius: 3px; background: rgba(0,0,0,.15); margin: 0 2px; }
.sw {
  width: var(--btn); height: var(--btn); border-radius: 50%; border: 5px solid #fff; padding: 0; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,.25); transition: transform .08s;
}
.sw.on { transform: scale(1.12); border-color: #222; box-shadow: 0 0 0 3px #fff, 0 3px 0 3px rgba(0,0,0,.2); }

.handle { position: absolute; z-index: 5; background: var(--azul); border-color: #fff; box-shadow: 0 0 0 3px rgba(0,0,0,.25), 0 4px 10px rgba(0,0,0,.3); width: 72px; height: 72px; font-size: 38px; }

/* versão A: faixa embaixo */
[data-layout="a"] .handle { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }

/* versão B: faixa vertical fina na lateral */
[data-layout="b"] #editor { flex-direction: row-reverse; }
[data-layout="b"] .bar { display: flex; flex-direction: row; height: 100%; }
[data-layout="b"] #sepColors { display: none; }
[data-layout="b"] .colors { flex-direction: column; padding: 7px; height: 100%; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; scrollbar-width: none; background: rgba(30,136,255,.12); }
[data-layout="b"] .colors::-webkit-scrollbar { display: none; }
[data-layout="b"] .strip { flex: none; }
[data-layout="b"] .strip { flex-direction: column; overflow-x: hidden; overflow-y: auto; touch-action: pan-y; height: 100%; }
[data-layout="b"] .sep { width: 40px; height: 6px; margin: 2px 0; }
[data-layout="b"] .handle { left: max(10px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); }

.toast { position: absolute; left: 50%; top: 50%; font-size: 30vmin; pointer-events: none; z-index: 9; animation: pop .9s ease-out forwards; }
@keyframes pop { 0% { transform: translate(-50%,-50%) scale(.2); opacity: 0; } 30% { transform: translate(-50%,-50%) scale(1.1); opacity: 1; } 100% { transform: translate(-50%,-50%) scale(1); opacity: 0; } }

/* ================= visual alegre (v2.1) ================= */
html, body {
  background:
    radial-gradient(circle at 20% 25%, rgba(255,255,255,.7) 0 5px, transparent 6px) 0 0 / 90px 90px,
    radial-gradient(circle at 70% 65%, rgba(255,255,255,.5) 0 3px, transparent 4px) 0 0 / 60px 60px,
    linear-gradient(180deg, #6fc8ff 0%, #bfeaff 65%, #d8f6c9 100%);
}
/* início */
#home { flex-direction: column; align-items: center; justify-content: center; gap: 3.5vmin; overflow: hidden; }
.choices { display: flex; gap: 5vmin; flex-wrap: wrap; justify-content: center; z-index: 2; }
.logo {
  margin: 0; z-index: 2; text-align: center; font-weight: 900; font-size: clamp(34px, 9vmin, 84px); line-height: 1.05;
  letter-spacing: .01em; -webkit-text-stroke: 3px #fff; paint-order: stroke fill; text-shadow: 0 5px 0 rgba(0,0,0,.18);
}
.logo span { display: inline-block; animation: wave 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.12s); }
.logo span:nth-child(7n+1) { color: #ff3b30; } .logo span:nth-child(7n+2) { color: #ff9500; } .logo span:nth-child(7n+3) { color: #f5c400; }
.logo span:nth-child(7n+4) { color: #34c759; } .logo span:nth-child(7n+5) { color: #1e88ff; } .logo span:nth-child(7n+6) { color: #8e5cf0; } .logo span:nth-child(7n) { color: #ff4fa3; }
@keyframes wave { 50% { transform: translateY(-.12em) rotate(-3deg); } }
.big { background: linear-gradient(160deg, #ffb340, #ff5e7e); border: 8px solid #fff; box-shadow: 0 10px 0 rgba(0,0,0,.2), inset 0 6px 0 rgba(255,255,255,.35); }
.big.alt { background: linear-gradient(160deg, #3fb2ff, #7a5cff); }
.big .lbl { text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.sun { position: absolute; top: 3vmin; left: 4vmin; width: 16vmin; height: 16vmin; min-width: 70px; min-height: 70px; border-radius: 50%;
  background: radial-gradient(circle, #fff7a8 0 40%, #ffd60a 41% 100%); box-shadow: 0 0 0 1.6vmin rgba(255,214,10,.35), 0 0 0 3.4vmin rgba(255,214,10,.18); animation: pulse 3s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.cloud { position: absolute; width: 18vmin; height: 6vmin; background: #fff; border-radius: 6vmin; opacity: .95; animation: drift 24s linear infinite; z-index: 1; }
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 9vmin; height: 9vmin; left: 2.5vmin; top: -4.2vmin; } .cloud::after { width: 7vmin; height: 7vmin; left: 9vmin; top: -2.8vmin; }
.cloud.c1 { top: 12vmin; left: -20vmin; } .cloud.c2 { top: 26vmin; left: -20vmin; animation-delay: -12s; transform: scale(.7); }
@keyframes drift { to { left: 110%; } }
.scenery { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34%; pointer-events: none; }
.deco { top: auto; bottom: 3vmin; font-size: 11vmin; z-index: 2; }

/* galeria */
.grid { padding: 8px; }
.card { border-color: #fff; box-shadow: 0 6px 0 rgba(0,0,0,.18), 0 0 0 5px var(--c, #ffb340); }
.card:nth-child(6n+1) { --c: #ff6b6b; } .card:nth-child(6n+2) { --c: #ffb340; } .card:nth-child(6n+3) { --c: #7ed957; }
.card:nth-child(6n+4) { --c: #3fb2ff; } .card:nth-child(6n+5) { --c: #8e5cf0; } .card:nth-child(6n) { --c: #ff6fb5; }
.card { margin: 5px; width: calc(100% - 10px); }

/* editor: papel com borda arco-íris e faixa de ferramentas colorida */
.stage {
  border: 7px solid transparent; border-radius: 18px; box-shadow: 0 8px 0 rgba(0,0,0,.18), 0 10px 24px rgba(0,0,0,.18);
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, #ff3b30, #ff9500, #ffd60a, #7ed957, #20c9c9, #1e88ff, #8e5ef0, #ff6fb5) border-box;
}
.bar { background: linear-gradient(180deg, #38a6ff, #6c5cff); box-shadow: 0 -4px 14px rgba(0,0,0,.22); }
[data-layout="b"] .bar { background: linear-gradient(90deg, #38a6ff, #6c5cff); box-shadow: 4px 0 14px rgba(0,0,0,.22); }
.sep { background: rgba(255,255,255,.55); }
.btn { background: #fff; border-color: rgba(255,255,255,.9); box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.btn[data-tool="pencil"] { background: #cfe8ff; } .btn[data-tool="chalk"] { background: #ffe0bd; } .btn[data-tool="marker"] { background: #ffc9e2; }
.btn[data-tool="rainbow"] { background: linear-gradient(135deg, #ffcdd2, #fff4b0, #c8f5c8, #c4dcff, #e2c8ff); }
.btn[data-tool="star"] { background: #fff3a8; } .btn[data-tool="heart"] { background: #ffc9c9; }
.btn[data-tool="bucket"] { background: #bff3ec; } .btn[data-tool="eraser"] { background: #e3d6ff; }
.btn.on, .btn[data-tool].on { transform: scale(1.1); border-color: #fff; box-shadow: 0 0 0 4px #ffd60a, 0 0 16px 6px rgba(255,214,10,.85); }
.btn:active { transform: scale(.88); }
.btn.on:active { transform: scale(.95); }
.btn:disabled { opacity: .45; }
.sw { border-color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.28); }
.sw.on { border-color: #fff; transform: scale(1.18); box-shadow: 0 0 0 4px #222, 0 0 0 7px #fff, 0 4px 0 7px rgba(0,0,0,.25); }
[data-layout="b"] .colors { background: linear-gradient(90deg, #ffe58a, #ffc15a); box-shadow: inset 4px 0 8px rgba(0,0,0,.12); }
[data-layout="a"] .strip { }

.spark { position: fixed; z-index: 30; pointer-events: none; font-size: 30px; margin: -15px 0 0 -15px; animation: spark .7s ease-out forwards; }
@keyframes spark { from { transform: translate(0,0) scale(.6); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1.3) rotate(140deg); opacity: 0; } }

/* versão fixa em todas as telas */
.ver {
  position: fixed; right: max(8px, env(safe-area-inset-right)); bottom: max(6px, env(safe-area-inset-bottom)); z-index: 40;
  min-height: 30px; padding: 4px 12px; border-radius: 999px; border: 2px solid rgba(0,0,0,.18); cursor: pointer;
  background: rgba(255,255,255,.92); color: #1b3a63; font: 700 12px/1.2 ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  box-shadow: 0 2px 6px rgba(0,0,0,.2); max-width: 70vw;
}
.ver.new { background: #ffd60a; border-color: #b58900; animation: pulse 1.4s ease-in-out infinite; }

/* botões principais flutuando no canto de cima, à direita */
.floater { position: absolute; z-index: 6; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); display: flex; gap: 8px; padding: 6px; border-radius: 28px; background: rgba(255,255,255,.6); box-shadow: 0 4px 14px rgba(0,0,0,.28); }
.btn.exit { background: linear-gradient(160deg, #ff9a8a, #ff4d6d); }

/* ilhas */
#worlds { flex-direction: column; gap: 6px; background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(30,140,230,.45) 100%); }
.islands { flex: 1; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 2vmin 3vmin; align-content: center; justify-items: center; padding: 6px 10px 40px; }
.island { position: relative; display: block; width: 100%; max-width: 270px; padding: 0; border: 0; background: none; cursor: pointer; animation: bob 4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.island::before { content: ''; display: block; padding-bottom: 100%; }
.island:active { transform: scale(.94); animation: none; }
.isl-soil { position: absolute; left: 14%; right: 14%; top: 56%; height: 30%; background: var(--s); border-radius: 0 0 50% 50% / 0 0 100% 100%; box-shadow: inset 0 -8px 0 rgba(0,0,0,.2); }
.isl-land { position: absolute; left: 3%; right: 3%; top: 38%; height: 34%; border-radius: 50%; background: radial-gradient(ellipse at 50% 25%, var(--t), var(--t2)); box-shadow: 0 6px 0 rgba(0,0,0,.14), inset 0 -6px 0 rgba(0,0,0,.12); }
.isl-emo { position: absolute; left: 10%; right: 10%; top: 0; height: 56%; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-end; gap: 0 8px; font-size: clamp(30px, 8vmin, 58px); line-height: 1.05; }
.isl-emo i { font-style: normal; filter: drop-shadow(0 3px 0 rgba(0,0,0,.2)); }
.isl-name { position: absolute; left: 6%; right: 6%; bottom: 2%; padding: 3px 8px; border-radius: 999px; background: #1e88ff; color: #fff; font-weight: 900; font-size: clamp(15px, 3.4vmin, 24px); text-shadow: 0 2px 0 rgba(0,0,0,.3); box-shadow: 0 3px 0 rgba(0,0,0,.2); border: 3px solid #fff; }

/* galeria de um mundo */
.gal-head { display: flex; align-items: center; gap: 12px; flex: none; }
.gal-title { font-weight: 900; font-size: clamp(22px, 5vmin, 38px); color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.28); -webkit-text-stroke: 1px rgba(0,0,0,.2); }
.card img { object-fit: cover; }
#goDraw { position: relative; }
.big .thumb { position: absolute; right: -8px; bottom: -8px; width: 38%; border: 4px solid #fff; border-radius: 10px; box-shadow: 0 4px 8px rgba(0,0,0,.3); transform: rotate(6deg); background: #fff; }

/* ferramenta seguindo o dedo */
#cursor { position: fixed; left: 0; top: 0; z-index: 25; pointer-events: none; will-change: transform; }
#cursor .ring { position: absolute; left: 0; top: 0; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.55); transform: translate(-50%, -50%); }
#cursor .tip { position: absolute; left: 0; top: 0; font-size: 52px; line-height: 1; transform: translate(-6%, -94%); filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); }
#cursor .tip.mid { transform: translate(-50%, -50%); }

/* pede para virar o aparelho: o app funciona deitado */
.rotate { display: none; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; padding: 20px; text-align: center;
  background: radial-gradient(circle at 30% 20%, #6c5cff, #1e88ff 60%, #20c9c9); color: #fff; touch-action: none; }
@media (orientation: portrait) { .rotate { display: flex; } }
.rot-dev { width: min(60vw, 300px); height: min(60vw, 300px); filter: drop-shadow(0 8px 0 rgba(0,0,0,.2)); }
.rot-anim { transform-origin: 60px 60px; animation: giravira 3s ease-in-out infinite; }
@keyframes giravira { 0%, 20% { transform: rotate(0deg); } 55%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
.rot-arrow { width: min(34vw, 170px); opacity: .9; }
.rot-txt { font-weight: 900; font-size: clamp(22px, 6.5vw, 40px); line-height: 1.2; text-shadow: 0 3px 0 rgba(0,0,0,.25); }

/* pastas por tema (substituem as ilhas) */
#worlds { flex-direction: column; gap: 4px; background: none; }
.folders { flex: 1; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 14px; padding: 4px 6px 56px; }
.folder { position: relative; margin-top: 46px; background: rgba(255,255,255,.5); border: 6px solid var(--c); border-radius: 0 26px 26px 26px; padding: 14px 10px 10px; box-shadow: 0 6px 0 rgba(0,0,0,.16); }
.folder .tab { position: absolute; left: -6px; top: -52px; height: 46px; padding: 0 22px 0 14px; display: flex; align-items: center; gap: 8px; background: var(--c); color: #fff; border-radius: 22px 22px 0 0; font-weight: 900; font-size: clamp(18px, 3.8vmin, 28px); text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.folder .tab .emo { font-size: 1.3em; }
.folder .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 20vw, 240px), 1fr)); gap: 8px; }
.folder .card { --c: rgba(0,0,0,.1); }

/* botão voltar flutuando sozinho (sem barra atrás), o conteúdo rola por baixo */
#worlds .back { position: absolute; z-index: 8; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); box-shadow: 0 4px 0 rgba(0,0,0,.25), 0 0 0 3px rgba(255,255,255,.7); }
#worlds .folders { padding-top: 84px; margin-top: -4px; }

/* ===== ilhas flutuantes com cartões em cima (v0.6) ===== */
#worlds { padding: 0; overflow: hidden; }
#worlds .cloud { z-index: 1; } #worlds .cloud.c1 { top: 8vmin; } #worlds .cloud.c2 { top: 62vmin; animation-delay: -9s; }
.islands { position: absolute; inset: 0; display: flex; align-items: center; gap: 1vw; padding: 0 4vw; overflow-x: auto; overflow-y: hidden; touch-action: pan-x; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; z-index: 2; }
.islands::-webkit-scrollbar { display: none; }
.isl { position: relative; flex: none; width: min(46vw, 78vh); scroll-snap-align: center; border: 0; background: none; padding: 0; cursor: pointer; animation: bob 5s ease-in-out infinite; animation-delay: var(--d, 0s); }
.isl::before { content: ''; display: block; padding-bottom: 98%; }
.isl:active { transform: scale(.97); animation: none; }
.isl-rock { position: absolute; left: 6%; right: 6%; top: 44%; bottom: 0; background: linear-gradient(180deg, #9a7650, #6e513b 55%, #4b3b32); clip-path: polygon(0 0, 100% 0, 91% 36%, 75% 68%, 53% 100%, 31% 70%, 13% 38%); }
.isl-grass { position: absolute; left: 0; right: 0; top: 16%; height: 50%; border-radius: 50%; background: radial-gradient(ellipse at 50% 28%, var(--t), var(--t2)); box-shadow: inset 0 -16px 0 rgba(0,0,0,.14), 0 8px 0 rgba(0,0,0,.1); }
.isl-deco { position: absolute; z-index: 2; font-size: clamp(34px, 8.5vw, 84px); line-height: 1; top: 20%; filter: drop-shadow(0 4px 0 rgba(0,0,0,.2)); }
.isl-deco.l { left: -1%; } .isl-deco.r { right: -1%; top: 24%; }
.mini { position: absolute; width: 31%; height: 25%; background: #fff; border: 3px solid #5a4036; border-radius: 10px; box-shadow: 0 5px 0 rgba(0,0,0,.28); overflow: hidden; transform: rotate(var(--r, 0deg)); }
.mini img { width: 100%; height: 100%; display: block; object-fit: cover; }
.isl-name { position: absolute; z-index: 12; left: 22%; right: 22%; top: 74%; padding: 4px 10px; border-radius: 999px; background: var(--c); color: #fff; font-weight: 900; font-size: clamp(16px, 3.4vmin, 26px); text-shadow: 0 2px 0 rgba(0,0,0,.3); border: 3px solid #fff; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
#gallery { padding: 0; flex-direction: column; background: none; }
#gallery .grid { position: absolute; inset: 0; padding: 86px 12px 56px; grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 22vw, 270px), 1fr)); }
#gallery .back { position: absolute; z-index: 8; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); box-shadow: 0 4px 0 rgba(0,0,0,.25), 0 0 0 3px rgba(255,255,255,.7); }
.gal-title { position: absolute; z-index: 8; top: max(10px, env(safe-area-inset-top)); left: calc(max(10px, env(safe-area-inset-left)) + 80px); height: 64px; padding: 0 24px; display: flex; align-items: center; border-radius: 32px; background: var(--c, #4cc15f); border: 4px solid #fff; color: #fff; font-weight: 900; font-size: clamp(20px, 4.4vmin, 32px); text-shadow: 0 2px 0 rgba(0,0,0,.3); box-shadow: 0 4px 0 rgba(0,0,0,.22); }
.isl .isl-name { bottom: auto; width: 56%; left: 22%; right: auto; top: 73%; text-align: center; line-height: 1.25; }

/* ===== arte gerada (ilhas e cartões) ===== */
.isl { background: var(--img) center bottom / contain no-repeat; }
.isl::before { padding-bottom: 87%; }
.isl-name { top: 71%; }
.mini { width: 27%; height: 24%; background: url(img/cartao-simples.webp) center / 100% 100% no-repeat; border: 0; border-radius: 0; box-shadow: none; overflow: visible; filter: drop-shadow(0 5px 2px rgba(0,0,0,.28)); }
.mini img { position: absolute; left: 4%; top: 4%; width: 92%; height: 90%; border-radius: 8px; object-fit: cover; }
.card, .folder .card { position: relative; width: 100%; height: 0; margin: 0; padding: 0 0 79% 0; border: 0; border-radius: 0; box-shadow: none; overflow: visible; background: var(--cb, url(img/cartao-simples.webp)) center / 100% 100% no-repeat; filter: drop-shadow(0 6px 3px rgba(0,0,0,.25)); box-sizing: content-box; }
.card img { position: absolute; left: 9%; top: 9%; width: 82%; height: 80%; border-radius: 10px; object-fit: cover; }
.card.k0 { --cb: url(img/cartao-verde.webp); } .card.k1 { --cb: url(img/cartao-azul.webp); } .card.k2 { --cb: url(img/cartao-laranja.webp); }
.card.k3 { --cb: url(img/cartao-amarelo.webp); } .card.k4 { --cb: url(img/cartao-vermelho.webp); } .card.k5 { --cb: url(img/cartao-turquesa.webp); }
.card:active { transform: scale(.95); }
#gallery .grid { gap: 18px 16px; }

.isl { width: min(54vw, 100vh); }
.mini { width: 26%; height: 23%; }
.isl .isl-name { top: 76%; width: 52%; left: 24%; }
#gallery .grid { grid-template-columns: repeat(auto-fill, minmax(clamp(210px, 27vw, 320px), 1fr)); }

/* botões principais: barra lateral vertical fixa à direita (v2b); o desenho fica depois dela */
[data-layout="b"] #editor { flex-direction: row; }
[data-layout="b"] .bar { order: 0; }
[data-layout="b"] .area { order: 1; }
[data-layout="b"] .floater { order: 2; position: static; flex: none; flex-direction: column; justify-content: flex-start; gap: 8px; padding: 7px; border-radius: 0; width: calc(var(--btn) + 22px); height: 100%; overflow-y: auto; scrollbar-width: none; touch-action: pan-y; background: linear-gradient(270deg, #38a6ff, #6c5cff); box-shadow: -4px 0 14px rgba(0,0,0,.22); }
[data-layout="b"] .floater::-webkit-scrollbar { display: none; }
#cursor .tip { font-size: 64px; }

.btn.exit svg { width: 36px; height: 36px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }

/* dentro do app Android a tela já é cheia: sem botão de tela cheia */
.native .fsb { display: none !important; }

/* ===== versão grátis x paga: cadeados e área dos pais ===== */
.card.locked { filter: grayscale(.55) brightness(.92) drop-shadow(0 6px 3px rgba(0,0,0,.25)); }
.card.locked img { opacity: .55; }
.lockbadge { position: absolute; right: 6%; bottom: 8%; width: clamp(34px, 7vmin, 58px); height: clamp(34px, 7vmin, 58px); border-radius: 50%; background: #ffd60a; border: 4px solid #fff; box-shadow: 0 3px 0 rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; font-size: clamp(16px, 3.4vmin, 28px); line-height: 1; z-index: 20; }
.isl.locked { filter: saturate(.55) brightness(.94); }
.lockbadge.isl-lock { right: 8%; bottom: auto; top: 12%; width: clamp(54px, 13vmin, 110px); height: clamp(54px, 13vmin, 110px); font-size: clamp(26px, 6.4vmin, 54px); }

.gate { position: fixed; inset: 0; z-index: 80; background: rgba(20, 40, 90, .72); display: flex; align-items: center; justify-content: center; padding: 16px; touch-action: none; }
.gate-card { position: relative; width: min(94vw, 560px); max-height: 94vh; overflow: auto; background: #fff; border-radius: 28px; border: 8px solid #ffd60a; padding: 22px 22px 20px; text-align: center; box-shadow: 0 10px 0 rgba(0,0,0,.25); }
.gate-x { position: absolute; top: 8px; right: 8px; width: 56px; height: 56px; min-width: 56px; background: linear-gradient(160deg, #ff9a8a, #ff4d6d); }
.gate-x svg { width: 28px; height: 28px; }
.gate-lock { font-size: 54px; line-height: 1; }
.gate-h { font-weight: 900; font-size: clamp(24px, 5vmin, 34px); color: #1b3a63; margin: 4px 0; }
.gate-p { color: #4f6785; font-size: 17px; }
.gate-q { font-weight: 900; font-size: clamp(30px, 7vmin, 46px); color: #1e88ff; margin: 8px 0 4px; }
.gate-ans { min-height: 56px; border: 4px solid #cfe4ff; border-radius: 16px; font-weight: 900; font-size: 36px; line-height: 48px; color: #1b3a63; width: 160px; margin: 0 auto 10px; }
.keys { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; justify-content: center; }
.key { font-size: 28px; font-weight: 900; color: #1b3a63; }
.gate-step.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.gate-list { text-align: left; color: #1b3a63; font-size: 18px; line-height: 1.5; margin: 10px auto; padding-left: 26px; max-width: 420px; }
.gate-price { font-weight: 900; font-size: 44px; color: #1e9e4a; margin: 6px 0 2px; }
.buy { display: block; width: 100%; max-width: 420px; margin: 10px auto 6px; min-height: 64px; border: 0; border-radius: 22px; background: linear-gradient(160deg, #34c759, #1e9e4a); color: #fff; font-weight: 900; font-size: 22px; box-shadow: 0 5px 0 rgba(0,0,0,.25); cursor: pointer; }
.buy:active { transform: scale(.97); }
.restore { background: none; border: 0; color: #1e88ff; font-weight: 700; font-size: 16px; padding: 12px; cursor: pointer; text-decoration: underline; }
.gate-msg { min-height: 22px; color: #c0392b; font-weight: 700; margin-top: 4px; }

/* celular deitado: a tela dos pais em duas colunas, sem cortar */
@media (max-height: 560px) {
  .gate-card { width: min(96vw, 820px); padding: 12px 84px 12px 18px; border-width: 6px; }
  .gate-step { display: flex; align-items: center; justify-content: center; gap: 22px; }
  .gate-left { flex: 1; min-width: 0; }
  .gate-right { flex: 1; min-width: 0; }
  .gate-lock { font-size: 34px; }
  .gate-h { font-size: 24px; margin: 0; }
  .gate-p { font-size: 15px; }
  .gate-q { font-size: 30px; margin: 4px 0; }
  .gate-ans { min-height: 48px; line-height: 40px; font-size: 30px; width: 150px; margin: 0 auto; }
  .keys { gap: 6px; grid-template-columns: repeat(4, 64px); }
  .gate-list { font-size: 15px; margin: 6px auto; }
  .gate-price { font-size: 34px; margin: 0; }
  .buy { min-height: 56px; font-size: 19px; margin: 8px auto 2px; }
  .gate-x { top: 4px; right: 4px; }
}

/* a área da câmera (recorte da tela) é ocupada pelas barras de ferramentas: sem faixa vazia nas laterais */
#editor { padding-left: 0; padding-right: 0; }
[data-layout="b"] .bar { padding-left: env(safe-area-inset-left); }
[data-layout="b"] .floater { width: calc(var(--btn) + 22px + env(safe-area-inset-right)); padding-right: calc(7px + env(safe-area-inset-right)); }

.btn.save { background: linear-gradient(160deg, #5be07f, #1e9e4a); }
.btn.save svg { width: 36px; height: 36px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }

/* cadeado grande com correntes (arte gerada) trancando o desenho/ilha */
.lockbadge { position: absolute; inset: 6% 4%; width: auto; height: auto; border: 0; border-radius: 0; box-shadow: none; background: url(img/cadeado.webp) center / contain no-repeat; font-size: 0; z-index: 20; pointer-events: none; filter: drop-shadow(0 6px 4px rgba(0,0,0,.35)); }
.lockbadge.isl-lock { inset: auto; left: 14%; right: 14%; top: 10%; bottom: auto; height: 66%; }

.lockbadge { inset: 0; background-size: cover; }
.lockbadge.isl-lock { inset: auto; left: 6%; right: 6%; top: 10%; height: 68%; }
.lockbadge.isl-lock { width: auto; }
.isl.locked { filter: none; }
.lockbadge.isl-lock { -webkit-mask-image: radial-gradient(ellipse 52% 56% at 50% 50%, #000 62%, transparent 100%); mask-image: radial-gradient(ellipse 52% 56% at 50% 50%, #000 62%, transparent 100%); }

/* logo pequeno do canal, sempre no canto direito */
.marca { position: fixed; right: max(8px, env(safe-area-inset-right)); bottom: max(6px, env(safe-area-inset-bottom)); width: clamp(44px, 9vmin, 70px); height: auto; z-index: 41; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.ver { right: calc(max(8px, env(safe-area-inset-right)) + clamp(44px, 9vmin, 70px) + 8px); }
[data-layout="b"] .floater { padding-bottom: calc(clamp(44px, 9vmin, 70px) + 14px); }

/* cores brilhantes (purpurina) */
.sw.glit { background:
  radial-gradient(circle at 24% 28%, #fff 0 2px, transparent 3px), radial-gradient(circle at 70% 24%, #fff 0 1.6px, transparent 2.6px),
  radial-gradient(circle at 52% 56%, #fffc 0 2.4px, transparent 3.4px), radial-gradient(circle at 28% 74%, #fff 0 1.6px, transparent 2.6px),
  radial-gradient(circle at 76% 72%, #fff 0 2px, transparent 3px), linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff) 60%, var(--c)); background-size: 100% 100%; animation: glint 2.2s ease-in-out infinite; }
@keyframes glint { 50% { filter: brightness(1.18) saturate(1.15); } }
/* cadeado simples, menor, no meio (dá para ver o desenho atrás) */
.lockbadge { inset: auto; left: 50%; top: 50%; width: 30%; height: 54%; transform: translate(-50%, -50%); background-size: contain; background-position: center; background-repeat: no-repeat; -webkit-mask-image: none; mask-image: none; }
.lockbadge.isl-lock { left: 50%; top: 40%; right: auto; bottom: auto; width: 17%; height: 36%; transform: translate(-50%, -50%); -webkit-mask-image: none; mask-image: none; }

/* abertura (splash) */
.splash-logo { position: relative; z-index: 2; width: min(46vmin, 320px); height: auto; filter: drop-shadow(0 8px 6px rgba(0,0,0,.25)); animation: pulse 2.2s ease-in-out infinite; }
.card img { border-radius: 14% / 18%; }
.mini img { border-radius: 12% / 16%; }
.card img, .mini img { object-fit: contain; background: #fff; }
/* botões da direita: mesmo tamanho dos da esquerda; se faltar espaço, rola (não encolhem) */
.floater > * { flex: none; }
[data-layout="b"] .floater { overflow-y: auto; -webkit-overflow-scrolling: touch; align-items: center; }
[data-layout="b"] .floater .btn { width: var(--btn); height: var(--btn); min-width: var(--btn); min-height: var(--btn); }
/* iPhone/iPad: o gesto "deslizar de baixo para cima" volta ao início e o app não consegue bloquear.
   Por isso o desenho não encosta na borda de baixo: sobra uma faixa livre para o dedo da criança. */
#area { margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); }
