/* Rossi Конференции — premium dark UI, red accent. */

:root {
  --accent:        #ff2d4a;
  --accent-soft:   #ff5563;
  --accent-deep:   #c81d35;
  --accent-glow:   rgba(255, 45, 74, .45);

  --bg-0:    #07080c;
  --bg-1:    #0c0e15;
  --surface: rgba(22, 24, 33, .72);
  --surface-2: rgba(32, 35, 47, .80);
  --stroke:  rgba(255, 255, 255, .08);
  --stroke-2: rgba(255, 255, 255, .14);

  --text:    #f4f5f8;
  --text-2:  #a6abba;
  --text-3:  #6b7185;

  --ok:      #2fd07a;
  --radius:  20px;
  --radius-sm: 13px;
  --shadow:  0 28px 60px -20px rgba(0, 0, 0, .75);
  --font:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }

#app { height: 100%; }

/* ───────── screens ───────── */

.screen {
  display: none;
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
}
.screen.active { display: flex; }

.screen:not(.call) {
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 16px;
  padding: 28px 24px;
  overflow-y: auto;
  background:
    radial-gradient(900px 600px at 18% -10%, rgba(255, 45, 74, .14), transparent 60%),
    radial-gradient(800px 600px at 100% 110%, rgba(120, 40, 220, .12), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
}

/* ───────── aurora ───────── */

.aurora {
  position: absolute;
  inset: -30%;
  pointer-events: none;
  background:
    radial-gradient(420px 420px at 25% 30%, var(--accent-glow), transparent 70%),
    radial-gradient(460px 460px at 78% 72%, rgba(120, 50, 235, .30), transparent 70%);
  filter: blur(40px);
  opacity: .55;
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(4%, 3%, 0) scale(1.12); }
}

/* ───────── card ───────── */

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 392px;
  padding: 34px 32px 30px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  animation: rise .5s cubic-bezier(.2, .7, .2, 1) both;
}
.card-wide { max-width: 520px; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ───────── brand ───────── */

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .2px;
  color: var(--text);
  margin-bottom: 22px;
}
.brand em {
  font-style: normal;
  font-weight: 600;
  color: var(--text-2);
}
.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 45, 74, .18), 0 0 14px var(--accent-glow);
}
.brand-sm { margin: 0; font-size: 14px; }

/* ───────── typography ───────── */

h1 {
  font-size: 23px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.3px;
  margin-bottom: 6px;
}
.muted {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ───────── form ───────── */

.lbl {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 14px;
}
.field {
  width: 100%;
  margin-top: 7px;
  padding: 13px 15px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: rgba(10, 11, 17, .72);
  border: 1px solid var(--stroke-2);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field::placeholder { color: var(--text-3); }
.field:focus {
  border-color: var(--accent-soft);
  background: rgba(10, 11, 17, .9);
  box-shadow: 0 0 0 3px rgba(255, 45, 74, .16);
}

/* ───────── buttons ───────── */

.btn {
  width: 100%;
  margin-top: 6px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 650;
  font-family: var(--font);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, filter .15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-deep));
  box-shadow: 0 12px 28px -10px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-primary:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: default; transform: none; filter: none; }

/* ───────── error ───────── */

.error {
  margin-top: 13px;
  padding: 10px 13px;
  font-size: 13px;
  color: #ffd7dc;
  background: rgba(255, 45, 74, .12);
  border: 1px solid rgba(255, 45, 74, .32);
  border-radius: 10px;
}
.error[hidden] { display: none; }

.page-foot {
  flex-shrink: 0;
  z-index: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* ───────── pre-call preview ───────── */

.preview-wrap {
  position: relative;
  margin: 18px 0;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--stroke);
}
.preview-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.novideo {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--bg-1);
}
.novideo[hidden] { display: none; }
.novideo-icon { font-size: 30px; opacity: .8; }

.precall-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.pill-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  color: #ffb9c1;
  background: rgba(255, 45, 74, .1);
  border: 1px solid rgba(255, 45, 74, .3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
}
.pill-toggle .ic { width: 18px; height: 18px; }
.pill-toggle.on {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--stroke-2);
}

/* ───────── icons ───────── */

