* { box-sizing: border-box; }

.auth-body {
    margin: 0;
    min-height: 100vh;
    background: #050914 url('/nightsky.jpg') center center / cover no-repeat fixed;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    color: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    position: relative;
    overflow-x: hidden;
}

/* Леко затъмняване — зад децата (z-index: -1) */
.auth-body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(5,9,20,.35) 0%, rgba(5,9,20,.55) 100%);
    pointer-events: none;
    z-index: -1;
}

.auth-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.45);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 2;
    margin: auto;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

/* Стек от карти (login + настолно приложение) — центриран по вертикала */
.auth-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 420px;
    margin: auto;
    position: relative;
    z-index: 2;
}

.auth-stack .auth-card {
    margin: 0;
    max-width: 100%;
}

/* Заглавие на секция с икона */
.auth-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    color: #fff;
    font-size: 18px;
    font-weight: 500;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.auth-section-title svg { flex-shrink: 0; }

/* Ред от два бутона (Свали / Изходен код) */
.auth-actions-row {
    display: flex;
    gap: 12px;
}

.auth-actions-row > .btn-primary,
.auth-actions-row > .btn-secondary {
    flex: 1;
    width: auto;
    margin-top: 0;
}

/* Кръгъл бутон „Помощ" с надпис „Инструкции" — горе вдясно */
.help-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: transform .15s ease;
}

.help-btn__circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #1976d2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: background .15s ease, box-shadow .15s ease;
}

.help-btn__label {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.help-btn:hover {
    transform: scale(1.06);
}

.help-btn:hover .help-btn__circle {
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.help-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    border-radius: 8px;
}

/* `help-btn` сега е <button> — изчистваме default browser styles */
button.help-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

/* ── Help модал (fullscreen overlay с iframe) ─────────────────────────── */
.help-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .18s ease;
}

/* HTML `hidden` атрибутът трябва да доминира над display: flex */
.help-modal[hidden] { display: none !important; }

.help-modal.open { opacity: 1; }

.help-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 9, 20, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.help-modal-frame {
    position: relative;
    width: calc(100vw - 48px);
    height: calc(100vh - 48px);
    max-width: 1400px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    transform: scale(0.96);
    transition: transform .22s ease;
}

.help-modal.open .help-modal-frame { transform: scale(1); }

.help-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.help-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #0F172A;
}

.help-modal-title svg { color: #0F766E; flex-shrink: 0; }

.help-modal-close {
    background: transparent;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748B;
    transition: background .12s, color .12s;
}

.help-modal-close:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.help-modal-close:focus-visible {
    outline: 2px solid #0F766E;
    outline-offset: 2px;
}

.help-modal-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
}

@media (max-width: 700px) {
    .help-modal-frame {
        width: 100vw;
        height: 100vh;
        max-width: none;
        border-radius: 0;
    }
}

/* ── Метеорити ───────────────────────────────────────────────── */
.meteors {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.meteor {
    position: absolute;
    top: -80px;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px #fff, 0 0 20px 4px rgba(170,200,255,0.7);
    opacity: 0;
    animation: meteor-fall 6s linear infinite;
    will-change: transform, opacity;
}

/* Опашката — наклонена в посока обратна на движението */
.meteor::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 2px;
    width: 160px;
    height: 2px;
    transform: translateY(-50%) rotate(-35deg);
    transform-origin: 0 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.95) 0%, rgba(170,200,255,0.45) 40%, rgba(255,255,255,0) 100%);
    filter: blur(0.3px);
}

/* Активен период ~50% от цикъла → пада „от време на време" но видимо */
@keyframes meteor-fall {
    0%   { transform: translate3d(0, 0, 0);          opacity: 0; }
    5%   { opacity: 1; }
    45%  { opacity: 1; }
    50%  { transform: translate3d(-900px, 1100px, 0); opacity: 0; }
    100% { transform: translate3d(-900px, 1100px, 0); opacity: 0; }
}

/* Различни метеорити — стартови позиции, продължителност и забавяне (50% по-бавно) */
.meteor:nth-child(1) { left: 75%; animation-duration: 7.5s;  animation-delay: 0.45s; }
.meteor:nth-child(2) { left: 95%; animation-duration: 10.5s; animation-delay: 3s;    }
.meteor:nth-child(3) { left: 60%; animation-duration: 9s;    animation-delay: 6s;    }
.meteor:nth-child(4) { left: 85%; animation-duration: 12s;   animation-delay: 9s;    }
.meteor:nth-child(5) { left: 70%; animation-duration: 9s;    animation-delay: 13.5s; }
.meteor:nth-child(6) { left: 50%; animation-duration: 10.5s; animation-delay: 18s;   }
.meteor:nth-child(7) { left: 90%; animation-duration: 9s;    animation-delay: 22.5s; }

/* По-малки „small" метеорити */
.meteor.small { width: 3px; height: 3px; box-shadow: 0 0 7px 1.5px rgba(255,255,255,0.85); }
.meteor.small::after { width: 110px; height: 1.5px; }

.auth-card-wide {
    max-width: 920px;
}

.auth-card {
    color: #fff;
}

.auth-card h1 {
    margin: 0 0 24px;
    font-weight: 500;
    color: #fff;
    font-size: 28px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.auth-card h2 {
    margin: 24px 0 12px;
    font-weight: 500;
    color: #fff;
    font-size: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 6px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.field {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
}

.field label {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.field input {
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 6px;
    outline: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

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

.field input:focus {
    border-color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.18);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
}

/* Autofill — Chrome/Edge: премахни жълтия фон, остави светъл текст */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px rgba(40,55,90,0.85) inset;
    caret-color: #fff;
}

.field-error {
    color: #ffb4ab;
    font-size: 12px;
    margin-top: 4px;
    min-height: 14px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.field-wide {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .grid-2 { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
}

.auth-error {
    background: rgba(183, 28, 28, 0.35);
    color: #ffd8d4;
    border: 1px solid rgba(255, 180, 171, 0.5);
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.btn-primary, .btn-secondary {
    display: inline-block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: #1976d2;
    color: #fff;
    margin-top: 8px;
}

.btn-primary:hover { background: #1565c0; }

.btn-secondary {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.8);
}

.auth-divider {
    height: 1px;
    background: rgba(255,255,255,0.25);
    margin: 20px 0;
}

.actions {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    justify-content: space-between;
}

.actions .btn-primary, .actions .btn-secondary {
    width: auto;
    padding: 12px 24px;
}
