:root {
  --bg: #F3F1F9; --panel: #fff; --ink: #231F3A; --muted: #6C6785; --line: #E2DEEE;
  --side: #1B1A2E; --side2: #26243F; --side-ink: #E8E5F5; --side-muted: #9A96B8;
  --brand: #8C4BFF; --brand-d: #6A33C9; --ok: #2FBF71; --warn: #F5A524; --bad: #E5484D; --help: #FFD23F;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.4 "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); overflow: hidden; }
button { font: inherit; cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, canvas:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

#app { display: grid; grid-template-columns: 264px 1fr 280px; height: 100vh; height: 100dvh; }
body.no-left #app { grid-template-columns: 0 1fr 280px; }
body.no-right #app { grid-template-columns: 264px 1fr 0; }
body.no-left.no-right #app { grid-template-columns: 0 1fr 0; }
.col { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
body.no-left #left, body.no-right #right { visibility: hidden; }
.scroll { overflow-y: auto; flex: 1; padding: 0 8px 16px; scrollbar-width: thin; scrollbar-color: #444066 transparent; }
.l-head, .r-head { padding: 14px 14px 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.brand .cube { width: 18px; height: 18px; background: var(--brand); border-radius: 4px; box-shadow: inset -5px -5px 0 rgba(0,0,0,.22), inset 4px 4px 0 rgba(255,255,255,.25); }
.brand .tag { font-size: 11px; background: var(--brand); border-radius: 8px; padding: 1px 7px; margin-left: 2px; }
.r-head h2 { margin: 0 0 8px; font-size: 16px; }
.r-head h2 span { color: var(--side-muted); font-weight: 600; font-size: 13px; margin-left: 4px; }
#memSearch { width: 100%; background: var(--side2); border: 1px solid #3A3760; color: #fff; border-radius: 10px; padding: 8px 10px; }

.sec { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--side-muted); padding: 14px 8px 4px; display: flex; justify-content: space-between; }
.row { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; color: var(--side-ink); padding: 7px 8px; border-radius: 9px; text-align: left; }
.row:hover { background: var(--side2); }
.row[aria-current="true"] { background: #36326A; }
.row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .ct { font-size: 12px; color: var(--ok); font-weight: 700; }
.row .ic { width: 18px; text-align: center; color: var(--side-muted); }
.row.locked { opacity: .6; }
.row .lock { font-size: 11px; background: #4A2A3A; color: #FFB3B8; border-radius: 6px; padding: 0 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* Chips */
.chip { display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; line-height: 1; padding: 3px 6px; border-radius: 8px; color: #fff; vertical-align: middle; letter-spacing: .02em; }
.chip.role { background: #4B4764; }
.chip.help { background: var(--help); color: #3B2F00; }
.chip svg { width: 11px; height: 11px; fill: #fff; }
.mem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; width: 100%; background: transparent; border: 0; color: var(--side-ink); text-align: left; }
.mem:hover { background: var(--side2); }
.mem .who { flex: 1; min-width: 0; }
.mem .who b { display: block; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem .who small { color: var(--side-muted); font-size: 12px; }
.av { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; border: 2px solid; background: #3A3760; position: relative; }
.av i { position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--side); }

/* Centre */
#center { display: flex; flex-direction: column; min-width: 0; position: relative; }
#top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 5; flex-wrap: wrap; }
#top .spacer { flex: 1; }
.where { font-weight: 800; min-width: 0; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.where small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; }
.views { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 2px; }
.views button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.views button[aria-pressed="true"] { background: #fff; color: var(--brand-d); box-shadow: 0 1px 3px rgba(35,31,58,.18); }
.icon { border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 38px; height: 38px; font-size: 18px; color: var(--ink); }
.icon:hover { background: var(--bg); }
.help-btn { border: 2px solid var(--help); background: #FFF8D6; color: #5C4800; font-weight: 800; border-radius: 10px; padding: 7px 12px; }
.help-btn[aria-pressed="true"] { background: var(--help); }
select { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; color: var(--ink); max-width: 100%; }

.stage { position: relative; flex: 1; min-height: 0; background: #cfe3c8; }
.stage[hidden] { display: none; }
#cv { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; image-rendering: pixelated; }
.hud { position: absolute; background: rgba(27,26,46,.88); color: #fff; border-radius: 12px; backdrop-filter: blur(4px); }
.hud-tl { left: 12px; top: 12px; padding: 8px 12px; font-size: 13px; max-width: min(360px, calc(100% - 24px)); }
.hud-tl[hidden] { display: none; }
.hud-tl button { background: transparent; border: 0; color: #fff; font-size: 16px; float: right; margin: -4px -6px 0 8px; }
.hud-zoom { right: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.hud-zoom button { width: 36px; height: 36px; border: 0; background: transparent; color: #fff; font-size: 20px; border-radius: 8px; }
.hud-zoom button:hover { background: rgba(255,255,255,.15); }
.hud-mini { right: 12px; bottom: 12px; width: 234px; height: 183px; padding: 0; cursor: pointer; }
.dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; width: min(640px, calc(100% - 270px)); background: rgba(27,26,46,.94); color: #fff; border-radius: 16px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; box-shadow: 0 6px 24px rgba(0,0,0,.28); }
.dock[hidden] { display: none; }
.dock .info { flex: 1; min-width: 160px; }
.dock .info b { display: block; }
.dock .info small { color: #B9B5D6; }
.dock .btns { display: flex; gap: 6px; }
.dock button { border: 0; border-radius: 10px; padding: 8px 12px; font-weight: 700; background: #36326A; color: #fff; }
.dock button.off { background: var(--bad); }
.dock button.leave { background: transparent; border: 1px solid #5A5690; }
.dock .faces { display: flex; gap: 4px; flex-wrap: wrap; }
.dock .faces .av { width: 24px; height: 24px; font-size: 10px; border-width: 2px; }
#toasts { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; z-index: 8; }
.toast { background: rgba(27,26,46,.94); color: #fff; padding: 9px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; max-width: 80vw; box-shadow: 0 4px 16px rgba(0,0,0,.25); animation: tin .2s ease; }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* Pages (vue Salons, Mode simple) */
.page { overflow-y: auto; background: var(--bg); padding: 18px 20px 40px; }
.page h2 { margin: 0 0 4px; font-size: 22px; }
.page .lead { color: var(--muted); margin: 0 0 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.card h3 { margin: 0; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.card .meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }
.card .join { border: 0; background: var(--brand); color: #fff; font-weight: 800; border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.card .join:hover { background: var(--brand-d); }
.card.locked { opacity: .72; background: #F8F4F5; }
.card.locked .join { background: #CFC8D3; color: #5B5568; cursor: not-allowed; }
.card .why { color: var(--bad); font-size: 13px; font-weight: 700; }
.simple .card { padding: 18px 20px; }
.simple .card h3 { font-size: 20px; }
.simple .card .join { font-size: 18px; padding: 15px; }
.gtitle { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; font-weight: 800; }

.discord { display: grid; grid-template-columns: minmax(280px, 1.1fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.vc { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.vc-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.vc-h b { flex: 1; }
.vc-h .ct { color: var(--ok); font-weight: 800; }
.vc-h button { border: 0; background: var(--brand); color: #fff; border-radius: 9px; padding: 6px 12px; font-weight: 800; }
.vc.locked .vc-h button { background: #CFC8D3; color: #5B5568; cursor: not-allowed; }
.vc-body { border-top: 1px solid var(--line); padding: 4px 8px; }
.vc-body .p { display: flex; align-items: center; gap: 8px; padding: 4px; font-size: 14px; }
.vc-body .p .av { width: 24px; height: 24px; font-size: 10px; }
.vc-body .more { color: var(--muted); font-size: 13px; padding: 4px; }
.vc-body .empty { color: var(--muted); font-size: 13px; padding: 6px 4px; }
.chat { background: #fff; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; height: min(640px, calc(100vh - 200px)); position: sticky; top: 0; }
.chat-h { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-h select { width: 100%; font-weight: 800; }
.chat-h small { color: var(--muted); display: block; margin-top: 4px; }
.msgs { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.msg b { font-size: 14px; } .msg small { color: var(--muted); margin-left: 6px; } .msg p { margin: 1px 0 0; word-break: break-word; }
.chat form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font: inherit; }
.chat form button { border: 0; background: var(--brand); color: #fff; border-radius: 10px; padding: 0 14px; font-weight: 800; }
.sim-note { background: #FFF8D6; border: 1px solid #F0DC84; color: #5C4800; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }

/* Modales */
.modal { position: fixed; inset: 0; background: rgba(20,17,40,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 18px; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px 20px 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-box .btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.modal-box .btn { border: 0; background: var(--brand); color: #fff; font-weight: 800; border-radius: 10px; padding: 10px 14px; }
.modal-box .btn.alt { background: #EEEAF8; color: var(--brand-d); }
.modal-box .btn.on { outline: 3px solid var(--brand); outline-offset: 1px; }
.modal-box ul { padding-left: 18px; }
.legend { display: grid; gap: 8px; }
.legend div { display: flex; align-items: center; gap: 10px; }
.table-sc { width: 100%; border-collapse: collapse; } .table-sc td { padding: 5px 4px; border-bottom: 1px solid var(--line); }

.tabbar { display: none; }
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  body[data-tab] #left, body[data-tab] #right, body[data-tab] #center { display: none; }
  body[data-tab="salons"] #left { display: flex; }
  body[data-tab="membres"] #right { display: flex; }
  body[data-tab="campus"] #center { display: flex; }
  body.no-left #left, body.no-right #right { visibility: visible; }
  .tabbar { display: flex; background: var(--side); }
  .tabbar button { flex: 1; border: 0; background: transparent; color: var(--side-muted); padding: 12px 0 14px; font-weight: 800; }
  .tabbar button[aria-pressed="true"] { color: #fff; box-shadow: inset 0 3px 0 var(--brand); }
  #toggleLeft, #toggleRight { display: none; }
  .hud-mini { width: 150px; height: 117px; }
  .dock { width: calc(100% - 24px); bottom: 124px; }
  .discord { grid-template-columns: 1fr; }
  .chat { position: static; height: 420px; }
  .views button { padding: 7px 10px; }
  .where { display: none; }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
@media (max-width: 1200px) and (min-width: 901px) {
  #app { grid-template-columns: 220px 1fr 250px; }
  body.no-left #app { grid-template-columns: 0 1fr 250px; }
  body.no-right #app { grid-template-columns: 220px 1fr 0; }
  body.no-left.no-right #app { grid-template-columns: 0 1fr 0; }
  .where { display: none; }
  .views button { padding: 7px 10px; }
}
@media (max-width: 1200px) {
  #top { gap: 6px; padding: 8px; }
  #status { max-width: 128px; padding: 7px 6px; }
  .help-btn { padding: 6px 9px; }
  .views button { padding: 6px 9px; }
  .icon { width: 34px; height: 34px; }
}
@media (max-width: 900px) {
  #app, body.no-left #app, body.no-right #app, body.no-left.no-right #app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  #top .spacer { display: none; }
  #top { justify-content: space-between; }
  #status { max-width: 150px; }
  .page { padding: 14px 14px 40px; }
}

.switch { display: inline-flex; align-items: center; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-weight: 800; border-radius: 10px; padding: 7px 12px; white-space: nowrap; }
.switch:hover { background: var(--bg); border-color: var(--brand); }
@media (max-width: 900px) { .switch { padding: 6px 9px; font-size: 14px; } }

.dock button.on { background: var(--ok); color: #05260F; }
.cam-prev { background: #14162A; border-radius: 14px; padding: 8px; margin-bottom: 10px; text-align: center; }
.cam-prev canvas { width: 100%; max-width: 420px; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; display: block; margin: 0 auto; }
.cam-prev .muted { color: #B9B5D6; font-size: 13px; min-height: 18px; margin-top: 4px; }
.field-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.field-row label { font-weight: 700; min-width: 120px; }
.field-row select, .field-row input[type=range] { flex: 1; min-width: 0; }
.cam-t { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin: 12px 0 6px; }
.cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.cam-bg { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 4px; display: flex; flex-direction: column; gap: 4px; align-items: center; font: inherit; font-size: 12px; font-weight: 700; color: var(--ink); }
.cam-bg canvas { width: 100%; border-radius: 8px; display: block; }
.cam-bg[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(140,75,255,.25); }
.cam-bg:hover { border-color: var(--brand); }

#pseudoAsk { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(20, 14, 34, .72); backdrop-filter: blur(4px); padding: 16px; }
#pseudoAsk form { background: #fff; color: var(--ink); border-radius: 18px; padding: 22px 24px; width: min(24rem, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .4); display: flex; flex-direction: column; gap: 12px; }
#pseudoAsk h2 { margin: 0; font-size: 22px; }
#pseudoAsk p { margin: 0; color: var(--muted); }
#pseudoAsk input { font: inherit; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: inherit; }
#pseudoAsk input.bad { border-color: var(--bad); }
#pseudoAsk button { border: 0; background: var(--brand); color: #fff; font: inherit; font-weight: 800; border-radius: 12px; padding: 13px; font-size: 17px; cursor: pointer; }
#pseudoAsk button:hover { background: var(--brand-d); }
#lkStrip { position: absolute; right: 64px; top: 12px; z-index: 6; display: none; flex-direction: column; align-items: flex-end; gap: 6px; max-height: calc(100% - 270px); overflow: hidden; }
.lktile { position: relative; width: 132px; height: 74px; border-radius: 12px; background: #2B2F44; color: #fff; overflow: hidden; display: grid; place-items: center; box-shadow: 0 3px 12px rgba(0, 0, 0, .3); border: 2px solid rgba(255, 255, 255, .15); }
.lktile .av { font-weight: 800; font-size: 20px; background: #4B4764; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; }
.lktile .n { position: absolute; left: 6px; bottom: 4px; font-size: 12px; font-weight: 700; background: rgba(20, 22, 42, .75); padding: 1px 7px; border-radius: 8px; }
.lktile video.lkv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lktile video.lkv.mirror { transform: scaleX(-1); }
.lktile.cam .av { display: none; }
@media (max-width: 900px) { #lkStrip { top: 56px; right: 56px; } .lktile { width: 104px; height: 60px; } }

.row .bd, .switch .bd { background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.switch { position: relative; }
#chatDrawer { position: absolute; left: 12px; bottom: 12px; z-index: 9; width: min(360px, calc(100% - 24px)); height: min(430px, calc(100% - 90px)); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 34px rgba(20, 14, 40, .3); overflow: hidden; }
#chatDrawer[hidden] { display: none; }
.chat { display: flex; flex-direction: column; }
.chat .chat-h { position: relative; padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chat .chSel { flex: 1; min-width: 0; font-weight: 800; }
.chat .chTopic { width: 100%; color: var(--muted); font-size: 12px; }
.chat .chX { width: 34px; height: 34px; }
.chat .mini { border: 0; background: var(--brand); color: #fff; font-weight: 800; border-radius: 9px; padding: 6px 12px; cursor: pointer; }
.chat .msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.chat .msg.mine b { color: var(--brand-d); }
.chat .chForm { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat .chForm input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font: inherit; }
.chat .chForm button { border: 0; background: var(--brand); color: #fff; border-radius: 10px; padding: 0 14px; font-weight: 800; cursor: pointer; }
#chatMount.chat { height: min(640px, calc(100vh - 200px)); position: sticky; top: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
#notifs { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 24px); }
.notif { display: flex; align-items: center; gap: 8px; background: #231F3A; color: #fff; padding: 10px 12px 10px 16px; border-radius: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); font-weight: 700; }
.notif button { border: 0; background: var(--brand); color: #fff; border-radius: 10px; padding: 7px 12px; font-weight: 800; cursor: pointer; }
.notif button.x { background: transparent; font-size: 18px; padding: 0 6px; color: #B9B5D6; }
#callBar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 12; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; background: #231F3A; color: #fff; border-radius: 16px; padding: 8px 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); max-width: calc(100% - 24px); }
#callBar b { padding: 0 6px; }
#callBar button { border: 0; border-radius: 10px; padding: 7px 12px; font-weight: 800; background: #36326A; color: #fff; cursor: pointer; }
#callBar button.off { background: #5A2A38; }
#callBar button.end { background: var(--bad); }
#screenPanel { position: absolute; z-index: 11; top: 64px; left: 50%; transform: translateX(-50%); width: min(720px, calc(100% - 24px)); background: #000; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 34px rgba(0, 0, 0, .5); }
#screenPanel .bar { display: flex; justify-content: space-between; align-items: center; background: #14162A; color: #fff; padding: 6px 10px; }
#screenPanel .bar button { border: 0; background: #36326A; color: #fff; border-radius: 8px; padding: 4px 10px; font-weight: 700; cursor: pointer; }
#screenPanel video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.lktile.speaking { border-color: #2FBF71; box-shadow: 0 0 0 3px rgba(47, 191, 113, .55); }
body[data-view="rooms"] #chatDrawer { display: none; }
@media (max-width: 900px) { #chatDrawer { bottom: 8px; height: min(380px, calc(100% - 140px)); } #callBar { top: 56px; } }
