﻿/* Экран входа: создание комнаты или вход по коду. */

.lobby {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: calc(var(--safe-top) + 18px) 16px calc(var(--safe-bottom) + 18px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lobby.is-leaving {
    opacity: 0;
    transform: scale(0.99);
    pointer-events: none;
}

.lobby-card {
    position: relative;
    width: min(460px, 100%);
    padding: clamp(20px, 4.6vw, 30px);
    border-radius: 26px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)),
        rgba(21, 23, 27, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow:
        0 0 0 1px rgba(var(--accent-rgb), 0.05),
        0 4px 18px rgba(0, 0, 0, 0.35),
        0 34px 90px rgba(0, 0, 0, 0.58),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(22px) saturate(1.1);
    -webkit-backdrop-filter: blur(22px) saturate(1.1);
    animation: lobby-in 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

.lobby-head {
    text-align: center;
    margin-bottom: 20px;
}

.lobby-logo {
    width: 66px;
    height: 66px;
    margin: 0 auto 14px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 30px;
    color: #04121f;
    background: linear-gradient(150deg, var(--accent) 0%, var(--accent-2) 100%);
    box-shadow: 0 14px 34px rgba(var(--accent-rgb), 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.lobby-head h1 {
    font-size: 26px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.lobby-sub {
    margin-top: 5px;
    font-size: 13.5px;
    color: var(--text-2);
}

.lobby-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.lobby-ping,
.lobby-online {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    color: var(--text-2);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}

.lobby-online .icon {
    font-size: 13px;
    color: var(--accent);
}

.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}

.signal-bars .bar {
    width: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    transition: background-color 0.3s ease;
}

.signal-bars .bar:nth-child(1) { height: 25%; }
.signal-bars .bar:nth-child(2) { height: 50%; }
.signal-bars .bar:nth-child(3) { height: 75%; }
.signal-bars .bar:nth-child(4) { height: 100%; }

.signal-bars .bar.is-active {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.45);
}

/* ---------- Вкладки ---------- */

.lobby-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.lobby-tab {
    min-height: 40px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 550;
    color: var(--text-2);
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.lobby-tab:hover {
    color: var(--text);
}

.lobby-tab.is-active {
    color: var(--text);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.24), rgba(var(--accent-rgb), 0.14));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 6px rgba(0, 0, 0, 0.25);
}

/* ---------- Поля ---------- */

.lobby-form {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-2);
}

.field-hint {
    color: var(--text-3);
    font-weight: 400;
}

.field-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.field-box:focus-within {
    border-color: rgba(var(--accent-rgb), 0.7);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
}

.field-box > .icon {
    font-size: 17px;
    color: var(--text-3);
    flex: none;
}

.input {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    border: none;
    background: transparent;
    color: var(--text);
    /* 16px — иначе iOS зумит страницу при фокусе */
    font-size: 16px;
    outline: none;
}

.input::placeholder {
    color: rgba(255, 255, 255, 0.32);
}

/* Рамку фокуса рисует .field-box, у самого поля она лишняя */
.field-box .input:focus,
.field-box .input:focus-visible {
    outline: none;
}

.input-code {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.35em;
    font-variant-numeric: tabular-nums;
    text-transform: none;
}

.input-code::placeholder {
    letter-spacing: 0.35em;
}

.field-eye {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: var(--text-3);
    font-size: 16px;
    flex: none;
}

.field-eye:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

.field-state {
    min-height: 16px;
    font-size: 12px;
    color: var(--text-3);
}

.field-state[data-tone="ok"] {
    color: var(--ok);
}

.field-state[data-tone="warn"] {
    color: var(--warn);
}

.field-state[data-tone="error"] {
    color: var(--danger);
}

.field-state .icon {
    font-size: 13px;
    margin-right: 3px;
}

.field-error {
    min-height: 18px;
    font-size: 13px;
    color: var(--danger);
}

/* Пустая строка ошибки не должна занимать место */
.field-error:empty {
    display: none;
}

.lobby-submit {
    width: 100%;
    min-height: 52px;
    font-size: 15.5px;
}

.lobby-note {
    font-size: 11.5px;
    line-height: 1.45;
    text-align: center;
    color: var(--text-3);
}

.lobby-foot {
    font-size: 12px;
    color: var(--text-3);
    text-align: center;
}

.lobby-foot a {
    color: var(--text-2);
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.25);
}

.lobby-foot a:hover {
    color: var(--text);
}

.shake {
    animation: shake 0.4s ease;
}

.spinner {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 2px solid rgba(4, 18, 31, 0.25);
    border-top-color: #04121f;
    animation: spin 0.7s linear infinite;
}



@keyframes lobby-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

/* ---------- Микрофон и камера до входа ---------- */

.lobby-devices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.lobby-device {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.lobby-device:hover {
    background: rgba(255, 255, 255, 0.08);
}

.lobby-device:active {
    transform: scale(0.985);
}

.lobby-device.is-on {
    border-color: rgba(110, 231, 168, 0.32);
    background: rgba(110, 231, 168, 0.1);
    color: #d8ffe9;
}

.lobby-device.is-off {
    border-color: rgba(240, 154, 154, 0.32);
    background: rgba(240, 154, 154, 0.1);
    color: #ffdede;
}

.lobby-device-icon {
    display: inline-flex;
    flex: none;
}

.lobby-device-icon .icon {
    width: 17px;
    height: 17px;
}

.lobby-device-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lobby-devices-note {
    margin-bottom: 12px;
    min-height: 16px;
}

.lobby-device.is-off .lobby-device-label {
    text-decoration: line-through;
    text-decoration-color: rgba(255, 255, 255, 0.3);
}