
:root{--bg:#f1f3f2;--fg:#17201e;--btn:#1d2b28;--btnfg:#e8fff2;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--bg:#0b1012;--fg:#d8e6e0;--btn:#2a4a40;--btnfg:#eafff4}}
:root[data-theme="dark"]{--bg:#0b1012;--fg:#d8e6e0;--btn:#2a4a40;--btnfg:#eafff4}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
body{margin:0;background:var(--bg);color:var(--fg);font-family:"Trebuchet MS",Verdana,sans-serif}
header{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:12px 16px}
h1{font-size:1.05rem;margin:0 auto 0 0;font-weight:600}
button{background:var(--btn);color:var(--btnfg);border:0;border-radius:6px;padding:8px 12px;font:inherit;cursor:pointer}
button:focus-visible{outline:2px solid #39ff8a;outline-offset:2px}
#ld{position:absolute;inset:0;display:grid;place-items:center;color:#9fe8c8}
#c{position:relative;margin:0 16px;height:74vh;min-height:360px;border-radius:6px;overflow:hidden;background:#0a1214}
#c canvas{display:block;touch-action:none}
p{margin:10px 16px 16px;font-size:.85rem;opacity:.75;max-width:80ch}


/* Zaun VTT 3D — Interface de campanha. O mapa permanece no canvas WebGL original. */
:root{--vbg:#0b1215;--vpanel:#111e21;--vpanel2:#18292a;--vborder:#2b4545;--vmint:#5dffbf;--vmute:#a1b8b4;--vtxt:#edf9f3;--vgold:#ffc86e}
body.vtt-mode{margin:0;overflow:hidden;background:var(--vbg);color:var(--vtxt);font-family:system-ui,Segoe UI,sans-serif}
body.vtt-mode header{z-index:12;position:fixed;inset:0 0 auto;height:58px;box-sizing:border-box;background:rgba(9,21,22,.96);border-bottom:1px solid var(--vborder);padding:8px 12px;flex-wrap:nowrap;overflow:auto;gap:6px}
body.vtt-mode header h1{font-size:14px;white-space:nowrap;flex:0 0 auto;margin-right:10px;color:#9ef6c8}
body.vtt-mode header button{font-size:12px;padding:7px 9px;white-space:nowrap;background:#213a38}
body.vtt-mode #c{position:fixed;z-index:1;inset:58px 316px 0 67px;margin:0;height:auto;min-height:0;border:0;border-radius:0;overflow:hidden;background:#070e12}
body.vtt-mode #c canvas{outline:none;width:100%;height:100%}
body.vtt-mode>p{display:none}
#vtt-root{position:fixed;z-index:20;inset:0;pointer-events:none;font-family:system-ui,Segoe UI,sans-serif;font-size:13px;color:var(--vtxt)}
#vtt-root *{box-sizing:border-box}
#vtt-root button,#vtt-root input,#vtt-root select,#vtt-root textarea{font:inherit}
#vtt-root button{background:#233b3a;color:var(--vtxt);border:1px solid #3c5653;border-radius:9px;padding:8px 9px;cursor:pointer;transition:background .15s,border .15s}
#vtt-root button:hover{background:#2b5048;border-color:#57b98d}
#vtt-root button.active{background:#19543f;border-color:var(--vmint);color:#d9ffe8}
#vtt-root button.danger{color:#ffd0c9;border-color:#774b4b}
#vtt-root button.primary{background:#147f5e;border-color:#42ca91;color:#f8fff8;font-weight:700}
#vtt-root button:disabled{opacity:.35;cursor:not-allowed}
#vtt-root input,#vtt-root select,#vtt-root textarea{border:1px solid #365654;border-radius:8px;background:#091819;color:#ecfff5;padding:8px 9px;min-width:0;max-width:100%;outline:none}
#vtt-root input:focus-visible,#vtt-root select:focus-visible{border-color:var(--vmint)}
#vtt-root textarea{resize:vertical}
#vtt-root label{display:flex;flex-direction:column;gap:4px;margin:5px 0;color:#c1d6cd;font-size:12px}
#vtt-root .check{flex-direction:row;align-items:center}
#vtt-root .check input{width:auto}
#vtt-root .muted{color:var(--vmute);font-size:11px}
#vtt-root .stack{display:flex;flex-direction:column;gap:8px}
#vtt-root .row{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
#vtt-root .grow{flex:1}
#vtt-root .separator{height:1px;background:#2b4848;margin:12px 0}
#vtt-root .section{padding:12px;border-bottom:1px solid #294545}
#vtt-root .section h3,#vtt-root .section h4{font-size:12px;color:var(--vmint);letter-spacing:.04em;margin:0 0 10px;text-transform:uppercase}
#vtt-root .tiny{font-size:11px}
#vtt-root .panels{position:absolute;inset:0;pointer-events:none}
#vtt-root .toolbar{pointer-events:auto;position:fixed;left:0;top:58px;bottom:0;width:67px;background:#101c1e;border-right:1px solid var(--vborder);overflow-y:auto;padding:7px 6px;display:flex;flex-direction:column;gap:6px}
#vtt-root .toolbar button{height:47px;padding:2px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:10px;border-radius:9px}
#vtt-root .toolbar .emoji{font-size:19px;line-height:21px}
#vtt-root .side{pointer-events:auto;position:fixed;right:0;top:58px;bottom:0;width:316px;display:flex;flex-direction:column;background:#111e20;border-left:1px solid var(--vborder);overflow:hidden}
#vtt-root .side .tabstrip{display:flex;overflow-x:auto;gap:3px;padding:7px 6px;border-bottom:1px solid #2c4946}
#vtt-root .side .tabstrip button{padding:7px 8px;font-size:11px;white-space:nowrap}
#vtt-root .side .content{overflow-y:auto;overscroll-behavior:contain;flex:1}
#vtt-root .toplinks{pointer-events:auto;position:fixed;right:323px;top:7px;z-index:13;display:flex;gap:5px;align-items:center}
#vtt-root .toplinks select{max-width:175px;font-size:12px;padding:7px 5px}
#vtt-root .toplinks button{padding:6px 9px;font-size:12px}
#vtt-root .minitip{pointer-events:none;position:fixed;bottom:10px;left:80px;max-width:calc(100vw - 420px);border:1px solid #3c665a;border-radius:10px;padding:9px 12px;background:rgba(13,29,29,.85);box-shadow:0 5px 22px #0009;color:#d6f3e8;font-size:12px}
#vtt-root .status{color:#a4eac9;font-size:11px;padding:4px}
#vtt-root .line{display:flex;gap:6px;align-items:center;padding:8px 0;border-bottom:1px solid #263e3d}
#vtt-root .line strong{display:block;overflow-wrap:anywhere;font-size:12px}
#vtt-root .item{display:flex;gap:8px;align-items:center;background:#16282a;border:1px solid #314947;border-radius:9px;padding:7px;margin-bottom:6px}
#vtt-root .item .thumbnail{width:34px;height:34px;border-radius:8px;object-fit:cover;background:#092224}
#vtt-root .item .itembody{flex:1;min-width:0}
#vtt-root .item .itembody small{display:block;color:#abc0b9;overflow:hidden;text-overflow:ellipsis}
#vtt-root .item button{font-size:11px;padding:5px 7px}
#vtt-root .auth-backdrop,#vtt-root .modal-backdrop{pointer-events:auto;position:fixed;inset:0;display:grid;place-items:center;background:radial-gradient(ellipse at 40% 40%,#152c2ae9,#031013fa);z-index:50;padding:18px;overflow:auto}
#vtt-root .auth-backdrop{background:radial-gradient(ellipse at 40% 40%,#113527e6,#08131af7)}
#vtt-root .auth-card,#vtt-root .modal-card{width:min(440px,96vw);border:1px solid #417565;border-radius:17px;background:linear-gradient(160deg,#142827,#0b171d);box-shadow:0 20px 90px #000c;padding:20px}
#vtt-root .auth-card h2,#vtt-root .modal-card h2{margin:4px 0 10px;font-size:22px;color:#b6ffe0}
#vtt-root .auth-card p{color:#b3c8c0;font-size:12px;line-height:1.6}
#vtt-root .modal-card{width:min(540px,96vw);max-height:calc(100vh - 30px);overflow-y:auto}
#vtt-root .auth-card form,#vtt-root .modal-card form{display:flex;flex-direction:column;gap:9px}
#vtt-root .modal-backdrop{background:#000b}
#vtt-root .auth-card input,#vtt-root .modal-card input:not([type=checkbox]),#vtt-root .modal-card select{width:100%}
#vtt-root .chat-log{display:flex;flex-direction:column;gap:6px;height:calc(100vh - 240px);max-height:650px;overflow-y:auto;padding:4px 0}
#vtt-root .msg{padding:7px;background:#172a29;border-radius:8px;overflow-wrap:anywhere}
#vtt-root .msg b{color:#8fe4be}
#vtt-root .msg.private{background:#382b22}
#vtt-root .chat-send{display:flex;gap:6px}
#vtt-root .chat-send input{flex:1;width:40px}
#vtt-root .scene-chip{display:flex;align-items:center;gap:6px;padding:7px;border:1px solid #31554d;background:#152825;border-radius:8px;margin-bottom:6px}
#vtt-root .scene-chip span{flex:1}
#vtt-root .field-inline{display:flex;align-items:center;gap:7px}
#vtt-root .field-inline label{flex:1}
#vtt-root .field-inline input{width:100%}
#vtt-root .dicebuttons{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
#vtt-root .dicebuttons button{min-width:0}
#vtt-root #toast{pointer-events:none;position:fixed;left:50%;top:68px;transform:translateX(-50%);max-width:70vw;padding:9px 15px;border-radius:10px;color:#e2ffea;background:#114836;border:1px solid #4be9a6;box-shadow:0 6px 30px #0009;opacity:0;transition:opacity .2s;z-index:80}
#vtt-root #toast.show{opacity:1}
#vtt-root #toast.error{background:#542726;border-color:#fa8e7a}
@media(max-width:1000px){body.vtt-mode header button{font-size:11px}#vtt-root .toplinks{top:64px;right:318px;z-index:15;background:#0b1e1edb;padding:5px;border-radius:9px}}
@media(max-width:730px){body.vtt-mode #c{right:0;left:53px;bottom:34%;}#vtt-root .toolbar{width:53px}#vtt-root .side{top:auto;bottom:0;height:34%;width:calc(100% - 53px);left:53px}#vtt-root .toplinks{top:60px;right:3px}#vtt-root .minitip{left:58px;max-width:calc(100vw - 60px);bottom:34%;}#vtt-root .toolbar button{height:41px}}



/* Zaun VTT 3D — Interface de campanha. O mapa permanece no canvas WebGL original. */
:root{--vbg:#0b1215;--vpanel:#111e21;--vpanel2:#18292a;--vborder:#2b4545;--vmint:#5dffbf;--vmute:#a1b8b4;--vtxt:#edf9f3;--vgold:#ffc86e}
body.vtt-mode{margin:0;overflow:hidden;background:var(--vbg);color:var(--vtxt);font-family:system-ui,Segoe UI,sans-serif}
body.vtt-mode header{z-index:12;position:fixed;inset:0 0 auto;height:58px;box-sizing:border-box;background:rgba(9,21,22,.96);border-bottom:1px solid var(--vborder);padding:8px 12px;flex-wrap:nowrap;overflow:auto;gap:6px}
body.vtt-mode header h1{font-size:14px;white-space:nowrap;flex:0 0 auto;margin-right:10px;color:#9ef6c8}
body.vtt-mode header button{font-size:12px;padding:7px 9px;white-space:nowrap;background:#213a38}
body.vtt-mode #c{position:fixed;z-index:1;inset:58px 316px 0 67px;margin:0;height:auto;min-height:0;border:0;border-radius:0;overflow:hidden;background:#070e12}
body.vtt-mode #c canvas{outline:none;width:100%;height:100%}
body.vtt-mode>p{display:none}
#vtt-root{position:fixed;z-index:20;inset:0;pointer-events:none;font-family:system-ui,Segoe UI,sans-serif;font-size:13px;color:var(--vtxt)}
#vtt-root *{box-sizing:border-box}
#vtt-root button,#vtt-root input,#vtt-root select,#vtt-root textarea{font:inherit}
#vtt-root button{background:#233b3a;color:var(--vtxt);border:1px solid #3c5653;border-radius:9px;padding:8px 9px;cursor:pointer;transition:background .15s,border .15s}
#vtt-root button:hover{background:#2b5048;border-color:#57b98d}
#vtt-root button.active{background:#19543f;border-color:var(--vmint);color:#d9ffe8}
#vtt-root button.danger{color:#ffd0c9;border-color:#774b4b}
#vtt-root button.primary{background:#147f5e;border-color:#42ca91;color:#f8fff8;font-weight:700}
#vtt-root button:disabled{opacity:.35;cursor:not-allowed}
#vtt-root input,#vtt-root select,#vtt-root textarea{border:1px solid #365654;border-radius:8px;background:#091819;color:#ecfff5;padding:8px 9px;min-width:0;max-width:100%;outline:none}
#vtt-root input:focus-visible,#vtt-root select:focus-visible{border-color:var(--vmint)}
#vtt-root textarea{resize:vertical}
#vtt-root label{display:flex;flex-direction:column;gap:4px;margin:5px 0;color:#c1d6cd;font-size:12px}
#vtt-root .check{flex-direction:row;align-items:center}
#vtt-root .check input{width:auto}
#vtt-root .muted{color:var(--vmute);font-size:11px}
#vtt-root .stack{display:flex;flex-direction:column;gap:8px}
#vtt-root .row{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
#vtt-root .grow{flex:1}
#vtt-root .separator{height:1px;background:#2b4848;margin:12px 0}
#vtt-root .section{padding:12px;border-bottom:1px solid #294545}
#vtt-root .section h3,#vtt-root .section h4{font-size:12px;color:var(--vmint);letter-spacing:.04em;margin:0 0 10px;text-transform:uppercase}
#vtt-root .tiny{font-size:11px}
#vtt-root .panels{position:absolute;inset:0;pointer-events:none}
#vtt-root .toolbar{pointer-events:auto;position:fixed;left:0;top:58px;bottom:0;width:67px;background:#101c1e;border-right:1px solid var(--vborder);overflow-y:auto;padding:7px 6px;display:flex;flex-direction:column;gap:6px}
#vtt-root .toolbar button{height:47px;padding:2px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:10px;border-radius:9px}
#vtt-root .toolbar .emoji{font-size:19px;line-height:21px}
#vtt-root .side{pointer-events:auto;position:fixed;right:0;top:58px;bottom:0;width:316px;display:flex;flex-direction:column;background:#111e20;border-left:1px solid var(--vborder);overflow:hidden}
#vtt-root .side .tabstrip{display:flex;overflow-x:auto;gap:3px;padding:7px 6px;border-bottom:1px solid #2c4946}
#vtt-root .side .tabstrip button{padding:7px 8px;font-size:11px;white-space:nowrap}
#vtt-root .side .content{overflow-y:auto;overscroll-behavior:contain;flex:1}
#vtt-root .toplinks{pointer-events:auto;position:fixed;right:323px;top:7px;z-index:13;display:flex;gap:5px;align-items:center}
#vtt-root .toplinks select{max-width:175px;font-size:12px;padding:7px 5px}
#vtt-root .toplinks button{padding:6px 9px;font-size:12px}
#vtt-root .minitip{pointer-events:none;position:fixed;bottom:10px;left:80px;max-width:calc(100vw - 420px);border:1px solid #3c665a;border-radius:10px;padding:9px 12px;background:rgba(13,29,29,.85);box-shadow:0 5px 22px #0009;color:#d6f3e8;font-size:12px}
#vtt-root .status{color:#a4eac9;font-size:11px;padding:4px}
#vtt-root .line{display:flex;gap:6px;align-items:center;padding:8px 0;border-bottom:1px solid #263e3d}
#vtt-root .line strong{display:block;overflow-wrap:anywhere;font-size:12px}
#vtt-root .item{display:flex;gap:8px;align-items:center;background:#16282a;border:1px solid #314947;border-radius:9px;padding:7px;margin-bottom:6px}
#vtt-root .item .thumbnail{width:34px;height:34px;border-radius:8px;object-fit:cover;background:#092224}
#vtt-root .item .itembody{flex:1;min-width:0}
#vtt-root .item .itembody small{display:block;color:#abc0b9;overflow:hidden;text-overflow:ellipsis}
#vtt-root .item button{font-size:11px;padding:5px 7px}
#vtt-root .auth-backdrop,#vtt-root .modal-backdrop{pointer-events:auto;position:fixed;inset:0;display:grid;place-items:center;background:radial-gradient(ellipse at 40% 40%,#152c2ae9,#031013fa);z-index:50;padding:18px;overflow:auto}
#vtt-root .auth-backdrop{background:radial-gradient(ellipse at 40% 40%,#113527e6,#08131af7)}
#vtt-root .auth-card,#vtt-root .modal-card{width:min(440px,96vw);border:1px solid #417565;border-radius:17px;background:linear-gradient(160deg,#142827,#0b171d);box-shadow:0 20px 90px #000c;padding:20px}
#vtt-root .auth-card h2,#vtt-root .modal-card h2{margin:4px 0 10px;font-size:22px;color:#b6ffe0}
#vtt-root .auth-card p{color:#b3c8c0;font-size:12px;line-height:1.6}
#vtt-root .modal-card{width:min(540px,96vw);max-height:calc(100vh - 30px);overflow-y:auto}
#vtt-root .auth-card form,#vtt-root .modal-card form{display:flex;flex-direction:column;gap:9px}
#vtt-root .modal-backdrop{background:#000b}
#vtt-root .auth-card input,#vtt-root .modal-card input:not([type=checkbox]),#vtt-root .modal-card select{width:100%}
#vtt-root .chat-log{display:flex;flex-direction:column;gap:6px;height:calc(100vh - 240px);max-height:650px;overflow-y:auto;padding:4px 0}
#vtt-root .msg{padding:7px;background:#172a29;border-radius:8px;overflow-wrap:anywhere}
#vtt-root .msg b{color:#8fe4be}
#vtt-root .msg.private{background:#382b22}
#vtt-root .chat-send{display:flex;gap:6px}
#vtt-root .chat-send input{flex:1;width:40px}
#vtt-root .scene-chip{display:flex;align-items:center;gap:6px;padding:7px;border:1px solid #31554d;background:#152825;border-radius:8px;margin-bottom:6px}
#vtt-root .scene-chip span{flex:1}
#vtt-root .field-inline{display:flex;align-items:center;gap:7px}
#vtt-root .field-inline label{flex:1}
#vtt-root .field-inline input{width:100%}
#vtt-root .dicebuttons{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
#vtt-root .dicebuttons button{min-width:0}
#vtt-root #toast{pointer-events:none;position:fixed;left:50%;top:68px;transform:translateX(-50%);max-width:70vw;padding:9px 15px;border-radius:10px;color:#e2ffea;background:#114836;border:1px solid #4be9a6;box-shadow:0 6px 30px #0009;opacity:0;transition:opacity .2s;z-index:80}
#vtt-root #toast.show{opacity:1}
#vtt-root #toast.error{background:#542726;border-color:#fa8e7a}
@media(max-width:1000px){body.vtt-mode header button{font-size:11px}#vtt-root .toplinks{top:64px;right:318px;z-index:15;background:#0b1e1edb;padding:5px;border-radius:9px}}
@media(max-width:730px){body.vtt-mode #c{right:0;left:53px;bottom:34%;}#vtt-root .toolbar{width:53px}#vtt-root .side{top:auto;bottom:0;height:34%;width:calc(100% - 53px);left:53px}#vtt-root .toplinks{top:60px;right:3px}#vtt-root .minitip{left:58px;max-width:calc(100vw - 60px);bottom:34%;}#vtt-root .toolbar button{height:41px}}

