/* =========================================================
   GameMates — стиль (тёмная игровая тема, неон)
   ========================================================= */
:root {
  --bg: #0b0b12; --panel: rgba(20,20,32,0.78); --panel-solid: #14141f;
  --border: rgba(255,255,255,0.08); --border-2: rgba(255,255,255,0.16);
  --text: #eef0f7; --muted: #8a8ca0;
  --violet: #7c5cff; --violet-2: #a892ff; --pink: #ff5c8a; --cyan: #2fd9ff;
  --green: #4be36a; --amber: #ffb02f; --red: #ff4d5e;
  --grad: linear-gradient(135deg,#7c5cff,#ff5c8a);
  --radius: 16px; --radius-sm: 11px; --shadow: 0 12px 40px rgba(0,0,0,.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { font-family: 'Inter',system-ui,sans-serif; background: var(--bg); color: var(--text); overflow: hidden; -webkit-font-smoothing: antialiased; }

/* фон */
.bg-grid { position: fixed; inset: 0; z-index: 0;
  background-image: linear-gradient(rgba(124,92,255,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(124,92,255,.05) 1px,transparent 1px);
  background-size: 46px 46px; mask-image: radial-gradient(ellipse 80% 70% at 50% 40%,#000 40%,transparent); }
.bg-glow { position: fixed; border-radius: 50%; filter: blur(130px); opacity: .4; z-index: 0; pointer-events: none; }
.bg-glow--1 { width: 540px; height: 540px; top: -180px; left: -120px; background: radial-gradient(circle,var(--violet),transparent 70%); animation: f1 20s ease-in-out infinite; }
.bg-glow--2 { width: 480px; height: 480px; bottom: -180px; right: -120px; background: radial-gradient(circle,var(--pink),transparent 70%); animation: f2 24s ease-in-out infinite; }
@keyframes f1 { 50% { transform: translate(60px,40px);} }
@keyframes f2 { 50% { transform: translate(-50px,-30px);} }

/* общие */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  padding: 11px 18px; border-radius: var(--radius-sm); font: inherit; font-weight: 600; font-size: 14px;
  background: rgba(255,255,255,.06); border: 1px solid var(--border-2); color: var(--text); transition: .18s; white-space: nowrap; }
.btn:hover { background: rgba(255,255,255,.1); transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 8px 22px rgba(124,92,255,.4); }
.btn--primary:hover { box-shadow: 0 10px 30px rgba(124,92,255,.55); }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--lg { padding: 15px 34px; font-size: 16px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; cursor: pointer; background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--text); font-size: 16px; }
.input { width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(0,0,0,.35); border: 1px solid var(--border-2); color: var(--text); font: inherit; font-size: 14px; transition: .15s; }
.input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124,92,255,.22); }
.input::placeholder { color: #5a5c70; }
select.input { appearance: none; cursor: pointer; }
textarea.input { resize: vertical; font-family: inherit; }
.badge { background: rgba(124,92,255,.2); color: var(--violet-2); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.muted { color: var(--muted); }
.only-mobile { display: none; }

.brand { display: flex; align-items: center; gap: 11px; justify-content: center; }
.brand__logo { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 25px; background: var(--grad); box-shadow: 0 6px 20px rgba(124,92,255,.5); flex-shrink: 0; }
.brand__name { font-family: 'Orbitron',sans-serif; font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.brand__name span { color: var(--violet-2); }

.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden; background-size: cover; background-position: center; }

/* =================== AUTH =================== */
.auth { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth__card { width: 100%; max-width: 420px; background: var(--panel); backdrop-filter: blur(20px); border: 1px solid var(--border-2); border-radius: 22px; padding: 34px 30px; box-shadow: var(--shadow); }
.auth__tagline { text-align: center; color: var(--muted); margin: 12px 0 22px; }
.tabs { display: flex; gap: 6px; background: rgba(0,0,0,.3); border-radius: var(--radius-sm); padding: 5px; margin-bottom: 22px; }
.tab { flex: 1; padding: 10px; border: none; background: transparent; color: var(--muted); font: inherit; font-weight: 600; border-radius: 8px; cursor: pointer; transition: .15s; }
.tab.is-active { background: var(--grad); color: #fff; }
.auth__form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.auth__divider { text-align: center; position: relative; margin: 20px 0 14px; color: var(--muted); font-size: 13px; }
.auth__divider::before, .auth__divider::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--border-2); }
.auth__divider::before { left: 0; } .auth__divider::after { right: 0; }
.google-host { display: flex; justify-content: center; }
.auth__error { color: var(--red); font-size: 13.5px; text-align: center; margin-top: 14px; min-height: 18px; }

/* =================== LAYOUT =================== */
.layout { position: relative; z-index: 1; height: 100vh; display: grid; grid-template-columns: 270px 1fr; gap: 14px; padding: 14px; }

/* НАВ */
.nav { background: var(--panel); backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; min-height: 0; }
.nav__brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; }
.nav__brand .brand__logo { width: 38px; height: 38px; font-size: 20px; border-radius: 11px; }
.nav__brand .brand__name { font-size: 18px; }

.profile-box { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius-sm); background: rgba(124,92,255,.12); border: 1px solid rgba(124,92,255,.3); margin-bottom: 16px; }
.profile-box__main { display: flex; align-items: center; gap: 11px; flex: 1; cursor: pointer; min-width: 0; }
.profile-box__info { min-width: 0; }
.profile-box__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-box__sub { font-size: 11px; color: var(--muted); }
.logout-btn { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; cursor: pointer; background: rgba(255,77,94,.12); border: 1px solid rgba(255,77,94,.3); color: var(--red); font-size: 17px; transition: .15s; }
.logout-btn:hover { background: rgba(255,77,94,.22); }

.nav__menu { display: flex; flex-direction: column; gap: 4px; }
.nav__item { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: var(--radius-sm); background: transparent; border: 1px solid transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; transition: .15s; }
.nav__item:hover { background: rgba(255,255,255,.05); }
.nav__item.is-active { background: rgba(124,92,255,.16); border-color: rgba(124,92,255,.4); color: #fff; }
.nav__ic { font-size: 17px; width: 22px; text-align: center; }
.nav__badge { margin-left: auto; background: var(--pink); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; display: grid; place-items: center; font-size: 11px; font-weight: 700; padding: 0 5px; }

.nav__online { margin-top: auto; padding-top: 14px; min-height: 0; display: flex; flex-direction: column; }
.nav__online-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.online-list { overflow-y: auto; display: flex; flex-direction: column; gap: 3px; max-height: 220px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; cursor: pointer; transition: .15s; }
.user-row:hover { background: rgba(255,255,255,.05); }
.user-row .avatar { width: 30px; height: 30px; font-size: 13px; }
.user-row__name { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

/* КОНТЕНТ */
.content { min-width: 0; min-height: 0; display: flex; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.view__head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.view__head h1 { font-family: 'Orbitron',sans-serif; font-size: 22px; }
.view__head .muted { font-size: 13px; margin-top: 3px; }
.view__head .btn { margin-left: auto; }

/* панель-обёртка */
.chat, .dm, .profile-card, .voice-stage, .voice-room { background: var(--panel); backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: var(--radius); }

/* ЧАТ */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 11px; animation: msgIn .2s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg .avatar { width: 38px; height: 38px; font-size: 15px; cursor: pointer; }
.msg__body { min-width: 0; }
.msg__head { display: flex; align-items: baseline; gap: 8px; }
.msg__name { font-weight: 700; font-size: 14px; cursor: pointer; }
.msg__name.is-me { color: var(--violet-2); }
.msg__time { font-size: 11px; color: var(--muted); }
.msg__text { font-size: 14.5px; line-height: 1.5; word-break: break-word; margin-top: 2px; }
.msg--out { flex-direction: row-reverse; }
.msg--out .msg__head { flex-direction: row-reverse; }
.msg--out .msg__text { background: rgba(124,92,255,.18); padding: 8px 12px; border-radius: 12px; }
.typing { height: 18px; padding: 0 18px; font-size: 12px; color: var(--muted); font-style: italic; }
.composer { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.composer .input { flex: 1; }
.composer .btn { width: 50px; font-size: 18px; }

/* ЗАЯВКИ */
.lfg-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 14px; align-content: start; padding-right: 4px; }
.lfg-empty-big { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 60px 20px; }
.lfg-card { background: rgba(0,0,0,.28); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 16px; transition: .18s; }
.lfg-card:hover { border-color: rgba(124,92,255,.5); }
.lfg-card__top { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; cursor: pointer; }
.lfg-card__top .avatar { width: 32px; height: 32px; font-size: 14px; }
.lfg-card__user { font-weight: 600; font-size: 14px; }
.lfg-card__game { font-family: 'Orbitron',sans-serif; font-size: 16px; margin-bottom: 9px; }
.lfg-card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 11px; }
.chip { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--border); color: var(--muted); }
.chip.v { color: var(--violet-2); border-color: rgba(124,92,255,.4); }
.lfg-card__note { font-size: 13px; color: var(--muted); margin-bottom: 12px; font-style: italic; }
.lfg-card__actions { display: flex; gap: 8px; }
.lfg-card__actions .btn { flex: 1; }

/* ЛС */
.view--dm { min-height: 0; }
.dm { flex: 1; display: grid; grid-template-columns: 260px 1fr; min-height: 0; overflow: hidden; }
.dm__list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.dm__list-head { padding: 16px; font-weight: 700; border-bottom: 1px solid var(--border); }
.dm__list > div:last-child { overflow-y: auto; flex: 1; }
.dm-row { display: flex; align-items: center; gap: 11px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: .15s; }
.dm-row:hover, .dm-row.is-active { background: rgba(124,92,255,.1); }
.dm-row .avatar { width: 38px; height: 38px; font-size: 15px; }
.dm-row__info { min-width: 0; flex: 1; }
.dm-row__name { font-weight: 600; font-size: 14px; }
.dm-row__last { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-row__badge { background: var(--pink); color: #fff; border-radius: 999px; min-width: 18px; height: 18px; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.dm__chat { display: flex; flex-direction: column; min-height: 0; }
.dm__empty { margin: auto; color: var(--muted); padding: 20px; text-align: center; }
.dm__active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dm__head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.dm__peer { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.dm__peer .avatar { width: 34px; height: 34px; font-size: 14px; }

/* ПРОФИЛЬ */
.profile-card { padding: 26px; max-width: 540px; }
.profile-card__top { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.profile-card__top .avatar { width: 72px; height: 72px; font-size: 28px; }
.profile-card__name { font-family: 'Orbitron',sans-serif; font-size: 22px; }
#profileForm { display: flex; flex-direction: column; gap: 16px; }

/* ГОЛОС */
.voice-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 30px; }
.voice-orb { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; font-size: 48px; background: var(--grad); box-shadow: 0 0 60px rgba(124,92,255,.5); animation: orb 3s ease-in-out infinite; }
@keyframes orb { 50% { transform: scale(1.06); } }
.voice-stage.searching .voice-orb { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 40px rgba(124,92,255,.4);} 50% { box-shadow: 0 0 90px rgba(124,92,255,.9);} }
.voice-stage h2 { font-family: 'Orbitron',sans-serif; font-size: 22px; }
.voice-settings { background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 280px; }
.ptt-bind { display: flex; align-items: center; gap: 10px; font-size: 13px; justify-content: center; flex-wrap: wrap; }
.ptt-bind .btn { min-width: 54px; font-family: 'JetBrains Mono',monospace; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--violet); }

.voice-room { flex: 1; display: flex; flex-direction: column; padding: 24px; gap: 20px; min-height: 0; }
.voice-room__peers { display: flex; gap: 24px; justify-content: center; }
.voice-peer { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.voice-peer__av { width: 90px; height: 90px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 700; background: rgba(124,92,255,.2); border: 3px solid transparent; transition: .12s; }
.voice-peer.speaking .voice-peer__av { border-color: var(--green); box-shadow: 0 0 24px rgba(75,227,106,.6); }
.voice-peer.muted .voice-peer__av { opacity: .55; }
.screen-wrap { flex: 1; min-height: 0; background: #000; border-radius: var(--radius-sm); overflow: hidden; display: grid; place-items: center; border: 1px solid var(--border-2); }
.screen-wrap video { width: 100%; height: 100%; object-fit: contain; }
.voice-controls { display: flex; gap: 14px; justify-content: center; }
.vc-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 76px; padding: 14px 0; border-radius: var(--radius-sm); cursor: pointer; background: rgba(255,255,255,.06); border: 1px solid var(--border-2); color: var(--text); font-size: 22px; transition: .15s; }
.vc-btn small { font-size: 11px; }
.vc-btn:hover { background: rgba(255,255,255,.12); }
.vc-btn.is-off { background: rgba(255,77,94,.16); border-color: rgba(255,77,94,.4); color: var(--red); }
.vc-btn.is-on { background: rgba(75,227,106,.16); border-color: rgba(75,227,106,.4); color: var(--green); }
.vc-btn--leave { background: rgba(255,77,94,.16); border-color: rgba(255,77,94,.4); color: var(--red); }
.vc-btn--leave:hover { background: rgba(255,77,94,.28); }
.ptt-indicator { text-align: center; color: var(--muted); font-size: 14px; padding: 10px; border-radius: var(--radius-sm); background: rgba(0,0,0,.25); }
.ptt-indicator.active { color: var(--green); background: rgba(75,227,106,.12); }
.ptt-indicator b { font-family: 'JetBrains Mono',monospace; color: var(--violet-2); }

/* модалки */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal[aria-hidden="false"] { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); }
.modal__box { position: relative; margin: 7vh auto 0; width: 92%; max-width: 460px; background: var(--panel-solid); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow); animation: pop .22s cubic-bezier(.2,.9,.3,1.2); }
.modal__box--sm { max-width: 400px; }
@keyframes pop { from { transform: translateY(18px) scale(.97); opacity: 0; } }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal__head h2 { font-size: 18px; }
.modal__body { padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* профиль в модалке */
.um-top { display: flex; align-items: center; gap: 14px; }
.um-top .avatar { width: 60px; height: 60px; font-size: 24px; }
.um-name { font-family: 'Orbitron',sans-serif; font-size: 20px; }
.um-about { color: var(--muted); font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

/* тосты */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--panel-solid); border: 1px solid var(--border-2); border-left: 4px solid var(--violet); padding: 13px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 14px; animation: tin .25s ease; }
.toast--success { border-left-color: var(--green); }
.toast--error { border-left-color: var(--red); }
@keyframes tin { from { transform: translateX(30px); opacity: 0; } }

/* ===== аватарка в профиле ===== */
.profile-card__topinfo { display: flex; flex-direction: column; gap: 6px; }
.avatar-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.profile-card__top .avatar { cursor: default; }

/* ===== композер ЛС: выравнивание значков ===== */
.composer { align-items: center; }
.composer .icon-btn { flex-shrink: 0; font-size: 18px; }

/* ===== смайлики ===== */
.emoji-picker { display: flex; flex-wrap: wrap; gap: 4px; padding: 12px 14px; border-top: 1px solid var(--border);
  background: rgba(0,0,0,.25); max-height: 180px; overflow-y: auto; }
.emoji { font-size: 22px; line-height: 1; padding: 5px; border: none; background: transparent; cursor: pointer;
  border-radius: 8px; transition: .12s; }
.emoji:hover { background: rgba(255,255,255,.1); transform: scale(1.15); }

/* ===== картинки в сообщениях ===== */
.msg__img { max-width: 240px; max-height: 240px; border-radius: 12px; margin-top: 4px; cursor: pointer;
  border: 1px solid var(--border-2); display: block; object-fit: cover; }
.msg--out .msg__img { margin-left: auto; }
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.9); display: grid; place-items: center;
  cursor: zoom-out; animation: fade .15s ease; padding: 24px; }
@keyframes fade { from { opacity: 0; } }
.lightbox img { max-width: 95%; max-height: 95%; border-radius: 10px; }

/* ===== голос: ровные значки ===== */
.voice-controls { gap: 16px; align-items: stretch; }
.vc-btn { justify-content: center; line-height: 1; }
.vc-btn small { opacity: .85; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(124,92,255,.3); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124,92,255,.5); }

