:root {
  --fundo: #f3f6ff;
  --tinta: #0f172a;
  --tinta-2: #475569;
  --tinta-3: #94a3b8;
  --linha: #e2e8f0;
  --cartao: #ffffff;
  --primario: #4f46e5;
  --primario-esc: #3730a3;
  --verde: #22c55e;
  --vermelho: #ef4444;
  --amarelo: #facc15;
  --raio: 18px;
  --sombra: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --topo: 64px;
  --t-basico: #22c55e;
  --t-intermediario: #3b82f6;
  --t-avancado: #f97316;
  --t-expert: #a855f7;
  --t-chefao: #e11d48;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Nunito', system-ui, 'Segoe UI', sans-serif;
  color: var(--tinta);
  background:
    radial-gradient(1200px 600px at 10% -10%, #e0e7ff 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #fce7f3 0%, transparent 55%),
    var(--fundo);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
code, pre, textarea, input { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
code, pre { font-family: var(--mono); }

/* ---------- Topo ---------- */
.topo {
  position: sticky; top: 0; z-index: 20; height: var(--topo);
  display: flex; align-items: center; gap: 24px; padding: 0 24px;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--linha);
}
.marca { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 20px; letter-spacing: -.02em; }
.marca-logo {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #ec4899); color: #fff; font-family: var(--mono); font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 0 #3730a3;
}
.abas { display: flex; gap: 4px; }
.abas a { padding: 8px 14px; border-radius: 12px; font-weight: 800; color: var(--tinta-2); }
.abas a:hover { background: #eef2ff; color: var(--primario); }
.abas a.ativa { background: #eef2ff; color: var(--primario); }
.status { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.st-nivel { display: flex; align-items: center; gap: 8px; }
.st-badge {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #6366f1); color: #fff; font-weight: 900; box-shadow: 0 3px 0 #4c1d95;
}
.st-xp { display: flex; flex-direction: column; gap: 3px; min-width: 96px; }
.st-xp small { font-weight: 800; color: var(--tinta-2); font-size: 12px; }
.st-moedas { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fef9c3; color: #854d0e; font-weight: 900; }
.st-moedas .ic { color: #ca8a04; }
.st-avatar .avatar { display: block; border-radius: 50%; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--linha); }

.barra-prog { position: relative; height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.barra-prog > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, var(--cor, #6366f1), color-mix(in srgb, var(--cor, #6366f1) 60%, #fff)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.barra-prog.fina { height: 6px; }
.barra-prog.grossa { height: 14px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 14px; border: 2px solid var(--linha); background: #fff;
  font-weight: 800; cursor: pointer; transition: transform .08s, box-shadow .08s, background .15s;
  box-shadow: 0 3px 0 var(--linha); white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--linha); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--primario); border-color: var(--primario); color: #fff; box-shadow: 0 4px 0 var(--primario-esc); }
.btn-primario:active:not(:disabled) { box-shadow: 0 1px 0 var(--primario-esc); }
.btn-claro { background: #fff; }
.btn-grande { padding: 14px 22px; font-size: 17px; border-radius: 16px; }
.btn-moeda { background: #fef08a; border-color: #facc15; color: #713f12; box-shadow: 0 3px 0 #ca8a04; }
.btn-usando { background: #dcfce7; border-color: #86efac; color: #166534; box-shadow: 0 3px 0 #86efac; }
.btn-perigo { color: #b91c1c; border-color: #fecaca; box-shadow: 0 3px 0 #fecaca; }
.btn-perigo:hover { background: #fef2f2; }
.voltar { display: inline-flex; align-items: center; gap: 4px; color: var(--tinta-2); font-weight: 800; }
.voltar:hover { color: var(--primario); }

.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 900; letter-spacing: .02em; border: 2px solid currentColor; background: #fff; }
.tier-basico .chip, .chip.tier-basico { color: var(--t-basico); }
.chip.tier-intermediario { color: var(--t-intermediario); }
.chip.tier-avancado { color: var(--t-avancado); }
.chip.tier-expert { color: var(--t-expert); }
.chip.tier-chefao { color: var(--t-chefao); }

.estrelas { display: inline-flex; gap: 2px; }
.estrelas span { color: #cbd5e1; }
.estrelas span.on { color: #f59e0b; }
.estrelas span.on .ic { fill: #fbbf24; }

/* ---------- Mapa ---------- */
main { padding: 24px; max-width: 1600px; margin: 0 auto; }
.painel-topo { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 20px; }
.boas-vindas {
  display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-radius: 24px;
  background: linear-gradient(120deg, #4f46e5, #7c3aed 55%, #db2777); color: #fff; box-shadow: var(--sombra);
}
.boas-vindas h1 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.boas-vindas p { margin: 4px 0 0; opacity: .92; }
.boas-vindas .btn { margin-left: auto; background: #fff; color: var(--primario); border-color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .18); }
.bv-avatar .avatar { display: block; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255, 255, 255, .5); }
.cartoes-stat { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); }
.stat b { font-size: 20px; font-weight: 900; display: block; line-height: 1.1; }
.stat small { color: var(--tinta-2); font-weight: 700; }
.stat-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; }
.stat-ic .ic { width: 22px; height: 22px; }
.cor-roxo { background: #f3e8ff; color: #9333ea; }
.cor-amarelo { background: #fef9c3; color: #ca8a04; }
.cor-laranja { background: #ffedd5; color: #ea580c; }
.cor-verde { background: #dcfce7; color: #16a34a; }
.cor-azul { background: #dbeafe; color: #2563eb; }

.mapa {
  position: relative; height: clamp(440px, calc(100vh - var(--topo) - 250px), 760px); border-radius: 28px; overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 110%, #bbf7d0 0 22%, transparent 23%),
    radial-gradient(ellipse at 75% 115%, #bfdbfe 0 25%, transparent 26%),
    linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 55%, #ecfeff 100%);
  box-shadow: var(--sombra), inset 0 0 0 1px rgba(255, 255, 255, .8);
}
.mapa-trilha { position: absolute; inset: 0; width: 100%; height: 100%; }
.trilha-base { fill: none; stroke: #fff; stroke-width: 14; stroke-linecap: round; opacity: .9; }
.trilha-tracejado { fill: none; stroke: #a5b4fc; stroke-width: 4; stroke-dasharray: 2 14; stroke-linecap: round; animation: tracejado 30s linear infinite; }
@keyframes tracejado { to { stroke-dashoffset: -400; } }
.nuvem { position: absolute; background: #fff; border-radius: 999px; opacity: .8; filter: blur(.5px); animation: nuvem 40s linear infinite; }
.nuvem::before, .nuvem::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.nuvem.n1 { width: 120px; height: 34px; top: 10%; left: 40%; }
.nuvem.n1::before { width: 56px; height: 56px; top: -26px; left: 20px; }
.nuvem.n1::after { width: 40px; height: 40px; top: -16px; left: 64px; }
.nuvem.n2 { width: 90px; height: 26px; top: 50%; left: 6%; animation-duration: 55s; }
.nuvem.n2::before { width: 40px; height: 40px; top: -20px; left: 16px; }
.nuvem.n3 { width: 140px; height: 36px; top: 82%; left: 58%; animation-duration: 70s; }
.nuvem.n3::before { width: 60px; height: 60px; top: -30px; left: 40px; }
@keyframes nuvem { 0% { transform: translateX(0); } 50% { transform: translateX(60px); } 100% { transform: translateX(0); } }

.ilha { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 2; }
.ilha-disco {
  position: relative; display: grid; place-items: center; width: clamp(80px, 9vw, 124px); aspect-ratio: 1; border-radius: 34%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--cor) 70%, #fff), var(--cor));
  box-shadow: 0 8px 0 color-mix(in srgb, var(--cor) 70%, #000), 0 18px 30px rgba(15, 23, 42, .18);
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
  animation: flutuar 5s ease-in-out infinite;
}
.ilha:nth-of-type(2n) .ilha-disco { animation-delay: -2.5s; }
@keyframes flutuar { 50% { translate: 0 -6px; } }
.ilha:hover .ilha-disco { transform: scale(1.08) rotate(-3deg); }
.ilha-glifo { color: #fff; font-family: var(--mono); font-weight: 700; font-size: clamp(20px, 2.2vw, 30px); text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.ilha-rotulo { background: #fff; padding: 6px 12px; border-radius: 12px; text-align: center; box-shadow: var(--sombra); }
.ilha-rotulo b { display: block; font-size: 14px; font-weight: 900; white-space: nowrap; }
.ilha-rotulo small { color: var(--tinta-2); font-weight: 700; font-size: 12px; }
.ilha.trancada .ilha-disco { filter: grayscale(1) opacity(.55); animation: none; }
.ilha.trancada { cursor: not-allowed; }
.ilha-cadeado { position: absolute; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #fff; color: var(--tinta-2); bottom: -10px; right: -10px; box-shadow: var(--sombra); }
.ilha-coroa { position: absolute; top: -18px; color: #f59e0b; }
.ilha-coroa .ic { width: 32px; height: 32px; fill: #fde047; }

/* ---------- Mundo ---------- */
.mundo-tela { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.mundo-lado { position: sticky; top: calc(var(--topo) + 24px); background: #fff; border-radius: 24px; padding: 22px; box-shadow: var(--sombra); display: flex; flex-direction: column; gap: 10px; }
.mundo-selo { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 28px; background: var(--cor); box-shadow: 0 6px 0 color-mix(in srgb, var(--cor) 70%, #000); margin-top: 8px; }
.mundo-selo span { color: #fff; font-family: var(--mono); font-weight: 700; font-size: 26px; }
.mundo-lado h1 { margin: 6px 0 0; font-size: 28px; font-weight: 900; letter-spacing: -.02em; }
.mundo-sub { margin: 0; color: var(--tinta-2); font-weight: 700; }
.mundo-num { margin: 0; color: var(--tinta-2); font-weight: 700; font-size: 14px; }
.mundo-lado .barra-prog { --cor: var(--cor); }
.legenda { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; font-weight: 700; color: var(--tinta-2); font-size: 14px; }
.legenda li { display: flex; align-items: center; gap: 8px; }
.mundo-dica { font-size: 13px; color: var(--tinta-2); background: #f8fafc; padding: 10px 12px; border-radius: 12px; margin: 0; }
.mundo-completo { display: flex; align-items: center; gap: 8px; font-weight: 900; color: #16a34a; }
.trilha-fases { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 20px 0 60px; background: radial-gradient(circle at 50% 0, color-mix(in srgb, var(--cor) 12%, transparent), transparent 70%); border-radius: 28px; }
.no { display: flex; align-items: center; gap: 14px; transform: translateX(var(--x)); width: 420px; }
.no-disco {
  display: grid; place-items: center; width: 74px; height: 74px; border-radius: 50%; flex: none;
  background: #fff; border: 4px solid var(--cor); color: var(--cor); font-weight: 900; font-size: 26px;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--cor) 75%, #000); transition: transform .15s;
}
.no-disco .ic { width: 30px; height: 30px; }
.no:hover .no-disco { transform: translateY(-3px) scale(1.05); }
.no.feito .no-disco { background: var(--cor); color: #fff; }
.no.trancado .no-disco { border-color: #cbd5e1; color: #94a3b8; box-shadow: 0 6px 0 #cbd5e1; background: #f1f5f9; }
.no.trancado { cursor: not-allowed; }
.no.chefe .no-disco { width: 96px; height: 96px; border-color: var(--t-chefao); color: var(--t-chefao); box-shadow: 0 7px 0 #9f1239; }
.no.chefe.feito .no-disco { background: var(--t-chefao); color: #fde047; }
.no.chefe .no-disco .ic { width: 40px; height: 40px; }
.no-rotulo { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; background: #fff; padding: 8px 12px; border-radius: 14px; box-shadow: var(--sombra); }
.no-rotulo b { font-weight: 900; }
.no.trancado .no-rotulo { opacity: .6; }

/* ---------- Fase ---------- */
body[data-rota="fase"] main { max-width: none; padding: 16px; }
.fase-tela { display: grid; grid-template-columns: minmax(320px, 30%) 1fr; gap: 16px; height: calc(100vh - var(--topo) - 32px); min-height: 560px; }
.fase-info { background: #fff; border-radius: 22px; padding: 18px 20px; box-shadow: var(--sombra); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; border-top: 6px solid var(--cor); }
.fase-nav { display: flex; justify-content: space-between; align-items: center; }
.fase-pos { font-weight: 800; color: var(--tinta-3); font-size: 14px; }
.fase-cab { display: flex; align-items: center; gap: 10px; }
.fase-info h1 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.teoria { color: #1e293b; line-height: 1.55; }
.teoria p { margin: 0 0 10px; }
.teoria ul { margin: 0 0 10px; padding-left: 20px; }
.teoria li { margin: 4px 0; }
.teoria code, .dica-caixa code { background: #f1f5f9; padding: 1px 6px; border-radius: 6px; font-size: .88em; color: #be185d; }
.cod { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.55; overflow-x: auto; margin: 0 0 10px; white-space: pre; }
.missao { background: color-mix(in srgb, var(--cor) 10%, #fff); border: 2px solid color-mix(in srgb, var(--cor) 45%, #fff); border-radius: 16px; padding: 12px 14px; }
.missao-tit { display: flex; align-items: center; gap: 6px; font-weight: 900; color: color-mix(in srgb, var(--cor) 70%, #000); text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.missao p { margin: 6px 0 0; font-weight: 800; font-size: 16px; }
.ajuda { display: flex; gap: 8px; flex-wrap: wrap; }
.dica-caixa { display: flex; gap: 8px; align-items: flex-start; background: #fefce8; border: 2px solid #fde68a; color: #713f12; padding: 10px 12px; border-radius: 14px; font-weight: 700; }
.dica-caixa[hidden] { display: none; }
.fase-setas { margin-top: auto; display: flex; justify-content: space-between; padding-top: 8px; }

.trabalho { display: grid; grid-template-columns: 1.15fr 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: "barra barra" "editor saida" "editor testes"; gap: 12px; min-height: 0; }
.trabalho.so-editor { grid-template-columns: 1fr; grid-template-areas: "barra" "editor" "testes"; grid-template-rows: auto 1fr auto; }
.barra-acoes { grid-area: barra; display: flex; align-items: center; gap: 10px; }
.atalho { margin-left: auto; color: var(--tinta-3); font-weight: 700; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.painel { background: #fff; border-radius: 18px; box-shadow: var(--sombra); min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.painel-editor { grid-area: editor; }
.painel-saida { grid-area: saida; }
.painel-testes { grid-area: testes; max-height: 38vh; }
.painel-tit { padding: 10px 14px; font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--tinta-2); border-bottom: 1px solid var(--linha); }
.palco { flex: 1; min-height: 0; overflow: auto; position: relative; }
.testes { overflow: auto; padding: 10px 12px; }
.vazio { color: var(--tinta-3); font-weight: 700; margin: 6px 4px; }
.lista-testes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lista-testes li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; font-weight: 700; }
.lista-testes li .ic { margin-top: 2px; }
.lista-testes li.pend { background: #f8fafc; color: var(--tinta-2); }
.lista-testes li.ok { background: #f0fdf4; color: #166534; }
.lista-testes li.ok .ic { color: #16a34a; }
.lista-testes li.falhou { background: #fef2f2; color: #991b1b; }
.lista-testes li.falhou .ic { color: #dc2626; }
.erro-caixa { background: #fef2f2; border: 2px solid #fecaca; color: #991b1b; padding: 10px 12px; border-radius: 12px; font-family: var(--mono); font-size: 13px; margin-bottom: 8px; white-space: pre-wrap; }
.tremer { animation: tremer .35s; }
@keyframes tremer { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Editor de código */
.editor { display: flex; flex: 1; min-height: 0; background: #0f172a; height: 100%; }
.editor-gutter { padding: 14px 10px 14px 14px; text-align: right; color: #475569; font-family: var(--mono); font-size: 14px; line-height: 1.6; white-space: pre; overflow: hidden; user-select: none; min-width: 46px; }
.editor-area { flex: 1; border: 0; outline: 0; resize: none; padding: 14px 14px 14px 6px; background: transparent; color: #e2e8f0; font-family: var(--mono); font-size: 14px; line-height: 1.6; tab-size: 2; caret-color: #facc15; white-space: pre; overflow: auto; }
.editor[data-ling="python"] .editor-area { tab-size: 4; }
.editor-area::selection { background: #334155; }

/* Console */
.console { padding: 12px 14px; font-family: var(--mono); font-size: 14px; line-height: 1.6; }
.cons-linha { white-space: pre-wrap; border-bottom: 1px dashed #f1f5f9; }
.cons-vazio { color: var(--tinta-3); }
.cons-erro { margin-top: 8px; padding: 10px 12px; background: #fef2f2; color: #b91c1c; border-radius: 10px; white-space: pre-wrap; }
.carregando { display: flex; align-items: center; gap: 10px; padding: 16px; color: var(--tinta-2); font-weight: 700; }
.girando { display: inline-block; width: 16px; height: 16px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: girar .7s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Prévia HTML */
.previa { width: 100%; height: 100%; border: 0; background: #fff; display: block; }

/* Tabela SQL */
.esquema { margin: 10px 12px; padding: 8px 12px; background: #f5f3ff; border-radius: 12px; font-size: 13px; color: #4c1d95; }
.esquema summary { font-weight: 900; cursor: pointer; }
.esquema div { margin-top: 4px; font-family: var(--mono); }
.esquema .esq-dica { font-family: inherit; color: #6d28d9; }
.tabela-wrap { overflow: auto; margin: 0 12px; border-radius: 12px; border: 1px solid var(--linha); }
.tabela { border-collapse: collapse; width: 100%; font-size: 14px; }
.tabela th { background: #f1f5f9; text-align: left; padding: 8px 12px; font-weight: 900; border-bottom: 1px solid var(--linha); position: sticky; top: 0; }
.tabela td { padding: 7px 12px; border-bottom: 1px solid #f1f5f9; font-family: var(--mono); font-size: 13px; }
.tabela tr:nth-child(even) td { background: #fafbff; }
.tabela-info { color: var(--tinta-3); font-weight: 700; font-size: 13px; margin: 6px 14px 12px; }

/* Blocos */
.blocos { display: grid; grid-template-columns: 220px 1fr; height: 100%; min-height: 0; }
.paleta { background: #f8fafc; border-right: 1px solid var(--linha); padding: 12px; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.paleta-tit, .programa-tit { font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--tinta-2); display: flex; justify-content: space-between; }
.paleta-lista { display: flex; flex-direction: column; gap: 8px; }
.paleta-dica { font-size: 12px; color: var(--tinta-3); font-weight: 700; margin: 4px 0 0; }
.bloco-pal { text-align: left; border: 0; border-radius: 12px; padding: 10px 12px; color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.bloco-pal:hover { filter: brightness(1.08); }
.bloco-pal:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.t-frente { --b: #3b82f6; } .t-esquerda, .t-direita { --b: #8b5cf6; } .t-repetir { --b: #f97316; } .t-enquanto { --b: #e11d48; } .t-se { --b: #0d9488; }
.bloco-pal { background: var(--b); }
.programa { padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.contador { color: var(--tinta-2); text-transform: none; letter-spacing: 0; }
.contador.estourou { color: var(--vermelho); }
.slot { border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 6px; border: 2px dashed transparent; min-height: 40px; cursor: pointer; }
.slot.ativo { border-color: #a5b4fc; background: #eef2ff; }
.slot-rotulo { font-size: 12px; font-weight: 900; color: var(--tinta-2); }
.slot-vazio { color: var(--tinta-3); font-weight: 700; font-size: 13px; padding: 4px 6px; }
.bloco { background: var(--b); border-radius: 12px; padding: 6px; color: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, .18); cursor: default; }
.bloco .slot { background: rgba(255, 255, 255, .92); color: var(--tinta); }
.bloco .slot.ativo { background: #eef2ff; }
.bloco-cab { display: flex; align-items: center; gap: 8px; font-weight: 800; padding: 2px 4px; }
.bloco-cab input, .bloco-cab select { border: 0; border-radius: 8px; padding: 2px 6px; font-weight: 800; color: var(--tinta); }
.bloco-cab input { width: 56px; }
.bloco-acoes { margin-left: auto; display: flex; gap: 2px; }
.bloco-acoes button { border: 0; background: rgba(255, 255, 255, .2); color: #fff; border-radius: 8px; width: 26px; height: 26px; display: grid; place-items: center; cursor: pointer; }
.bloco-acoes button:hover { background: rgba(255, 255, 255, .35); }
.bloco-acoes .ic { width: 15px; height: 15px; }
.lang-blocos .palco { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; background: #f0fdf4; }
.grade { position: relative; display: grid; width: min(100%, 560px); max-height: 100%; border-radius: 16px; overflow: hidden; box-shadow: 0 6px 0 #15803d; }
.celula { display: grid; place-items: center; }
.celula.chao { background: #dcfce7; }
.celula.chao.alt { background: #d1fae5; }
.celula.parede { background: #166534; background-image: linear-gradient(135deg, rgba(255, 255, 255, .06) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .06) 50%, rgba(255, 255, 255, .06) 75%, transparent 75%); background-size: 12px 12px; }
.estrela-mapa { width: 70%; height: 70%; animation: brilho 1.6s ease-in-out infinite; }
@keyframes brilho { 50% { transform: scale(1.12) rotate(8deg); } }
.robo-pos { position: absolute; display: grid; place-items: center; transition: left .18s, top .18s, transform .18s; }
.robo { width: 82%; height: 82%; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .25)); }
.robo-pos.bateu { animation: tremer .35s; }
.robo-pos.bateu .robo rect:first-child { fill: #ef4444; }
.palco-info { margin-top: 10px; font-weight: 800; color: #166534; }

/* Terminal */
.terminal { flex: 1; height: 100%; background: #0b1220; color: #e2e8f0; font-family: var(--mono); font-size: 14px; padding: 14px 16px; overflow: auto; cursor: text; }
.term-out, .term-cmd { margin: 0; white-space: pre-wrap; word-break: break-word; line-height: 1.55; font-family: inherit; }
.term-cmd { color: #a5f3fc; margin-top: 6px; }
.term-out.erro { color: #fca5a5; }
.term-out.dim { color: #64748b; }
.term-linha { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.term-prompt { color: #4ade80; white-space: nowrap; }
.term-input { flex: 1; background: transparent; border: 0; outline: 0; color: #f8fafc; font-family: inherit; font-size: 14px; caret-color: #facc15; }

/* ---------- Loja ---------- */
.loja-tela { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.loja-lado { position: sticky; top: calc(var(--topo) + 24px); background: #fff; border-radius: 24px; padding: 22px; box-shadow: var(--sombra); text-align: center; }
.loja-lado h1 { margin: 0 0 12px; font-weight: 900; }
.loja-avatar .avatar { border-radius: 50%; box-shadow: 0 0 0 6px #eef2ff; }
.saldo { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 10px 18px; border-radius: 999px; background: #fef9c3; color: #854d0e; font-size: 18px; }
.saldo .ic { color: #ca8a04; }
.loja-txt { color: var(--tinta-2); font-weight: 700; font-size: 14px; }
.loja-secao { margin-bottom: 22px; }
.loja-secao h3 { margin: 0 0 10px; font-weight: 900; }
.itens { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.item { background: #fff; border-radius: 18px; padding: 14px; box-shadow: var(--sombra); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; border: 2px solid transparent; }
.item.usando { border-color: #86efac; }
.item .avatar { border-radius: 50%; }
.item b { font-weight: 800; font-size: 14px; }

/* ---------- Medalhas ---------- */
.cab-tela h1 { margin: 0; font-weight: 900; font-size: 30px; }
.cab-tela p { margin: 4px 0 18px; color: var(--tinta-2); font-weight: 700; }
.medalhas { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.medalha { background: #fff; border-radius: 20px; padding: 18px; box-shadow: var(--sombra); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.medalha-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #f1f5f9; color: #94a3b8; }
.medalha-ic .ic { width: 32px; height: 32px; }
.medalha.ganha .medalha-ic { background: linear-gradient(135deg, #fde047, #f59e0b); color: #78350f; box-shadow: 0 4px 0 #b45309; }
.medalha b { font-weight: 900; }
.medalha small { color: var(--tinta-2); font-weight: 700; }
.medalha:not(.ganha) b { color: var(--tinta-2); }
.medalha-data { font-size: 12px; color: var(--tinta-3); font-weight: 800; display: inline-flex; gap: 4px; align-items: center; }

/* ---------- Perfil ---------- */
.perfil-tela { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.perfil-card { background: #fff; border-radius: 24px; padding: 24px; box-shadow: var(--sombra); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.perfil-card .avatar { border-radius: 50%; }
.campo { display: flex; flex-direction: column; gap: 6px; width: 100%; font-weight: 800; font-size: 14px; color: var(--tinta-2); }
.campo input { border: 2px solid var(--linha); border-radius: 12px; padding: 10px 12px; color: var(--tinta); font-weight: 700; }
.campo input:focus { outline: 0; border-color: #a5b4fc; }
.perfil-nivel { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.perfil-nivel small { color: var(--tinta-2); font-weight: 700; }
.perfil-col { display: flex; flex-direction: column; gap: 16px; }
.cartao { background: #fff; border-radius: 22px; padding: 20px 22px; box-shadow: var(--sombra); }
.cartao h2 { margin: 0 0 14px; font-size: 18px; font-weight: 900; }
.cartao-txt { color: var(--tinta-2); font-weight: 700; margin: 0 0 12px; }
.pm { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.pm-glifo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--cor); color: #fff; font-family: var(--mono); font-size: 12px; font-weight: 700; flex: none; }
.pm-txt { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pm small { font-weight: 800; color: var(--tinta-2); }
.linha-botoes { display: flex; gap: 10px; flex-wrap: wrap; }
.chave { display: flex; align-items: center; gap: 14px; padding: 10px 0; cursor: pointer; }
.chave input { position: absolute; opacity: 0; pointer-events: none; }
.chave-trilho { position: relative; width: 50px; height: 28px; border-radius: 999px; background: #cbd5e1; flex: none; transition: background .2s; }
.chave-trilho::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: left .2s; }
.chave input:checked + .chave-trilho { background: var(--verde); }
.chave input:checked + .chave-trilho::after { left: 25px; }
.chave input:focus-visible + .chave-trilho { outline: 3px solid #a5b4fc; outline-offset: 2px; }
.chave b { display: block; }
.chave small { color: var(--tinta-2); font-weight: 700; }

/* ---------- Modal, toast, confete ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-caixa { background: #fff; border-radius: 26px; padding: 26px 28px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(15, 23, 42, .35); animation: surgir .35s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes surgir { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.modal-caixa h2 { margin: 0 0 10px; font-weight: 900; font-size: 26px; }
.modal-caixa p { color: var(--tinta-2); font-weight: 600; line-height: 1.5; }
.modal-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.cod-sol { max-height: 50vh; }
.celebra { text-align: center; }
.celebra h2 { font-size: 34px; }
.celebra-fase { margin: 0; }
.celebra-estrelas { display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; }
.ce { color: #e2e8f0; animation: estrela .5s cubic-bezier(.3, 1.8, .5, 1) both; }
.ce .ic { width: 64px; height: 64px; fill: #f1f5f9; }
.ce:nth-child(2) .ic { width: 80px; height: 80px; }
.ce.on { color: #f59e0b; }
.ce.on .ic { fill: #fbbf24; }
@keyframes estrela { from { transform: scale(0) rotate(-60deg); opacity: 0; } }
.premios { display: flex; justify-content: center; gap: 10px; margin: 14px 0; }
.premio { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; font-weight: 900; font-size: 18px; animation: estrela .5s .6s both; }
.premio.xp { background: #f3e8ff; color: #7e22ce; }
.premio.moeda { background: #fef9c3; color: #854d0e; }
.celebra-dica { font-size: 14px; }
.subiu, .nova-medalha, .novo-mundo { margin: 8px auto 0; padding: 10px 14px; border-radius: 14px; font-weight: 800; display: flex; gap: 8px; align-items: center; justify-content: center; }
.subiu { background: linear-gradient(90deg, #ede9fe, #fce7f3); color: #6b21a8; }
.nova-medalha { background: #fef3c7; color: #92400e; }
.novo-mundo { background: color-mix(in srgb, var(--cor) 15%, #fff); color: color-mix(in srgb, var(--cor) 60%, #000); }
.celebra .modal-acoes { justify-content: center; }
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 700; box-shadow: 0 10px 30px rgba(15, 23, 42, .3); display: flex; gap: 10px; align-items: center; max-width: 380px; animation: surgir .3s; transition: opacity .4s, transform .4s; }
.toast.saindo { opacity: 0; transform: translateY(10px); }
.toast small { display: block; opacity: .75; font-weight: 600; }
.toast-medalha { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #fde047, #f59e0b); color: #78350f; flex: none; }
#confete { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

/* Autoteste */
.at td, .at th { font-size: 13px; }
.at-falha td { background: #fef2f2 !important; color: #991b1b; }

/* ---------- Telas menores ---------- */
@media (max-width: 1100px) {
  .fase-tela { grid-template-columns: 1fr; height: auto; }
  .fase-info { max-height: none; }
  .trabalho { grid-template-columns: 1fr; grid-template-areas: "barra" "editor" "saida" "testes"; grid-template-rows: auto 420px 360px auto; }
  .trabalho.so-editor { grid-template-rows: auto 460px auto; }
  .cartoes-stat { grid-template-columns: repeat(3, 1fr); }
  .mundo-tela, .loja-tela, .perfil-tela { grid-template-columns: 1fr; }
  .mundo-lado, .loja-lado { position: static; }
}
@media (max-width: 720px) {
  .topo { padding: 0 12px; gap: 10px; }
  .marca-nome, .st-xp, .atalho { display: none; }
  .abas a { padding: 8px 8px; font-size: 14px; }
  main { padding: 14px; }
  .boas-vindas { flex-wrap: wrap; }
  .boas-vindas .btn { margin-left: 0; width: 100%; }
  .cartoes-stat { grid-template-columns: repeat(2, 1fr); }
  .mapa { aspect-ratio: auto; height: 760px; }
  .ilha:nth-of-type(1) { left: 25% !important; top: 8% !important; }
  .ilha:nth-of-type(2) { left: 72% !important; top: 23% !important; }
  .ilha:nth-of-type(3) { left: 28% !important; top: 40% !important; }
  .ilha:nth-of-type(4) { left: 72% !important; top: 56% !important; }
  .ilha:nth-of-type(5) { left: 28% !important; top: 72% !important; }
  .ilha:nth-of-type(6) { left: 72% !important; top: 89% !important; }
  .mapa-trilha { display: none; }
  .no { width: 300px; transform: translateX(calc(var(--x) * .4)); }
  .blocos { grid-template-columns: 1fr; }
  .paleta { border-right: 0; border-bottom: 1px solid var(--linha); }
  .paleta-lista { flex-direction: row; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
