/* ============ ATELIÊ ESTELAR — ESTILOS ============
   Desktop/paisagem: layout do jogo de referência (menu com tablet, editor em 2 colunas).
   Celular/retrato: blocos empilhados, personagem no topo, painel embaixo. */
:root {
  --bg: #120c2a; --panel: #1d1a3a; --panel2: #262251; --panel3: #302b62;
  --line: #3d3875; --line2: #5a54a3;
  --text: #eef0ff; --muted: #a7a4d0; --dim: #6f6b9e;
  --acc: #5fd3e0; --acc2: #b98cff; --pink: #ff6fb5; --gold: #ffc93c; --danger: #ff5c7a; --ok: #6ee7a8;
  --r: 10px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --ui: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--ui); font-size: 17px; user-select: none; -webkit-user-select: none; touch-action: manipulation; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { opacity: .45; cursor: default; }
input, textarea, select { font: inherit; font-family: var(--ui); color: var(--text); background: #120f2b; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; user-select: text; -webkit-user-select: text; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--acc); outline-offset: 0; }
h4 { margin: 14px 0 6px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.muted { color: var(--muted); } .small { font-size: .85em; } .hint { color: var(--dim); font-size: .9em; margin: 10px 2px; }
.ico { width: 26px; height: 26px; display: block; }

#app { height: 100%; }
.screen { display: none; height: 100%; }
.screen.active { display: block; }

/* ---------- Fundo e palco ---------- */
.scene-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.scene-bg .bg-svg { width: 100%; height: 100%; display: block; }
.stage { position: relative; overflow: hidden; z-index: 1; min-height: 0; }
.stage-char { position: absolute; inset: 0; transform-origin: 50% 88%; transition: transform .25s; }
.stage-char .rig-svg { width: 100%; height: 100%; display: block; }
/* Profundidade do personagem (rig.js): sem filtros na qualidade baixa */
.low-quality .rig-svg .fx, .low-quality .portrait .fx, .low-quality .thumb .fx { filter: none; }
.low-quality .fxs { display: none; }
.spot { display: none; }

/* ---------- Botões genéricos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 8px; background: var(--panel3); border: 1px solid var(--line2); font-weight: 600; transition: filter .15s, transform .1s; }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn.primary { background: linear-gradient(180deg, #38b8d0, #2a8aa8); border-color: #6fe3f0; }
.btn.danger { background: #4a1f36; border-color: #a23a5e; color: #ffc1d2; }
.btn.on { border-color: var(--acc); color: var(--acc); }
.btn.sm { padding: 5px 10px; font-size: .9em; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn-row .btn { flex: 1; }
.xbtn { width: 38px; height: 38px; border-radius: 8px; background: #2a2656; border: 1px solid var(--line2); font-size: 20px; font-weight: 700; color: #cfd2ff; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 99px; background: var(--panel3); border: 1px solid var(--line); font-size: .92em; white-space: nowrap; }
.chip .ico { width: 16px; height: 16px; }
.chip.on { background: #1f5e6e; border-color: var(--acc); color: #dffbff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { padding: 6px 12px; background: var(--panel2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: #1f5e6e; color: #dffbff; }

/* ============ MENU PRINCIPAL ============ */
.menu { position: relative; height: 100%; display: grid; overflow: hidden;
  grid-template-columns: minmax(170px, 19vw) minmax(0, 1fr) 64px minmax(300px, 34vw);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "card card . tablet" "roster stage icons tablet" "nav nav nav nav";
  gap: 10px; padding: calc(10px + var(--safe-t)) 12px 0; }
.menu > .ui, .menu > .stage { z-index: 2; }
.pcard { grid-area: card; display: flex; align-items: stretch; background: rgba(20, 16, 44, .82); border: 2px solid var(--line2); border-radius: 14px; overflow: hidden; max-width: 780px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.pc-portrait { width: 92px; flex: none; background: linear-gradient(135deg, #ff9df2, #6b4cff); border-right: 2px solid var(--line2); }
.pc-portrait svg, .ro svg, .ed-who svg, .preset svg, .bk svg { width: 100%; height: 100%; display: block; }
.pc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; border-right: 2px solid var(--line2); }
.pc-title { --tc: #6b4cff; padding: 4px 14px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: linear-gradient(90deg, var(--tc), color-mix(in srgb, var(--tc) 40%, #ff6fb5)); text-shadow: 0 1px 3px rgba(0, 0, 0, .5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-name { flex: 1; display: grid; place-items: center; font-size: 1.9em; font-weight: 600; padding: 2px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-lv { width: 140px; flex: none; display: flex; flex-direction: column; justify-content: space-between; padding: 6px 10px; border-right: 2px solid var(--line2); }
.pc-lv small { color: var(--muted); }
.pc-lv b { font-size: 1.8em; text-align: center; line-height: 1; }
.xpbar { height: 12px; background: #0e0b24; border: 1px solid var(--line2); border-radius: 3px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #6b4cff, #b98cff); }
.pc-cur { width: 130px; flex: none; display: flex; flex-direction: column; justify-content: center; }
.pc-cur span { display: flex; align-items: center; gap: 8px; padding: 4px 12px; font-size: 1.6em; font-weight: 600; }
.pc-cur span + span { border-top: 2px solid var(--line2); }
.pc-cur i { font-style: normal; font-size: .8em; }
.pc-cur i.gold { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(#ffe07a, #c58b00); color: #5a3a00; font-weight: 700; font-size: .7em; border: 2px solid #8a5a00; }

.roster { grid-area: roster; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 6px; background: rgba(20, 16, 44, .75); border: 2px solid var(--line2); border-radius: 12px; align-self: start; height: min(100%, 50vw); min-height: 0; }
.ro { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 0; min-width: 0; padding: 3px; border-radius: 6px; border: 2px solid transparent; background: rgba(255, 255, 255, .04); overflow: hidden; }
.ro svg { flex: 1; min-height: 0; }
.ro small { flex: none; font-size: .95em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ro.on { border-color: #cfd2ff; background: rgba(255, 255, 255, .14); }
.menu .stage { grid-area: stage; }
.side-icons { grid-area: icons; display: flex; flex-direction: column; gap: clamp(4px, 1.4vh, 10px); align-self: center; }
.side-icons button { width: clamp(40px, 9vh, 58px); height: clamp(40px, 9vh, 58px); display: grid; place-items: center; border-radius: 10px; background: linear-gradient(180deg, rgba(210, 214, 255, .9), rgba(150, 156, 220, .9)); color: #2b2a5a; border: 2px solid #eef0ff; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
.side-icons .ico { width: 30px; height: 30px; }

.tablet { grid-area: tablet; min-height: 0; display: flex; }
.tb-frame { flex: 1; display: flex; flex-direction: column; background: #111; border-radius: 34px; padding: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 0 0 2px #333; }
.tb-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; font-size: 1.35em; background: linear-gradient(180deg, #2a2656, #221f47); border-radius: 20px 20px 0 0; color: #e8e6ff; }
.tb-status { display: flex; gap: 8px; align-items: center; font-size: .8em; }
.tb-ver { font-size: .78em; letter-spacing: .04em; color: #a7a4d0; padding: 1px 6px; border: 1px solid #4a4580; border-radius: 6px; background: rgba(0, 0, 0, .25); }
.batt { display: inline-block; width: 34px; height: 16px; border: 2px solid #6ee7a8; border-radius: 4px; padding: 2px; }
.batt b { display: block; height: 100%; width: 80%; background: #6ee7a8; border-radius: 1px; }
.tb-apps { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 10px; padding: 18px; background: linear-gradient(160deg, #4a3a8a, #6d4a9a 50%, #3a2f70); border-radius: 0 0 20px 20px; min-height: 0; container-type: size; }
.app { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 0; min-width: 0; }
.app .ai { --ac: #3a8; width: clamp(24px, min(96px, 26cqw, 33cqh - 44px), 96px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 22%; background: linear-gradient(160deg, color-mix(in srgb, var(--ac) 80%, #fff), var(--ac)); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--ac) 60%, #000), 0 6px 14px rgba(0, 0, 0, .3); transition: transform .12s; }
.app .ai .ico { width: 55%; height: 55%; }
.app b { font-size: 1.25em; font-weight: 500; text-shadow: 0 2px 4px rgba(0, 0, 0, .5); white-space: nowrap; }
.app:active .ai { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ac) 60%, #000); }

.bnav { grid-area: nav; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 6px 6px calc(6px + var(--safe-b)); margin: 0 -12px; background: linear-gradient(180deg, #b6b3e8, #8e8acb); border-top: 2px solid #d9d7ff; }
.bnav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 6px; background: linear-gradient(180deg, #3a3470, #2a2556); border: 2px solid #5c56a8; color: #e8e6ff; }
.bnav button b { font-size: 1.05em; font-weight: 500; white-space: nowrap; }
.bnav button.on { background: linear-gradient(180deg, #4b5a9a, #3a4580); border-color: #cfd2ff; }
.bnav button.off { opacity: .45; }
.ui-hidden > .ui { display: none !important; }
.ui-hidden { grid-template-areas: "stage stage stage stage" "stage stage stage stage" "stage stage stage stage"; }
/* tela limpa: o palco ocupa a tela toda, então o personagem encolhe um pouco para caber com folga */
.ui-hidden .stage-char { inset: 26% 14% 7%; }
/* Painéis do menu "na frente" da cena: vidro fosco, sombra projetada e brilho na borda de cima */
.pcard, .roster { backdrop-filter: blur(8px) saturate(1.2); -webkit-backdrop-filter: blur(8px) saturate(1.2); box-shadow: 0 12px 30px rgba(4, 2, 20, .55), inset 0 1px 0 rgba(255, 255, 255, .16); }
.tb-frame { box-shadow: 0 18px 44px rgba(4, 2, 20, .65), inset 0 0 0 2px #333, inset 0 2px 0 #4a4a4a; }
.tb-apps { box-shadow: inset 0 8px 24px rgba(0, 0, 0, .35); }
.app .ai { background: radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, .35), transparent 55%), linear-gradient(160deg, color-mix(in srgb, var(--ac) 80%, #fff), var(--ac) 55%, color-mix(in srgb, var(--ac) 75%, #000)); }
.side-icons button { box-shadow: 0 6px 14px rgba(4, 2, 20, .45), inset 0 2px 0 rgba(255, 255, 255, .6), inset 0 -3px 0 rgba(60, 60, 140, .35); }
.low-quality .pcard, .low-quality .roster { backdrop-filter: none; -webkit-backdrop-filter: none; }
.unhide { position: absolute; right: 16px; bottom: 16px; z-index: 5; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(20, 16, 44, .7); border: 2px solid #cfd2ff; }

/* ============ EDITOR ============ */
.editor { height: 100%; display: grid; grid-template-columns: minmax(0, 38fr) minmax(0, 62fr); }
.ed-left { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.ed-left > * { z-index: 1; }
.ed-left .scene-bg { z-index: 0; }
.ed-who-bar { display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-t)) 10px 0; }
.nav-arrow { width: 40px; height: 52px; border-radius: 8px; background: rgba(20, 16, 44, .8); border: 2px solid var(--line2); font-size: 28px; line-height: 1; }
.ed-who { display: flex; align-items: center; gap: 8px; padding: 2px 12px 2px 2px; background: rgba(20, 16, 44, .8); border: 2px solid var(--line2); border-radius: 8px; height: 52px; }
.ed-who svg { width: 46px; height: 46px; flex: none; }
.ed-who b { font-size: 1.3em; font-weight: 600; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* fica na mesma célula do palco (entre o nome e os botões de baixo); os botões encolhem para caber os 4 em coluna */
.ed-left .side-icons { grid-area: 2 / 1; justify-self: end; align-self: stretch; margin: 6px 10px 6px 0; width: 50px; min-height: 0; justify-content: center; container-type: size; pointer-events: none; }
.ed-left .stage { grid-area: 2 / 1; }
.ed-left .side-icons button { pointer-events: auto; }
.ed-left .side-icons button { width: min(50px, calc((100cqh - 18px) / 4)); height: min(50px, calc((100cqh - 18px) / 4)); align-self: flex-end; }
.ed-left .side-icons .ico { width: 60%; height: 60%; }
.ed-left .side-icons { gap: 6px; }
.ed-foot { display: flex; gap: 8px; padding: 8px 10px calc(10px + var(--safe-b)); }
.ed-foot button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 64px; height: 62px; padding: 4px 8px; border-radius: 8px; background: rgba(44, 40, 90, .92); border: 2px solid var(--line2); line-height: 1.05; }
.ed-foot b { font-weight: 600; }
.ed-right { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); border-left: 2px solid var(--line2); }
.ed-left { min-width: 0; }
.ed-tabs { display: flex; gap: 4px; padding: calc(6px + var(--safe-t)) 6px 6px; background: #17142f; border-bottom: 2px solid var(--line2); }
.ed-tabs button[data-tab] { --ac: #888; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 8px; background: var(--panel2); border: 2px solid var(--line); }
.ed-tabs button[data-tab] .ico { color: var(--ac); }
.ed-tabs button[data-tab] b { font-weight: 500; font-size: .98em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ed-tabs button.on { background: color-mix(in srgb, var(--ac) 35%, var(--panel2)); border-color: var(--ac); }
.ed-tabs button.on .ico { color: #fff; }
.ed-x { width: 56px; flex: none; border-radius: 8px; background: #2d2a66; border: 2px solid #6c66c6; font-size: 26px; font-weight: 700; color: #cfd2ff; }
.ed-panel { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 10px 20px; -webkit-overflow-scrolling: touch; }
.sub-tabs { position: sticky; top: 0; z-index: 3; display: flex; gap: 4px; padding: 8px 0; background: var(--panel); overflow-x: auto; scrollbar-width: none; }
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tabs button { flex: 1 0 auto; padding: 7px 12px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); font-size: 1.05em; }
.sub-tabs button.on { background: #1f5e6e; border-color: var(--acc); color: #e9fdff; }
.pn-body { padding-top: 4px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.bar-row.wrap { flex-wrap: wrap; }
.bar-row > b { flex: 1; font-weight: 600; }

/* Controle de peça: ‹ miniatura › + cores */
.ctl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(170px, 22vw, 250px), 1fr)); gap: 8px; }
.ctl { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px 8px; }
.ctl-lab { display: flex; justify-content: space-between; font-size: 1em; color: #d8d6ff; margin-bottom: 4px; }
.ctl-lab b { color: var(--muted); font-weight: 500; }
.ctl-row { display: flex; align-items: center; gap: 4px; }
.arr { width: 36px; height: 44px; flex: none; border-radius: 6px; background: #151230; border: 1px solid var(--line); font-size: 24px; line-height: 1; color: #d9d7ff; }
.arr:active { background: #2a2656; }
.ctl-th { flex: 1; min-width: 0; height: 88px; display: flex; flex-direction: column; border-radius: 8px; background: linear-gradient(180deg, #3a3478, #26224f); border: 1px solid var(--line2); overflow: hidden; }
.ctl-th svg, .pz svg { flex: 1; min-height: 0; width: 100%; }
.ctl-th small, .pz small { font-size: .82em; line-height: 1.15; padding: 1px 3px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #d9d7ff; }
.sws { display: flex; flex-direction: column; gap: 4px; }
.bar-row .sws, .num .sws { flex-direction: row; flex-wrap: wrap; }
.sw { width: 28px; height: 26px; border-radius: 5px; border: 2px solid #fff; box-shadow: 0 0 0 1px #000; flex: none; }
.sw.big { width: 38px; height: 34px; }
.none-mark { display: grid; place-items: center; flex: 1; font-size: 2em; color: var(--dim); }

/* Grades de escolha */
.pick-grid, .adj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.pose-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.expr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.pz { display: flex; flex-direction: column; aspect-ratio: 1 / 1.08; border-radius: 8px; background: linear-gradient(180deg, #3a3478, #26224f); border: 2px solid var(--line); overflow: hidden; }
.pose-grid .pz { aspect-ratio: 1 / 1.35; }
/* Lista paginada de peças (como no Gacha Club): título com Remover, grade 5×4 e navegação de páginas */
.pk-head { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.pk-head b { flex: 1; min-width: 0; text-align: center; font-size: 1.15em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-grid.pk { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.pick-grid.pk .pz { aspect-ratio: 1.35 / 1; }
.pick-grid.pk .pz small { display: none; }
.pk-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-top: 8px; }
.pk-nav span { text-align: center; line-height: 1.1; color: var(--muted); }
.pk-nav b { color: #e9e8ff; }
.pk-nav .btn:disabled { opacity: .4; }
/* Espaços de mascotes/objetos (20/30) */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 5px; margin: 8px 0 6px; }
.slot-grid .pz { position: relative; aspect-ratio: 1 / 1; }
.slot-grid .pz small { position: absolute; left: 3px; top: 1px; padding: 0; font-size: .75em; color: var(--muted); }
.slot-grid .pz.target { border-style: dashed; border-color: var(--acc); }
.slot-grid .star { position: absolute; right: 3px; top: 0; color: #ffd23f; font-style: normal; font-size: 1.1em; text-shadow: 0 1px 2px #000; }
.ctl-grid.one { grid-template-columns: 1fr; }
.obj-edit { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 10px; align-items: start; }
.obj-prev { aspect-ratio: 1 / 1; display: flex; border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(180deg, #2f3a6e, #1d2248); }
.obj-prev svg { width: 100%; height: 100%; }
/* Perfil: personagem e clube favoritos */
.fav-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; grid-column: 1 / -1; }
.fav { width: 100%; height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--r); background: linear-gradient(180deg, #3a3478, #26224f); border: 2px solid var(--line2); overflow: hidden; }
.fav svg { flex: 1; min-height: 0; width: 100%; }
.fav i { font-style: normal; font-size: 52px; line-height: 1.1; filter: drop-shadow(0 0 10px var(--cc)); }
.fav small { font-size: .85em; color: #d9d7ff; }
.fav-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.club-gal { display: grid; grid-template-columns: minmax(120px, 36%) 1fr; gap: 10px; }
.club-big { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border-radius: var(--r); background: #151230; border: 1px solid var(--line); padding: 10px; }
.club-big i { font-style: normal; font-size: 84px; filter: drop-shadow(0 0 16px var(--cc)); }
.club-big b { font-size: 1.2em; text-align: center; }
.club-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 4px; align-content: start; }
.club-grid button { aspect-ratio: 1 / 1; font-size: 26px; border-radius: 8px; background: #151230; border: 2px solid var(--line); }
.club-grid button.on { border-color: var(--cc); box-shadow: 0 0 10px var(--cc); }
/* Posição da estampa (junto das cores) */
.pos { width: 28px; padding: 2px 0; border-radius: 5px; background: #151230; border: 1px solid var(--line); font-size: .7em; line-height: 1.1; color: #d9d7ff; display: flex; flex-direction: column; align-items: center; }
.pos b { font-weight: 600; }
.pz.on { border-color: var(--acc); box-shadow: 0 0 0 2px rgba(95, 211, 224, .35); }
.pz.mod { border-color: var(--gold); }
.sil { filter: grayscale(1) brightness(1.9) contrast(.45) sepia(.35) hue-rotate(180deg); }
.num-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-bottom: 8px; }
.num { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); }
.num > span { color: #d8d6ff; }
.num > div { display: flex; align-items: center; gap: 6px; }
.num b { min-width: 64px; text-align: center; font-weight: 600; }
.num .arr { width: 34px; height: 36px; font-size: 20px; }
.tgl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin: 6px 0; }
.tgl { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r); background: var(--panel2); border: 1px solid var(--line); }
.tgl i { font-style: normal; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: #151230; color: var(--dim); }
.tgl.on i { background: #1f5e6e; color: #dffbff; }
.clubs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.club { --cc: #6b4cff; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 8px; font-size: 1.3em; background: var(--panel2); border: 2px solid var(--line); }
.club.on { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 35%, var(--panel2)); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.preset { display: flex; flex-direction: column; aspect-ratio: 1 / 1.1; border-radius: 8px; overflow: hidden; background: linear-gradient(180deg, #4a4090, #2a2556); border: 2px solid var(--line); }
.preset svg { flex: 1; min-height: 0; }
.preset small { font-size: .95em; padding: 2px; background: rgba(0, 0, 0, .35); }

/* Ajustar */
.adj-pad { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.dpad { display: grid; grid-template-columns: 56px 64px 56px; grid-template-rows: 22px 56px 56px 56px; gap: 4px; justify-items: center; align-items: center; }
.dpad .dl { grid-column: 1 / 4; color: var(--muted); }
.dpad button { width: 56px; height: 56px; border-radius: 10px; background: #151230; border: 2px solid var(--line2); font-size: 22px; }
.dpad .u { grid-column: 2; grid-row: 2; } .dpad .l { grid-column: 1; grid-row: 3; } .dpad .r { grid-column: 3; grid-row: 3; } .dpad .d { grid-column: 2; grid-row: 4; }
.dpad .dv { grid-column: 2; grid-row: 3; font-size: .85em; text-align: center; line-height: 1.2; color: #d8d6ff; }
.adj-side { display: flex; flex-direction: column; gap: 8px; }

/* Chat */
.chat-svg { width: 100%; max-width: 460px; display: block; }
.chat-prev { display: flex; flex-direction: column; align-items: center; padding: 8px; margin-bottom: 6px; border-radius: var(--r); background: repeating-linear-gradient(45deg, #221e48 0 12px, #1d1a3f 12px 24px); }
.bubble { position: relative; max-width: 90%; padding: 12px 18px; font-size: 1.15em; border: 3px solid #2b2140; border-radius: 16px; text-align: center; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); word-break: break-word; }
.bubble.r-think { border-radius: 40px; }
.bubble.r-shout { border-radius: 4px; transform: rotate(-2deg); font-weight: 700; border-width: 4px; }
.bubble.r-whisper { border-style: dashed; opacity: .9; font-style: italic; }
.bname { margin-top: 6px; font-weight: 700; font-size: 1.1em; text-shadow: 0 2px 3px #000; }
.emotes { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.emotes button { height: 48px; border-radius: 8px; background: var(--panel2); border: 2px solid var(--line); font-size: 24px; }
.emotes button.on { border-color: var(--acc); }

/* Perfil */
.prof { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fld { display: flex; flex-direction: column; gap: 3px; }
.fld span { color: var(--muted); font-size: .92em; }
.fld.big, .fld.wide { grid-column: 1 / -1; }
.fld.big input { font-size: 1.3em; }

/* Seletor de cor */
.cp { padding-top: 8px; }
.cp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cp-head > b { font-size: 1.2em; }
.cp-targets { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.cp-t { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; background: var(--panel2); border: 2px solid var(--line); }
.cp-t i { width: 26px; height: 22px; border-radius: 4px; border: 2px solid #fff; }
.cp-t.on { border-color: var(--acc); }
.cp-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 2px; }
.cp-c { aspect-ratio: 1.3; border-radius: 2px; min-height: 18px; }
.cp-c.sel { outline: 2px solid #fff; outline-offset: -2px; box-shadow: 0 0 0 2px #000; }
.cp-row { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; margin-top: 6px; }
.cp-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cp-recent { display: flex; gap: 3px; flex: 1; flex-wrap: wrap; }
.cp-recent .cp-c { width: 26px; min-height: 22px; }
.cp-custom { position: relative; width: 42px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: var(--panel3); border: 1px solid var(--line2); cursor: pointer; }
.cp-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cp-hex { width: 96px; }

/* ============ JANELAS ============ */
#modal-root { position: relative; z-index: 50; }
.modal-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6, 4, 18, .62); opacity: 0; transition: opacity .18s; }
.modal-wrap.show { opacity: 1; }
.modal { width: 100%; max-width: 640px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: linear-gradient(180deg, #221e4a, #17142f); border: 2px solid var(--line2); border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .55); transform: scale(.96); transition: transform .18s; }
.modal-wrap.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 2px solid var(--line); }
.modal-head h2 { flex: 1; margin: 0; font-size: 1.5em; font-weight: 600; }
.modal-body { padding: 12px 14px; overflow-y: auto; }
.modal-body p { margin: 6px 0; line-height: 1.35; }
.modal-body textarea { margin: 8px 0; font-size: .85em; resize: vertical; }
.modal-btns { display: flex; gap: 8px; padding: 0 14px 14px; }
.modal-btns .btn { flex: 1; padding: 11px; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { padding: 12px; border-radius: 6px; background: linear-gradient(180deg, #3a3478, #2a2556); border: 2px solid #6c66c6; font-size: 1.1em; }
.opt.danger { border-color: #a23a5e; color: #ffc1d2; }
.credits { text-align: center; }
.credits h3 { margin: 6px 0; font-size: 1.6em; }
.tut-modal { max-width: 980px; }
.tut-tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.tut-tabs button { flex: 1 0 auto; padding: 8px 12px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); font-size: 1.1em; }
.tut-tabs button.on { background: #2a3a66; border-color: #9fb0e8; }
.tut-main { display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1.6fr) 40px; gap: 10px; align-items: center; }
.tut-arrow { height: 100%; min-height: 120px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); font-size: 30px; }
.tut-guide-wrap { height: min(52vh, 420px); }
.tut-guide { width: 100%; height: 100%; }
.say { background: #dfe6ff; color: #232046; padding: 10px 16px; border-radius: 18px; font-size: 1.25em; font-weight: 600; text-align: center; box-shadow: 0 3px 0 #0006; }
.say.pet { background: #f2e3ff; }
.tut-text ul { margin: 12px 0; padding-left: 20px; font-size: 1.15em; line-height: 1.35; }
.swap-modal { max-width: 900px; }
.swap { display: grid; grid-template-columns: 170px 1fr; gap: 10px; }
.swap-main { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; align-content: start; }
.swap-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; align-content: start; max-height: 52vh; overflow-y: auto; }
.bk { display: flex; align-items: center; gap: 4px; height: 44px; padding: 2px 6px 2px 2px; border-radius: 6px; background: var(--panel2); border: 2px solid var(--line); text-align: left; }
.bk svg { width: 38px; height: 38px; flex: none; }
.bk small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk.empty small { color: var(--dim); }
.bk.on { border-color: var(--acc); }
.swap-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.pager { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bg-modal { max-width: 900px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin: 10px 0; }
.bgt { display: flex; flex-direction: column; aspect-ratio: 3 / 4.3; border-radius: 6px; overflow: hidden; border: 2px solid var(--line); background: #000; }
.bgt svg { flex: 1; min-height: 0; width: 100%; }
.bgt small { font-size: .8em; padding: 2px; background: #17142f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bgt.on { border-color: var(--acc); }
.bg-ctl { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; align-items: center; }
.profile-modal { max-width: 820px; }
.pf { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 12px; }
.pf-art { background: radial-gradient(circle at 50% 60%, #6b4cff55, transparent 70%), #17142f; border-radius: 10px; min-height: 320px; }
.pf-art svg { width: 100%; height: 100%; }
.pf-title { --tc: #6b4cff; padding: 6px 12px; border-radius: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: linear-gradient(90deg, var(--tc), #ff6fb5); margin-bottom: 8px; }
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.pf-row { background: var(--panel2); border-radius: 6px; padding: 5px 8px; display: flex; flex-direction: column; }
.pf-row small, .pf-bio small { color: var(--muted); }
.pf-bio { background: var(--panel2); border-radius: 6px; padding: 6px 8px; }
.pf-bio p { margin: 2px 0; }

/* ---------- Toast, texto, carregando ---------- */
#toasts { position: fixed; z-index: 90; left: 0; right: 0; top: calc(12px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { max-width: 90%; padding: 10px 18px; border-radius: 10px; background: rgba(23, 20, 47, .96); border: 2px solid var(--acc); font-size: 1.05em; text-align: center; transform: translateY(-12px); opacity: 0; transition: .22s; box-shadow: 0 8px 20px rgba(0, 0, 0, .4); }
.toast.show { transform: none; opacity: 1; }
.text-entry { position: fixed; inset: 0; z-index: 80; background: rgba(6, 4, 18, .6); }
.te-bar { display: flex; gap: 8px; padding: calc(10px + var(--safe-t)) 10px 10px; background: #2a2656; border-bottom: 2px solid var(--line2); }
.te-bar input, .te-bar textarea { flex: 1; font-size: 1.2em; background: #e8e6ff; color: #1b1838; border: 0; }
.te-no, .te-ok { width: 56px; border-radius: 8px; font-size: 26px; font-weight: 700; }
.te-no { background: #c43a52; } .te-ok { background: #3a6fd0; }
.loading-screen { position: fixed; inset: 0; z-index: 95; display: grid; place-content: center; justify-items: center; gap: 8px; background: radial-gradient(circle, #3a2a7a, #120c2a); opacity: 0; transition: opacity .2s; }
.loading-screen.show { opacity: 1; }
.ld-logo { display: flex; align-items: center; gap: 12px; font-size: 2.4em; font-weight: 700; }
.ld-logo img { width: 72px; }

/* ============ ANIMAÇÕES DO PERSONAGEM ============ */
/* a duração é multiplicada pelo nível de animação do personagem (--d-*, definido pelo rig) */
.rig .anim-blink { animation: blink calc(4.2s * var(--d-blink, 1)) infinite; }
.rig .anim-hair { animation: hairSway calc(5s * var(--d-hair, 1)) ease-in-out infinite; transform-origin: 150px 110px; }
.rig .anim-hairb { animation: hairSway calc(5s * var(--d-hairB, 1)) ease-in-out infinite; transform-origin: 150px 110px; }
.rig .anim-wing-l { animation: flapL calc(2.4s * var(--d-wings, 1)) ease-in-out infinite; transform-origin: 132px 232px; }
.rig .anim-wing-r { animation: flapR calc(2.4s * var(--d-wings, 1)) ease-in-out infinite; transform-origin: 168px 232px; }
.rig .anim-cape { animation: capeSway calc(3.6s * var(--d-cape, 1)) ease-in-out infinite; transform-origin: 150px 212px; }
.rig .anim-tail { animation: tailWag calc(2.2s * var(--d-tail, 1)) ease-in-out infinite; transform-origin: 166px 280px; }
.anim-bob { animation: bob 2.4s ease-in-out infinite; }
.anim-tw { animation: twinkle 1.8s ease-in-out infinite; }
.anim-float { animation: floatUp 3.5s ease-in-out infinite; }
.anim-sway { animation: sway 3.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-flicker { animation: flicker .9s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center bottom; }
.anim-pulse, .pulse { animation: pulse 2.2s ease-in-out infinite; }
.anim-eq { animation: eq 1.1s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center bottom; }
.anim-spin { animation: spin 12s linear infinite; }
.anim-glow { animation: pulse 1.6s ease-in-out infinite; }
.anim-scan { animation: scan 1.6s ease-in-out infinite alternate; }
.anim-flap { animation: flapSmall .6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.tw { animation: twinkle 1.8s ease-in-out infinite; }
.sway { animation: sway 3.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
.na-blink .anim-blink, .na-hair .anim-hair, .na-hairb .anim-hairb, .na-wing .anim-wing-l, .na-wing .anim-wing-r, .na-wing .anim-wing, .na-cape .anim-cape, .na-tail .anim-tail,
.na-fx .fx-back *, .na-fx .fx-front * { animation: none !important; }
.still *, .low-quality *, .low-quality *::before { animation: none !important; transition: none !important; }

/* Sobreposições animadas (chuva, neve...) */
svg .w-fall { animation: wFall 1s linear infinite; }
svg .w-fall-sway { animation: wFallSway 6s linear infinite; }
svg .w-fall-spin { animation: wFallSpin 4s linear infinite; }
svg .w-rise { animation: wRise 5s linear infinite; }
svg .w-wander { animation: wWander 5s ease-in-out infinite; }
svg .w-meteor { animation: wMeteor 4s ease-in infinite; }
svg .w-fog { animation: wFog 18s ease-in-out infinite alternate; }

@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.08); } }
@keyframes hairSway { 0%, 100% { transform: rotate(-.8deg); } 50% { transform: rotate(.8deg); } }
@keyframes flapL { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }
@keyframes flapR { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(9deg); } }
@keyframes capeSway { 0%, 100% { transform: skewX(0); } 50% { transform: skewX(2.5deg); } }
@keyframes tailWag { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes floatUp { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes sway { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes flicker { from { transform: scaleY(.9) skewX(-3deg); opacity: .85; } to { transform: scaleY(1.07) skewX(3deg); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes eq { from { transform: scaleY(.35); } to { transform: scaleY(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes scan { from { transform: translateY(-6px); } to { transform: translateY(6px); } }
@keyframes flapSmall { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }
@keyframes wFall { from { transform: translateY(0); } to { transform: translate(-30px, 440px); } }
@keyframes wFallSway { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(18px, 110px) rotate(90deg); } 50% { transform: translate(-6px, 220px) rotate(180deg); } 75% { transform: translate(16px, 330px) rotate(270deg); } 100% { transform: translate(0, 440px) rotate(360deg); } }
@keyframes wFallSpin { from { transform: translateY(0) rotate(0); } to { transform: translate(20px, 440px) rotate(720deg); } }
@keyframes wRise { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(14px, -440px); opacity: 0; } }
@keyframes wWander { 0%, 100% { transform: translate(0, 0); opacity: .2; } 25% { transform: translate(12px, -10px); opacity: 1; } 50% { transform: translate(-6px, -22px); opacity: .5; } 75% { transform: translate(-14px, -6px); opacity: 1; } }
@keyframes wMeteor { 0%, 60% { transform: translate(0, 0); opacity: 0; } 65% { opacity: 1; } 100% { transform: translate(-260px, 160px); opacity: 0; } }
/* Cenários: nuvens passando, raios de luz, brilhos, ondas e aurora */
svg .bg-drift { animation: bgDrift 38s ease-in-out infinite alternate; }
svg .bg-drift2 { animation: bgDrift 52s ease-in-out infinite alternate-reverse; }
svg .bg-rays { animation: bgRays 7s ease-in-out infinite; }
svg .bg-glow { animation: bgGlow 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
svg .bg-shimmer { animation: bgShimmer 2.6s ease-in-out infinite; }
svg .bg-wave { animation: bgWave 5s ease-in-out infinite; }
svg .bg-wave2 { animation: bgWave2 4.4s ease-in-out infinite; }
svg .bg-aurora { animation: bgAurora 9s ease-in-out infinite alternate; }
svg .bg-drift-w { animation: bgDriftW 40s ease-in-out infinite alternate; }
svg .bg-drift-w2 { animation: bgDriftW 56s ease-in-out infinite alternate-reverse; }
svg .bg-sweep { animation: bgSweep 6s ease-in-out infinite alternate; }
svg .bg-spots { animation: bgSpots 3.2s ease-in-out infinite alternate; }
svg .bg-spots2 { animation: bgSpots 4.6s ease-in-out infinite alternate-reverse; }
svg .bg-thump { animation: bgThump .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
svg .bg-facets { animation: bgFacets 2s linear infinite; }
svg .bg-leaf { animation: bgLeaf 9s linear infinite; }
svg .bg-curtain { animation: bgCurtain 6s ease-in-out infinite alternate; }
svg .bg-plant { animation: bgPlant 4.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
@keyframes bgPlant { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
svg .bg-water { animation: bgWater .8s linear infinite; }
svg .bg-streak { animation: bgStreak 2s linear infinite; }
svg .bg-bat { animation: wWander 6s ease-in-out infinite; }
@keyframes bgWater { to { stroke-dashoffset: -36; } }
@keyframes bgStreak { from { transform: translateY(-120px); } to { transform: translateY(260px); } }
@keyframes bgDriftW { from { transform: translateX(-50px); } to { transform: translateX(50px); } }
@keyframes bgSweep { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
@keyframes bgSpots { from { transform: translateX(-24px); opacity: .6; } to { transform: translateX(24px); opacity: 1; } }
@keyframes bgThump { from { transform: scale(1); } to { transform: scale(1.12); } }
@keyframes bgFacets { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
@keyframes bgLeaf { 0% { transform: translate(0, -40px) rotate(0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(-160px, 620px) rotate(540deg); opacity: 0; } }
@keyframes bgCurtain { from { transform: skewX(0); } to { transform: skewX(1.4deg); } }
@keyframes bgDrift { from { transform: translateX(-14px); } to { transform: translateX(14px); } }
@keyframes bgRays { 0%, 100% { opacity: .6; transform: translateX(0); } 50% { opacity: 1; transform: translateX(8px); } }
@keyframes bgGlow { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes bgShimmer { 0%, 100% { opacity: 1; transform: translateX(0); } 50% { opacity: .45; transform: translateX(4px); } }
@keyframes bgWave { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-24px); } }
@keyframes bgWave2 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
@keyframes bgAurora { from { transform: translateX(-16px) skewX(-4deg); opacity: .6; } to { transform: translateX(16px) skewX(4deg); opacity: 1; } }
@keyframes wFog { from { transform: translateX(-60px); } to { transform: translateX(60px); } }

/* ============ HOVER (mouse) ============ */
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled), .app:hover .ai, .side-icons button:hover, .bnav button:not(.off):hover, .opt:hover { filter: brightness(1.15); }
  .ro:hover, .pz:hover, .preset:hover, .bgt:hover, .bk:hover, .ctl-th:hover { border-color: #9fa0e8; }
  .arr:hover, .dpad button:hover { background: #262251; }
  ::-webkit-scrollbar { width: 10px; height: 8px; }
  ::-webkit-scrollbar-thumb { background: #3d3875; border-radius: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* ============ TELAS MÉDIAS ============ */
@media (max-width: 1180px) {
  .pc-lv { width: 110px; } .pc-cur { width: 104px; } .pc-cur span { font-size: 1.3em; }
  .pc-name { font-size: 1.5em; }
}

/* ============ TELAS BAIXAS (janela pequena no PC, celular deitado) ============ */
@media (max-height: 620px) {
  body { font-size: 15px; }
  .menu { grid-template-columns: minmax(150px, 19vw) minmax(0, 1fr) auto minmax(250px, 34vw); gap: 6px; padding: calc(6px + var(--safe-t)) 8px 0; }
  .pc-portrait { width: 64px; }
  .pc-title { padding: 2px 10px; }
  .pc-name { font-size: 1.4em; }
  .pc-lv { width: 90px; padding: 4px 8px; } .pc-lv b { font-size: 1.3em; }
  .pc-cur { width: 90px; } .pc-cur span { font-size: 1.15em; padding: 2px 8px; gap: 5px; }
  .pc-cur i.gold { width: 20px; height: 20px; }
  .roster { padding: 4px; gap: 3px; }
  .tb-frame { border-radius: 22px; padding: 8px; }
  .tb-head { padding: 4px 12px; font-size: 1.05em; border-radius: 14px 14px 0 0; }
  .tb-apps { gap: 4px; padding: 8px; border-radius: 0 0 14px 14px; }
  .app { gap: 3px; }
  .app .ai { width: clamp(22px, min(80px, 26cqw, 33cqh - 30px), 80px); }
  .app b { font-size: 1em; }
  .bnav { gap: 4px; padding: 4px 4px calc(4px + var(--safe-b)); margin: 0 -8px; }
  .bnav button { padding: 3px 2px; gap: 0; }
  .bnav button b { font-size: .88em; }
  .bnav .ico { width: 20px; height: 20px; }
}
/* Muito baixa: só a miniatura na lista (o nome do escolhido aparece no cartão) */
@media (max-height: 460px) {
  .ro small { display: none; }
  .pc-title { font-size: .8em; }
  .pc-lv small { display: none; }
}

/* ============ CELULAR / RETRATO ============ */
@media (max-width: 640px), (orientation: portrait) and (max-width: 1100px) {
  body { font-size: 16px; }
  .menu { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "card card" "stage icons" "roster roster" "tablet tablet" "nav nav"; gap: 8px; padding: calc(8px + var(--safe-t)) 8px 0; }
  .pcard { max-width: none; border-radius: 10px; }
  .pc-portrait { width: 58px; }
  .pc-name { font-size: 1.35em; }
  .pc-title { font-size: .85em; padding: 2px 10px; }
  .pc-lv { width: 76px; padding: 4px 6px; } .pc-lv small { font-size: .75em; } .pc-lv b { font-size: 1.2em; }
  .pc-cur { width: 78px; } .pc-cur span { font-size: 1em; padding: 3px 8px; gap: 4px; }
  .pc-cur i.gold { width: 18px; height: 18px; }
  .roster { display: flex; overflow-x: auto; padding: 4px; gap: 4px; border-radius: 10px; scrollbar-width: none; }
  .roster::-webkit-scrollbar { display: none; }
  .ro { flex: none; width: 64px; aspect-ratio: auto; height: 70px; }
  .ro small { font-size: .82em; }
  .side-icons { gap: 6px; }
  .side-icons button { width: 44px; height: 44px; border-radius: 8px; }
  .side-icons .ico { width: 24px; height: 24px; }
  .tb-frame { border-radius: 18px; padding: 6px; }
  .tb-head { padding: 4px 12px; font-size: 1em; border-radius: 12px 12px 0 0; }
  .tb-apps { padding: 8px; gap: 6px; grid-auto-rows: auto; border-radius: 0 0 12px 12px; container-type: normal; }
  .app { flex-direction: row; justify-content: flex-start; gap: 6px; padding: 2px; }
  .app .ai { width: 38px; border-radius: 10px; box-shadow: 0 2px 0 color-mix(in srgb, var(--ac) 60%, #000); }
  .app b { font-size: 1em; }
  .bnav { display: flex; overflow-x: auto; margin: 0 -8px; gap: 4px; scrollbar-width: none; }
  .bnav::-webkit-scrollbar { display: none; }
  .bnav button { flex: 1 0 64px; padding: 4px 2px; }
  .bnav button b { font-size: .78em; }
  .bnav .ico { width: 22px; height: 22px; }

  .editor { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(250px, 42%) minmax(0, 1fr); }
  .ed-left { grid-template-rows: auto minmax(0, 1fr) auto; }
  .ed-who-bar { padding-top: calc(6px + var(--safe-t)); }
  .nav-arrow { width: 34px; height: 42px; font-size: 24px; }
  .ed-who { height: 42px; } .ed-who svg { width: 38px; height: 38px; } .ed-who b { font-size: 1.1em; }
  .ed-left .side-icons { position: absolute; right: 6px; top: 50%; width: auto; margin: 0; transform: translateY(-50%); container-type: normal; }
  .ed-left .side-icons button { width: 40px; height: 40px; }
  .ed-foot { position: absolute; left: 0; bottom: 0; padding: 6px; gap: 6px; }
  .ed-foot button { min-width: 54px; height: 50px; font-size: .85em; }
  .ed-right { border-left: 0; border-top: 2px solid var(--line2); }
  .ed-tabs { padding: 4px; gap: 3px; }
  .ed-tabs button[data-tab] { padding: 4px 1px; }
  .ed-tabs button[data-tab] b { font-size: .78em; }
  .ed-tabs .ico { width: 22px; height: 22px; }
  .ed-x { width: 42px; font-size: 20px; }
  .ctl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .ctl { padding: 5px 5px 6px; }
  .ctl-lab { font-size: .9em; }
  .ctl-row { gap: 3px; }
  .ctl-row .arr { width: 24px; height: 40px; font-size: 20px; }
  .ctl-th { height: 80px; }
  .sw { width: 22px; height: 22px; }
  .num-grid { grid-template-columns: 1fr; }
  .prof { grid-template-columns: 1fr; }
  .pf { grid-template-columns: 1fr; }
  .obj-edit, .club-gal { grid-template-columns: 1fr; } .obj-prev { max-width: 200px; } .pf-art { min-height: 260px; }
  .swap { grid-template-columns: 1fr; } .swap-main { grid-template-columns: repeat(5, 1fr); }
  .opt-grid { grid-template-columns: 1fr; }
  .tut-main { grid-template-columns: 30px minmax(0, 1fr) 30px; }
  .tut-guide-wrap { display: none; }
  .tut-text ul { font-size: 1em; }
  .say { font-size: 1.05em; }
  .adj-pad { grid-template-columns: 1fr; justify-items: center; }
  .adj-side { width: 100%; }
  .modal-wrap { padding: 8px; }
}

/* ============ ESTÚDIO ============ */
.studio { position: relative; height: 100%; display: grid; grid-template-columns: 96px minmax(0, 1fr) 112px; grid-template-areas: "left stage right"; background: #0b0820; overflow: hidden; }
.st-stage { grid-area: stage; position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; touch-action: none; overflow: hidden; }
.st-svg { width: 100%; height: 100%; display: block; }
.st-svg .ent { cursor: grab; }
.st-svg.dragging .st-over { display: none; }
.st-selbox { fill: rgba(95, 211, 224, .08); stroke: #5fd3e0; stroke-width: 3; stroke-dasharray: 10 7; vector-effect: non-scaling-stroke; }
.st-name { font-family: var(--ui); font-size: 19px; font-weight: 600; fill: #fff; stroke: #2b2140; stroke-width: 4; paint-order: stroke; }
.st-left, .st-right { display: flex; flex-direction: column; gap: 6px; padding: calc(8px + var(--safe-t)) 6px calc(8px + var(--safe-b)); background: rgba(20, 16, 44, .92); overflow-y: auto; scrollbar-width: none; z-index: 2; }
.st-left { grid-area: left; border-right: 2px solid var(--line2); }
.st-right { grid-area: right; border-left: 2px solid var(--line2); }
.st-left::-webkit-scrollbar, .st-right::-webkit-scrollbar { display: none; }
.st-left button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 8px; background: var(--panel2); border: 2px solid var(--line); flex: none; }
.st-left button b { font-size: .88em; font-weight: 500; line-height: 1.1; text-align: center; }
.st-left button.on { border-color: var(--acc); background: #1f5e6e; }
.st-ch { position: relative; display: flex; flex-direction: column; align-items: center; flex: none; padding: 3px; border-radius: 8px; background: var(--panel2); border: 2px solid var(--line); }
.st-ch svg { width: 64px; height: 58px; }
.st-ch small { font-size: .82em; max-width: 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-ch .dot { position: absolute; top: 5px; right: 5px; width: 14px; height: 14px; border-radius: 50%; background: #1b1838; border: 2px solid #5a54a3; }
.st-ch.in .dot { background: #3de07a; border-color: #b8ffd0; box-shadow: 0 0 6px #3de07a; }
.st-ch.on { border-color: var(--acc); }
.st-actions { position: absolute; top: 10px; right: 122px; z-index: 3; display: flex; flex-direction: column; gap: 5px; }
.has-panel .st-actions { right: 520px; }
.st-actions > button, .st-scale { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 70px; padding: 6px 4px; border-radius: 8px; background: rgba(38, 34, 81, .95); border: 2px solid var(--line2); font-size: 1.05em; }
.st-actions .ico { width: 22px; height: 22px; }
.st-actions b { font-size: .82em; font-weight: 500; }
.st-scale { flex-direction: row; justify-content: space-between; padding: 4px; }
.st-scale button { width: 24px; height: 28px; border-radius: 5px; background: #151230; font-size: 18px; }
.st-scale b { font-size: .9em; }
.st-panel { position: absolute; top: 10px; right: 122px; bottom: 10px; width: 390px; z-index: 3; display: none; padding: 8px 10px 14px; overflow-y: auto; background: rgba(29, 26, 58, .97); border: 2px solid var(--line2); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.has-panel .st-panel { display: block; }
.st-ph { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.st-ph b { flex: 1; font-size: 1.25em; font-weight: 600; }
.st-panel .pick-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.st-panel .seg { display: flex; flex-wrap: wrap; }
.st-panel .seg button { flex: 1; }
.st-who { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 8px 0; }
.st-who button { border-radius: 8px; border: 2px solid var(--line); background: var(--panel2); aspect-ratio: 1; overflow: hidden; }
.st-who button svg { width: 100%; height: 100%; }
.st-who button.on { border-color: var(--acc); }
.studio.view { grid-template-columns: 0 minmax(0, 1fr) 0; }
.studio.view .st-left, .studio.view .st-right { display: none; }
.st-exitview { position: absolute; right: 14px; bottom: calc(14px + var(--safe-b)); z-index: 5; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(20, 16, 44, .6); border: 2px solid #cfd2ff; opacity: .7; }
.jump-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.jump-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 8px; background: var(--panel2); border: 2px solid var(--line); }
.scenes-modal { max-width: 900px; }
.scene-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.scs { display: flex; flex-direction: column; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); background: #0b0820; }
.scs svg { width: 100%; aspect-ratio: 16 / 9; display: block; }
.scs > span { aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--dim); }
.scs small { padding: 3px 6px; background: var(--panel2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scs.on { border-color: var(--acc); }

@media (max-width: 640px), (orientation: portrait) and (max-width: 1100px) {
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto minmax(0, 1fr); grid-template-areas: "stage" "right" "left" "actions" "panel"; }
  .st-stage { aspect-ratio: 16 / 9; width: 100%; margin-top: var(--safe-t); }
  .st-left, .st-right { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 5px; border: 0; border-top: 2px solid var(--line2); }
  .st-left button { min-width: 74px; padding: 5px 2px; }
  .st-ch svg { width: 50px; height: 44px; }
  .st-actions { grid-area: actions; position: static; flex-direction: row; flex-wrap: wrap; padding: 5px; background: rgba(20, 16, 44, .92); }
  .st-actions > button, .st-scale { min-width: 58px; flex: 1 0 auto; }
  .has-panel .st-actions { right: auto; }
  .st-panel { grid-area: panel; position: static; width: auto; border-radius: 0; border-width: 2px 0 0; min-height: 0; }
  .studio.view { grid-template-rows: minmax(0, 1fr); grid-template-areas: "stage"; }
  .studio.view .st-stage { aspect-ratio: auto; height: 100%; }
  .jump-grid { grid-template-columns: repeat(3, 1fr); }
}
.hidden { display: none !important; }
.gc-note { margin: 6px 0 10px; padding: 8px 10px; border-radius: 8px; background: rgba(95, 211, 224, .1); border: 1px solid #2f7f8c; }
.gc-note .seg { margin-top: 6px; }
