@charset "utf-8";
/* ============================================================
   ASSIMILAÇÃO RPG — MESA VIRTUAL
   Estética tirada do Livro Básico e da Ficha de Infectados:
   pergaminho envelhecido, fitas escuras rasgadas com título em caixa-alta,
   abas cor de ferrugem, bordas de musgo, tinta marrom, veias vermelhas e azul-petróleo.
   Fontes (locais, em vendor/fonts): EB Garamond (texto), Barlow Condensed (títulos, no estilo do DIN do livro),
   Special Elite (máquina de escrever, anotações), Grape Nuts (manuscrito).
   ============================================================ */
@font-face { font-family: 'EB Garamond'; font-weight: 400; font-style: normal; font-display: swap; src: url(vendor/fonts/garamond-400.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 400; font-style: italic; font-display: swap; src: url(vendor/fonts/garamond-400i.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 600; font-style: normal; font-display: swap; src: url(vendor/fonts/garamond-600.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 700; font-style: normal; font-display: swap; src: url(vendor/fonts/garamond-700.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-display: swap; src: url(vendor/fonts/barlow-500.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url(vendor/fonts/barlow-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url(vendor/fonts/barlow-700.woff2) format('woff2'); }
@font-face { font-family: 'Special Elite'; font-weight: 400; font-display: swap; src: url(vendor/fonts/elite-400.woff2) format('woff2'); }
@font-face { font-family: 'Grape Nuts'; font-weight: 400; font-display: swap; src: url(vendor/fonts/grape-400.woff2) format('woff2'); }

:root {
  --papel: #f1e9d2; --papel2: #e6dabb; --papel3: #d5c59c; --papel-claro: #f7f1e0;
  --tinta: #33291f; --tinta2: #5d4e3d; --tinta3: #8a7a64;
  --carvao: #2b2a26; --carvao2: #1b1a17; --carvao3: #403e37;
  --ferrugem: #8a4a22; --ferrugem2: #a9602d; --cobre: #b87a3f;
  --oliva: #7b7a47; --oliva2: #98965c; --musgo: #566236;
  --vinho: #6e2227; --vinho2: #8f3036;
  --petroleo: #1f5f6b; --petroleo2: #2f7f8f; --dado: #2a62a8;
  --ouro: #d9a82f; --linha: #b9a77f;
  --f-texto: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --f-titulo: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  --f-maquina: 'Special Elite', 'Courier New', monospace;
  --f-mao: 'Grape Nuts', 'Segoe Print', cursive;
  --ui: img/ui/;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--carvao2); color: var(--tinta); font-family: var(--f-texto); font-size: 17px; line-height: 1.3; }
.hidden { display: none !important; }
::selection { background: var(--ferrugem2); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: var(--cobre) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--cobre); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- peças reutilizáveis ---------- */
/* superfície de pergaminho */
.papel, #side, #fichaBox, #invBox, #menu, #fajudaBox, #frolarBox, #loginForm {
  background: var(--papel) url(img/ui/papel.jpg) 0 0 / 720px 720px; color: var(--tinta);
}
/* bordas de papel rasgado em cima e embaixo (a máscara soma as duas faixas ao miolo) */
.rasgado, #loginForm, #fichaBox, #invBox, #menu, #fajudaBox, #frolarBox {
  -webkit-mask: url(img/ui/rasga-topo.svg) top left / 240px 14px repeat-x, url(img/ui/rasga-base.svg) bottom left / 240px 14px repeat-x, linear-gradient(#000 0 0) 0 13px / 100% calc(100% - 26px) no-repeat;
          mask: url(img/ui/rasga-topo.svg) top left / 240px 14px repeat-x, url(img/ui/rasga-base.svg) bottom left / 240px 14px repeat-x, linear-gradient(#000 0 0) 0 13px / 100% calc(100% - 26px) no-repeat;
}
/* fita escura rasgada com título */
.fita, #side h3, .menu-head, #fajudaBox h4, #frolarBox h4 {
  position: relative; color: #f2ecdc; font-family: var(--f-titulo); font-weight: 700; text-transform: uppercase; letter-spacing: .09em; text-shadow: 0 1px 0 #0008;
  background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 300px 300px;
  -webkit-mask: url(img/ui/fita.svg) center / 100% 100% no-repeat; mask: url(img/ui/fita.svg) center / 100% 100% no-repeat;
}
/* veia (vinha) separadora */
.veia { height: 22px; background: url(img/ui/veia-vermelha.svg) 0 center / 200px 22px repeat-x; opacity: .85; }
.veia.azul { background-image: url(img/ui/veia-azul.svg); }

input, select, textarea, button { font: inherit; }
input, select, textarea {
  background: rgba(255, 252, 240, .6); color: var(--tinta); border: 1px solid var(--linha); border-radius: 2px; padding: 6px 9px; font-family: var(--f-texto); font-size: 16px;
  box-shadow: inset 0 1px 2px rgba(60, 40, 10, .12);
}
input::placeholder, textarea::placeholder { color: var(--tinta3); font-style: italic; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ferrugem2); outline-offset: 0; background: #fffdf3; }
select option, select optgroup { background: var(--papel-claro); color: var(--tinta); }
input[type=checkbox], input[type=radio] { accent-color: var(--ferrugem); }
button {
  cursor: pointer; border: 0; border-radius: 3px; padding: 8px 14px; background: var(--ferrugem) linear-gradient(#ffffff1f, #0000001f); color: #f8f1df;
  font-family: var(--f-titulo); font-weight: 600; font-size: 16px; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 1px 0 #00000055, inset 0 0 0 1px #ffffff1a;
  transition: background-color .12s, transform .06s, opacity .12s;
}
button:hover { background-color: var(--ferrugem2); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ouro); outline-offset: 2px; }
button.ghost { background: transparent; color: var(--ferrugem); box-shadow: inset 0 0 0 1.5px var(--ferrugem); }
button.ghost:hover { background: #8a4a2218; }
.hint { font-size: 14px; color: var(--tinta2); margin: 0; font-style: italic; }

/* ---------- LOGO ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; color: #f4eedd; text-decoration: none; }
.logo .marca { width: 28px; height: 28px; background: url(img/ui/marca.svg) center / contain no-repeat; flex: none; }
.logo b { font-family: var(--f-titulo); font-weight: 700; letter-spacing: .24em; font-size: 19px; text-shadow: 1.5px 0 #c0392baa, -1.5px 0 #2fb7c9aa; }
.logo small { font-family: var(--f-titulo); font-weight: 500; letter-spacing: .4em; font-size: 11px; opacity: .8; margin-left: -2px; align-self: flex-end; padding-bottom: 3px; }

/* ---------- LOGIN ---------- */
#login {
  position: fixed; inset: 0; display: grid; place-items: center; overflow: auto; padding: 24px 12px;
  background: linear-gradient(#0a0e08cc, #05070488 45%, #0a0e08ee), url(img/ui/capa.jpg) 50% 30% / cover #0b0f09;
}
#loginForm { width: min(92vw, 400px); padding: 34px 32px 38px; display: flex; flex-direction: column; gap: 16px; filter: none; position: relative; }
#loginForm h1 { margin: 0 0 2px; text-align: center; line-height: 1; }
#loginForm h1 .logo { display: flex; flex-direction: column; gap: 6px; color: var(--tinta); }
#loginForm h1 .logo .marca { width: 54px; height: 54px; filter: invert(1) hue-rotate(180deg) brightness(.35); }
#loginForm h1 .logo b { font-size: 34px; letter-spacing: .2em; text-shadow: 2px 0 #c0392b88, -2px 0 #2fb7c988; }
#loginForm h1 .logo small { align-self: center; margin: 0; padding: 0; font-size: 13px; letter-spacing: .6em; color: var(--tinta2); }
#loginForm .sub { text-align: center; font-family: var(--f-maquina); font-size: 13px; color: var(--tinta2); margin: -6px 0 4px; }
#loginForm label { display: flex; flex-direction: column; gap: 4px; font-family: var(--f-titulo); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: 14px; color: var(--ferrugem); }
#loginForm input { background: transparent; border: 0; border-bottom: 2px solid var(--cobre); border-radius: 0; box-shadow: none; font-family: var(--f-maquina); font-size: 17px; padding: 6px 2px; }
#loginForm input:focus { outline: 0; border-bottom-color: var(--vinho); background: #ffffff40; }
#loginForm button { margin-top: 6px; padding: 12px; font-size: 19px; background-color: var(--vinho); letter-spacing: .12em; }
#loginForm button:hover { background-color: var(--vinho2); }
#loginErr { color: var(--vinho); min-height: 20px; line-height: 1.3; margin: 0; text-align: center; font-size: 15px; font-style: italic; }

/* ---------- SALA ---------- */
#room { display: flex; flex-direction: column; height: 100%; --bar: 0px; background: var(--carvao2) url(img/ui/madeira.jpg) 0 0 / 420px 420px; }
#room.has-bar { --bar: 36px; }              /* altura da aba "Cenas" (mestre) */
#room.has-bar.bar-open { --bar: 252px; }    /* aba aberta */
header {
  position: relative; z-index: 12; display: flex; justify-content: space-between; align-items: center; gap: 10px; height: 46px; padding: 0 14px; flex: none;
  background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 300px 300px; color: #f2ecdc;
}
header::after { content: ''; position: absolute; left: 0; right: 0; top: calc(100% - 1px); height: 14px; pointer-events: none; background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 300px 300px;
  -webkit-mask: url(img/ui/rasga-base.svg) left top / 240px 14px repeat-x; mask: url(img/ui/rasga-base.svg) left top / 240px 14px repeat-x; }
header button { padding: 5px 12px; font-size: 15px; }
#hLeft { display: flex; align-items: center; gap: 12px; min-width: 0; }
#hRight { display: flex; gap: 8px; }
#whoami { font-family: var(--f-maquina); font-size: 14px; color: #d9cfb4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gearBtn { background: transparent; padding: 5px 7px; display: grid; place-items: center; line-height: 0; color: #e8dfc6; box-shadow: inset 0 0 0 1.5px #e8dfc666; }
#gearBtn:hover { background: #ffffff1f; }
main { flex: 1; display: flex; min-height: 0; position: relative; z-index: 1; }

/* ---------- MESA (mapa) ---------- */
#stage { flex: 1; position: relative; min-width: 0; overflow: hidden; display: grid; place-items: center; --h: calc(100vh - 46px - var(--bar, 0px));
  background: radial-gradient(ellipse at 50% 45%, #0000 40%, #000a 100%), #000; }
/* --arn = largura/altura do mapa atual (o app.js ajusta quando a cena muda) */
#board { --arn: 0.9624; position: relative; width: min(100%, calc(var(--h) * var(--arn))); aspect-ratio: var(--arn); container-type: inline-size; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }

/* ASSENTOS */
.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: .5cqw; width: 12cqw; text-align: center; z-index: 4; }
.seat.master { width: 15cqw; }
.seat.spectator { width: 8cqw; opacity: .85; }
.portrait { width: calc(100% * var(--ts, 1)); flex: none; aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 0; background: radial-gradient(circle, #3a3126, #12100c); display: grid; place-items: center; position: relative; }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; transform: scale(1.35); transform-origin: 50% 22%; }
.portrait .ini { font-family: var(--f-titulo); font-size: 4.4cqw; font-weight: 700; color: var(--c); }
.seat.master .portrait { border-radius: 18px; aspect-ratio: 1.15; }
/* plaquinha de nome: etiqueta de papel */
.pname { font-family: var(--f-titulo); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: max(10px, 1.7cqw); line-height: 1.15; padding: .1cqw 1.2cqw; color: var(--tinta);
  background: var(--papel) url(img/ui/papel.jpg) 0 0 / 200px; border: 1px solid #00000055; border-bottom-width: 2px; border-radius: 1px; box-shadow: 0 .3cqw .6cqw #000a; border-top: 2px solid var(--c, var(--cobre)); }
.role { font-family: var(--f-maquina); font-size: max(8px, 1.2cqw); color: #f2ecdc; text-shadow: 0 1px 2px #000; }
.hpbar { width: 100%; height: max(7px, 1.3cqw); background: #1d130d; border-radius: 1px; overflow: hidden; border: 1px solid #000; box-shadow: 0 0 0 1px #f1e9d255, 0 .3cqw .5cqw #000a; position: relative; }
.hpfill { height: 100%; background: linear-gradient(var(--hp1, #98965c), var(--hp2, #7b7a47)); transition: width .4s; }
.hpfill.n6 { --hp1: #98965c; --hp2: #6e6d3c; } .hpfill.n5 { --hp1: #a4a064; --hp2: #7f7c46; } .hpfill.n4 { --hp1: #c0884e; --hp2: #a56a3c; }
.hpfill.n3 { --hp1: #b4642e; --hp2: #8a4a22; } .hpfill.n2 { --hp1: #9a3a3f; --hp2: #6e2227; } .hpfill.n1 { --hp1: #7a2429; --hp2: #4d1418; }
.hptxt { font-family: var(--f-maquina); font-size: max(9px, 1.4cqw); color: #f6eed7; background: #1b1a17dd; padding: 0 .8cqw; border-radius: 1px; }
.hpniv { font-family: var(--f-titulo); letter-spacing: .08em; text-transform: uppercase; font-size: max(8px, 1.15cqw); color: #e9b9b0; background: #1b1a17dd; padding: 0 .7cqw; border-radius: 1px; }
.bubble { position: absolute; top: -3cqw; font-family: var(--f-titulo); font-size: 2.3cqw; left: 50%; transform: translateX(-50%); background: var(--ouro); color: #2a1d08; font-weight: 700; padding: 1px 11px; border-radius: 2px; border: 1px solid #5a3f08; white-space: nowrap; z-index: 5; animation: tumble .5s ease-out; box-shadow: 0 2px 6px #000a; }
.dead .portrait { filter: grayscale(1) brightness(.5); }

/* tokens arrastáveis */
.seat.movable .portrait { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.seat.movable .portrait img { pointer-events: none; -webkit-user-drag: none; }
.seat.dragging { z-index: 20; }
.seat.dragging .portrait { cursor: grabbing; transform: scale(1.08); }
.seat.sel { z-index: 25; }
.seat.spectator.sprt { width: 12cqw; }

/* barra do token: poses + tamanho */
.tbar { position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: max(12px, 1.5cqw); }
.tsz, .tpose { display: flex; align-items: center; gap: 4px; background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 200px; border: 1px solid #00000099; border-radius: 3px; padding: 3px 6px; white-space: nowrap; box-shadow: 0 4px 14px #000a; color: #f2ecdc; }
.tbar .tsz { position: static; }
.tsz span { min-width: 3.2em; font-family: var(--f-maquina); text-align: center; }
.tsz button { min-width: 1.9em; height: 1.9em; padding: 0; border-radius: 2px; font-size: 1.05em; line-height: 1; }
.tpose { gap: 3px; padding: 3px 5px; }
.tpose button { padding: .15em .7em; font-size: .88em; border-radius: 2px; background: #ffffff1a; box-shadow: none; font-weight: 600; }
.tpose button:hover { background: #ffffff33; }
.tpose button.on { background: var(--ferrugem2); }

/* painel de cena e zoom */
#sceneChip { position: absolute; left: 10px; top: 20px; z-index: 6; background: var(--papel) url(img/ui/papel.jpg) 0 0 / 240px; border: 1px solid #000a; border-left: 5px solid var(--ferrugem); border-radius: 1px; padding: 3px 12px; font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; font-size: 15px; color: var(--tinta); box-shadow: 0 3px 10px #000a; pointer-events: auto; }
#sceneChip button { margin-left: 8px; padding: 2px 10px; font-size: 13px; }
#stage { touch-action: none; user-select: none; -webkit-user-select: none; }
#stage.zoomed { cursor: grab; }
#stage.panning { cursor: grabbing; }
/* NÃO usar will-change: transform aqui: faz o navegador esticar um bitmap congelado e o zoom fica borrado */
#board { transform-origin: 50% 50%; }
#zoomCtl { position: absolute; right: 10px; bottom: 10px; z-index: 8; display: flex; flex-direction: column; align-items: center; gap: 5px; }
#zoomCtl button { width: 36px; height: 36px; padding: 0; font-size: 22px; line-height: 1; background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 200px; border: 1px solid #000; box-shadow: 0 2px 8px #000a; color: #f2ecdc; font-family: var(--f-titulo); }
#zoomCtl button:hover { background-color: var(--carvao3); }
#zPct { font-family: var(--f-maquina); font-size: 11px; color: #f2ecdc; background: #1b1a17cc; border-radius: 2px; padding: 1px 6px; }

/* rota / distância / caminhada dos tokens */
#route { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
#route polyline { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
#route .aim { stroke: #f3dfa0; stroke-width: 3; stroke-dasharray: 9 7; filter: drop-shadow(0 0 2px #000); }
#route .wk { stroke: var(--c, #fff); stroke-width: 3; stroke-dasharray: 2 9; opacity: .9; filter: drop-shadow(0 0 2px #000); }
#route .dot { stroke: #f3dfa0; stroke-width: 11; filter: drop-shadow(0 0 2px #000); }
#route .dot.start { stroke: #f1e9d2; stroke-width: 7; }
#route .dot.end { stroke: var(--ouro); stroke-width: 15; }
#routeLbl { position: absolute; z-index: 30; transform: translate(-50%, -150%) scale(calc(1 / var(--z, 1))); pointer-events: none; white-space: nowrap; text-align: center;
  background: var(--papel) url(img/ui/papel.jpg) 0 0 / 220px; border: 1px solid #000a; border-top: 3px solid var(--ferrugem); color: var(--tinta); font: 700 17px var(--f-titulo); letter-spacing: .06em; padding: 1px 11px; border-radius: 1px; box-shadow: 0 3px 10px #000a; }
#routeLbl.below { transform: translate(-50%, 55%) scale(calc(1 / var(--z, 1))); }
#routeLbl small { display: block; font: 400 12px var(--f-maquina); letter-spacing: 0; color: var(--tinta2); }

/* ---------- PAINEL LATERAL (pergaminho) ---------- */
#side { position: relative; width: 322px; display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 12px 20px; min-height: 0; flex: none; overflow: hidden;
  box-shadow: inset 0 0 38px 4px #8a6f3a55, -6px 0 18px #0009; }
#side::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; z-index: 2; pointer-events: none;
  background: var(--oliva) linear-gradient(90deg, #5d5d34, #8d8b52); -webkit-mask: url(img/ui/rasga-faixa.svg) left top / 12px 240px repeat-y; mask: url(img/ui/rasga-faixa.svg) left top / 12px 240px repeat-y; }
#side h3 { margin: 0 -8px 8px; padding: 6px 14px; font-size: 21px; text-align: center; line-height: 1.1; }
#dicePanel { display: flex; flex-direction: column; gap: 8px; }
#logPanel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#log { list-style: none; margin: 0; padding: 0 2px 0 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column-reverse; gap: 7px; }
#log li { font-size: 15px; line-height: 1.25; background: #fffaf033; padding: 5px 9px 6px; border: 1px solid #b9a77f99; border-left: 4px solid var(--c, var(--tinta3)); border-radius: 1px; }
#log li b { font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .07em; font-size: 16px; }
#log li i { color: var(--tinta2); }
#log li.sys { color: var(--vinho); font-style: italic; border-left-color: var(--vinho); background: #6e22270d; font-size: 14.5px; }
#log .t { color: var(--tinta3); font-family: var(--f-maquina); font-size: 11px; }
.pkbtn { margin-top: 4px; padding: 3px 10px !important; font-size: 13px !important; background-color: var(--vinho) !important; }

/* seletor de dados */
#counter { display: flex; align-items: center; justify-content: center; gap: 10px; visibility: hidden; }
#counter.on { visibility: visible; }
#counter button { padding: 2px 12px; }
#cNum { min-width: 28px; text-align: center; font-family: var(--f-titulo); font-weight: 700; font-size: 22px; }
#pool { display: flex; gap: 8px; justify-content: center; }
.pcard { flex: 1; max-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 4px 7px; background: #fffaf040 !important; border: 1.5px dashed var(--linha); border-radius: 2px; color: var(--tinta); box-shadow: none; text-transform: none; }
.pcard:hover { background: #fffaf080 !important; border-color: var(--ferrugem2); }
.pcard.sel { background: #8a4a2220 !important; border: 1.5px solid var(--ferrugem); }
.pcard .dd { --s: 42px; animation: none; filter: drop-shadow(0 2px 2px #0006); }
.pcard .dd .dface { animation: none; }
.pcard small { font-family: var(--f-titulo); font-size: 15px; letter-spacing: .08em; font-weight: 600; }
.pcard .badge { font-family: var(--f-maquina); font-size: 12px; background: var(--carvao); color: #f2ecdc; border-radius: 2px; padding: 0 8px; }
#dNote { font-family: var(--f-maquina); font-size: 14px; }
#rollBtn { background-color: var(--vinho); padding: 11px; font-size: 21px; letter-spacing: .16em; }
#rollBtn:hover { background-color: var(--vinho2); }

@media (max-width: 800px) {
  main { flex-direction: column; }
  #side { width: 100%; max-height: 42vh; flex-direction: row; padding: 12px; box-shadow: inset 0 0 30px 3px #8a6f3a55; }
  #side::before { display: none; }
  #side > div { flex: 1; min-width: 0; }
  #stage { min-height: 56vh; --h: 56vh; }
  .logo b { letter-spacing: .14em; font-size: 16px; } .logo small { display: none; }
  #whoami { max-width: 34vw; }
}

/* ===== RESULTADO DA ROLAGEM (cartão em cima do mapa) ===== */
#rollShow { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; width: 40cqw; max-height: 50cqw; overflow: auto;
  background: var(--papel) url(img/ui/papel.jpg) 0 0 / 300px; border: .15cqw solid #000b; border-top: .6cqw solid var(--ferrugem); border-radius: .3cqw; padding: 1.4cqw 2cqw 1.6cqw; text-align: center; box-shadow: 0 1cqw 4cqw #000d; pointer-events: auto; color: var(--tinta); font-family: var(--f-texto); }
.rs-head { font-size: 1.9cqw; margin-bottom: .6cqw; padding-right: 3cqw; line-height: 1.2; }
.rs-head b { font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .08em; font-size: 2.2cqw; }
.rs-lbl { font-family: var(--f-maquina); font-size: 1.6cqw; color: var(--ferrugem); font-weight: 400; }
.rs-x { position: absolute; top: .6cqw; right: .8cqw; background: transparent; color: var(--tinta2); font-size: 2.8cqw; line-height: 1; padding: .1cqw .8cqw; box-shadow: none; }
.rs-x:hover { background: #0001; color: var(--vinho); }
.rdiv { display: flex; align-items: center; gap: 1cqw; margin: 1.2cqw 0 .8cqw; color: var(--ferrugem); font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .12em; font-size: 1.6cqw; font-weight: 700; }
.rdiv::before, .rdiv::after { content: ''; flex: 1; height: 1px; background: var(--linha); }
.rgrid { display: flex; flex-wrap: wrap; gap: 1.4cqw; justify-content: center; }
.rs-tally { margin-top: 1.4cqw; font-family: var(--f-maquina); font-size: 1.9cqw; color: var(--vinho); }
#rollShow.rs-top { top: 2.2cqw; transform: translateX(-50%); width: auto; max-width: 78cqw; min-width: 30cqw; padding: .9cqw 4.6cqw .9cqw 2.4cqw; }
#rollShow.rs-top .rs-head { margin: 0; padding-right: 0; }
#rollShow.rs-top .rs-tally { margin-top: .3cqw; }
.rs-pick { display: flex; align-items: center; justify-content: center; gap: 1.4cqw; margin-top: .8cqw; font-size: 1.8cqw; color: var(--tinta2); font-style: italic; }
.rs-pick button { font-size: 1.9cqw; padding: .4cqw 2cqw; }
.rs-res { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2cqw; margin-top: .9cqw; }
.rchip { display: flex; align-items: center; gap: .6cqw; background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 200px; color: #f2ecdc; border: .12cqw solid #000; border-radius: .3cqw; padding: .3cqw 1.3cqw .3cqw .8cqw; font-size: 1.8cqw; box-shadow: 0 .2cqw .5cqw #0006; }
.rchip .ico { width: 3cqw; height: 3cqw; filter: drop-shadow(0 0 .3cqw #fff6); } .rchip .ico .eye { fill: var(--carvao); }
.rchip b { font-family: var(--f-titulo); font-size: 3.1cqw; color: var(--ouro); line-height: 1; }
.rchip small { font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .08em; color: #d9cfb4; font-size: 1.6cqw; }
.rchip.pressao { background-color: var(--vinho); } .rchip.pressao b { color: #ffd9cf; }
.rchip.adaptacao { background-color: var(--musgo); }
.rchip.zero { opacity: .4; }
.rchip.sucesso .ico { fill: #ffe27a; } .rchip.adaptacao .ico { fill: #c9f2a4; } .rchip.pressao .ico { fill: #ffb4a2; }
.rs-faces { gap: .8cqw; margin: .6cqw 0 .2cqw; }
#rollShow .rs-faces .dd { --s: 5.2cqw; animation: none; }
#rollShow .rs-faces .dd .dface { animation: none; }
#rollShow.rs-top .rs-faces .dd { --s: 4.4cqw; }
.rs-res + p, #rollShow p { margin: .5cqw 0 0; font-size: 1.6cqw; color: var(--tinta2); font-style: italic; }
#rollShow p.ruimtxt { color: var(--vinho); }
.pks { margin: .6cqw 0; }
.pk { background: transparent !important; padding: .35cqw !important; border-radius: .6cqw; border: .25cqw solid transparent; cursor: pointer; box-shadow: none !important; }
.pk:disabled { cursor: default; opacity: 1; }
.pk.on { border-color: var(--ferrugem); background: #8a4a2222 !important; }
.pk.off { opacity: .32; }

/* ===== DADOS 2D (formas SVG) ===== */
.dd { --s: 6.4cqw; width: var(--s); height: var(--s); position: relative; flex: none; filter: drop-shadow(0 .3cqw .4cqw #0007);
  animation: ddspin .9s cubic-bezier(.2,.7,.3,1) both; animation-delay: calc(var(--i) * 70ms); }
.dd .dshape { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.dd .dface { position: absolute; inset: 0; animation: ddface .35s both; animation-delay: calc(var(--i) * 70ms + 650ms); }
.dicon { position: absolute; transform: translate(-50%, -50%); filter: drop-shadow(0 0 .2cqw #000a); }
.dicon .eye, .dicon.eye { fill: #0b2a55; }
@keyframes ddspin { from { transform: translateY(-6cqw) rotateY(1080deg) scale(.35); opacity: 0; } 15% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes ddface { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes tumble { from { transform: translateY(-40px) rotate(-540deg) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.mini { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; align-items: center; }
.mini .dd { --s: 28px; animation: none; filter: none; }
.mini .dd .dface { animation: none; }
.mini .mk { display: inline-block; border-radius: 4px; }
.mini .mk.on { outline: 2px solid var(--ferrugem); outline-offset: 1px; }
.mini .mk.off { opacity: .4; }
/* dados 3D: canvas transparente por cima do tabuleiro (o dice3d.js posiciona e dimensiona) */
#dice3d { position: absolute; z-index: 7; pointer-events: none; }

/* ===== JANELAS (menu, inventário, ficha, ajuda, rolagem) ===== */
#menu { position: absolute; top: 56px; left: 8px; width: 304px; z-index: 50; padding: 22px 20px 26px; box-shadow: none; filter: drop-shadow(0 10px 26px #000c); }
.menu-head { display: flex; justify-content: space-between; align-items: center; margin: 0 -8px 10px; padding: 5px 14px; font-size: 20px; }
.menu-head b { font-weight: 700; }
.menu-head button { background: transparent; box-shadow: none; font-size: 26px; line-height: 1; padding: 0 8px; color: #f2ecdc; }
.menu-head button:hover { background: #fff2; }
#menu h4 { margin: 12px 0 2px; font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .1em; font-size: 16px; color: var(--ferrugem); border-bottom: 1px solid var(--linha); }
#avPreviewWrap { width: 130px; height: 130px; margin: 10px auto; border-radius: 50%; overflow: hidden; border: 3px solid var(--carvao); background: radial-gradient(circle, #3a3126, #12100c); display: grid; place-items: center; position: relative; box-shadow: 0 3px 8px #0006; }
#avPreviewWrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; transform: scale(1.35); transform-origin: 50% 22%; }
#avIni { font-family: var(--f-titulo); font-size: 48px; font-weight: 700; color: var(--cobre); }
.menu-btns { display: flex; flex-direction: column; gap: 8px; }
.menu-btns .ghost { background: transparent; }
#avMsg { min-height: 18px; margin: 8px 0 0; font-size: 14px; color: var(--ferrugem); text-align: center; font-style: italic; }
#invModal, #fichaModal { position: fixed; inset: 0; z-index: 60; background: radial-gradient(ellipse at center, #0008, #000d); display: grid; place-items: center; padding: 10px; }
#fajuda, #frolar { position: fixed; inset: 0; z-index: 70; background: #000b; display: grid; place-items: center; padding: 12px; }
#frolar { z-index: 65; }
#invBox { width: min(100%, 460px); max-height: 94vh; overflow: auto; padding: 22px 18px 26px; }
#fichaBox { width: min(100%, 1060px); max-height: 95vh; overflow: auto; padding: 24px 22px 30px; box-shadow: inset 0 0 50px 6px #8a6f3a66; }
#fajudaBox, #frolarBox { position: relative; width: min(100%, 460px); max-height: 90vh; overflow: auto; padding: 26px 22px 30px; }
#fajudaBox h4, #frolarBox h4 { margin: 0 -8px 10px; padding: 6px 40px 6px 16px; font-size: 21px; display: flex; align-items: center; gap: 8px; }
#fajudaBox p { margin: 7px 0; font-size: 17px; line-height: 1.4; }
#fajudaBox .fpag { font-family: var(--f-maquina); font-size: 12.5px; color: var(--tinta2); margin-top: 12px; }
.fx { position: absolute; top: 14px; right: 16px; background: transparent !important; color: #f2ecdc; font-size: 24px; line-height: 1; padding: 0 8px !important; box-shadow: none !important; z-index: 2; }
#invBox h4, .invblock h4 { margin: 12px 0 6px; font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .1em; font-size: 16px; color: var(--ferrugem); }
#invTabs, #fichaTabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.itab { background: transparent; color: var(--ferrugem); box-shadow: inset 0 0 0 1.5px var(--ferrugem); padding: 4px 12px; font-size: 15px; }
.itab:hover { background: #8a4a2214; }
.itab.on { background: var(--ferrugem); color: #f8f1df; }
.invgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.islot { position: relative; min-height: 84px; padding: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: #fffaf033; border: 1.5px dashed var(--linha); border-radius: 2px; color: var(--tinta);
  font-family: var(--f-texto); text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 16px; text-align: center; overflow: hidden; box-shadow: none; }
.islot:hover { background: #fffaf080; }
.invgrid.q .islot { border-color: var(--cobre); }
.islot.full { border-style: solid; border-color: var(--ferrugem); background: #fffaf0aa; cursor: grab; }
.islot.sel { outline: 2px solid var(--ouro); }
.islot.over { outline: 2px dashed var(--vinho); background: #6e22271a; }
.islot .sn { position: absolute; top: 3px; left: 6px; font-family: var(--f-maquina); font-size: 10px; color: var(--tinta3); }
.islot .iname { word-break: break-word; line-height: 1.1; font-weight: 600; }
.islot .iqty { position: absolute; bottom: 3px; right: 5px; background: var(--carvao); border-radius: 2px; padding: 0 6px; font-family: var(--f-maquina); font-size: 12px; color: var(--ouro); }
.islot .iempty { color: var(--tinta3); font-size: 14px; font-style: italic; }
.invform { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--linha); }
.irow { display: flex; gap: 8px; }
.irow input[type=number] { width: 64px; flex: none; }
.irow input, .irow select { min-width: 0; flex: 1; }
.irow button { padding: 6px 12px; }
.invblock .invform textarea.iNote { flex: 1; min-width: 0; }

/* ===== CENAS (mestre) ===== */
#scenesBar { flex: none; position: relative; z-index: 11; background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 300px; border-top: 2px solid #000; }
#scenesTab { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 36px; padding: 0 16px; border-radius: 0; background: transparent; box-shadow: none; color: #f2ecdc; font-size: 17px; letter-spacing: .18em; }
#scenesTab:hover { background: #ffffff14; }
#scenesPanel { height: 216px; display: flex; gap: 12px; padding: 10px 14px; overflow-x: auto; align-items: stretch; background: var(--madeira, #20160f) url(img/ui/madeira.jpg) 0 0 / 420px; }
#scenesList { display: flex; gap: 10px; }
.scard { position: relative; width: 156px; flex: none; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--papel) url(img/ui/papel.jpg) 0 0 / 280px; border: 1px solid #000a; border-radius: 1px; cursor: pointer; box-shadow: 0 3px 8px #0009; color: var(--tinta); }
.scard:hover { outline: 2px solid var(--cobre); }
.scard.active { border-top: 4px solid var(--musgo); }
.scard.viewing { outline: 2px solid var(--ferrugem); }
.sthumb { width: 100%; height: 72px; object-fit: cover; border-radius: 1px; background: #000; display: block; border: 1px solid #0007; }
.sname { font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .06em; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbadge { position: absolute; top: 10px; left: 10px; font-family: var(--f-maquina); font-size: 11px; background: var(--musgo); color: #f6f0dc; border-radius: 1px; padding: 0 7px; }
.shint { font-size: 13px; color: var(--tinta2); font-style: italic; }
.scard.viewing .shint { color: var(--ferrugem); font-weight: 600; }
.sbtns { display: flex; gap: 6px; margin-top: auto; }
.sbtns button { padding: 3px 8px; font-size: 13px; }
.sbtns .sgo { flex: 1; }
.sbtns .sdel { background-color: var(--vinho); }
#sceneForm, #scaleBox { flex: none; width: 214px; display: flex; flex-direction: column; gap: 6px; padding: 9px 10px; background: var(--papel) url(img/ui/papel.jpg) 0 0 / 280px; border: 1px dashed var(--ferrugem); border-radius: 1px; color: var(--tinta); box-shadow: 0 3px 8px #0009; }
#sceneForm b, #scaleBox b { font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .1em; font-size: 17px; color: var(--ferrugem); }
#scaleBox input, #sceneForm input[type=text], #sceneForm #sName { width: 100%; padding: 4px 8px; margin-top: 2px; }
#scaleBox button, #sceneForm button { padding: 5px 10px; font-size: 14px; }
#sPreview { width: 100%; height: 40px; object-fit: cover; border-radius: 1px; }
#toast { position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 80; background: var(--papel) url(img/ui/papel.jpg) 0 0 / 240px; border: 1px solid #000; border-left: 6px solid var(--ferrugem); color: var(--tinta); padding: 9px 18px; border-radius: 1px; box-shadow: 0 6px 26px #000c; font-size: 17px; max-width: 90vw; }

/* ===== FICHA DE INFECTADOS (no desenho da ficha do livro) ===== */
.fbarra { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
button.grande { padding: 9px 20px; font-size: 18px; letter-spacing: .1em; }
.fmodo { font-family: var(--f-maquina); font-size: 13px; color: var(--tinta2); }
.fmodo.cria { color: var(--vinho); }
.fgrid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
@media (min-width: 860px) { .fgrid { grid-template-columns: 1fr 1fr; } }
.fcoluna { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.fsec { background: #fffaf025; border: 1px solid #b9a77f88; border-radius: 1px; padding: 10px 14px 12px; min-width: 0; position: relative; }
.fsec h3 { margin: 0 0 8px; font-family: var(--f-titulo); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 26px; line-height: 1.1; color: var(--tinta2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 4px; border-bottom: 2px solid var(--cobre); }
/* abas de categoria (Instintos / Conhecimentos / Práticas), como na ficha */
.fsec h4 { margin: 12px 0 4px; padding: 3px 10px; font-family: var(--f-titulo); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: 16px; color: #f6efdc; display: flex; align-items: center; gap: 8px; background: var(--ferrugem) linear-gradient(#ffffff22, #0003); }
.fsec h4::before { content: '◆'; font-size: 11px; opacity: .8; }
.fdica { margin: 4px 0; font-size: 14.5px; color: var(--tinta2); font-style: italic; }
.fq { width: 19px; height: 19px; min-width: 19px; padding: 0; border-radius: 50%; background: transparent; color: var(--ferrugem); box-shadow: inset 0 0 0 1.5px var(--ferrugem); font-family: var(--f-texto); font-size: 13px; font-weight: 700; line-height: 19px; text-align: center; letter-spacing: 0; }
.fsec h4 .fq { color: #f6efdc; box-shadow: inset 0 0 0 1.5px #f6efdcaa; }
.fq:hover { background: var(--ferrugem); color: #fff; }
.fl { display: flex; flex-direction: column; gap: 3px; margin: 7px 0; font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; font-size: 14px; color: var(--ferrugem); }
.fl input, .fl select, .fl textarea, .fsec select, .fsec textarea, .fsec input[type=number] { width: 100%; text-transform: none; letter-spacing: 0; font-size: 16px; }
.fl textarea, .fsec textarea { resize: vertical; }
/* campos de linha única viram linhas de caderno, como no "Nome: ____" da ficha */
.fl textarea.one, .fsec textarea.one { background: transparent; border: 0; border-bottom: 1.5px solid var(--cobre); border-radius: 0; box-shadow: none; padding: 3px 2px; font-family: var(--f-maquina); font-size: 15.5px; }
.fl textarea.one:focus, .fsec textarea.one:focus { outline: 0; background: #ffffff55; border-bottom-color: var(--vinho); }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chip { font-family: var(--f-maquina); font-size: 12px; background: #fffaf055; border: 1px solid var(--linha); border-radius: 1px; padding: 1px 9px; color: var(--tinta2); }
.chip.ok { border-color: var(--musgo); color: var(--musgo); background: #56623618; }
/* aptidões: células da tabela da ficha */
.frow { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-bottom: 1px solid #b9a77f77; }
.frow:nth-of-type(odd) { background: #8a4a2210; }
.fn { flex: 1; font-size: 17px; min-width: 90px; font-weight: 600; }
.fctl { display: flex; align-items: center; gap: 6px; }
.fctl button, .fdado { padding: 0; width: 26px; height: 26px; border-radius: 2px; font-size: 17px; line-height: 1; letter-spacing: 0; }
.fctl small { font-size: 8px; display: block; margin-top: -3px; }
.fpips { display: flex; gap: 3px; }
.fpips i { display: block; width: 12px; height: 12px; border: 1.5px solid var(--ferrugem); background: transparent; }
.fpips i.sq { border-radius: 0; }
.fpips i.di { transform: rotate(45deg) scale(.82); }
.fpips i.on { background: var(--ferrugem); }
.fv { width: 14px; text-align: center; font-family: var(--f-maquina); font-size: 14px; }
.fdado { background: transparent; box-shadow: none; font-size: 17px; }
.fdado:hover { background: #8a4a2220; }
/* saúde: os seis níveis nas cores da ficha */
.fvida { margin-left: auto; font-family: var(--f-maquina); font-size: 15px; color: var(--vinho); text-transform: none; letter-spacing: 0; }
.fvida small { color: var(--tinta3); font-weight: 400; }
.fnivel { --nv: var(--oliva); display: grid; grid-template-columns: 26px 100px 1fr; grid-template-areas: "nn nm gt" ". . nt"; gap: 2px 8px; align-items: center; padding: 5px 8px; margin: 3px 0; border: 1px solid transparent; border-left: 6px solid var(--nv); background: #fffaf033; }
.fnivel:nth-of-type(1) { --nv: #6e6d3c; } .fnivel:nth-of-type(2) { --nv: #8e8c52; } .fnivel:nth-of-type(3) { --nv: #a56a3c; }
.fnivel:nth-of-type(4) { --nv: #8a4a22; } .fnivel:nth-of-type(5) { --nv: #6e2227; } .fnivel:nth-of-type(6) { --nv: #4d1418; }
.fnivel .nn { grid-area: nn; text-align: center; font-family: var(--f-titulo); font-size: 20px; color: var(--nv); }
.fnivel .nm { grid-area: nm; font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .06em; font-size: 16px; font-weight: 700; color: var(--nv); }
.fnivel .gotas { grid-area: gt; display: flex; flex-wrap: wrap; gap: 3px; }
.fnivel .nt { grid-area: nt; font-size: 13px; color: var(--tinta2); font-style: italic; }
.fnivel.atual { background: color-mix(in srgb, var(--nv) 18%, transparent); border-color: var(--nv); box-shadow: inset 0 0 0 1px var(--nv); }
.gota { display: block; width: 11px; height: 15px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; border: 1.5px solid var(--nv, var(--vinho)); background: transparent; }
.gota.on { background: var(--nv, var(--vinho)); }
.falerta { margin: 8px 0; padding: 7px 11px; border-radius: 1px; border-left: 5px solid var(--ouro); background: #d9a82f26; color: #5a3f08; font-size: 15.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.falerta.ruim { border-left-color: var(--vinho); background: #6e22271c; color: var(--vinho); }
.fdano, .frec, .fclar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 9px; font-size: 15px; color: var(--tinta2); }
.fdano input[type=number], .frec input[type=number] { width: 64px; }
.fdano label, .frec label { display: flex; align-items: center; gap: 6px; }
.fsec button:not(.fq):not(.fx2):not(.fdado):not(.islot):not(.itab) { padding: 5px 11px; font-size: 14.5px; }
.fsec button.ruim { background-color: var(--vinho); color: #fff1ea; } .fsec button.ruim:hover:not(:disabled) { background-color: var(--vinho2); }
.fsec button.bom { background-color: var(--musgo); } .fsec button.bom:hover:not(:disabled) { background-color: #6a7a42; }
.ruim { color: var(--vinho); }
/* cabo de guerra: veia vermelha (Determinação) contra veia petróleo (Assimilação), como na base da ficha */
.fcabo { margin: 4px 0 12px; }
.fcabo svg { width: 100%; height: auto; display: block; overflow: visible; }
.cabo-lbl { font-family: var(--f-titulo); font-weight: 700; font-size: 38px; letter-spacing: .08em; }
.fcol2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .fcol2 { grid-template-columns: 1fr; } }
.fcol2 h4 { margin-top: 0; }
.fcol2 h4 b { margin-left: auto; font-size: 13px; white-space: nowrap; }
.fdet h4 { background-color: var(--vinho); } .fass h4 { background-color: var(--petroleo); }
.bolas { display: flex; flex-wrap: wrap; gap: 4px; min-height: 18px; }
.bola { display: block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid; background: transparent; }
.bola.det { border-color: var(--vinho); } .bola.det.on { background: var(--vinho); }
.bola.ass { border-color: var(--petroleo); } .bola.ass.on { background: var(--petroleo); }
.fbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fxp { margin-left: auto; font-family: var(--f-maquina); font-size: 12.5px; color: var(--tinta2); text-transform: none; letter-spacing: 0; font-weight: 400; }
.fcar { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid #b9a77f77; }
.fcar > div { flex: 1; }
.fcar p { margin: 2px 0 0; font-size: 15px; color: var(--tinta2); }
.fcusto { font-family: var(--f-maquina); font-size: 11px; background: var(--ferrugem); color: #f6efdc; border-radius: 1px; padding: 0 7px; }
.fextra { width: 150px !important; padding: 3px 7px !important; margin-left: 6px; }
.fx2 { width: 24px; height: 24px; padding: 0; background-color: var(--vinho); border-radius: 2px; font-size: 16px; line-height: 1; }
.fadd { display: flex; gap: 8px; margin-top: 8px; }
.fadd select { flex: 1; }
.fass2 { border: 1px solid var(--linha); border-radius: 1px; padding: 6px; margin-bottom: 8px; background: #fffaf033; }
.fass2h { display: flex; gap: 6px; margin-bottom: 4px; align-items: flex-start; }
.fass2h .fan { flex: 1; min-width: 0; }
.fass2h .fac { width: 118px; }
.fcinop { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 15px; color: var(--tinta2); }
.fcinop > span { flex: 1; }
.fcinop button { padding: 1px 10px !important; }
.fmestre { border-color: var(--vinho); border-width: 2px; }
.fmestre h3 { color: var(--vinho); border-bottom-color: var(--vinho); }
.fmestre .fl { max-width: none; }
.fmestre h3 small { font-weight: 400; }
.fck { display: flex; align-items: center; gap: 6px; font-family: var(--f-texto); font-size: 15.5px; color: var(--tinta2); margin: 4px 0; text-transform: none; letter-spacing: 0; font-weight: 400; }
.fck input { width: auto !important; }
.fresumo { font-family: var(--f-maquina); font-size: 14px; color: var(--vinho); margin: 10px 0 6px; }
#frolarBox .grande { width: 100%; background-color: var(--vinho); }
.flh { display: flex; align-items: center; gap: 6px; }
.fajgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.fajck { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 12px; margin: 6px 0; }
.fsec textarea.auto, .fl textarea.auto { resize: none; overflow: hidden; line-height: 1.35; min-height: 34px; }
.finv { margin-top: 14px !important; padding-top: 10px; border-top: 1px solid var(--linha); }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ===== SPRITES ANIMADOS (personagem de corpo inteiro no lugar da foto redonda) ===== */
.portrait.sprite { background: none; border-radius: 0; overflow: visible; }
.portrait .spr { position: absolute; inset: 0; transform-origin: 50% 100%; --f: 1; }
.portrait .spr.left { --f: -1; }
.portrait.sprite img { width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; transform: none; transform-origin: 50% 100%;
  filter: drop-shadow(0 .5cqw .5cqw #000b); pointer-events: none; -webkit-user-drag: none; display: block; }
.portrait.sprite img.flip { transform: scaleX(-1); }
.dead .portrait.sprite { filter: none; }
@keyframes spr-idle  { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.022); } }
@keyframes spr-walk  { 0%, 100% { transform: translateY(0) rotate(calc(-1.5deg * var(--f))); } 50% { transform: translateY(-3%) rotate(calc(1.5deg * var(--f))); } }
@keyframes spr-run   { 0%, 100% { transform: translateY(0) rotate(calc(2deg * var(--f))); } 50% { transform: translateY(-6%) rotate(calc(5deg * var(--f))); } }
@keyframes spr-sneak { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(1.5%); } }
.spr.pose-idle, .spr.pose-sit { animation: spr-idle 2.6s ease-in-out infinite; }
.spr.pose-walk  { animation: spr-walk .5s ease-in-out infinite; }
.spr.pose-run   { animation: spr-run .3s ease-in-out infinite; }
.spr.pose-sneak { animation: spr-sneak 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .portrait .spr { animation: none !important; } }

/* ===== VISÃO LIMITADA (névoa) E PAREDES ===== */
#fog { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
#wallsSvg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
#wallsSvg polyline { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
#wallsSvg .w { stroke: #ff8a3d; stroke-width: 3; filter: drop-shadow(0 0 2px #000); }
#wallsSvg .wc { stroke: #ffe08a; stroke-width: 3; stroke-dasharray: 8 6; }
#wallsSvg .wd { stroke: #ff8a3d; stroke-width: 8; }
#wallsSvg .wcd { stroke: #ffe08a; }
#stage.wall-mode { cursor: crosshair; }
#fogBox { flex: none; width: 262px; display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; overflow-y: auto; background: var(--papel) url(img/ui/papel.jpg) 0 0 / 280px; border: 1px dashed var(--ferrugem); border-radius: 1px; color: var(--tinta); box-shadow: 0 3px 8px #0009; }
#fogBox b { font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .1em; font-size: 17px; color: var(--ferrugem); }
#fogBox input[type=number] { width: 70px; padding: 3px 6px; }
#fogBox .irow input[type=number] { width: 64px; flex: none; }
#fogBox button { padding: 4px 9px; font-size: 14px; }
#fogBox button.on { background-color: var(--vinho); }
#fogBox .irow { align-items: center; }
/* ===== BIBLIOTECA DO MESTRE + NPCs + imagem mostrada ===== */
#libModal, #showModal { position: fixed; inset: 0; z-index: 60; background: radial-gradient(ellipse at center, #0008, #000d); display: grid; place-items: center; padding: 10px; }
#showModal { z-index: 62; background: #000c; }
#libBox { background: var(--papel) url(img/ui/papel.jpg) 0 0 / 720px 720px; color: var(--tinta); width: min(100%, 640px); max-height: 94vh; overflow: auto; padding: 0 16px 20px; border: 1px solid #000a; box-shadow: 0 10px 40px #000c; }
#libBox .menu-head { margin: 0 -16px 10px; }
#libTabs { display: flex; gap: 4px; margin-bottom: 10px; }
#libTabs button { flex: 1; background: #00000022; color: var(--tinta2); box-shadow: none; border: 1px solid var(--linha); }
#libTabs button.on { background: var(--ferrugem); color: #f6eed7; }
#libForm { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px dashed var(--linha); background: #fffaf033; margin-bottom: 12px; }
#libPrev { max-height: 110px; max-width: 100%; object-fit: contain; align-self: center; border: 1px solid var(--linha); background: #0002; }
#libNpcOpts { display: flex; flex-direction: column; gap: 4px; }
#libNpcOpts input[type=number] { width: 90px; }
#libGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.lcard { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--linha); background: #fffaf040; border-radius: 2px; }
.lcard.on { outline: 2px solid var(--ouro); }
.lthumb { aspect-ratio: 1; display: grid; place-items: center; background: #1b1a17 url(img/ui/carvao.jpg) 0 0 / 200px; overflow: hidden; }
.lthumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lthumb.round { border-radius: 50%; } .lthumb.round img { width: 100%; height: 100%; object-fit: cover; }
.lname { font-family: var(--f-titulo); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lsub { font-family: var(--f-maquina); font-size: 12px; color: var(--tinta2); }
.lbtns { display: flex; gap: 4px; } .lbtns button { flex: 1; padding: 4px 6px; font-size: 13px; } .lbtns button.ghost { flex: 0 0 auto; }
#showModal figure { margin: 0; max-width: 96vw; max-height: 96vh; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#showModal img { max-width: 96vw; max-height: calc(96vh - 60px); object-fit: contain; border: 6px solid var(--papel); box-shadow: 0 10px 50px #000; background: #000; }
#showModal figcaption { display: flex; gap: 14px; align-items: center; color: #f2ecdc; font-family: var(--f-titulo); letter-spacing: .1em; text-transform: uppercase; font-size: 18px; }
#showBtns { display: flex; gap: 6px; }
.tnpc { display: flex; align-items: center; gap: 3px; background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 200px; border: 1px solid #00000099; border-radius: 3px; padding: 3px 5px; white-space: nowrap; box-shadow: 0 4px 14px #000a; color: #f2ecdc; }
.tnpc button { padding: .15em .6em; font-size: .88em; border-radius: 2px; background: #ffffff1a; box-shadow: none; font-weight: 600; } .tnpc button:hover { background: #ffffff33; }
.seat.npc { width: 11cqw; }
.seat.npc.ghost { opacity: .5; }
.seat.npc.dead .portrait { filter: grayscale(1) brightness(.55); }
.seat.npc .portrait:not(.sprite) img { transform: none; object-position: 50% 50%; }
/* ===== aba ITENS da biblioteca ===== */
#libGrid.itens { display: block; }
.ifilt { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.ifilt input[type=search] { flex: 1 1 140px; min-width: 0; }
.ifilt select { max-width: 100%; }
#itList { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.icard { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; align-items: center; padding: 6px 8px; border: 1px solid var(--linha); background: #fffaf040; border-left: 4px solid var(--tinta3); }
.icard.art { border-left-color: var(--ouro); background: #d9a82f1c; } .icard.pac { border-left-color: var(--ferrugem); } .icard.car { border-left-color: #5d4e3d; background: #0000000d; }
.icard .ihead { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.icard .ihead b { font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .06em; font-size: 16px; }
.ibadge { font-family: var(--f-maquina); font-size: 12px; color: var(--tinta2); }
.icard .isub { grid-column: 1; font-size: 13px; color: var(--tinta3); font-style: italic; }
.icard .idesc { grid-column: 1; font-size: 14.5px; line-height: 1.25; }
.icard button { grid-column: 2; grid-row: 1 / span 3; align-self: center; padding: 4px 12px; font-size: 14px; }
/* ===== PONTOS DE LUZ ===== */
#glow { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; mix-blend-mode: screen; }
#lightsLayer { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
#lightsLayer .lring { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; border-radius: 50%; border: 2px dashed var(--c, #ffb45a); box-shadow: 0 0 12px var(--c, #ffb45a) inset; opacity: .75; pointer-events: none; }
#lightsLayer .lhandle { position: absolute; transform: translate(-50%, -50%); width: max(16px, 2.6cqw); aspect-ratio: 1; border-radius: 50%; pointer-events: auto; cursor: grab; touch-action: none;
  background: radial-gradient(circle, #fff 0 22%, var(--c, #ffb45a) 24% 62%, #0006 66%); border: 2px solid #1b1a17; box-shadow: 0 0 10px 3px var(--c, #ffb45a), 0 2px 6px #000a; }
#lightsLayer .lhandle.off { filter: grayscale(1) brightness(.6); box-shadow: 0 2px 6px #000a; }
#lightsLayer .lhandle.sel { outline: 2px solid #fff; outline-offset: 2px; }
#lightsLayer .lbar { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); display: flex; align-items: center; gap: 3px; white-space: nowrap; cursor: default; font-size: max(12px, 1.5cqw);
  background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 200px; border: 1px solid #00000099; border-radius: 3px; padding: 3px 5px; box-shadow: 0 4px 14px #000a; color: #f2ecdc; }
#lightsLayer .lbar span { min-width: 3.4em; text-align: center; font-family: var(--f-maquina); }
#lightsLayer .lbar button { padding: .15em .6em; font-size: .9em; border-radius: 2px; background: #ffffff1a; box-shadow: none; font-weight: 600; } #lightsLayer .lbar button:hover { background: #ffffff33; }
/* rota bloqueada por parede */
#route .aim.bad { stroke: #e0483c; stroke-dasharray: 6 5; }
#routeLbl small.bad { color: #a8281d; font-weight: 700; }

/* ===== PORTAS ===== */
#doorsSvg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
#doorsSvg line { vector-effect: non-scaling-stroke; stroke-linecap: round; fill: none; }
#doorsSvg .dbase { stroke: #1b1209; stroke-width: 9; }
#doorsSvg .dc { stroke: #a8743a; stroke-width: 5; } #doorsSvg .dc.lk { stroke: #8a2f2a; }
#doorsSvg .do { stroke: #d9c79a; stroke-width: 2; stroke-dasharray: 5 6; } #doorsSvg .do.lk { stroke: #c98a85; }
#doorsSvg .dpre { stroke: #ffe08a; stroke-width: 4; stroke-dasharray: 7 5; }
#doorsSvg .dpt { fill: #ffe08a; stroke: #1b1209; stroke-width: 1; vector-effect: non-scaling-stroke; }
#doorsLayer { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
#doorsLayer .dbtn { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; white-space: nowrap; font-size: max(12px, 1.6cqw); padding: .25em .9em; border-radius: 2px; z-index: 2; box-shadow: 0 0 0 2px #fff8, 0 4px 12px #000b; }
#doorsLayer .dbtn.lock { background: #3a1b18; color: #f0c9c4; border: 1px solid #000; font-family: var(--f-titulo); text-transform: uppercase; letter-spacing: .08em; }
#doorsLayer .dhandle { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; width: max(18px, 2.8cqw); height: max(18px, 2.8cqw); padding: 0; border-radius: 3px; font-size: max(11px, 1.5cqw); line-height: 1; background: #a8743a; color: #1b1209; border: 2px solid #1b1209; box-shadow: 0 2px 6px #000a; }
#doorsLayer .dhandle.open { background: #d9c79a; } #doorsLayer .dhandle.lk { background: #8a2f2a; color: #fff; } #doorsLayer .dhandle.sel { outline: 2px solid #fff; outline-offset: 2px; }
#doorsLayer .dbar { position: absolute; transform: translate(-50%, calc(-100% - 1.8cqw)); pointer-events: auto; display: flex; gap: 3px; white-space: nowrap; font-size: max(12px, 1.5cqw); z-index: 3; background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 200px; border: 1px solid #00000099; border-radius: 3px; padding: 3px 5px; box-shadow: 0 4px 14px #000a; }
#doorsLayer .dbar button { padding: .15em .6em; font-size: .9em; border-radius: 2px; background: #ffffff1a; box-shadow: none; font-weight: 600; color: #f2ecdc; } #doorsLayer .dbar button:hover { background: #ffffff33; }
/* ===== MODO 3D (protótipo) ===== */
#w3d { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; display: block; touch-action: none; cursor: grab; }
#w3d:active { cursor: grabbing; }
body.is3d #board { visibility: hidden; }
body.is3d #zoomCtl button:not(#w3dBtn), body.is3d #zPct { display: none; }
#w3dBtn { width: 36px; height: 36px; padding: 0; font-size: 15px; background: var(--ferrugem); color: #f6eed7; border: 1px solid #000; box-shadow: 0 2px 8px #000a; font-family: var(--f-titulo); }
#w3dBar { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 9; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 20px);
  background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 200px; border: 1px solid #000; padding: 4px 6px; box-shadow: 0 3px 12px #000a; color: #f2ecdc; }
#w3dBar button { padding: 3px 11px; font-size: 14px; background: #ffffff1a; box-shadow: none; color: #f2ecdc; } #w3dBar button.on { background: var(--ferrugem2); }
#w3dBar .hint { color: #cfc6ad; font-size: 12px; margin-left: 4px; }
#w3dLbl { position: absolute; z-index: 9; transform: translate(-50%, -140%); pointer-events: none; background: var(--papel) url(img/ui/papel.jpg) 0 0 / 220px; border: 1px solid #000a; border-top: 3px solid var(--ferrugem); color: var(--tinta); font: 700 17px var(--f-titulo); letter-spacing: .06em; padding: 1px 11px; box-shadow: 0 3px 10px #000a; white-space: nowrap; }
#w3dLbl small { display: block; font: 700 12px var(--f-maquina); letter-spacing: 0; color: #a8281d; }

/* ===== NOME COMO "TAG" EM CIMA DO PERSONAGEM (translúcida) ===== */
.seat .pname { position: absolute; left: 50%; top: 0; transform: translate(-50%, calc(-100% - .5cqw)); width: max-content; max-width: 22cqw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: max(9px, 1.45cqw); padding: .1cqw 1cqw; opacity: .5; pointer-events: none; z-index: 3; transition: opacity .15s; box-shadow: 0 .2cqw .5cqw #0006; }
.seat:hover .pname { opacity: .95; }
.seat.sel .pname, .seat.dragging .pname { opacity: 0; }
.seat.dead .pname { opacity: .35; }
/* barra de POSE no 3D (jogador muda a própria; mestre a de quem selecionar) + botões de subir/descer a câmera */
#w3dPose { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); z-index: 9; display: flex; gap: 4px; align-items: center; background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 200px; border: 1px solid #00000099; border-radius: 3px; padding: 4px 7px; box-shadow: 0 4px 14px #000a; color: #f2ecdc; }
#w3dPose .pl { font: 700 13px var(--f-titulo); letter-spacing: .08em; text-transform: uppercase; color: #cfc6ad; margin-right: 4px; }
#w3dPose button { padding: 3px 12px; font-size: 14px; border-radius: 2px; background: #ffffff1a; box-shadow: none; color: #f2ecdc; font-weight: 600; }
#w3dPose button:hover { background: #ffffff33; } #w3dPose button.on { background: var(--ferrugem2); }
#w3dBar #w3dUp, #w3dBar #w3dDn { padding: 3px 9px; touch-action: none; }
#w3dLbl small.hintc { color: #5a4a30; }

/* 2D: jogador só clica no PRÓPRIO personagem; os dos outros (e NPCs) ficam "transparentes" ao clique, então nada que esteja na frente atrapalha */
.seat:not(.movable) { pointer-events: none; }

/* botões das portas no 3D */
#w3dDoors { position: absolute; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
#w3dDoors .wd { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: flex; gap: 3px; white-space: nowrap; }
#w3dDoors .wd button { padding: .25em .9em; font-size: 15px; border-radius: 2px; box-shadow: 0 0 0 2px #fff8, 0 4px 12px #000b; }
#w3dDoors .wd:has(button + button) button { background: var(--carvao) url(img/ui/carvao.jpg) 0 0 / 200px; color: #f2ecdc; box-shadow: 0 4px 12px #000b; font-weight: 600; }
#w3dDoors .wd .lockd { background: #3a1b18; color: #f0c9c4; border: 1px solid #000; font: 700 14px var(--f-titulo); text-transform: uppercase; letter-spacing: .08em; padding: .25em .8em; border-radius: 2px; box-shadow: 0 4px 12px #000b; }
