@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&display=swap');

:root {
  --ink: #0e1018;
  --panel: #171a26;
  --panel-2: #1f2333;
  --line: #2c3148;
  --text: #eef0f7;
  --muted: #949bb3;
  --accent: #ffb547;
  --accent-ink: #2a1c02;
  --mint: #5fe3b0;
  --danger: #ff5d6c;
  --radius: 14px;
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--ink); color: var(--text); font: 15px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }
canvas.px { image-rendering: pixelated; }

.logo { display: inline-flex; align-items: center; gap: 9px; font: 800 22px/1 var(--display); letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.logo i { width: 20px; height: 20px; border-radius: 6px; background: var(--accent); box-shadow: 7px 7px 0 -2px var(--mint); margin-right: 5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; transition: background .12s, transform .05s; }
.btn:hover { background: #272c40; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #ffc266; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #10121b; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 181, 71, .18); }
.error { color: var(--danger); font-size: 13.5px; min-height: 20px; margin: 4px 0 10px; }

/* ---------------------------------------------------------------- */
/* Landing / auth                                                    */
/* ---------------------------------------------------------------- */
.landing { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 460px); gap: 48px; padding: 32px clamp(20px, 5vw, 72px) 48px; max-width: 1500px; margin: 0 auto; align-items: start; }
.landing header { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.hero h1 { font: 800 clamp(38px, 5vw, 68px)/0.98 var(--display); letter-spacing: -0.035em; margin: 18px 0 16px; max-width: 12ch; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { color: var(--muted); font-size: 18px; max-width: 46ch; margin: 0 0 26px; }
.preview { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #090a10; aspect-ratio: 16 / 10; }
.preview canvas { width: 100%; height: 100%; display: block; }
.preview .tag { position: absolute; left: 12px; top: 12px; padding: 5px 10px; border-radius: 99px; background: rgba(14, 16, 24, .8); font-size: 12.5px; font-weight: 600; backdrop-filter: blur(6px); }
.points { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.points li { padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; font-size: 13.5px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 26px; position: sticky; top: 24px; }
.card h2 { font: 700 26px/1.1 var(--display); letter-spacing: -0.02em; margin: 0 0 6px; }
.card .sub { color: var(--muted); margin: 0 0 20px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #10121b; border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.seg button { padding: 8px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--panel-2); color: var(--text); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.templates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpl { padding: 6px; border-radius: 12px; border: 2px solid var(--line); background: #10121b; text-align: left; display: grid; gap: 6px; }
.tpl canvas { width: 100%; border-radius: 7px; display: block; image-rendering: pixelated; aspect-ratio: 16/10; object-fit: cover; }
.tpl b { font-size: 12.5px; line-height: 1.15; }
.tpl small { color: var(--muted); font-size: 11.5px; display: block; font-weight: 500; }
.tpl.on { border-color: var(--accent); background: #1d1a12; }
.tpl:hover { border-color: #454b68; }
.tpl.on:hover { border-color: var(--accent); }

@media (max-width: 980px) {
  .landing { grid-template-columns: 1fr; gap: 28px; }
  .card { position: static; }
}

/* ---------------------------------------------------------------- */
/* Office                                                            */
/* ---------------------------------------------------------------- */
body.app { overflow: hidden; user-select: none; }
#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: pointer; }

.glass { background: rgba(20, 23, 34, .86); border: 1px solid rgba(255, 255, 255, .08); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }

#place { position: fixed; left: 14px; top: 14px; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border-radius: 12px; z-index: 5; max-width: 40vw; }
#place .logo { font-size: 16px; }
#place .logo i { width: 14px; height: 14px; border-radius: 4px; box-shadow: 5px 5px 0 -1px var(--mint); }
#place .sep { width: 1px; height: 18px; background: var(--line); }
#zone-name { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#zone-name b { color: var(--text); font-weight: 600; }

/* video strip */
#videos { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 6; max-width: calc(100vw - 520px); flex-wrap: wrap; justify-content: center; pointer-events: none; }
.tile { --s: 1; position: relative; width: 176px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #10121b; border: 2px solid rgba(255, 255, 255, .1); opacity: calc(.28 + .72 * var(--s)); transform: scale(calc(.8 + .2 * var(--s))); transition: opacity .25s, transform .25s, border-color .2s; pointer-events: auto; cursor: zoom-in; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.self video.mirror { transform: scaleX(-1); }
.tile.screen video { object-fit: contain; }
.tile .fallback { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #2a2f45, #12141d); }
.tile .fallback canvas { height: 62%; image-rendering: pixelated; }
.tile .label { position: absolute; left: 6px; bottom: 6px; right: 6px; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.tile .label span { padding: 2px 8px; border-radius: 99px; background: rgba(10, 12, 20, .72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .label .muted { color: var(--danger); flex: none; }
.tile .emoji { position: absolute; right: 8px; top: 6px; font-size: 30px; animation: pop .3s ease-out; }
.tile .hand { position: absolute; left: 8px; top: 6px; font-size: 22px; }
.tile.far { filter: saturate(.6); }
.tile.big { position: fixed; top: 50%; left: 50%; width: min(78vw, 130vh); transform: translate(-50%, -52%); z-index: 30; opacity: 1; cursor: zoom-out; border-color: var(--accent); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }

/* dock */
#dock { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 7px; border-radius: 18px; z-index: 10; }
#dock .group { display: flex; gap: 4px; padding: 0 6px; border-left: 1px solid var(--line); }
.ib { position: relative; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--text); background: rgba(255, 255, 255, .05); transition: background .12s; font-size: 19px; }
.ib:hover { background: rgba(255, 255, 255, .12); }
.ib svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ib.off { background: rgba(255, 93, 108, .16); color: var(--danger); }
.ib.off::after { content: ''; position: absolute; width: 26px; height: 2px; background: currentColor; transform: rotate(-45deg); border-radius: 2px; }
.ib.on { background: var(--accent); color: var(--accent-ink); }
.ib .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.ib[data-tip]:hover::before { content: attr(data-tip); position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 7px; background: #05060a; color: #fff; pointer-events: none; }
#me-btn { display: flex; align-items: center; gap: 9px; padding: 4px 12px 4px 6px; border-radius: 12px; text-align: left; height: 44px; }
#me-btn:hover { background: rgba(255, 255, 255, .08); }
#me-btn canvas { height: 38px; image-rendering: pixelated; }
#me-btn b { display: block; font-size: 13.5px; line-height: 1.2; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#me-btn small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; max-width: 130px; white-space: nowrap; overflow: hidden; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); flex: none; display: inline-block; }
.dot.busy { background: #ffb347; } .dot.dnd { background: var(--danger); } .dot.away, .dot.offline { background: #6d7389; }

#hint { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); padding: 8px 14px; border-radius: 12px; z-index: 9; font-weight: 600; font-size: 14px; display: flex; gap: 9px; align-items: center; cursor: pointer; }
kbd { font: 700 12px var(--body); padding: 2px 7px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); }

#banner { position: fixed; left: 50%; top: 160px; transform: translateX(-50%); padding: 9px 16px; border-radius: 12px; z-index: 12; font-size: 13.5px; font-weight: 600; border-color: rgba(255, 181, 71, .5); cursor: pointer; }

/* popovers */
.popover { position: fixed; z-index: 20; border-radius: 16px; padding: 10px; min-width: 230px; }
.popover h4 { margin: 4px 8px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mi { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-align: left; font-weight: 500; }
.mi:hover { background: rgba(255, 255, 255, .08); }
.mi small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.mi.sel { background: rgba(255, 181, 71, .14); }
.mi.danger { color: var(--danger); }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
#pop-react { display: flex; gap: 2px; min-width: 0; padding: 6px; }
#pop-react button { width: 42px; height: 42px; font-size: 24px; border-radius: 10px; position: relative; }
#pop-react button:hover { background: rgba(255, 255, 255, .1); transform: scale(1.15); }
#pop-react button small { position: absolute; right: 3px; bottom: 1px; font-size: 9px; color: var(--muted); }
#card { width: 250px; }
#card .who { display: flex; gap: 10px; align-items: center; padding: 4px 6px 10px; }
#card .who canvas { height: 52px; image-rendering: pixelated; }
#card .who b { display: block; }
#card .who small { color: var(--muted); display: flex; gap: 5px; align-items: center; }
#card .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* side panel */
#panel { position: fixed; right: 14px; top: 14px; bottom: 14px; width: 340px; border-radius: 18px; z-index: 8; display: flex; flex-direction: column; overflow: hidden; user-select: text; }
#panel > header { display: flex; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
#panel .tabs { display: flex; gap: 4px; flex: 1; }
#panel .tabs button { padding: 7px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); }
#panel .tabs button.on { background: rgba(255, 255, 255, .1); color: var(--text); }
#panel section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#people { overflow-y: auto; padding: 8px; }
#people h4 { margin: 12px 8px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.person { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; position: relative; }
.person:hover { background: rgba(255, 255, 255, .06); }
.person .face { width: 36px; height: 36px; border-radius: 10px; background: #262b40; overflow: hidden; flex: none; display: grid; place-items: start center; }
.person .face canvas { width: 40px; image-rendering: pixelated; margin-top: 2px; }
.person .info { min-width: 0; flex: 1; }
.person b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.person.offline { opacity: .55; }
.person .acts { display: none; gap: 2px; position: absolute; right: 6px; background: #252a3d; border-radius: 9px; padding: 2px; }
.person:hover .acts { display: flex; }
.person .acts button { width: 30px; height: 30px; border-radius: 7px; font-size: 15px; }
.person .acts button:hover { background: rgba(255, 255, 255, .14); }

#channels { display: flex; gap: 6px; padding: 10px; overflow-x: auto; flex: none; border-bottom: 1px solid var(--line); }
.chip { padding: 5px 11px; border-radius: 99px; background: rgba(255, 255, 255, .06); font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip i { font-style: normal; background: var(--danger); color: #fff; border-radius: 99px; font-size: 10.5px; padding: 0 5px; }
#chat-note { padding: 6px 12px; font-size: 12px; color: var(--muted); flex: none; }
#chat-log { flex: 1; overflow-y: auto; padding: 4px 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.msg { display: grid; grid-template-columns: 32px 1fr; gap: 0 9px; padding-top: 8px; }
.msg .face { width: 32px; height: 32px; border-radius: 9px; background: #262b40; overflow: hidden; display: grid; place-items: start center; }
.msg .face canvas { width: 36px; image-rendering: pixelated; margin-top: 1px; }
.msg .head b { font-size: 13.5px; }
.msg .head time { font-size: 11.5px; color: var(--muted); margin-left: 6px; }
.msg p { margin: 0; grid-column: 2; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.msg p a { color: var(--accent); }
.empty { color: var(--muted); text-align: center; margin: auto; padding: 20px; font-size: 14px; }
#chat-form { padding: 10px; border-top: 1px solid var(--line); flex: none; }

/* toasts */
#toasts { position: fixed; left: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 40; width: 320px; }
.toast { padding: 12px 14px; border-radius: 14px; animation: slide .2s ease-out; }
.toast .t { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 14px; }
.toast .t canvas { height: 40px; image-rendering: pixelated; flex: none; }
.toast .t small { display: block; font-weight: 400; color: var(--muted); overflow: hidden; text-overflow: ellipsis; max-height: 3em; }
.toast .acts { display: flex; gap: 8px; margin-top: 10px; }
.toast.ring { border-color: var(--accent); }
@keyframes slide { from { transform: translateX(-20px); opacity: 0; } }

/* dialogs */
dialog { border: 1px solid var(--line); border-radius: 20px; background: var(--panel); color: var(--text); padding: 24px; width: min(560px, 92vw); max-height: 90vh; user-select: none; }
dialog::backdrop { background: rgba(5, 6, 10, .65); backdrop-filter: blur(3px); }
dialog h3 { font: 700 24px/1.1 var(--display); letter-spacing: -0.02em; margin: 0 0 4px; }
dialog p.sub { color: var(--muted); margin: 0 0 18px; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.editor { display: grid; grid-template-columns: 170px 1fr; gap: 22px; }
.editor .stage { background: radial-gradient(circle at 50% 35%, #2c3250, #14161f); border-radius: 16px; display: grid; place-items: center; padding: 16px 0; gap: 10px; align-content: center; cursor: pointer; }
.editor .stage canvas { height: 210px; image-rendering: pixelated; }
.opt { margin-bottom: 11px; }
.opt label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; outline: 1px solid rgba(255, 255, 255, .12); }
.sw.txt { width: auto; padding: 0 10px; font-size: 12.5px; font-weight: 600; background: #10121b; text-transform: capitalize; }
.sw.on { border-color: #fff; outline-color: #fff; }
.copyrow { display: flex; gap: 8px; }
@media (max-width: 560px) { .editor { grid-template-columns: 1fr; } .editor .stage canvas { height: 130px; } }
@media (max-width: 900px) { #videos { max-width: 96vw; top: 60px; } .tile { width: 120px; } #panel { width: min(340px, calc(100vw - 28px)); } }
