.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,7,4,.68);
    backdrop-filter: saturate(160%) blur(24px);
    -webkit-backdrop-filter: saturate(160%) blur(24px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.auth-modal-overlay.active { display: flex; }

.auth-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 520px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(201,133,26,.25),
        0 40px 100px rgba(0,0,0,.45);
    animation: authModalIn 0.36s cubic-bezier(0.19, 1, 0.22, 1);
}
@keyframes authModalIn {
    from { opacity: 0; transform: scale(0.94) translateY(18px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.auth-header-strip {
    background: linear-gradient(140deg, #d4920f 0%, #c9851a 45%, #9d6514 100%);
    padding: 1.75rem 1.75rem 1.5rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.auth-header-strip::before {
    content: 'M';
    position: absolute;
    right: -1rem;
    bottom: -2rem;
    font-size: 10rem;
    font-weight: 900;
    font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
    color: rgba(0,0,0,.07);
    line-height: 1;
    user-select: none;
    pointer-events: none;
    z-index: 0;
    letter-spacing: -0.06em;
}
.auth-header-strip::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 18px 18px;
    pointer-events: none;
    z-index: 0;
}

.auth-header-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.125rem;
}
.auth-header-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    flex: 1;
    min-width: 0;
}
.auth-header-name {
    font-weight: 900;
    font-size: 1rem;
    letter-spacing: .08em;
    color: #fff;
    line-height: 1;
    margin-bottom: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.auth-header-sub {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,.42);
    letter-spacing: .16em;
    text-transform: uppercase;
    font-family: 'Courier New', 'Courier', monospace;
    line-height: 1;
}
.auth-header-status {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.auth-header-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74,222,128,.7);
    animation: dotPulse 2.4s ease-in-out infinite;
}
@keyframes dotPulse {
    0%,100% { opacity:1; }
    50%      { opacity:.4; }
}
.auth-header-status-text {
    font-size: 9px;
    font-weight: 700;
    color: rgba(74,222,128,.9);
    letter-spacing: .1em;
    font-family: 'Courier New', 'Courier', monospace;
    text-transform: uppercase;
}
.auth-header-divider {
    position: relative;
    z-index: 1;
    height: 1px;
    background: rgba(255,255,255,.18);
    margin-bottom: 1rem;
}
.auth-header-tagline {
    position: relative;
    z-index: 1;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255,255,255,.65);
    line-height: 1.6;
    letter-spacing: .01em;
}