.ic {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ───────── in-call layout ───────── */

.screen.call {
  flex-direction: column;
  background: linear-gradient(180deg, #0a0b11, #060709);
}

.call-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(8, 9, 13, .8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 5;
}
.call-title {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
}
.call-top .brand-sm { margin-right: 4px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 999px;
}
.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(47, 208, 122, .7);
}
.chip-rec {
  margin-left: auto;
  color: #ffc2c9;
  background: rgba(255, 45, 74, .14);
  border-color: rgba(255, 45, 74, .35);
  animation: pulse 2s ease-in-out infinite;
}
.chip-rec[hidden] { display: none; }
@keyframes pulse { 50% { opacity: .55; } }

/* ───────── video grid ───────── */

.grid {
  flex: 1;
  display: grid;
  gap: 12px;
  padding: 16px;
  overflow: auto;
  align-content: center;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid:has(.tile:nth-child(1):last-child) { grid-template-columns: minmax(0, 880px); }
.grid:has(.tile:nth-child(2):last-child),
.grid:has(.tile:nth-child(3):last-child),
.grid:has(.tile:nth-child(4):last-child) { grid-template-columns: repeat(2, 1fr); }

.tile {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #101119;
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 30px -16px rgba(0, 0, 0, .8);
  animation: rise .35s ease both;
}
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile.self video { transform: scaleX(-1); }
.tile-name {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: rgba(7, 8, 12, .74);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

/* ───────── control bar ───────── */

.call-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: rgba(8, 9, 13, .9);
  border-top: 1px solid var(--stroke);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 5;
}
.ctl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 74px;
  padding: 9px 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .12s, background .15s, color .15s, border-color .15s;
}
.ctl:hover { transform: translateY(-2px); color: var(--text); }
.ctl.on {
  color: #fff;
  background: rgba(255, 45, 74, .16);
  border-color: rgba(255, 45, 74, .42);
}
.ctl.on .ic { color: var(--accent-soft); }
.ctl.off {
  color: #ffb9c1;
  background: rgba(255, 45, 74, .12);
  border-color: rgba(255, 45, 74, .3);
}
.ctl-leave {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-deep));
  border-color: transparent;
}
.ctl-leave:hover { color: #fff; filter: brightness(1.08); }

/* ───────── side panels ───────── */

.panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 86vw;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--stroke);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  box-shadow: -24px 0 60px -24px rgba(0, 0, 0, .8);
  z-index: 10;
  animation: slideIn .25s cubic-bezier(.2, .7, .2, 1);
}
.panel[hidden] { display: none; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid var(--stroke);
}
.x {
  width: 30px;
  height: 30px;
  font-size: 19px;
  line-height: 1;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 9px;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.x:hover { color: var(--text); background: rgba(255, 45, 74, .14); }

.panel-list {
  flex: 1;
  list-style: none;
  overflow: auto;
  padding: 10px;
}
.panel-list li {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 11px 12px;
  margin-bottom: 6px;
  font-size: 14px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--stroke);
  border-radius: 11px;
}
.p-main {
  display: flex;
  align-items: center;
  gap: 9px;
}
.p-main > span:first-child {
  flex: 1;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-hand { font-size: 15px; }
.p-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  padding: 3px 8px;
  background: var(--surface-2);
  border-radius: 999px;
}
.p-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.p-btn {
  flex: 1;
  min-width: 78px;
  padding: 7px 8px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 9px;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.p-btn:hover { color: var(--text); border-color: var(--stroke-2); }
.p-btn.muted { color: var(--accent-soft); border-color: rgba(255, 45, 74, .35); }
.p-btn.danger { color: #ffb9c1; }
.p-btn.danger:hover {
  color: #fff;
  background: rgba(255, 45, 74, .2);
  border-color: rgba(255, 45, 74, .45);
}

.lock-btn {
  margin-left: auto;
  margin-right: 8px;
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.lock-btn:hover { color: var(--text); }
.lock-btn.on {
  color: #fff;
  background: rgba(255, 45, 74, .18);
  border-color: rgba(255, 45, 74, .42);
}

/* ───────── chat ───────── */

.chat-log {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 86%;
  padding: 8px 12px;
  font-size: 13.5px;
  line-height: 1.45;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 12px 12px 12px 4px;
  word-wrap: break-word;
  animation: rise .25s ease both;
}
.chat-msg.self {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-deep));
  border-color: transparent;
  border-radius: 12px 12px 4px 12px;
}
.chat-msg .chat-from {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-soft);
  margin-bottom: 2px;
}
.chat-msg.self .chat-from { color: rgba(255, 255, 255, .85); }
.chat-empty {
  margin: auto;
  font-size: 13px;
  color: var(--text-3);
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--stroke);
}
.chat-form .field { margin-top: 0; }
.btn-send {
  flex-shrink: 0;
  width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-deep));
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter .15s, transform .12s;
}
.btn-send:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-send .ic { width: 20px; height: 20px; }

/* ───────── ended ───────── */

.ended-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-deep));
  border-radius: 50%;
  box-shadow: 0 12px 30px -8px var(--accent-glow);
}
#screen-ended .card { text-align: center; }
#screen-ended h1 { margin-bottom: 6px; }

/* ───────── responsive ───────── */

@media (max-width: 560px) {
  .call-bar { gap: 6px; padding: 11px 8px calc(11px + env(safe-area-inset-bottom)); }
  .ctl { width: auto; flex: 1; max-width: 58px; padding: 11px 4px; gap: 0; }
  .ctl span:not(.ic) { display: none; }
  .grid { grid-template-columns: 1fr !important; padding: 10px; }
  .call-title { display: none; }
  .panel { width: 100%; max-width: 100%; }
}
