/* Venti Experience — interface por cima do jogo. Cores do DataLab (verde/turquesa neon no escuro). */
:root {
  --bg: #07080d;
  --panel: rgba(13, 15, 20, 0.92);
  --line: #262b33;
  --text: #e6e8ec;
  --dim: #8a919c;
  --ok: #7ee0a1;
  --breeze: #a0c3ec;
  --warn: #ff7a17;
  --bad: #f2495c;
  --font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; height: 100vh; height: 100dvh; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); overflow: hidden; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; touch-action: none; }

kbd { display: inline-block; padding: 1px 6px; border: 1px solid #3a414c; border-bottom-width: 2px; border-radius: 4px; background: #14171c; font: 12px var(--font); color: var(--text); }

/* missão */
.mission { position: fixed; top: 16px; left: 16px; width: min(360px, calc(100vw - 32px)); padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 8px; }
.mission h1 { margin: 0 0 4px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--warn); }
.mission p { margin: 0 0 10px; font-size: 13px; }
.mission ol { margin: 0; padding: 0; list-style: none; }
.mission li { position: relative; padding: 3px 0 3px 22px; color: var(--dim); font-size: 13px; }
.mission li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 10px; height: 10px; border: 1px solid #4a515c; border-radius: 2px; }
.mission li.is-ok { color: var(--ok); }
.mission li.is-ok::before { background: var(--ok); border-color: var(--ok); }
.mission.is-done { border-left-color: var(--ok); }
.mission.is-done h1 { color: var(--ok); }
.carry { display: none; margin-top: 8px; padding: 6px 8px; border-radius: 4px; background: #1d2129; color: var(--breeze); font-size: 12px; }
.carry.is-on { display: block; }

.keys { position: fixed; right: 16px; bottom: 16px; /* (embaixo à direita: em cima, tampava a porta das salas) */ max-width: 250px; line-height: 1.8; /* (em 2 linhas: não encosta na dica do meio) */ padding: 6px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--dim); font-size: 12px; }
.held { position: fixed; left: 16px; bottom: 16px; padding: 7px 12px; background: var(--panel); border: 1px solid rgba(242, 229, 154, 0.45); border-radius: 8px; color: #f2e59a; font-size: 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); }
.touch-controls { display: none; }
.mobile-close-panel { display: none; }

/* QR Code "Acesse o jogo": canto de cima à direita (a missão fica à esquerda, as teclas embaixo) */
.game-qr { position: fixed; z-index: 4; top: 16px; right: 16px; display: grid; justify-items: center; gap: 5px; padding: 7px 7px 5px; background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--ok); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); pointer-events: none; user-select: none; -webkit-user-select: none; transition: opacity 0.25s ease, visibility 0.25s; }
.game-qr img { display: block; width: 132px; height: 132px; border-radius: 3px; image-rendering: pixelated; }
.game-qr span { font-size: 10px; line-height: 1.2; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ok); white-space: nowrap; }
/* some no menu, nas cenas de cinema, na troca de mapa, com janela aberta e no carregando; volta sozinho depois */
.menu-on .game-qr, .in-cutscene .game-qr, .map-fade .game-qr,
body:has(.panel.is-open) .game-qr, body:has(.loading:not([hidden])) .game-qr { opacity: 0; visibility: hidden; transition-duration: 0.12s; }
@media (prefers-reduced-motion: reduce) { .game-qr { transition: none; } }
/* QR só no desktop: no celular/tablet (tela estreita ou toque como ponteiro principal) ele não aparece */
@media (max-width: 640px), (pointer: coarse) { .game-qr { display: none; } }