.auth-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    cursor: pointer;
    background: rgba(0,0,0,.15);
    border: 1px solid rgba(0,0,0,.18);
    color: rgba(255,255,255,.65);
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s, color .18s;
    padding: 0;
    line-height: 0;
}
.auth-modal-close:hover { background: rgba(0,0,0,.28); color: #fff; }

.auth-back-btn {
    display: none;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: rgba(201,133,26,.8);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 12px;
    letter-spacing: .04em;
    cursor: pointer;
    padding: 0;
    margin-bottom: .875rem;
    font-family: 'Courier New', 'Courier', monospace;
    text-transform: uppercase;
    transition: color .15s;
}
.auth-back-btn:hover { color: #c9851a; }
.auth-back-btn.visible { display: inline-flex; }
.auth-back-btn svg { display: block; flex-shrink: 0; }
.auth-back-btn span { display: block; line-height: 1; position: relative; top: 0.5px; }

.auth-form-panel {
    background: #ffffff;
    position: relative;
    flex: 1;
}

.auth-modal-header {
    padding: 1.75rem 2rem 1.125rem;
}
.auth-modal-step-label {
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 10px;
    font-weight: 700;
    color: #c9851a;
    letter-spacing: .16em;
    text-transform: uppercase;
    margin-bottom: .625rem;
    display: flex;
    align-items: center;
    gap: 7px;
}
.auth-modal-step-label::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 2px;
    background: #c9851a;
    border-radius: 2px;
    flex-shrink: 0;
}
.auth-modal-title {
    font-family: 'Noto Serif SC', 'STSong', serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.25;
    color: #111;
    margin-bottom: .3rem;
}
.auth-modal-subtitle {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(0,0,0,.38);
    line-height: 1.6;
}

.auth-modal-body {
    border-top: 1px solid rgba(0,0,0,.06);
    padding: 1.5rem 2rem 2rem;
}

.auth-form-group { margin-bottom: 1.125rem; }
.auth-form-label {
    display: block;
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: 6px;
    color: rgba(201,133,26,.75);
    font-family: 'Courier New', 'Courier', monospace;
}
.auth-form-input {
    width: 100%;
    background: #f8f6f2;
    border: 1.5px solid #e8e4dc;
    border-radius: 9px;
    padding: 11px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #111;
    transition: all .18s ease;
    outline: none;
    font-family: inherit;
}
.auth-form-input::placeholder { color: rgba(0,0,0,.2); }
.auth-form-input:focus {
    background: #fff;
    border-color: #c9851a;
    box-shadow: 0 0 0 3px rgba(201,133,26,.12);
}

.auth-btn-primary {
    width: 100%;
    background: #c0392b;
    color: #fff;
    padding: 13px 20px;
    border-radius: 9px;
    border: none;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-top: .75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'Courier New', 'Courier', monospace;
    transition: background .15s, transform .1s, box-shadow .1s;
    box-shadow: 0 4px 16px rgba(192,57,43,.25);
}
.auth-btn-primary::after { content: '→'; font-size: 1rem; opacity: .75; }
.auth-btn-primary:hover  { background: #a93226; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(192,57,43,.35); }
.auth-btn-primary:active { transform: translateY(0); }

.auth-error-message,
.auth-success-message {
    display: none;
    padding: 9px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    margin-bottom: 1rem;
    border-radius: 8px;
    line-height: 1.5;
    border-left: 3px solid;
}
.auth-error-message   { background: rgba(192,57,43,.07); color: #a93226; border-color: #c0392b; }
.auth-success-message { background: rgba(52,199,89,.07); color: #1e7a38; border-color: #34C759; }
.auth-error-message.active,
.auth-success-message.active { display: block; }

.auth-code-inputs {
    display: flex;
    gap: 7px;
    justify-content: space-between;
    margin-bottom: 1.125rem;
}
.auth-code-input {
    width: 100%;
    max-width: 54px;
    height: 56px;
    background: #f8f6f2;
    border: 1.5px solid #e8e4dc;
    border-radius: 9px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: #111;
    transition: all .18s ease;
    outline: none;
    font-family: 'Courier New', 'Courier', monospace;
}
.auth-code-input:focus {
    background: #fff;
    border-color: #c9851a;
    box-shadow: 0 0 0 3px rgba(201,133,26,.12);
}

.auth-btn-text {
    background: none;
    border: none;
    font-size: 0.77rem;
    font-weight: 600;
    color: rgba(0,0,0,.3);
    cursor: pointer;
    transition: color .15s;
    padding: 3px 0;
    font-family: inherit;
}
.auth-btn-text:hover { color: #c9851a; }

.auth-countdown-text {
    font-size: 0.67rem;
    font-weight: 700;
    color: rgba(0,0,0,.28);
    display: block;
    margin-top: 8px;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-family: 'Courier New', 'Courier', monospace;
}
.auth-helper-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(0,0,0,.42);
    margin-bottom: 1.125rem;
    line-height: 1.65;
}

.auth-step-content        { display: none; }
.auth-step-content.active { display: block; }

@media (max-width: 560px) {
    .auth-modal { max-width: 100%; border-radius: 16px; }
    .auth-modal-header { padding: 1.5rem 1.5rem .875rem; }
    .auth-modal-body   { padding: 1.25rem 1.5rem 1.75rem; }
    .auth-code-input   { max-width: 46px; height: 50px; font-size: 1.2rem; }
}
