:root {
    --ink: #243238;
    --ink-soft: #5d6b72;
    --line: #e3e7ea;
    --bg: #ffffff;
    --bg-soft: #f6f7f8;
    --card: #ffffff;
    --input: #f3f5f6;
    --brand: #9757d7;
    --accent: #ff4d6d;
    --accent-2: #ff7a8f;
    --tab-active-bg: #243238;
    --tab-active-text: #ffffff;
}

html[data-theme="dark"] {
    --ink: #ffffff;
    --ink-soft: #a9b1b7;
    --line: #25292d;
    --bg: #000000;
    --bg-soft: #0f1113;
    --card: #0d0e10;
    --input: #17181a;
    --tab-active-bg: #ffffff;
    --tab-active-text: #000000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--ink);
    transition: background .3s, color .3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ======================= TOP TOOLS ======================= */
.top-tools {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 50;
    display: flex;
    gap: 8px;
}

.tool-btn {
    height: 40px;
    min-width: 40px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all .25s;
}

.tool-btn:hover {
    transform: translateY(-2px);
    border-color: var(--ink-soft);
}

/* ======================= AUTH LAYOUT ======================= */
.auth {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 760px;
}

/* ---------- LEFT VISUAL ---------- */
.auth-visual {
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--line);
    display: flex;
    align-items: flex-end;
    padding: 48px;
}

.visual-grid {
    position: absolute;
    inset: -10%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    transform: rotate(-8deg) scale(1.15);
    opacity: .55;
    animation: drift 40s linear infinite alternate;
}

.visual-grid img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 12px;
    filter: saturate(.8);
}

@keyframes drift {
    from {
        transform: rotate(-8deg) scale(1.15) translateY(0);
    }

    to {
        transform: rotate(-8deg) scale(1.15) translateY(-40px);
    }
}

.auth-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(circle at 15% 25%, rgba(151, 87, 215, .35), transparent 55%),
        linear-gradient(180deg, rgba(0, 0, 0, .35) 0%, rgba(0, 0, 0, .95) 100%);
}

html[data-theme="light"] .auth-visual::before {
    background:
        radial-gradient(circle at 15% 25%, rgba(151, 87, 215, .25), transparent 55%),
        linear-gradient(180deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, .95) 100%);
}

.visual-text {
    position: relative;
    z-index: 2;
    max-width: 460px;
}

.visual-text h2 {
    font-size: clamp(32px, 4vw, 46px);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
}

.visual-text p {
    color: var(--ink-soft);
    font-size: 17px;
    line-height: 1.6;
}

/* ---------- RIGHT FORM ---------- */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
}

.auth-card {
    width: 100%;
    max-width: 410px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    animation: rise .6s ease both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tabs */
.auth-tabs {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--input);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 28px;
}

.auth-tabs .indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    background: var(--tab-active-bg);
    border-radius: 999px;
    transition: transform .35s cubic-bezier(.65, .05, .36, 1);
}

.auth-tabs[data-active="login"] .indicator {
    transform: translateX(0);
}

.auth-tabs[data-active="register"] .indicator {
    transform: translateX(100%);
}

.auth-tab {
    position: relative;
    z-index: 1;
    background: none;
    border: none;
    padding: 10px;
    font-weight: 800;
    font-size: 14px;
    color: var(--ink-soft);
    cursor: pointer;
    transition: color .3s;
}

.auth-tab.active {
    color: var(--tab-active-text);
}

/* Forms */
.auth-form {
    display: none;
    animation: fade .4s ease;
}

.auth-form.active {
    display: block;
}

@keyframes fade {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.auth-form h1 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 8px;
}

.auth-form .sub {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 22px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 8px;
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    width: 100%;
    height: 46px;
    background: var(--input);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 44px 0 14px;
    color: var(--ink);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color .25s, box-shadow .25s;
}

.input-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 77, 109, .15);
}

.input-wrap input.invalid {
    border-color: #e5484d;
}

.toggle-pass {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: none;
    color: var(--ink-soft);
    cursor: pointer;
    border-radius: 8px;
    transition: color .2s;
}

.toggle-pass:hover {
    color: var(--ink);
}

.hint {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 8px;
    line-height: 1.5;
}

.error-msg {
    font-size: 12px;
    color: #e5484d;
    margin-top: 6px;
    display: none;
}

.error-msg.show {
    display: block;
}

/* Password strength */
.strength {
    display: flex;
    gap: 4px;
    margin-top: 10px;
}

.strength span {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--line);
    transition: background .3s;
}

.strength[data-level="1"] span:nth-child(1) {
    background: #e5484d;
}

.strength[data-level="2"] span:nth-child(-n+2) {
    background: #f5a524;
}

.strength[data-level="3"] span:nth-child(-n+3) {
    background: #4cc38a;
}

.strength[data-level="4"] span {
    background: #2fb36f;
}

/* Verification box */
.verify {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    background: var(--input);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 20px;
    cursor: pointer;
    user-select: none;
}

.verify-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.check-box {
    width: 26px;
    height: 26px;
    border: 2px solid var(--ink-soft);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s;
    color: transparent;
}

.verify.loading .check-box {
    border-color: transparent;
    border-top-color: #4cc38a;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.verify.done .check-box {
    background: #2fb36f;
    border-color: #2fb36f;
    color: #fff;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.verify-text {
    font-size: 14px;
    font-weight: 600;
}

.verify-brand {
    text-align: right;
    font-size: 10px;
    color: var(--ink-soft);
    line-height: 1.3;
}

.verify-brand strong {
    display: block;
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--ink);
}

/* Submit */
.btn-submit {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(255, 77, 109, .28);
    transition: transform .25s, box-shadow .25s, opacity .25s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(255, 77, 109, .38);
}

.btn-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.switch-text {
    text-align: center;
    font-size: 14px;
    margin-top: 18px;
}

.switch-text a {
    color: var(--accent);
    font-weight: 800;
    cursor: pointer;
}

.switch-text a:hover {
    text-decoration: underline;
}

.back-site {
    display: block;
    text-align: center;
    margin-top: 22px;
    font-size: 13px;
    color: var(--ink-soft);
    transition: color .2s;
}

.back-site:hover {
    color: var(--ink);
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    font-size: 13px;
}

.row-between a {
    color: var(--accent);
    font-weight: 700;
}

/* ======================= FOOTER ======================= */
.site-footer {
    background: var(--bg-soft);
    border-top: 1px solid var(--line);
    padding: 70px 0 30px;
}

.footer-brand {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 14px;
}

.footer-desc {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.7;
    max-width: 260px;
}

.footer-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 18px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 14px;
}

.footer-links a {
    font-weight: 700;
    font-size: 15px;
    transition: color .2s, padding-left .2s;
}

.footer-links a:hover {
    color: var(--accent);
    padding-left: 4px;
}

.badge-sfw {
    background: rgba(47, 179, 111, .15);
    color: #4cc38a;
    border: 1px solid rgba(47, 179, 111, .4);
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 6px;
    margin-left: 6px;
}

.footer-bottom {
    margin-top: 40px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--ink-soft);
    font-size: 13px;
}

.install-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 36px auto 0;
    padding: 10px 20px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .25s;
}

.install-btn:hover {
    transform: translateY(-2px);
    border-color: var(--ink-soft);
}

/* ======================= RESPONSIVE ======================= */
@media (max-width: 991px) {
    .auth {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 320px;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 30px 24px;
    }

    .auth-panel {
        padding: 40px 16px;
    }

    .top-tools {
        top: 10px;
        right: 10px;
    }
}
