@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/golos-cyr.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/golos-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Палитра из логотипа: золото и серо-голубой (шалфей). Встреча — тёмная, чтобы видео было в центре внимания. */
:root {
  --gold: #d6b06c; --gold-deep: #a9803c; --gold-soft: #ead7ae; --sage: #b7caca;
  --bg: #0e1617; --surface: #162123; --surface2: #1f2d2f; --line: #2c3d3f; --text: #eef3f2; --muted: #9fb2b1;
  --accent: var(--gold); --on-accent: #1d1608; --primary: var(--gold); --on-primary: #1d1608;
  --danger: #df5a52; --on-danger: #fff; --ok: #4fa37a; --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(0,0,0,.55);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}
.light {
  --bg: #f6f4ee; --surface: #fffefb; --surface2: #efece4; --line: #ddd8cc; --text: #1f3437; --muted: #5d7072;
  --primary: #2f5457; --on-primary: #fff; --accent: var(--gold-deep);
  --shadow: 0 18px 40px -24px rgba(47,84,87,.45);
  color-scheme: light;
  background: var(--bg); color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 'Golos Text', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; }
::selection { background: var(--gold-soft); color: #1f3437; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; min-width: 0; caret-color: var(--gold); transition: border-color .2s, box-shadow .2s; }
.light input, .light select { background: var(--surface); }
input::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214,176,108,.28); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.muted { color: var(--muted); }
.error { color: #ff8f86; margin: 10px 0 0; font-size: 14px; }
.light .error { color: #b23b33; }
.row { display: flex; gap: 8px; }
.gap { gap: 10px; justify-content: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); text-decoration: none; color: var(--text); white-space: nowrap; font-weight: 500; transition: background-color .2s, border-color .2s, transform .15s var(--ease), filter .2s; }
.light .btn { background: var(--surface); }
.btn:hover { border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn.primary, .light .btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 15px 22px; font-size: 16px; width: 100%; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.loading { color: transparent !important; position: relative; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
.btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn.send { padding: 10px 12px; }
.link { background: none; border: 0; color: var(--gold); padding: 2px 4px; font-size: 13px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link:disabled { color: var(--muted); opacity: .5; cursor: default; }
.link.danger { color: #ff8f86; }

/* главная */
body.home { overflow: auto; display: grid; place-items: center; min-height: 100%; padding: 24px 16px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse 70% 55% at 50% 30%, rgba(234,215,174,.38), transparent 70%), var(--bg); }
.home-main { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; }
.home-logo { width: min(440px, 92vw); height: auto; margin: 0 0 clamp(20px, 5vh, 44px); animation: dawn 1.6s var(--ease) both; }
@keyframes dawn { from { opacity: .001; filter: blur(10px); transform: translateY(8px) scale(.98); } }
.home-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; animation: rise .9s .35s var(--ease) both; }
@keyframes rise { from { opacity: .001; transform: translateY(10px); } }
.join { display: flex; gap: 8px; }
.join .btn { flex-shrink: 0; }
.or { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; margin: 6px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold) 70%); opacity: .7; }
.or::after { background: linear-gradient(270deg, transparent, var(--gold) 70%); }
.home-actions .error { text-align: center; margin: 0; }
@media (prefers-reduced-motion: reduce) { .home-logo, .home-actions { animation: none; } }

/* экраны */
.screen { position: fixed; inset: 0; }
.screen.center { display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(ellipse 60% 50% at 70% 10%, rgba(234,215,174,.3), transparent 70%), var(--bg); }
.card { background: var(--surface); padding: 32px 28px; border-radius: 22px; text-align: center; max-width: 420px; width: 100%; border: 1px solid var(--line); box-shadow: var(--shadow); }
.card h2 { margin: 16px 0 6px; font-size: 20px; line-height: 1.3; text-wrap: balance; }
.card p { margin: 0 0 20px; }
.mini-logo { display: block; width: 150px; height: auto; margin: 0 auto 8px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface2); border-top-color: var(--gold); margin: 0 auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* перед входом */
.prejoin { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 36px; align-items: center; max-width: 980px; width: 100%; }
.preview { position: relative; aspect-ratio: 16/9; background: #0e1617; border-radius: 22px; overflow: hidden; box-shadow: 0 24px 50px -28px rgba(31,52,55,.7); }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off { position: absolute; inset: 0; display: grid; place-items: center; color: #9fb2b1; background: #162123; }
.preview-controls { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 12px; }
.round { width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); display: grid; place-items: center; background: rgba(14,22,23,.6); color: #fff; backdrop-filter: blur(8px); transition: background-color .2s; }
.round.off { background: var(--danger); border-color: var(--danger); }
.round svg, .ctl svg, .state svg, .mic svg { width: 22px; height: 22px; fill: currentColor; }
.prejoin-form .mini-logo { margin: 0 0 14px; width: 130px; }
.prejoin-form h2 { margin: 0 0 2px; font-size: 24px; line-height: 1.25; }
.prejoin-form > * + * { margin-top: 12px; }
.prejoin-form #roomLabel { margin-top: 2px; font-variant-numeric: tabular-nums; }
.devices { display: grid; gap: 8px; }
@media (max-width: 720px) {
  .prejoin { grid-template-columns: 1fr; gap: 18px; }
  .preview { aspect-ratio: 4/3; border-radius: 18px; }
  .prejoin-form .mini-logo { display: none; }
  .prejoin-form h2 { font-size: 21px; }
}

/* встреча */
#meeting { display: flex; flex-direction: column; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 52px; padding-top: max(10px, env(safe-area-inset-top)); font-size: 14px; }
.code { font-weight: 600; letter-spacing: .02em; }
#clock { font-variant-numeric: tabular-nums; }
.top-logo { height: 30px; width: auto; }
.rec-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.rec-badge { display: inline-flex; align-items: center; gap: 6px; color: #fff; background: var(--danger); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.body { flex: 1; display: flex; min-height: 0; padding: 0 12px; gap: 12px; }
.stage { flex: 1; min-width: 0; display: flex; gap: 8px; }
.grid { flex: 1; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; min-height: 0; overflow: hidden; }
.grid > .tile { width: var(--tw, 320px); height: var(--th, 180px); }
.stage.has-focus .screen-area { flex: 1; min-width: 0; display: flex; }
.stage.has-focus .screen-area > .tile { flex: 1; }
.stage.has-focus .grid { flex: 0 0 220px; flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; overflow-y: auto; }
.stage.has-focus .grid > .tile { width: 100%; height: auto; aspect-ratio: 16/9; flex-shrink: 0; }

.tile { position: relative; background: var(--surface); border-radius: 14px; overflow: hidden; display: grid; place-items: center; outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .15s; }
.tile.speaking { outline-color: var(--gold); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.tile.screen-tile video, .screen-area .tile video { object-fit: contain; background: #000; }
.tile.has-video video { display: block; }
.tile.mirror video { transform: scaleX(-1); }
.tile.has-video .avatar { display: none; }
.avatar { color: #fff; border: 2px solid rgba(214,176,108,.35); width: min(30%, 96px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: clamp(16px, 3vw, 32px); }
.tile .name { position: absolute; left: 8px; bottom: 8px; color: #fff; backdrop-filter: blur(6px); display: flex; align-items: center; gap: 4px; max-width: calc(100% - 16px); background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 6px; font-size: 13px; }
.tile .name .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .mic:not(:empty) { color: #ff8a8d; display: flex; }
.tile .mic svg { width: 16px; height: 16px; }
.tile .hand { position: absolute; top: 8px; left: 8px; font-size: 22px; background: rgba(0,0,0,.5); border-radius: 8px; padding: 2px 6px; }
.tile .pin svg { width: 18px; height: 18px; fill: #fff; display: block; }
.tile .pin { position: absolute; top: 8px; right: 8px; border: 0; background: rgba(0,0,0,.5); border-radius: 8px; padding: 4px 6px; opacity: 0; transition: opacity .15s; }
.tile:hover .pin, .tile.pinned .pin { opacity: 1; }
.quality { position: absolute; top: 10px; right: 44px; width: 8px; height: 8px; border-radius: 50%; }
.q-poor { background: #ffb224; } .q-lost { background: var(--danger); }

/* панель */
.panel { width: 340px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; margin-bottom: 4px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 0 8px; }
.tabs { display: flex; gap: 4px; }
.tab { background: none; border: 0; padding: 8px 12px; border-radius: 8px; color: var(--muted); }
.tab.active { background: var(--surface2); color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }
.icon-btn { background: none; border: 0; padding: 8px; color: var(--muted); display: grid; border-radius: 8px; }
.icon-btn:hover { color: var(--text); background: var(--surface2); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.tab-body { flex: 1; overflow-y: auto; padding: 8px 14px 14px; min-height: 0; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; display: flex; justify-content: space-between; align-items: center; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.list .who em { color: var(--muted); font-style: normal; font-size: 12px; }
.list .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.list .state { color: var(--muted); display: flex; }
.list .state svg { width: 18px; height: 18px; }
.list .actions { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 10px; padding-left: 38px; }
#waitingList .actions { padding-left: 0; flex-basis: auto; }
.switch { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
#muteAll { margin-top: 6px; }

.chat { display: flex; flex-direction: column; padding: 0; }
.chat-log { flex: 1; list-style: none; margin: 0; padding: 8px 14px; overflow-y: auto; }
.chat-log li { margin: 0 0 12px; }
.chat-log .meta { font-size: 12px; color: var(--muted); }
.chat-log .meta b { color: var(--text); font-weight: 600; }
.chat-log .text { white-space: pre-wrap; word-wrap: break-word; }
.chat-log .text a { color: var(--gold); text-underline-offset: 3px; }
.chat-log .sys { color: var(--muted); font-size: 12px; text-align: center; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }

/* нижняя панель */
.controls { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 10px 8px; padding-bottom: max(10px, env(safe-area-inset-bottom)); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.controls::-webkit-scrollbar { display: none; }
.ctl { position: relative; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; padding: 9px 6px 7px; border: 1px solid transparent; border-radius: 14px; background: var(--surface2); font-size: 11px; color: var(--muted); transition: background-color .2s, color .2s, border-color .2s, transform .15s var(--ease); }
.ctl:active { transform: scale(.96); }
.ctl i { font-style: normal; font-size: 20px; line-height: 22px; height: 22px; color: var(--text); display: flex; }
.ctl:hover { border-color: var(--line); color: var(--text); }
.ctl.off { background: var(--danger); color: #fff; }
.ctl.off i, .ctl.active i, .ctl.leave i { color: inherit; }
.ctl.active { background: var(--gold); color: var(--on-accent); }
.ctl.leave { background: var(--danger); color: #fff; margin-left: 8px; }
.badge { position: absolute; top: 2px; right: 6px; background: var(--danger); color: #fff; font-size: 11px; border-radius: 10px; min-width: 18px; padding: 0 5px; line-height: 18px; }
.react-wrap { position: relative; }
.react-menu { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 6px; display: flex; gap: 2px; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 5; }
.react-menu button { background: none; border: 0; font-size: 26px; padding: 4px 6px; border-radius: 8px; }
.react-menu button:hover { background: var(--line); }

.toasts { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 20; width: min(92vw, 420px); pointer-events: none; }
.toast { background: rgba(31,45,47,.97); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.35); font-size: 14px; animation: fadein .2s; word-wrap: break-word; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } }
.reactions-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 15; }
.float-reaction { position: absolute; bottom: 90px; display: flex; flex-direction: column; align-items: center; animation: floatup 4s ease-out forwards; }
.float-reaction span { font-size: 40px; }
.float-reaction small { background: rgba(0,0,0,.6); padding: 1px 6px; border-radius: 6px; font-size: 11px; }
@keyframes floatup { to { transform: translateY(-60vh); opacity: 0; } }

/* телефон */
@media (max-width: 720px) {
  .body { padding: 0 6px; }
  .topbar { padding: 8px 12px; }
  .ctl { min-width: 52px; }
  .ctl span { display: none; }
  .ctl { padding: 10px; border-radius: 50%; width: 46px; height: 46px; min-width: 46px; justify-content: center; }
  .ctl.leave { margin-left: 4px; }
  .badge { top: -2px; right: -2px; }
  .controls { justify-content: flex-start; gap: 8px; padding-left: 10px; padding-right: 10px; }
  .panel { position: fixed; inset: 0; width: auto; border-radius: 0; z-index: 30; margin: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .grid { gap: 6px; }
  .stage.has-focus { flex-direction: column; }
  .stage.has-focus .grid { flex: 0 0 110px; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .stage.has-focus .grid > .tile { width: auto; height: 100%; }
  .tile .pin { opacity: .8; }
}
#moreBtn { display: none; }
@media (max-width: 720px) {
  #moreBtn { display: flex; }
  .controls { flex-wrap: wrap; justify-content: center; overflow: visible; }
  .controls .extra { display: none; }
  .controls.more-open .extra:not([hidden]) { display: flex; }
  .controls.more-open #moreBtn { background: var(--gold); color: var(--on-accent); }
  .react-wrap .ctl { display: flex; }
}

/* доска для рисования */
.wb-tile { background: #22302f; }
.wb-layer { position: absolute; inset: 0; z-index: 2; }
.wb-canvas { position: absolute; touch-action: none; cursor: crosshair; border-radius: 6px; }
.wb-layer.overlay .wb-canvas { border-radius: 0; outline: 2px dashed rgba(214,176,108,.7); }
.wb-tools { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 5px 8px; background: rgba(22,33,35,.94); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.35); max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; }
.wb-tools button { flex-shrink: 0; background: none; border: 0; border-radius: 8px; padding: 4px 6px; font-size: 17px; line-height: 1; }
.wb-tools button.active { background: var(--gold); }
.wb-tools .wb-color { width: 22px; height: 22px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid #555; }
.wb-tools .wb-color.active { outline: 2px solid #fff; outline-offset: 1px; background: var(--c); }
.wb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px; flex-shrink: 0; }
.wb-tile .name { z-index: 3; }
.tile.screen-tile .pin, .tile.screen-tile .quality { z-index: 3; }
.wb-layer.readonly .wb-tools { display: none; }
.wb-layer.readonly .wb-canvas { pointer-events: none; cursor: default; }