/* dica "E · ..." e mensagens */
.hint, .toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(6px); padding: 7px 12px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); opacity: 0; pointer-events: none; transition: opacity 0.18s ease, transform 0.18s ease; white-space: nowrap; max-width: calc(100vw - 32px); }
.hint { bottom: 20px; background: rgba(13, 15, 20, 0.78); color: var(--dim); font-size: 12px; }
.hint kbd { opacity: 0.8; font-size: 11px; padding: 0 5px; }
.toast { bottom: 72px; }
.hint.is-on, .toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-ok { border-color: var(--ok); color: var(--ok); }
.toast.is-bad { border-color: var(--bad); color: #ffb3bc; white-space: normal; }
.speech-bubble { position: fixed; transform: translate(-50%, calc(-100% - 6px)); padding: 4px 10px; border-radius: 6px; background: #fffdf6; color: #29313b; border: 1.5px solid #29313b; font: 600 12px/1.3 var(--font); white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); z-index: 5; }
.speech-bubble::after { content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #29313b; }
/* balões dos NPCs (engine/baloes.js): texto em px CSS por cima do canvas, posição vinda do mundo */
.npc-baloes { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.npc-balao { left: 0; top: 0; transform: none; width: max-content; max-width: min(220px, calc(100vw - 16px)); padding: 5px 10px; text-align: center; white-space: normal; overflow-wrap: break-word; line-height: 1.3; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; will-change: transform; }
.npc-balao[hidden] { display: none; }
.npc-balao::after { left: var(--tail, 50%); }
.npc-balao[data-lado="baixo"]::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #29313b; }
.npc-balao[data-lado="dir"]::after, .npc-balao[data-lado="esq"]::after { top: var(--tail, 50%); transform: translateY(-50%); border-top-color: transparent; }
.npc-balao[data-lado="dir"]::after { left: auto; right: 100%; border-right-color: #29313b; }
.npc-balao[data-lado="esq"]::after { left: 100%; border-left-color: #29313b; }
.menu-on .npc-baloes, .in-cutscene .npc-baloes, .map-fade .npc-baloes, body:has(.panel.is-open) .npc-baloes { visibility: hidden; }
@media (max-width: 640px), (pointer: coarse) { .npc-balao { max-width: min(200px, calc(100vw - 16px)); font-size: 12.5px; } }

/* missão concluída */
.done { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); pointer-events: none; opacity: 0; transition: opacity 0.4s; }
.done.is-on { opacity: 1; }
.done__box { display: grid; gap: 6px; padding: 22px 34px; text-align: center; background: var(--panel); border: 2px solid var(--ok); border-radius: 10px; box-shadow: 0 0 40px rgba(126, 224, 161, 0.25); }
.done__box strong { font-size: 26px; color: var(--ok); letter-spacing: 0.04em; }
.done__box span { color: var(--dim); }

/* painel do rack */
.panel { position: fixed; z-index: 10; inset: 0; display: none; place-items: center; background: rgba(4, 5, 9, 0.6); padding: 16px; }
.panel.is-open { display: grid; }
.panel__box { width: min(760px, 100%); background: #0b0d11; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.panel__head, .panel__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.panel__head { border-bottom: 1px solid var(--line); }
.panel__foot { border-top: 1px solid var(--line); }
.panel__svg { display: block; width: 100%; height: auto; background: #08090c; }
.panel__msg { color: var(--dim); font-size: 13px; }
.panel__msg .ok { color: var(--ok); }
.panel__msg .bad { color: #ffb3bc; }
.btn { padding: 8px 14px; border: 1px solid var(--ok); border-radius: 6px; background: #12301f; color: var(--ok); font: 13px var(--font); cursor: pointer; white-space: nowrap; }
.btn:disabled { border-color: #3a414c; background: #14171c; color: #5d6573; cursor: not-allowed; }
.btn--ghost { border-color: #3a414c; background: transparent; color: var(--dim); }

.coord-computer { width: min(1200px, 100%); max-height: calc(100vh - 32px); display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.coord-computer__subtitle { display: block; margin-top: 3px; color: var(--dim); font-size: 12px; }
.coord-computer__browserbar { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); background: #10141a; }
.coord-computer__secure { color: var(--ok); font: 11px var(--font); white-space: nowrap; }
.coord-computer__url { flex: 1; min-width: 0; overflow: hidden; padding: 7px 10px; border: 1px solid #303947; border-radius: 5px; background: #080a0e; color: #c6ced8; font: 12px var(--font); text-overflow: ellipsis; white-space: nowrap; }
.coord-computer__screen { min-height: 0; height: min(74vh, 760px); background: #fff; }
.coord-computer__screen iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

/* SVG do rack (estilos do cabling do DataLab, simplificados) */
.rp-small { fill: #8a919c; font: 11px var(--font); }
.rp-name { fill: #e6e8ec; font: bold 13px var(--font); }
.rp-empty { fill: #4a515c; font: 12px var(--font); text-anchor: middle; }
.rp-label { fill: #8a919c; font: 10px var(--font); text-anchor: middle; }
.rp-unit__body { fill: #1a1f27; stroke: #2d3542; }
.rp-port { cursor: pointer; }
.rp-port rect:first-child { fill: #0b0d11; stroke: #4a515c; }
.rp-port:hover rect:first-child { stroke: var(--breeze); }
.rp-port.is-sel rect:first-child { stroke: #fff; stroke-width: 2; }
.rp-port.is-up rect:first-child { stroke: #c98a3c; }
.rp-plug { fill: #6aa7e8; }
.rp-led { fill: #1f4a35; }
.rp-led.is-on { fill: var(--ok); }
.rp-cable { fill: none; stroke-width: 4; stroke-linecap: round; pointer-events: none; }
.rp-cable.is-drag { stroke-dasharray: 6 4; opacity: 0.8; }

@media (max-width: 640px) {
  .coord-computer { max-height: calc(100vh - 16px); }
  .coord-computer__screen { height: 74vh; }
  .coord-computer__browserbar { padding: 7px 9px; }
}

/* cena de abertura: faixas de cinema, legenda do lugar e botão Pular */
.in-cutscene .mission, .in-cutscene .keys, .in-cutscene .hint, .in-cutscene .done { display: none; }
.cutscene { position: fixed; inset: 0; pointer-events: none; }
.cutscene[hidden] { display: none; }
.cutscene::before, .cutscene::after { content: ""; position: absolute; left: 0; right: 0; height: 7vh; background: #000; }
.cutscene::before { top: 0; }
.cutscene::after { bottom: 0; }
.cutscene__skip { position: absolute; top: calc(7vh + 12px); right: 16px; pointer-events: auto; background: rgba(13, 15, 20, 0.7); }
.cutscene__caption { position: absolute; left: 16px; top: calc(7vh + 12px); display: grid; gap: 2px; padding: 10px 14px; border-left: 3px solid var(--warn); background: rgba(13, 15, 20, 0.72); opacity: 0; transform: translateY(6px); }
.cutscene__caption.is-on { animation: cap-in 0.6s ease-out forwards; }
.cutscene__caption b { font-size: 15px; color: #fff; }
.cutscene__caption span { font-size: 12px; color: var(--dim); }
@keyframes cap-in { to { opacity: 1; transform: none; } }

/* terminal do servidor */
.term { width: min(980px, 100%); }
.term__body { display: grid; grid-template-columns: 1fr 280px; min-height: 360px; }
.term__screen { display: flex; flex-direction: column; background: #050608; padding: 12px 14px; font: 13px/1.5 var(--font); min-width: 0; }
.term__out { flex: 1; overflow-y: auto; max-height: 52vh; white-space: pre-wrap; word-break: break-word; color: #c8ccd2; cursor: text; }
.term__out .ok { color: var(--ok); }
.term__out .w { color: #ffb36b; }
.term__out .m { color: #6d7581; }
.term .p { color: var(--ok); }
.term__line { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.term__line input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; caret-color: var(--ok); }
.term__guide { padding: 14px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.term__guide b { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--warn); }
.term__guide ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.term__guide li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; display: grid; gap: 4px; color: var(--dim); font-size: 12px; }
.term__guide li code { color: var(--text); font: 13px var(--font); }
.term__guide li.is-next { border-color: var(--breeze); }
.term__guide li.is-ok { border-color: #1f4a35; color: var(--ok); }
.term__guide li.is-ok code { color: var(--ok); }
.term__guide li.is-ok code::before { content: "✓ "; }
.term__guide small { color: var(--dim); font-size: 11px; }

/* monitoramento (cores do monitor do DataLab, estilo Grafana) */
.mon { width: min(1100px, 100%); background: #111217; color: #ccccdc; }
.mon__bar { background: #181b1f; }
.mon__logo { display: inline-flex; align-items: center; gap: 8px; color: #ccccdc; }
.mon__logo b { font-weight: 400; color: #fff; }
.mon__logo i { width: 14px; height: 14px; border-radius: 3px; background: conic-gradient(#ff9830, #f2495c, #b877d9, #5794f2, #73bf69, #fade2a, #ff9830); }
.mon__range { margin-left: auto; padding: 4px 10px; border: 1px solid rgba(204, 204, 220, 0.15); border-radius: 2px; font-size: 11px; }
.mon__body { max-height: calc(100vh - 120px); overflow-y: auto; padding: 12px; }
.mon__tip { margin-bottom: 10px; padding: 10px 14px; border-left: 3px solid #5794f2; background: rgba(87, 148, 242, 0.08); font-size: 13px; line-height: 19px; }
.mon__tip b { font-weight: 400; color: #fff; }
.mon__tip em { font-style: normal; color: #f2495c; }
.mon__empty { padding: 48px 16px; text-align: center; }
.mon__empty p:last-child { color: #8e8e8e; }
.grow1, .grow2 { display: grid; gap: 8px; margin-bottom: 8px; }
.grow2 { grid-template-columns: 1fr 1fr; }
.gp { display: flex; flex-direction: column; min-width: 0; padding: 8px 10px 10px; border: 1px solid rgba(204, 204, 220, 0.12); border-radius: 2px; background: #181b1f; }
.gp__h { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; }
.gp__i { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 1px solid #5a5f68; border-radius: 50%; font-size: 9px; font-style: normal; color: #8e8e8e; cursor: help; }
.gp__c { display: block; width: 100%; height: 160px; }
.gp__c--tl { height: 60px; }
.gp__empty { padding: 16px 0; text-align: center; color: #73bf69; font-size: 12px; margin: 0; }
.gstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gstat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 2px; background: color-mix(in srgb, var(--c) 14%, #181b1f); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.gstat__l { font-size: 12px; }
.gstat__v { font-weight: 400; font-size: 26px; line-height: 32px; color: var(--c); font-variant-numeric: tabular-nums; }
.gstat__s { font-size: 11px; color: #8e8e8e; }
.glegend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.glegend span { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
.glegend span::before { content: ''; width: 12px; height: 3px; border-radius: 2px; background: var(--c); }
.ztable { width: 100%; border-collapse: collapse; font-size: 12px; }
.ztable th { padding: 6px 8px; text-align: left; font-weight: 400; color: #8e8e8e; border-bottom: 1px solid rgba(204, 204, 220, 0.15); }
.ztable td { padding: 6px 8px; border-bottom: 1px solid rgba(204, 204, 220, 0.07); }

/* quadro de giz interativo */
.quadro { width: min(560px, 100%); }
.quadro__board { padding: 14px; background: #14171d; display: grid; place-items: center; }
.quadro__board canvas { width: 100%; height: auto; border: 6px solid #7a5434; border-radius: 4px; background: #1d2221; cursor: crosshair; touch-action: none; box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45), 0 4px 16px rgba(0, 0, 0, 0.4); }
.quadro__hint { display: none; color: var(--dim); font-size: 11px; }
.quadro__bar { flex-wrap: wrap; gap: 10px; }
.quadro__colors { display: flex; align-items: center; gap: 6px; }
.quadro__swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; background: #1d2221; transition: transform 0.12s; }
.quadro__swatch:hover { transform: scale(1.12); }
.quadro__swatch.is-on { border-color: #fff; transform: scale(1.15); }
.quadro__swatch--erase { border-radius: 4px; background: #2c313a; color: var(--text); font-size: 11px; display: grid; place-items: center; width: 26px; }
.quadro__sign { display: flex; gap: 6px; flex: 1; min-width: 180px; }
.quadro__sign input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #14171c; color: var(--text); font: 12px var(--font); outline: none; }
.quadro__sign input:focus { border-color: var(--breeze); }

/* área de trabalho do notebook */
.nb { width: min(860px, 100%); background: #16181f; border-color: #2d323d; }
.nb__bezel { padding: 12px 14px 14px; background: #101217; }
.nb__cam { width: 6px; height: 6px; margin: 0 auto 8px; border-radius: 50%; background: #262b36; border: 1px solid #394050; }
.nb__screen { border: 1px solid #2a303c; border-radius: 8px; overflow: hidden; background: radial-gradient(circle at 20% 20%, #1d2b4f 0%, #121726 55%, #0c0f18 100%); }
.nb__topbar { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: rgba(9, 11, 16, 0.85); border-bottom: 1px solid rgba(255, 255, 255, 0.08); font-size: 12px; }
.nb__status { margin-left: auto; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
.nb__wifi { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.nb__power { padding: 4px 10px; font-size: 12px; }
.nb__desktop { display: grid; grid-template-columns: 88px 1fr; min-height: 360px; padding: 14px; gap: 14px; }
.nb__icons { display: flex; flex-direction: column; gap: 10px; }
.nb__icon { display: grid; place-items: center; gap: 4px; padding: 8px 4px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); font: 11px var(--font); cursor: pointer; transition: background 0.14s, border-color 0.14s; }
.nb__icon span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: rgba(255, 255, 255, 0.08); font-size: 14px; font-weight: bold; color: var(--breeze); }
.nb__icon:hover { background: rgba(255, 255, 255, 0.06); }
.nb__icon.is-on { background: rgba(160, 195, 236, 0.14); border-color: rgba(160, 195, 236, 0.45); }
.nb__win { display: flex; flex-direction: column; background: rgba(13, 15, 22, 0.94); border: 1px solid #2b3140; border-radius: 8px; overflow: hidden; min-width: 0; }
.nb__whead { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #141822; border-bottom: 1px solid #242a38; font-size: 12px; }
.nb__wbody { flex: 1; padding: 12px; font-size: 13px; overflow: auto; max-height: 340px; }
.nb__code { width: 100%; min-height: 150px; padding: 10px; border: 1px solid #252b38; border-radius: 6px; background: #090b10; color: #c8e1ff; font: 12px/1.5 var(--font); resize: vertical; outline: none; }
.nb__out { margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: #07090d; border: 1px solid #1f2532; color: var(--ok); font: 12px/1.4 var(--font); white-space: pre-wrap; min-height: 44px; }
.nb__termout { min-height: 200px; max-height: 240px; overflow-y: auto; white-space: pre-wrap; color: #c8ccd2; font: 12px/1.5 var(--font); margin-bottom: 8px; }
.nb__notes { width: 100%; min-height: 240px; padding: 10px; border: 1px solid #252b38; border-radius: 6px; background: #0d1017; color: #f2e59a; font: 13px/1.5 var(--font); resize: none; outline: none; }
.nb__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.nb__card { padding: 10px 12px; border-radius: 6px; background: #131722; border: 1px solid #262d3d; }
.nb__card b { display: block; margin-bottom: 4px; color: var(--breeze); font-size: 12px; }
.nb__card p { margin: 0; color: var(--dim); font-size: 12px; }

/* barraca de lanche */
.lanche { width: min(560px, 100%); }
.lanche__body { padding: 14px; }
.lanche__sub { margin: 0 0 12px; color: #f2e59a; font-size: 13px; }
.lanche__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.lanche__item { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #13161e; }
.lanche__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lanche__top b { color: var(--text); font-size: 13px; }
.lanche__price { color: var(--ok); font-size: 12px; font-weight: bold; }
.lanche__item small { color: var(--dim); font-size: 12px; flex: 1; }
.ztable .mono { font-family: var(--font); }
.zsev { display: inline-block; padding: 2px 6px; border-left: 3px solid var(--c); font-size: 11px; }

@media (max-width: 720px) {
  .gstats { grid-template-columns: 1fr 1fr; }
  .grow2 { grid-template-columns: 1fr; }
  .term__body { grid-template-columns: 1fr; }
  .term__guide { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 640px), (pointer: coarse), (any-pointer: coarse) {
  .keys { display: none; }
  .mission { top: calc(8px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); width: min(320px, calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right))); max-height: 27vh; max-height: 27dvh; overflow-y: auto; padding: 10px 12px; }
  .mission p, .mission li { font-size: 12px; }
  .done { top: auto; bottom: calc(120px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }
  .done__box { padding: 16px 18px; }
  .done__box strong { font-size: clamp(18px, 5vw, 26px); }
  .hint { bottom: calc(84px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); white-space: normal; text-align: center; }
  .toast { bottom: calc(196px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); white-space: normal; text-align: center; } /* (acima do joystick/botões; a fala longa quebra a linha) */
  .held { left: 8px; bottom: calc(190px + env(safe-area-inset-bottom)); max-width: calc(100vw - 16px); pointer-events: none; }
  .panel { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .panel__box { max-height: calc(100vh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow: auto; }
  .panel__head, .panel__foot { flex-wrap: wrap; }
}

@media (pointer: coarse), (any-pointer: coarse), (max-width: 640px) {
  .quadro__hint { display: block; }
  .quadro__swatch { min-width: 36px; min-height: 36px; touch-action: manipulation; }
  .quadro__swatch--erase { width: 42px; }
  .mobile-close-panel:not([hidden]) {
    position: fixed;
    z-index: 12;
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid rgba(230, 232, 236, 0.45);
    border-radius: 10px;
    background: rgba(13, 15, 20, 0.94);
    color: var(--text);
    font: 600 13px var(--font);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-close-panel span { font-size: 20px; line-height: 1; }
  .touch-controls {
    --joystick-size: clamp(104px, 30vw, 136px);
    position: fixed;
    z-index: 6;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 max(12px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
  }
  .touch-controls__joystick {
    position: relative;
    width: var(--joystick-size);
    height: var(--joystick-size);
    flex: 0 0 var(--joystick-size);
    border: 1px solid rgba(230, 232, 236, 0.45);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(28, 33, 42, 0.76) 0 42%, rgba(13, 15, 20, 0.82) 43% 100%);
    pointer-events: auto;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }
  .touch-controls__joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 42%;
    height: 42%;
    border: 1px solid rgba(230, 232, 236, 0.65);
    border-radius: 50%;
    background: rgba(91, 112, 137, 0.82);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }
  .touch-controls__action {
    display: grid;
    place-items: center;
    border: 1px solid rgba(230, 232, 236, 0.45);
    border-radius: 12px;
    background: rgba(13, 15, 20, 0.78);
    color: var(--text);
    font: 700 22px/1 var(--font);
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }
  .touch-controls__actions { display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
  .touch-controls__action { min-width: 76px; min-height: 52px; padding: 8px 10px; font-size: 12px; }
  .touch-controls__zoom { display: flex; justify-content: flex-end; gap: 6px; }
  .touch-controls__zoom .touch-controls__action { min-width: 44px; min-height: 40px; padding: 6px; font-size: 20px; }
  .menu-on .touch-controls, .in-cutscene .touch-controls { display: none; }
}

@media (max-height: 420px) and (pointer: coarse), (max-height: 420px) and (any-pointer: coarse) {
  .touch-controls { --joystick-size: 104px; }
  .touch-controls__action { min-height: 44px; }
  .touch-controls__zoom .touch-controls__action { min-height: 36px; }
}

/* Lago (parte 0): botão de som, no canto de baixo (acima da faixa preta do filme) */
.som-btn { position: fixed; left: 16px; bottom: calc(7vh + 12px); z-index: 5; background: rgba(13, 15, 20, 0.7); font-size: 12px; padding: 6px 10px; }
body:not(.in-cutscene) .som-btn { bottom: 16px; }

/* (Venti) tela interna pequena ampliada com pixels nítidos (mapa do lago) */
canvas.is-pixel { image-rendering: pixelated; }
/* carregando (lago) */
.loading { position: fixed; inset: 0; display: grid; place-content: center; gap: 10px; background: #0b0a10; color: #e8dcc8; font: 13px var(--font, monospace); z-index: 40; text-align: center; }
.loading[hidden] { display: none; }
.loading__bar { width: min(320px, 70vw); height: 6px; background: #2a2433; border-radius: 3px; overflow: hidden; }
.loading__bar i { display: block; height: 100%; width: 0; background: #f2a640; transition: width 0.15s; }
/* ?debug=1 no lago: a foto de referência por cima, transparente */
.debug-ref { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0.38; pointer-events: none; z-index: 30; }
.debug-ref[hidden] { display: none; }
.debug-tip { position: fixed; left: 50%; bottom: 4px; transform: translateX(-50%); z-index: 31; padding: 3px 8px; background: rgba(0, 0, 0, 0.75); color: #ffe14a; font: 11px monospace; pointer-events: none; }