/* ===================== АДАПТИВ (телефон) ===================== */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 8px; padding: 8px; height: 100dvh; }
  .nav { flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; overflow-x: auto; }
  .nav__brand, .nav__online { display: none; }
  .profile-box { margin: 0; flex-shrink: 0; padding: 6px 8px; }
  .profile-box__sub { display: none; }
  .nav__menu { flex-direction: row; flex: 1; gap: 6px; }
  .nav__item { padding: 9px 11px; white-space: nowrap; font-size: 0; gap: 0; }
  .nav__ic { font-size: 20px; width: auto; }
  .nav__item.is-active { font-size: 13px; gap: 8px; }     /* активная — с подписью */
  .nav__badge { font-size: 10px; min-width: 16px; height: 16px; }
  .only-mobile { display: grid; }

  .view__head h1 { font-size: 19px; }
  .view__head .muted { display: none; }
  .content { overflow: hidden; }

  .dm { grid-template-columns: 1fr; }
  .dm__list.hide-mobile { display: none; }
  .msg__img { max-width: 70vw; }

  .voice-room__peers { gap: 16px; }
  .voice-peer__av { width: 70px; height: 70px; font-size: 24px; }
  .voice-orb { width: 90px; height: 90px; font-size: 38px; }
  .voice-settings { min-width: 0; width: 100%; }
  .vc-btn { width: 64px; font-size: 20px; padding: 12px 0; }
  .modal__box { margin-top: 4vh; }
}

