:root{
    --bg:#000000;
    --card:#1a1a1a;
    --text:#ffffff;
    --muted:#a0a0a0;
    --border:#333333;
    --primary:#B8860B;
    --primary-pressed:#8B6914;
    --ring: 0 0 0 3px rgba(184,134,11,.3);
    --radius:12px;
}

* { box-sizing: border-box; }
html,body { 
    height:100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}
body {
    margin:0;
    padding: 0;
    background:var(--bg);
    color:var(--text);
    font:16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
    overflow-x: hidden;
    width: 100%;
}

/* Loading Modal Styles */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

#vanta-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.loading-content {
    position: relative;
    z-index: 10;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-content {
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.logo-container {
    margin-bottom: 60px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

@keyframes float3d {
    0%, 100% { 
        transform: translateY(0px) rotateX(0deg) rotateY(0deg);
    }
    50% { 
        transform: translateY(-15px) rotateX(5deg) rotateY(5deg);
    }
}

@keyframes rotate3d {
    0%, 100% { 
        transform: perspective(2000px) rotateY(0deg) rotateX(0deg);
    }
    25% { 
        transform: perspective(2000px) rotateY(8deg) rotateX(3deg);
    }
    50% { 
        transform: perspective(2000px) rotateY(0deg) rotateX(0deg);
    }
    75% { 
        transform: perspective(2000px) rotateY(-8deg) rotateX(-3deg);
    }
}

.m-shadow {
    filter: blur(8px);
    z-index: -1;
}

.m-path {
    position: relative;
    z-index: 1;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotateY(0deg); }
    50% { transform: translateY(-10px) rotateY(5deg); }
}

@keyframes rotate3d {
    0%, 100% { transform: perspective(1000px) rotateY(0deg) rotateX(0deg); }
    25% { transform: perspective(1000px) rotateY(5deg) rotateX(2deg); }
    50% { transform: perspective(1000px) rotateY(0deg) rotateX(0deg); }
    75% { transform: perspective(1000px) rotateY(-5deg) rotateX(-2deg); }
}

.brand-name {
    font-size: 72px;
    font-weight: 900;
    background: linear-gradient(135deg, #654321 0%, #8B6914 25%, #B8860B 50%, #8B6914 75%, #654321 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 
        0 0 30px rgba(139, 105, 20, 0.5),
        0 0 60px rgba(139, 105, 20, 0.3),
        0 0 90px rgba(139, 105, 20, 0.2),
        3px 3px 10px rgba(0, 0, 0, 0.9);
    animation: 
        shimmer 3s ease-in-out infinite,
        fadeInUp 0.8s ease 0.3s forwards;
    margin: 0;
    letter-spacing: 8px;
    opacity: 0;
    filter: drop-shadow(0 0 20px rgba(139, 105, 20, 0.4));
    text-align: center;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-container {
    margin-top: 40px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #B8860B 0%, #CD853F 50%, #B8860B 100%);
    background-size: 200% 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 
        0 0 10px rgba(139, 105, 20, 0.5),
        0 0 20px rgba(205, 133, 63, 0.3),
        0 0 30px rgba(139, 105, 20, 0.2);
    animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.progress-text {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(205, 133, 63, 0.9);
    letter-spacing: 1px;
    opacity: 0;
    animation: fadeIn 0.5s ease 0.5s forwards;
}

/* Hide loading modal when done */
.loading-modal.hidden {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Show auth form when loading is done */
.auth {
    min-height:100dvh;
    display:flex;
    align-items:flex-start;
    justify-content:flex-start;
    padding:48px 20px;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
    overflow-x: hidden;
    width: 100%;
    margin: 0;
}

.auth-card{
    width:min(440px, 100%);
    margin-left:clamp(12px, 12vw, 160px); /* чуть смещаем влево как на макете */
    background:var(--card);
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:0 10px 30px rgba(0,0,0,.5), 0 0 40px rgba(184,134,11,.1);
    padding:28px;
    opacity:0;
    animation:fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to { opacity:1; }
}

.auth-title{
    margin:0 0 2px;
    font-size:28px;
    font-weight:700;
    letter-spacing:.2px;
}

.auth-subtitle{
    margin:0 0 18px;
    color:var(--muted);
    font-size:14px;
}
.auth{
    align-items: center;       /* вертикально по центру */
    justify-content: center;   /* горизонтально по центру */
    padding: 24px 20px;        /* равные отступы, чтобы не сдвигало вниз */
    min-height: 100svh;        /* занять высоту экрана */
}

.auth-card{
    margin: 0 auto;            /* на случай отключённого flex */
}
.form{ display:block; }

.field{ margin-bottom:18px; }
.field label{
    display:block;
    margin:0 0 8px;
    font-size:14px;
    color:var(--text);
}
.field input{
    width:100%;
    height:44px;
    padding:10px 12px;
    border:1px solid var(--border);
    border-radius:10px;
    background:#0f0f0f;
    color:var(--text);
    outline:none;
    transition:border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder{ color:#666666; }
.field input:focus{
    border-color:var(--primary);
    box-shadow:var(--ring);
    background:#151515;
}

.password{
    position:relative;
}
.pw-toggle{
    position:absolute;
    top:50%;
    right:8px;
    transform:translateY(-50%);
    width:36px; height:36px;
    display:grid; place-items:center;
    border:none; background:transparent; padding:0; margin:0;
    border-radius:8px; cursor:pointer;
}
.pw-toggle:focus-visible{ box-shadow:var(--ring); }
.pw-toggle .icon[hidden]{ display:none; }
.icon{ width:20px; height:20px; fill:#6b7280; }

.captcha{
    display:flex; align-items:center; gap:10px;
    margin-bottom:8px;
}
.captcha img{
    display:block;
    height:40px; width:auto;
    border:1px solid var(--border);
    border-radius:8px;
    background:#f8fafc;
    user-select:none;
}

/* Custom Captcha Styles */
.captcha-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.captcha-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #0f0f0f;
    border: 1px solid var(--border);
    border-radius: 10px;
    min-height: 48px;
}

.captcha-question {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
    user-select: none;
    flex: 1;
    text-align: center;
}

.captcha-refresh {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--muted);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.captcha-refresh:hover {
    background: rgba(184, 134, 11, 0.2);
    color: var(--primary);
    transform: rotate(180deg);
}

.captcha-refresh:active {
    transform: rotate(360deg);
}

.captcha-container input[type="number"] {
    width: 100%;
    height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #0f0f0f;
    color: var(--text);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.captcha-container input[type="number"]::placeholder {
    color: #666666;
}

.captcha-container input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
    background: #151515;
}

.captcha-container input[type="number"]::-webkit-inner-spin-button,
.captcha-container input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    height: 20px;
}
.link{
    background:none; border:none; color:var(--primary);
    padding:0 4px; height:32px;
    cursor:pointer; font-weight:600;
}
.link:hover{ text-decoration:underline; }
.link:focus-visible{ box-shadow:var(--ring); border-radius:8px; }

.error{
    display:block;
    min-height:16px;
    margin-top:6px;
    font-size:12px;
    color:#ff6b6b;
    visibility:hidden;
}
.field[aria-invalid="true"] .error{ visibility:visible; }

.error-message{
    display:none;
    margin-bottom:16px;
    padding:12px 16px;
    background:#2a1a1a;
    border:1px solid #ff6b6b;
    border-radius:8px;
    color:#ff6b6b;
    font-size:14px;
    font-weight:500;
    line-height:1.4;
}

.btn{
    width:100%;
    height:46px;
    border:none; border-radius:10px;
    background:var(--primary);
    color:#fff; font-weight:700;
    cursor:pointer;
    transition:transform .04s ease, background .15s ease, opacity .15s ease;
}
.btn:hover{ background:var(--primary-pressed); }
.btn:active{ transform:translateY(1px); }
.btn[disabled]{ opacity:.6; cursor:default; }

.noscript{
    margin-top:14px;
    padding:10px 12px;
    background:#2a241a;
    border:1px solid #B8860B;
    color:#B8860B;
    border-radius:10px;
    font-size:14px;
}

/* Mobile fine-tuning */
@media (max-width:520px){
    .auth { padding:24px 12px; }
    .auth-card { margin-left:auto; margin-right:auto; }
}
