/*
 * Phase 13 — Unified Welcome Gateway.
 * Bespoke Lab Records ice/slime identity. Строго ЗАПРЕЩЕНО использовать
 * platform theme variables (--tg-theme-*, --vkui--*) — см. PHASE_13 §2.
 * Палитра переиспользует акценты main.css (#77F601 lime / #C400FB magenta,
 * фон #0a0a12), но не импортирует main.css целиком — экран отдельный.
 */

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body.welcome-shell {
    margin: 0;
    min-height: 100vh;
    font-family: 'Benzin', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    color: #ffffff;
    background-color: #0a0a12;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-x: hidden;
    position: relative;
}

/* Пока ищем Telegram/VK — только спиннер, без вспышки формы входа */
body.welcome-shell.welcome-pending {
    padding: 0;
}
body.welcome-shell.welcome-pending .welcome-card {
    display: none !important;
}
body.welcome-shell.welcome-pending .welcome-backdrop {
    opacity: 0;
}
.welcome-gate-spinner {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
}
body.welcome-shell.welcome-pending .welcome-gate-spinner {
    display: flex;
}
.welcome-gate-spinner-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.welcome-gate-spinner-ring {
    position: absolute;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.92);
    animation: welcome-gate-spin 0.85s linear infinite;
}
.welcome-gate-logo {
    position: relative;
    width: 52px;
    height: 52px;
    overflow: hidden;
}
.welcome-gate-logo-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) saturate(0%) invert(1);
    opacity: 0.82;
}
@keyframes welcome-gate-spin {
    to { transform: rotate(360deg); }
}

.welcome-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #0a0a12 url('/static/background/main.webp') center/cover no-repeat;
}

.welcome-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 50% at 50% 0%, rgba(119, 246, 1, 0.16), transparent 70%),
        radial-gradient(60% 50% at 100% 100%, rgba(196, 0, 251, 0.16), transparent 70%),
        rgba(10, 10, 18, 0.72);
}

.welcome-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 40px 28px 32px;
    border-radius: 28px;
    background: rgba(18, 18, 28, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: welcome-card-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes welcome-card-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.welcome-logo {
    width: 160px;
    max-width: 70vw;
    margin-bottom: 16px;
}

.welcome-logo-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.welcome-title {
    margin: 0 0 8px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #ffffff;
}

.welcome-subtitle {
    margin: 0 0 24px;
    font-size: 0.92rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.65);
    max-width: 320px;
}

.welcome-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 4px;
    text-align: left;
}

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

.welcome-field-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    padding-left: 2px;
}

.welcome-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.welcome-input::placeholder {
    color: rgba(255, 255, 255, 0.28);
}

.welcome-input:focus {
    border-color: rgba(119, 246, 1, 0.45);
    background: rgba(255, 255, 255, 0.07);
}

.welcome-divider {
    width: 100%;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.8rem;
}

.welcome-divider::before,
.welcome-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.welcome-divider span {
    flex-shrink: 0;
}

.welcome-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    margin-top: 0;
}

.welcome-vkid-slot {
    width: 100%;
    display: flex;
    justify-content: center;
    min-height: 44px;
}

.welcome-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    border-radius: 16px;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.welcome-btn:active {
    transform: translateY(1px);
}

.welcome-btn--primary {
    background: #ffffff;
    color: #0a0a12;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.welcome-btn--primary:hover {
    background: #f2f2f5;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.welcome-btn--primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.welcome-btn--telegram {
    background: #2AABEE;
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 16px rgba(42, 171, 238, 0.35);
}

.welcome-btn--telegram:hover {
    background: #229ED9;
    box-shadow: 0 6px 22px rgba(42, 171, 238, 0.45);
}

.welcome-btn--secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.welcome-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.welcome-btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.welcome-legal {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.4);
    max-width: 300px;
}

.welcome-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 14px;
    background: rgba(20, 20, 30, 0.92);
    border: 1px solid rgba(255, 80, 80, 0.35);
    color: #ffdddd;
    font-size: 0.85rem;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 20;
}

@media (max-width: 380px) {
    .welcome-card {
        padding: 32px 20px 26px;
        border-radius: 22px;
    }
}
