:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --error: #ef4444;
    --input-bg: #f1f5f9;
}

/* Настройки для имитации нативного приложения */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Полный запрет скролла на странице входа */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent; /* Убираем синий блик при клике */
    user-select: none; /* Запрет выделения интерфейса */
}

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background-color: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Используем dvh для идеального соответствия высоте экрана мобильного */
    height: 100dvh; 
    width: 100%;
    /* Учитываем безопасные зоны iPhone (челка/полоска внизу) */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
}

.auth-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 400px;
    /* На мобилках карточка должна занимать почти всю ширину */
    margin: 0 20px;
    padding: 32px 24px;
    border-radius: 28px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    text-align: center;
    /* Плавное появление */
    animation: fadeInScale 0.4s ease-out;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.logo-circle {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 24px;
    box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.4);
}

h1 { 
    font-size: 24px; 
    font-weight: 800;
    color: var(--text); 
    margin: 0 0 8px; 
    letter-spacing: -0.5px;
}

.subtitle { 
    color: var(--muted); 
    font-size: 14px; 
    margin-bottom: 32px; 
    line-height: 1.5;
}

.form-group { 
    text-align: left; 
    margin-bottom: 16px; 
}

label { 
    display: block; 
    font-size: 13px; 
    font-weight: 600; 
    color: var(--muted); 
    margin-bottom: 8px; 
    margin-left: 4px; 
}

.input-wrapper { 
    position: relative; 
}

.input-wrapper i { 
    position: absolute; 
    left: 16px; 
    top: 50%; 
    transform: translateY(-50%); 
    color: var(--muted);
    font-size: 18px;
}

.input-wrapper input {
    width: 100%;
    background: var(--input-bg);
    border: 2px solid transparent;
    padding: 16px 16px 16px 48px;
    border-radius: 16px;
    font-size: 16px; /* 16px предотвращает автозум в Safari iOS */
    color: var(--text);
    box-sizing: border-box;
    transition: all 0.2s ease;
    appearance: none; /* Убираем стандартные стили iOS */
}

/* Включаем возможность ввода текста */
.input-wrapper input {
    user-select: text;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.btn-submit {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 18px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.btn-submit:active { 
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-install {
    background: #10b981 !important; /* Зеленый цвет для установки */
    margin-top: 16px;
}

/* Ошибки */
.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.error-msg {
    color: var(--error);
    background: #fef2f2;
    padding: 14px;
    border-radius: 14px;
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.links {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
}

.links a:hover { color: var(--primary); }

/* Адаптация под очень маленькие экраны (iPhone SE) */
@media (max-height: 670px) {
    .auth-card { padding: 24px 20px; }
    .logo-circle { width: 56px; height: 56px; margin-bottom: 16px; }
    .subtitle { margin-bottom: 20px; }
}