:root {
  --bg: #161a24;
  --panel: #232938;
  --panel-2: #2c3346;
  --text: #eef1f7;
  --muted: #9aa3b5;
  --accent: #3498db;
  --accent-2: #2a7fc0;
  --danger: #e74c3c;
  --ok: #2ecc71;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Tela de entrada ---------- */
.screen { min-height: 100%; display: grid; place-items: center; padding: 16px; overflow: auto; }
.card { width: min(760px, 100%); background: var(--panel); border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
h1 { margin: 0 0 4px; font-size: 26px; }
.sub { margin: 0 0 22px; color: var(--muted); }
.join-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; }
@media (max-width: 640px) { .join-grid { grid-template-columns: 1fr; } }

.preview-wrap { position: relative; aspect-ratio: 4 / 3; background: #0f121a; border-radius: 12px; overflow: hidden; }
.preview-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.preview-controls { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 12px; }

form { display: flex; flex-direction: column; gap: 8px; }
label { font-size: 13px; color: var(--muted); margin-top: 6px; }
input { background: var(--panel-2); border: 1px solid #3a4258; color: var(--text); border-radius: 10px; padding: 11px 12px; font: inherit; outline: none; width: 100%; }
input:focus { border-color: var(--accent); }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; outline: none; }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.primary { margin-top: 12px; background: var(--accent); border: 0; border-radius: 10px; padding: 13px; font-weight: 600; }
.primary:hover { background: var(--accent-2); }
.primary:disabled { opacity: .6; cursor: wait; }
.error { color: #ff8a80; margin: 4px 0 0; font-size: 14px; }
.note { color: #ffd479; margin: 4px 0 0; font-size: 13px; }

/* ---------- Botões redondos ---------- */
.round, .pill { border: 0; background: rgba(44, 51, 70, .92); height: 44px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; backdrop-filter: blur(6px); }
.round { width: 44px; }
.pill { padding: 0 16px; font-weight: 600; }
.round:hover, .pill:hover { background: #3a4258; }
.round svg, .pill svg { width: 20px; height: 20px; }
.round .slash { stroke: currentColor; stroke-width: 2.4; display: none; }
.round.off { background: var(--danger); }
.round.off .slash { display: inline; }

/* ---------- App ---------- */
#app { position: fixed; inset: 0; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }

#tiles { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; max-width: calc(100% - 24px); overflow-x: auto; padding: 2px; pointer-events: none; }
.tile { pointer-events: auto; position: relative; width: var(--tile-w, 176px); aspect-ratio: 4 / 3; flex: none; background: #0f121a; border-radius: 12px; overflow: hidden; border: 2px solid transparent; box-shadow: 0 6px 20px rgba(0,0,0,.35); transition: border-color .15s; }
.tile.speaking { border-color: var(--ok); }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile.self video { transform: scaleX(-1); }
.fake-media .tile.self video, .fake-media .preview-wrap video { transform: none; }
.tile .placeholder { position: absolute; inset: 0; display: none; place-items: center; background: #1d2230; }
.tile.cam-off .placeholder { display: grid; }
.tile .initial { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.tile .label { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,.6); padding: 3px 8px; border-radius: 8px; font-size: 12px; }
.tile .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .mic-off { display: none; color: #ff6b6b; }
.tile.mic-muted .mic-off { display: inline-flex; }
.tile.connecting::after { content: 'conectando…'; position: absolute; top: 6px; right: 8px; font-size: 11px; color: var(--muted); }

.desk-prompt { position: absolute; left: 12px; top: 12px; background: var(--accent); color: #fff; border: 0; padding: 9px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.desk-prompt:hover { filter: brightness(1.1); }
.hud-area { position: absolute; left: 12px; bottom: 16px; background: rgba(35, 41, 56, .92); padding: 10px 14px; border-radius: 12px; font-size: 14px; max-width: min(250px, calc(100% - 24px)); }
.controls { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
@media (max-width: 640px) {
  .hud-area { bottom: 64px; font-size: 13px; padding: 8px 12px; }
  .help { display: none; }
  .controls { gap: 5px; bottom: 10px; }
  .round, .pill { height: 40px; }
  .round { width: 40px; }
  .pill { padding: 0 11px; }
  #status-label { display: none; }
  .panel { bottom: 62px; }
  .menu { left: 0; transform: none; }
}
.help { pointer-events: none; position: absolute; right: 12px; bottom: 18px; font-size: 12px; color: var(--muted); background: rgba(22,26,36,.7); padding: 6px 10px; border-radius: 8px; }

.people h3 { margin: 4px 6px 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.people ul { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 8px; font-size: 14px; }
.people li[title] { cursor: pointer; }
.people li[title]:hover { background: var(--panel-2); }
.people .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.people .pname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.people .where { color: var(--muted); font-size: 12px; white-space: nowrap; }

.status { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(35,41,56,.96); padding: 14px 20px; border-radius: 12px; font-weight: 600; z-index: 30; }

/* ---------- Avisos ---------- */
.toasts { position: absolute; bottom: 72px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(460px, calc(100% - 32px)); z-index: 45; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: rgba(35,41,56,.97); border: 1px solid #3a4258; padding: 10px 14px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.35); animation: toast-in .2s ease-out; }
.toast button { border: 0; background: var(--accent); border-radius: 8px; padding: 6px 10px; font-weight: 600; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Botões pequenos ---------- */
.mini { border: 0; background: var(--panel-2); border-radius: 8px; padding: 5px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.mini:hover { background: #3a4258; }
.mini.danger { background: var(--danger); }
.primary-mini { background: var(--accent); }
.primary-mini:hover { background: var(--accent-2); }
.round.active { background: var(--ok); color: #0d1f14; }
.round { position: relative; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---------- Status ---------- */
.status-wrap { position: relative; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #2ecc71; display: inline-block; flex: none; }
.menu { position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%); background: var(--panel); border-radius: 12px; padding: 6px; min-width: 160px; box-shadow: 0 10px 40px rgba(0,0,0,.45); z-index: 25; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 8px; text-align: left; }
.menu button:hover { background: var(--panel-2); }
.emoji-menu { display: flex; gap: 2px; min-width: 0; }
.emoji-menu button { width: 40px; height: 40px; justify-content: center; padding: 0; font-size: 22px; }
#btn-react { font-size: 20px; }

/* ---------- Painéis laterais ---------- */
.panel { position: absolute; right: 12px; bottom: 70px; width: min(320px, calc(100% - 24px)); background: var(--panel); border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.4); z-index: 15; }
.people { padding: 12px; max-height: 60vh; overflow: auto; }
.people li { gap: 8px; }
.people .pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.people .where { font-size: 11px; }

.chat { display: flex; flex-direction: column; height: min(520px, calc(100% - 150px)); }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 8px; border-bottom: 1px solid #323a4f; }
.seg { display: flex; background: var(--panel-2); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.active { background: var(--accent); color: #fff; }
.seg button:disabled { opacity: .45; cursor: default; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { font-size: 14px; line-height: 1.35; }
.msg-head { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.msg .author { font-weight: 700; filter: brightness(1.35); }
.msg time { color: var(--muted); margin-left: auto; font-size: 11px; }
.msg .scope-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: #0d1f14; background: var(--ok); padding: 1px 5px; border-radius: 4px; font-weight: 700; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text a { color: #7fc8f8; }
.msg.mention { background: rgba(241, 196, 15, .12); border-left: 3px solid #f1c40f; padding: 4px 8px; border-radius: 6px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #323a4f; }
.chat-form input { padding: 9px 10px; }

/* ---------- Tela compartilhada ---------- */
.stage { position: absolute; top: calc(var(--tile-w, 176px) * .75 + 30px); left: 50%; transform: translateX(-50%); width: min(1100px, calc(100% - 24px)); max-height: calc(100% - var(--tile-w, 176px) * .75 - 110px); display: flex; flex-direction: column; background: #0f121a; border-radius: 14px; overflow: hidden; box-shadow: 0 16px 50px rgba(0,0,0,.5); z-index: 10; }
.stage-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); font-size: 14px; font-weight: 600; }
.spacer { flex: 1; }
.stage video { width: 100%; min-height: 0; flex: 1; object-fit: contain; background: #000; }
.stage-pill { position: absolute; top: calc(var(--tile-w, 176px) * .75 + 30px); left: 50%; transform: translateX(-50%); border: 0; background: var(--accent); padding: 8px 14px; border-radius: 20px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.35); z-index: 10; }
.screen-banner { position: absolute; left: 12px; bottom: 64px; display: flex; align-items: center; gap: 10px; background: rgba(46, 204, 113, .95); color: #0d1f14; font-weight: 600; font-size: 13px; padding: 7px 8px 7px 12px; border-radius: 10px; }
@media (max-width: 640px) { .screen-banner { bottom: 112px; } }
.tile .screen-badge { display: none; position: absolute; top: 6px; left: 6px; border: 0; background: var(--ok); color: #0d1f14; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 6px; }
.tile.sharing .screen-badge { display: block; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-card { width: min(420px, 100%); background: var(--panel); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-card h2 { margin: 0 0 6px; font-size: 20px; }
select { background: var(--panel-2); border: 1px solid #3a4258; color: var(--text); border-radius: 10px; padding: 10px; font: inherit; width: 100%; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin-top: 12px; }
.check input { width: auto; }

/* ---------- Conta e avatar ---------- */
.link { border: 0; background: none; color: #7fc8f8; font-size: 13px; padding: 0; text-decoration: underline; }
#account-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); background: var(--panel-2); border-radius: 10px; padding: 8px 12px; margin-bottom: 4px; }
#account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input[readonly] { opacity: .7; }
.avatar-pick { display: flex; align-items: center; gap: 14px; }
.avatar-pick canvas { width: 48px; height: 66px; background: var(--panel-2); border-radius: 10px; image-rendering: auto; }
.avatar-card { align-items: stretch; max-height: calc(100% - 16px); overflow: auto; }
.avatar-card canvas { align-self: center; width: 96px; height: 132px; background: var(--panel-2); border-radius: 12px; image-rendering: auto; }
.seg.wrap { flex-wrap: wrap; gap: 2px; }
.seg.wrap button { flex: 1; }
.mini.wide { width: 100%; margin-top: 10px; padding: 9px; }
.avatar-card .primary { margin-top: 8px; }
/* ---------- Objetos interativos ---------- */
#btn-objects { font-size: 19px; }
.obj-prompt-row { position: absolute; left: 12px; top: 60px; display: flex; gap: 6px; pointer-events: none; }
.obj-prompt-row .desk-prompt { position: static; pointer-events: auto; }
.obj-prompt { background: #8e6ad8; }
.obj-config { padding: 9px 11px; }
.obj-menu { min-width: 300px; }
.obj-menu button { align-items: flex-start; }
.obj-menu b { display: block; font-size: 14px; }
.obj-menu small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.obj-ic { font-size: 20px; line-height: 1; flex: none; }
#world.placing { cursor: copy; }
.place-banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: var(--panel); padding: 8px 8px 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; z-index: 20; box-shadow: var(--shine), var(--frame); white-space: nowrap; }
.obj-panel { top: 12px; bottom: auto; max-height: calc(100% - 100px); overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; width: min(340px, calc(100% - 24px)); }
.obj-panel > * { flex-shrink: 0; }
.obj-head { display: flex; align-items: center; gap: 8px; }
.obj-head .obj-name { flex: 1; min-width: 0; font-size: 15px; }
.obj-head input.obj-name { padding: 6px 8px; font-weight: 700; }
.obj-state { display: flex; align-items: center; gap: 12px; background: #1b2040; border-radius: 8px; padding: 8px; box-shadow: 0 0 0 2px var(--ink); }
.obj-preview { width: 64px; height: 72px; image-rendering: auto; flex: none; }
.obj-state-text { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.obj-state small { display: block; color: var(--muted); font-size: 12px; }
.obj-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.obj-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow: auto; }
.obj-feed li { background: #1b2040; border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.obj-feed li small { color: var(--muted); }
.obj-feed time { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.obj-feed .empty { color: var(--muted); font-size: 12px; }
.obj-hook { display: flex; flex-direction: column; gap: 4px; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 4px; }
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row code, .obj-hook pre { flex: 1; min-width: 0; background: #11142b; border-radius: 6px; padding: 6px 8px; font-size: 11px; overflow-x: auto; white-space: nowrap; }
.copy-row.token code { color: #ffd479; }
.obj-hook pre { margin: 0; white-space: pre; color: #c9d1ea; }
.obj-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }

/* quadro branco */
.board { position: fixed; inset: 16px; z-index: 40; display: flex; flex-direction: column; background: var(--panel); border-radius: 10px; box-shadow: var(--shine), var(--frame), 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.board-head, .board-drawbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
.board-head { border-bottom: 2px solid var(--ink); }
.board-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.board-drawbar.disabled { opacity: .35; pointer-events: none; }
.board-tools button { font-size: 17px; padding: 4px 9px; }
.board-colors { gap: 5px; }
.board-colors .swatch { width: 24px; height: 24px; }
.board-sizes button { display: grid; place-items: center; width: 34px; height: 30px; padding: 0; }
.board-sizes i { display: block; border-radius: 50%; background: currentColor; }
.board-people { display: flex; gap: 3px; }
.board-person { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; box-shadow: 0 0 0 1.5px var(--ink); }
.board-surface { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #fbfcfd; }
.board-surface.dropping::after { content: 'Solte a imagem aqui'; position: absolute; inset: 10px; display: grid; place-items: center; border: 3px dashed #4a9fe0; border-radius: 10px; background: rgba(74,159,224,.08); color: #2a6fa8; font-weight: 700; font-size: 18px; pointer-events: none; }
#board-canvas { position: absolute; inset: 0; display: block; touch-action: none; }
#board-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.board-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #6b7685; font-weight: 600; pointer-events: none; }
.board-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px; }
.board-zoom .mini { min-width: 30px; padding: 6px 8px; }
#board-zoom-label { min-width: 54px; }
.board-hint { position: absolute; left: 10px; bottom: 12px; font-size: 12px; color: #6b7685; background: rgba(251,252,253,.9); padding: 4px 8px; border-radius: 6px; pointer-events: none; max-width: calc(100% - 220px); }
.board-drawbar .mini:disabled { opacity: .4; cursor: default; }
.mini.toggle.active { background: var(--accent); color: #07162a; }
.board-input { position: absolute; z-index: 2; min-width: 60px; background: rgba(255,255,255,.6); color: #1c2036; border: 1.5px dashed #4a9fe0; border-radius: 3px; padding: 4px; font: 600 20px system-ui, sans-serif; line-height: 1.3; resize: none; outline: none; field-sizing: content; overflow: hidden; }
.board-input.text { min-width: 120px; }
.board-input.note { font-weight: 500; color: #2b2f3a; border-style: solid; border-color: rgba(0,0,0,.15); }
.board-input.shape { background: transparent; text-align: center; field-sizing: fixed; color: #1c2036; }
.board-input.arrow { text-align: center; background: #fff; }
@media (max-width: 640px) { .board-hint { display: none; } }
@media (max-width: 640px) {
  .board { inset: 0; border-radius: 0; }
  .obj-prompt-row { top: 56px; }
}

.toast .toast-actions { display: flex; gap: 6px; }
.toast button.ghost { background: var(--panel-2); }

#dk-preview { width: 144px; height: 216px; align-self: center; border-radius: 10px; image-rendering: auto; background: var(--panel-2); margin-bottom: 4px; }
.swatch { font-size: 14px; line-height: 1; color: var(--muted); }


/* ---------- Tema "escritório pixel": mesmos tons, contornos e sombras duras do mundo ---------- */
:root {
  --ink: #141830;
  --bg: #11142b;
  --panel: #272d4b;
  --panel-2: #353d63;
  --text: #f4f0e6;
  --muted: #a9b0cf;
  --accent: #4a9fe0;
  --accent-2: #3a86c4;
  --danger: #e2574c;
  --ok: #4cc98a;
  --shine: inset 0 1px 0 rgba(255,255,255,.14);
  --frame: 0 0 0 2px var(--ink), 0 5px 0 2px rgba(8,10,26,.55);
  --btn: var(--shine), 0 0 0 2px var(--ink), 0 4px 0 2px var(--ink);
}
.card, .modal-card, .panel, .menu, .toast, .hud-area, .status, .stage, #account-bar { border-radius: 10px; box-shadow: var(--shine), var(--frame); }
.modal { background: rgba(10, 12, 30, .66); }
.hud-area, .help { backdrop-filter: none; }
.help { background: rgba(17, 20, 43, .78); border-radius: 6px; }
.toast { border: 0; }

/* botões: "teclas" chunky que afundam ao clicar */
.round, .pill { border-radius: 12px; background: var(--panel-2); backdrop-filter: none; box-shadow: var(--btn); margin-bottom: 4px; transition: transform .06s, box-shadow .06s, background .12s; }
.round:hover, .pill:hover { background: #435082; }
.round:active, .pill:active { transform: translateY(3px); box-shadow: var(--shine), 0 0 0 2px var(--ink), 0 1px 0 2px var(--ink); }
.round.off { background: var(--danger); }
.round.active { background: var(--ok); }
.primary { border-radius: 8px; box-shadow: var(--btn); margin-bottom: 4px; font-weight: 700; transition: transform .06s, box-shadow .06s; }
.primary:active { transform: translateY(3px); box-shadow: var(--shine), 0 0 0 2px var(--ink), 0 1px 0 2px var(--ink); }
.mini { border-radius: 6px; box-shadow: var(--shine), 0 0 0 1.5px var(--ink); }
.desk-prompt, .stage-pill { border-radius: 10px; box-shadow: var(--btn); font-weight: 700; }
.toast button, .tile .screen-badge { border-radius: 5px; box-shadow: 0 0 0 1.5px var(--ink); }

/* campos */
input, select { border: 2px solid var(--ink); border-radius: 8px; background: #1b2040; }
input:focus { border-color: var(--accent); }
.seg { border-radius: 8px; box-shadow: 0 0 0 2px var(--ink); background: #1b2040; }
.seg button { border-radius: 5px; }
.seg button.active { color: #07162a; box-shadow: var(--shine), 0 0 0 1.5px var(--ink); font-weight: 700; }
.swatch { border-radius: 6px; border: 2px solid var(--ink); box-shadow: var(--shine); }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* vídeo */
.tile { border-radius: 8px; border: 3px solid var(--ink); box-shadow: 0 4px 0 rgba(8,10,26,.55); }
.tile.speaking { border-color: var(--ok); }
.tile .label { border-radius: 4px; background: rgba(20, 24, 48, .85); }
.preview-wrap { border-radius: 8px; box-shadow: 0 0 0 2px var(--ink); }

/* chat */
.chat-head, .chat-form { border-color: var(--ink); }
.msg .scope-tag { border-radius: 3px; }
.badge { border-radius: 5px; box-shadow: 0 0 0 1.5px var(--ink); }

/* ---------- Fase 1: status, conversa, busca, balão ---------- */
.menu-sep { height: 1px; background: #3a4258; margin: 4px 6px; }
#status-menu { min-width: 250px; }
.status-form { padding: 4px 6px 2px; display: grid; grid-template-columns: 52px 1fr; gap: 6px; }
.status-form input { padding: 7px 8px; font-size: 13px; border-radius: 8px; }
#status-emoji { text-align: center; }
.status-form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; }
#status-label { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.conv-bar { position: absolute; top: calc(var(--tile-w, 176px) * .75 + 22px); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 6; }
.conv-bar .mini { background: rgba(35, 41, 56, .95); box-shadow: 0 4px 14px rgba(0,0,0,.35); padding: 6px 11px; }
.conv-bar .mini.on { background: #7a5c1e; }

.tile .tile-mute { position: absolute; top: 6px; left: 6px; border: 0; border-radius: 8px; background: rgba(0,0,0,.6); padding: 3px 6px; font-size: 12px; display: none; }
.tile:not(.mic-muted):hover .tile-mute { display: block; }
.tile .tile-mute:hover { background: var(--danger); }

.popup { position: fixed; z-index: 40; background: var(--panel); border-radius: 12px; padding: 6px; min-width: 200px; max-width: min(300px, calc(100vw - 16px)); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.popup-title { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; overflow-wrap: anywhere; }
.popup button { width: 100%; display: block; border: 0; background: none; padding: 8px 10px; border-radius: 8px; text-align: left; }
.popup button:hover { background: var(--panel-2); }

.say { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); width: min(460px, calc(100% - 24px)); z-index: 20; }
.say input { box-shadow: 0 8px 30px rgba(0,0,0,.45); border-color: var(--accent); }

.palette-wrap { align-items: start; padding-top: 12vh; }
.palette { width: min(520px, calc(100% - 24px)); background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.palette input { border: 0; border-bottom: 1px solid #3a4258; border-radius: 0; padding: 14px 16px; font-size: 15px; background: transparent; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette-list li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.palette-list li.sel, .palette-list li:hover { background: var(--panel-2); }
.palette-list li.empty { display: block; color: var(--muted); cursor: default; }
.pal-ic { text-align: center; }
.pal-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pal-hint { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

.shortcuts { margin-top: 10px; font-size: 13px; }
.shortcuts summary { cursor: pointer; color: var(--muted); }
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; }
.shortcuts dt { font-family: ui-monospace, monospace; font-size: 12px; background: var(--panel-2); padding: 1px 6px; border-radius: 5px; justify-self: start; }
.shortcuts dd { margin: 0; color: var(--muted); }
#settings .modal-card { max-height: calc(100vh - 32px); overflow-y: auto; }
#settings .check { margin-top: 8px; align-items: flex-start; }
#settings .check input { margin-top: 3px; }
.menu .status-form button { width: auto; display: inline-block; padding: 5px 10px; background: var(--panel-2); }
.menu .status-form button.primary-mini { background: var(--accent); }
@media (max-width: 1180px) { .help { display: none; } }

/* ---------- Portais (objetos que abrem um site) ---------- */
.menu-sep { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-top: 2px solid var(--ink); margin-top: 4px; }
.obj-menu { max-height: min(70vh, 560px); overflow: auto; }
.portal-view { z-index: 41; }
.portal-host { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#portal-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.portal-hint { position: absolute; left: 10px; bottom: 10px; font-size: 12px; color: #6b7685; background: rgba(251,252,253,.92); padding: 4px 8px; border-radius: 6px; pointer-events: none; }
.portal-status { font-size: 13px; line-height: 1.35; padding: 8px 10px; border-radius: 6px; background: #1b2040; box-shadow: 0 0 0 2px var(--ink); }
.portal-status.ok { color: #9be7bd; }
.portal-status.no { color: #ffd479; }
.portal-status.warn { color: #ffb38a; }
.portal-status.wait { color: var(--muted); }
.portal-skins button { font-size: 17px; padding: 4px 6px; }
.portal-tip { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.portal-tip summary { cursor: pointer; }
.portal-tip ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- Fase 2: modo reunião e palco ---------- */
.meeting-bg { position: absolute; inset: 0; background: var(--bg); z-index: 4; }
#app.meeting #tiles { top: 60px; bottom: 76px; left: 12px; right: 12px; transform: none; max-width: none; display: grid; grid-template-columns: repeat(var(--grid-cols, 2), var(--grid-w, 320px)); justify-content: center; align-content: center; gap: 10px; overflow: auto; z-index: 5; pointer-events: auto; }
#app.meeting .tile { width: var(--grid-w, 320px); }
#app.meeting .tile .initial { width: 88px; height: 88px; font-size: 36px; }
#app.meeting .conv-bar { top: 14px; }
#app.meeting.has-stage #tiles { left: auto; width: 240px; grid-template-columns: 1fr; --grid-w: 220px; align-content: start; }
#app.meeting .stage { top: 60px; bottom: 76px; left: 12px; right: 264px; width: auto; max-height: none; transform: none; z-index: 6; }
#app.meeting .stage-pill { top: 60px; z-index: 6; }
@media (max-width: 720px) {
  #app.meeting.has-stage #tiles { top: auto; left: 12px; width: auto; height: 120px; grid-template-columns: none; grid-auto-flow: column; --grid-w: 150px; }
  #app.meeting .stage { right: 12px; bottom: 206px; }
}
.stage-scroll { flex: 1; min-height: 0; overflow: auto; background: #000; display: flex; }
.stage-scroll video { width: 100%; height: 100%; object-fit: contain; flex: none; }
.stage-scroll.zoomed video { width: calc(var(--z, 1) * 100%); height: auto; margin: auto; }
.stage-switch button { padding: 3px 9px; font-size: 12px; }
#app.meeting #tiles { overflow-x: hidden; }
#app.meeting .controls, #app.meeting .hud-area, #app.meeting .toasts, #app.meeting #say { z-index: 8; }
#app.meeting .help, #app.meeting .desk-prompt { display: none; }
.stage-scroll:not(.zoomed) { overflow: hidden; }

.popup-range { display: grid; gap: 4px; padding: 8px 10px 6px; font-size: 12px; color: var(--muted); margin: 0; }
.popup-range input { padding: 0; accent-color: var(--accent); }

.announce-banner { position: absolute; top: 12px; left: 12px; z-index: 9; display: flex; align-items: center; gap: 10px; background: #7a3b1e; color: #fff; padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.4); max-width: min(420px, calc(100% - 24px)); }

.rec-banner { position: absolute; top: 12px; right: 12px; z-index: 9; background: #8e1f17; color: #fff; padding: 7px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.conv-bar .mini.rec-on { background: var(--danger); }

/* ---------- Planning poker (acima da barra de ícones) ---------- */
.poker { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); width: min(720px, calc(100% - 24px)); z-index: 7; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.poker > * { pointer-events: auto; }
.poker-head, .poker-table { background: rgba(39, 45, 75, .95); border-radius: 10px; box-shadow: var(--shine), var(--frame); }
.poker-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; flex-wrap: wrap; }
.poker-title { font-weight: 700; }
.poker-sub, .poker-count { font-size: 12px; color: var(--muted); }
.poker-head .spacer { flex: 1; }
.poker-head .mini:disabled { opacity: .5; cursor: default; }
.poker-table { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.poker-avg { display: flex; flex-direction: column; align-items: center; padding: 2px 14px 2px 4px; border-right: 2px solid var(--ink); }
.poker-avg-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.poker-avg-value { font-size: 28px; font-weight: 800; color: #f6c445; line-height: 1.1; }
.poker-people { display: flex; flex-wrap: wrap; gap: 6px 12px; min-width: 0; }
.poker-chip { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.poker-chip.voted { color: var(--text); }
.poker-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poker-mini { width: 22px; height: 30px; border-radius: 4px; display: grid; place-items: center; font-size: 12px; font-weight: 800; border: 2px dashed var(--muted); color: var(--muted); }
.poker-mini.back { border: 2px solid var(--ink); background: repeating-linear-gradient(45deg, #3a86c4 0 4px, #4a9fe0 4px 8px); }
.poker-mini.face { border: 2px solid var(--ink); background: #f4f0e6; color: #141830; animation: poker-flip .35s ease-out; }
.poker-chip.none .poker-mini { opacity: .5; }
@keyframes poker-flip { from { transform: rotateY(90deg); } to { transform: none; } }
.poker-hand { display: flex; justify-content: center; align-items: flex-end; gap: 6px; padding-top: 16px; flex-wrap: wrap; }
.poker-card { width: 42px; height: 58px; border-radius: 6px; border: 0; background: #f4f0e6; color: #141830; font-size: 17px; font-weight: 800; box-shadow: var(--shine), 0 0 0 2px var(--ink), 0 4px 0 2px var(--ink); transition: transform .14s ease-out, background .12s; cursor: pointer; }
.poker-card:hover:not(:disabled) { transform: translateY(-6px); }
.poker-card.picked { transform: translateY(-16px); background: #f6c445; box-shadow: var(--shine), 0 0 0 2px var(--ink), 0 6px 0 2px var(--ink), 0 10px 18px rgba(0,0,0,.4); }
.poker-card:disabled { cursor: default; opacity: .55; }
.poker-card.picked:disabled { opacity: 1; }
#app.poker-on .toasts { bottom: auto; top: 70px; }
#app.poker-on .say { bottom: 250px; }
#app.meeting .poker { z-index: 8; }
@media (max-width: 640px) {
  .poker { bottom: 62px; }
  .poker-card { width: 34px; height: 48px; font-size: 14px; }
  .poker-hand { gap: 4px; }
}

/* ---------- Soundboard ---------- */
.soundboard { top: 60px; bottom: auto; right: 12px; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 150px); display: flex; flex-direction: column; z-index: 26; }
.sb-head { display: flex; align-items: baseline; gap: 8px; padding: 10px 10px 8px 12px; border-bottom: 1px solid #323a4f; }
.sb-hint { color: var(--muted); font-size: 12px; flex: 1; }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; padding: 10px; overflow: auto; min-height: 0; }
.sb-empty { grid-column: 1 / -1; margin: 6px 2px; color: var(--muted); font-size: 13px; }
.sb-item { position: relative; }
.sb-sound { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid #3a4258; background: var(--panel-2); border-radius: 10px; padding: 10px 6px 8px; cursor: pointer; }
.sb-sound:hover { border-color: var(--accent); background: #333b52; }
.sb-sound:active { transform: scale(.96); }
.sb-emoji { font-size: 24px; line-height: 1.1; }
.sb-label { font-size: 12px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-tools { position: absolute; top: 2px; right: 2px; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.sb-item:hover .sb-tools, .sb-item:focus-within .sb-tools { opacity: 1; }
.sb-mini { border: 0; background: rgba(22,26,36,.85); border-radius: 6px; padding: 2px 4px; font-size: 12px; cursor: pointer; }
.sb-mini:hover { background: #3a4258; }
.sb-foot { display: flex; align-items: center; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid #323a4f; }
.sb-vol { flex: 1; display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; }
.sb-vol input { padding: 0; accent-color: var(--accent); min-width: 0; }
.sb-form { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 12px; }
.sb-form input { padding: 8px 10px; font-size: 13px; }
.sb-row { display: flex; gap: 6px; }
.sb-row #sb-emoji { width: 56px; flex: none; text-align: center; }
.sb-rules { margin: 0; font-size: 11px; color: var(--muted); }
.sb-error { margin: 0; font-size: 12px; color: #ff8a80; }
@media (hover: none) { .sb-tools { opacity: 1; } }
.portal-open-row { display: flex; gap: 6px; }
.portal-open-row > .wide { flex: 1; }

/* ---------- Editor de avatar ---------- */
.av-card { width: min(860px, 100%); max-height: calc(100% - 16px); padding: 18px 20px 16px; gap: 10px; overflow: hidden; }
.av-top { display: flex; align-items: center; justify-content: space-between; }
.av-top h2 { margin: 0; }
.av-body { display: grid; grid-template-columns: 200px 1fr; gap: 18px; min-height: 0; flex: 1; }
.av-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.av-floor {
  width: 100%; display: grid; place-items: center; padding: 6px 0 0; border-radius: 10px; box-shadow: 0 0 0 2px var(--ink, #141830);
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255,255,255,.07), transparent 65%),
    repeating-conic-gradient(#2a3150 0 25%, #252b48 0 50%) 0 0 / 24px 24px;
}
.av-floor canvas { width: 154px; height: 203px; image-rendering: auto; }
.av-turn { display: flex; align-items: center; justify-content: space-between; width: 100%; font-size: 13px; font-weight: 700; color: var(--muted); }
.av-turn .mini { font-size: 16px; padding: 4px 12px; line-height: 1; }
.av-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.av-actions .mini { padding: 8px 6px; }
.av-actions .mini:disabled { opacity: .45; cursor: default; }
.av-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.av-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 3px; border-radius: 8px; background: #1b2040; box-shadow: 0 0 0 2px var(--ink, #141830); }
.av-tab { border: 0; background: none; padding: 8px 4px; border-radius: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.av-tab:hover { color: var(--text); }
.av-tab.active { background: var(--accent); color: #07162a; box-shadow: var(--shine), 0 0 0 1.5px var(--ink, #141830); }
.av-pages { overflow: auto; min-height: 0; height: min(440px, calc(100vh - 210px)); padding: 4px 4px 8px 2px; margin-top: 10px; }
.av-page h3 { margin: 14px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.av-page h3:first-child { margin-top: 2px; }
.av-page h3 small { font-weight: 500; font-size: 11px; opacity: .75; }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.av-opt {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 6px; border: 0; border-radius: 8px;
  background: #1b2040; box-shadow: 0 0 0 2px var(--ink, #141830); color: var(--muted); transition: transform .06s, background .12s;
}
.av-opt:hover { background: #2a3158; color: var(--text); }
.av-opt:active { transform: translateY(1px); }
.av-opt canvas { width: 56px; height: 56px; image-rendering: auto; }
.av-opt span { font-size: 11px; font-weight: 600; line-height: 1.15; text-align: center; max-width: 100%; padding: 0 2px; min-height: 2.3em; display: grid; place-items: center; }
.av-opt.selected { background: #24407a; color: #fff; box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--ink, #141830); }
.av-card .colors { gap: 7px; }
.av-card .swatch { width: 32px; height: 32px; margin: 0; }
.swatch.custom { position: relative; display: block; cursor: pointer; overflow: hidden; padding: 0;
  background: var(--pick, conic-gradient(#e74c3c, #f1c40f, #2ecc71, #1abc9c, #3498db, #9b59b6, #e84393, #e74c3c)); }
.swatch.custom::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff; text-shadow: 0 1px 2px #000; pointer-events: none; }
.swatch.custom input { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); opacity: 0; cursor: pointer; padding: 0; border: 0; }
.av-card > .primary { margin-top: 2px; }
@media (max-width: 640px) {
  .av-card { padding: 14px 12px 12px; }
  .av-body { grid-template-columns: 1fr; gap: 10px; }
  .av-stage { display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto auto; align-items: center; gap: 6px 10px; }
  .av-floor { grid-row: span 2; padding: 2px 0 0; }
  .av-floor canvas { width: 77px; height: 101px; }
  .av-pages { height: auto; max-height: calc(100vh - 330px); }
  .av-grid { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 6px; }
}
