@font-face {
  font-family: 'Pixelify';
  src: url('vendor/fonts/PixelifySans.ttf') format('truetype');
  font-display: swap;
}
:root {
  --escuro: #2a1622;
  --painel: rgba(34, 18, 30, 0.92);
  --creme: #fbf3e4;
  --rosa: #f07aa8;
  --amarelo: #f6cf52;
  --agua: #4fc0b0;
  --laranja: #f08a3c;
  --borda: #f6cf52;
  --sombra: #140a10;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1a0e16; color: var(--creme); overflow: hidden; }
body { font-family: 'Pixelify', 'Trebuchet MS', system-ui, sans-serif; -webkit-user-select: none; user-select: none; touch-action: none; }
button { font-family: inherit; }
#app { position: fixed; inset: 0; }
#cena { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#visor { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; image-rendering: pixelated; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity 0.18s ease-out; }
#flash.on { opacity: 0.85; transition: none; }
[hidden] { display: none !important; }

/* painéis e botões em estilo 16-bit */
.painel {
  position: relative; max-width: min(560px, 92vw); max-height: 92vh; overflow: auto; padding: 22px 24px;
  background: var(--painel); border: 4px solid var(--escuro);
  box-shadow: 0 0 0 3px var(--borda), 0 0 0 6px var(--escuro), 8px 10px 0 6px rgba(0,0,0,0.35);
}
.painel.largo { max-width: min(920px, 95vw); }
.tela { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; background: rgba(20, 8, 16, 0.35); }
h1, h2, h3 { margin: 0 0 10px; font-weight: 700; letter-spacing: 1px; }
h1 { font-size: clamp(38px, 8vw, 64px); line-height: 0.95; color: var(--amarelo); text-shadow: 3px 3px 0 var(--rosa), 6px 6px 0 var(--escuro); }
h1 span { color: var(--creme); }
h2 { font-size: 28px; color: var(--amarelo); text-shadow: 2px 2px 0 var(--escuro); }
h2 small { font-size: 16px; color: var(--creme); }
.sobre { margin: 0 0 8px; color: var(--agua); font-size: 15px; letter-spacing: 2px; text-transform: uppercase; }
.linha { margin: 8px 0; font-size: 17px; line-height: 1.35; }
.destaque { color: var(--amarelo); }
.ficcao, .controles-lista, .nota { font-size: 13px; line-height: 1.4; opacity: 0.85; margin: 10px 0 0; }
.btn {
  appearance: none; border: 0; cursor: pointer; font-size: 18px; color: var(--escuro); background: var(--creme);
  padding: 10px 16px; min-height: 44px; min-width: 44px;
  box-shadow: inset -3px -3px 0 #c9b79c, 0 0 0 3px var(--escuro); margin: 4px;
}
.btn:hover, .btn:focus-visible { background: var(--amarelo); outline: none; }
.btn:active { transform: translateY(2px); }
.btn.grande { background: var(--rosa); color: #fff; font-size: 22px; box-shadow: inset -3px -3px 0 #b44c78, 0 0 0 3px var(--escuro); }
.btn.grande:hover, .btn.grande:focus-visible { background: #ff94bd; }
.btn.pequeno { font-size: 15px; padding: 6px 10px; }
.btn[aria-checked="true"], .btn[aria-pressed="true"] { background: var(--agua); color: var(--escuro); }
.btn:disabled { opacity: 0.45; cursor: default; }
.botoes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 14px; align-items: center; }
.botoes.coluna { flex-direction: column; align-items: stretch; }
.btn-ico { appearance: none; border: 0; width: 48px; height: 48px; font-size: 18px; color: var(--creme); background: var(--painel); box-shadow: 0 0 0 3px var(--escuro), inset 0 0 0 2px var(--borda); cursor: pointer; }

/* HUD */
#hud, #hubHud { position: absolute; inset: 0; pointer-events: none; }
#hud button, #hubHud button { pointer-events: auto; }
.hud-topo { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 10px; align-items: center; }
.filme { background: var(--painel); padding: 6px 10px; box-shadow: 0 0 0 3px var(--escuro), inset 0 0 0 2px var(--borda); display: flex; align-items: center; gap: 6px; font-size: 22px; }
.filme small { font-size: 12px; opacity: 0.8; }
.filme.acabou b { color: var(--laranja); }
.ico-filme { width: 16px; height: 18px; background: linear-gradient(90deg, var(--escuro) 0 3px, var(--amarelo) 3px 13px, var(--escuro) 13px); box-shadow: 0 0 0 2px var(--escuro); }
.progresso { flex: 1; height: 14px; background: var(--painel); box-shadow: 0 0 0 3px var(--escuro); position: relative; }
.progresso div { height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--rosa) 0 8px, #ff9cc2 8px 12px); }
.progresso span { position: absolute; left: 6px; top: 16px; font-size: 13px; text-shadow: 1px 1px 0 var(--escuro); }
.tutorial { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); width: min(560px, 90vw); text-align: center; background: var(--painel); padding: 10px 14px; font-size: 18px; box-shadow: 0 0 0 3px var(--escuro), inset 0 0 0 2px var(--agua); }
.tag { position: absolute; left: 50%; transform: translateX(-50%); top: 20%; padding: 6px 12px; font-size: 20px; font-weight: 700; letter-spacing: 1px; box-shadow: 0 0 0 3px var(--escuro); }
.tag.momento { background: var(--amarelo); color: var(--escuro); animation: pulsa 0.5s steps(2) infinite; }
.tag.pose { background: var(--creme); color: var(--escuro); }
.tag.raro { background: var(--rosa); color: #fff; }
@keyframes pulsa { 50% { transform: translateX(-50%) scale(1.06); } }
.notar { position: absolute; left: 50%; top: calc(20% + 44px); transform: translateX(-50%); display: flex; gap: 6px; align-items: center; font-size: 13px; background: var(--painel); padding: 4px 8px; box-shadow: 0 0 0 2px var(--escuro); }
.notar i { display: block; width: 70px; height: 8px; background: #50303c; }
.notar b { display: block; height: 100%; width: 0; background: var(--laranja); }
#polaroides { position: absolute; left: 12px; bottom: 16px; display: flex; flex-direction: column-reverse; gap: 6px; }
.polaroide { background: var(--creme); color: var(--escuro); padding: 5px 5px 4px; width: 132px; box-shadow: 0 0 0 3px var(--escuro); font-size: 12px; animation: entra 0.35s steps(4); }
.polaroide img { display: block; width: 122px; height: 91px; image-rendering: pixelated; background: #222; filter: brightness(1.8) saturate(0.2); animation: revela 1.2s steps(6) forwards; }
.polaroide.sai { animation: sai 0.3s steps(3) forwards; }
@keyframes entra { from { transform: translateY(40px) rotate(-8deg); opacity: 0; } }
@keyframes sai { to { transform: translateX(-160px); opacity: 0; } }
@keyframes revela { to { filter: none; } }
.aviso { position: absolute; bottom: 24%; left: 50%; transform: translateX(-50%); background: var(--rosa); color: #fff; padding: 10px 16px; font-size: 24px; box-shadow: 0 0 0 3px var(--escuro); text-align: center; }
.controles-toque { position: absolute; right: 14px; bottom: max(16px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: auto auto; gap: 10px; align-items: end; }
.bt-toque { appearance: none; border: 0; min-width: 64px; min-height: 64px; font-size: 24px; color: var(--escuro); background: var(--creme); box-shadow: 0 0 0 3px var(--escuro), inset -3px -3px 0 #c9b79c; cursor: pointer; display: grid; place-items: center; line-height: 1; }
.bt-toque small { font-size: 11px; display: block; }
.bt-toque.ativo { background: var(--agua); }
.bt-foto { grid-row: span 2; width: 92px; height: 92px; border-radius: 50%; background: var(--rosa); box-shadow: 0 0 0 4px var(--escuro), inset -4px -4px 0 #b44c78; }
.bt-foto span { width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px var(--escuro); }
.bt-foto:disabled { opacity: 0.5; }
.bt-item { background: var(--amarelo); }
.encerrar { position: absolute; right: 14px; top: 70px; }

/* hub */
.hub-titulo { background: var(--painel); padding: 6px 12px; box-shadow: 0 0 0 3px var(--escuro), inset 0 0 0 2px var(--borda); display: flex; flex-direction: column; }
.hub-titulo small { font-size: 13px; opacity: 0.85; }
.hud-topo .hub-titulo { margin-right: auto; }
.hub-prompt { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); width: min(520px, 92vw); text-align: center; background: var(--painel); padding: 10px 14px; font-size: 18px; box-shadow: 0 0 0 3px var(--escuro), inset 0 0 0 2px var(--agua); }
.hub-prompt small { display: block; font-size: 14px; opacity: 0.85; margin-top: 4px; }
.controles-hub { position: absolute; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 14px; }
.bt-entrar { min-width: 120px; font-size: 20px; background: var(--rosa); color: #fff; }

/* revelação */
.rev-lista { display: grid; gap: 12px; margin-top: 10px; }
.rev-assunto { background: rgba(255,255,255,0.05); padding: 8px; box-shadow: 0 0 0 2px var(--escuro); }
.rev-assunto h3 { font-size: 18px; margin: 0 0 6px; }
.rev-fotos { display: flex; gap: 8px; overflow-x: auto; padding: 4px; }
.rev-foto { appearance: none; border: 0; padding: 4px; background: var(--creme); color: var(--escuro); cursor: pointer; box-shadow: 0 0 0 3px var(--escuro); font-size: 12px; min-width: 110px; text-align: left; }
.rev-foto img { width: 104px; height: 78px; display: block; image-rendering: pixelated; }
.rev-foto[aria-pressed="true"] { background: var(--amarelo); box-shadow: 0 0 0 3px var(--escuro), 0 0 0 6px var(--rosa); }
.rev-foto .r { display: block; margin-top: 3px; }
.rev-vazio { opacity: 0.8; }

/* curadora */
.curadoria { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
.curadora-lado { text-align: center; }
#curadoraCanvas { width: 128px; height: 192px; image-rendering: pixelated; }
.nome { margin: 4px 0 0; font-size: 18px; }
.nome small { font-size: 11px; opacity: 0.8; }
.foto-grande { position: relative; background: var(--creme); padding: 6px; box-shadow: 0 0 0 3px var(--escuro); width: fit-content; }
.foto-grande img { width: min(320px, 70vw); aspect-ratio: 4 / 3; display: block; image-rendering: pixelated; background: #222; }
.selo { position: absolute; right: -8px; top: -10px; padding: 4px 8px; font-size: 15px; box-shadow: 0 0 0 3px var(--escuro); transform: rotate(6deg); }
.selo.momento { background: var(--amarelo); color: var(--escuro); }
.selo.pose { background: var(--creme); color: var(--escuro); }
.selo.comum, .selo.dormindo { background: #9a8c9c; color: var(--escuro); }
.conta { border-collapse: collapse; font-size: 17px; margin: 8px 0; }
.conta td { padding: 2px 10px 2px 0; }
.conta td:last-child { text-align: right; color: var(--amarelo); }
.conta tr.total td { border-top: 3px solid var(--creme); font-size: 22px; padding-top: 4px; }
.conta tr.mult td:last-child { color: var(--rosa); }
.fala { background: var(--creme); color: var(--escuro); padding: 8px 12px; font-size: 17px; position: relative; box-shadow: 0 0 0 3px var(--escuro); }

/* resultado */
.total { font-size: 40px; margin: 6px 0; color: var(--amarelo); text-shadow: 3px 3px 0 var(--escuro); }
.novidades { list-style: none; padding: 0; margin: 8px 0; font-size: 16px; }
.novidades li { padding: 3px 0; }

/* álbum */
.abas { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.aba { font-size: 16px; }
.aba[aria-selected="true"] { background: var(--amarelo); }
.pagina { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; background: #f3e5c8; color: var(--escuro); padding: 14px; box-shadow: 0 0 0 3px var(--escuro), inset 0 0 0 6px #e2cfa8; min-height: 220px; }
.slot { background: #fff8ea; padding: 6px; box-shadow: 0 0 0 2px var(--escuro); font-size: 13px; transform: rotate(-1deg); }
.slot:nth-child(2n) { transform: rotate(1.2deg); }
.slot .img { width: 100%; aspect-ratio: 4 / 3; background: #3a2a36 center / cover no-repeat; image-rendering: pixelated; display: grid; place-items: center; color: #d9c7b0; font-size: 34px; }
.slot b { display: block; margin-top: 4px; font-size: 14px; }
.slot .sel { display: inline-block; margin-top: 3px; padding: 1px 5px; box-shadow: 0 0 0 2px var(--escuro); }
.slot .sel.momento { background: var(--amarelo); }
.slot .sel.pose { background: #fff; }
.slot .sel.comum, .slot .sel.dormindo { background: #cdbfcf; }
.slot.vazio { opacity: 0.85; }
.slot.vazio .dica { font-style: italic; opacity: 0.8; }
.pagina .emBreve { grid-column: 1 / -1; text-align: center; font-size: 18px; padding: 30px; }

.opcoes { border: 0; padding: 0; margin: 14px 0 0; }
.opcoes legend { font-size: 15px; color: var(--agua); margin-top: 8px; float: left; width: 100%; }
.presets { display: flex; flex-wrap: wrap; clear: both; }
.volume { display: flex; gap: 8px; align-items: center; font-size: 17px; clear: both; padding: 6px 4px; }
.volume input { width: 180px; accent-color: var(--rosa); }

.carregando { position: absolute; inset: 0; display: grid; place-items: center; background: #1a0e16; font-size: 22px; }

@media (max-width: 600px) {
  .painel { padding: 16px 14px; }
  .curadoria { grid-template-columns: 1fr; }
  .curadora-lado { display: flex; align-items: center; gap: 10px; text-align: left; }
  #curadoraCanvas { width: 64px; height: 96px; }
  .tutorial { top: 64px; font-size: 16px; }
  .polaroide { width: 96px; font-size: 10px; }
  .polaroide img { width: 86px; height: 64px; }
  .filme { font-size: 18px; }
  .hub-prompt { bottom: 104px; font-size: 16px; }
  .linha { font-size: 16px; }
  h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .tag.momento { animation: none; }
}
