:root {
    --bg: #030303;
    --surface: #101010;
    --surface-2: #161616;
    --red: #e10600;
    --red-bright: #ff2a2a;
    --red-dark: #8a0400;
    --red-glow: rgba(225, 6, 0, 0.38);
    --border: rgba(225, 6, 0, 0.28);
    --border-hover: rgba(255, 42, 42, 0.65);
    --text: #f4f4f4;
    --text-muted: #8d8d8d;
    --success: #4ade80;
    --error: #f87171;
}

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

html {
    min-height: 100%;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: Outfit, system-ui, sans-serif;
    background:
        radial-gradient(ellipse 55% 45% at 12% 18%, rgba(225, 6, 0, 0.2) 0%, transparent 55%),
        radial-gradient(ellipse 40% 35% at 88% 82%, rgba(138, 4, 0, 0.16) 0%, transparent 60%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}

img, svg, video, canvas {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

input, textarea, select, [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

.bg-grid,
.bg-glow,
.bg-slash {
    position: fixed;
    pointer-events: none;
    z-index: 0;
}

.bg-grid {
    inset: 0;
    background-image:
        linear-gradient(rgba(225, 6, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(225, 6, 0, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
}

.bg-glow { display: none; }

.bg-slash {
    width: 38vw;
    height: 120vh;
    top: -16vh;
    left: -6vw;
    background: linear-gradient(180deg, rgba(225, 6, 0, 0.14), transparent 72%);
    transform: rotate(-18deg);
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 40;
    background: linear-gradient(90deg, transparent, var(--red) 18%, var(--red-bright) 50%, var(--red) 82%, transparent);
}

.shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px 72px 56px;
}

.brand-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    color: var(--red-bright);
    margin-bottom: 22px;
}

.brand-kicker::before {
    content: "";
    width: 28px;
    height: 2px;
    background: var(--red);
}

.onion-logo {
    width: 78px;
    height: 78px;
    margin-bottom: 18px;
}

.wordmark {
    display: inline-block;
    margin: 10px 0 18px;
    line-height: 0;
    overflow: visible;
}
.wordmark img,
.wordmark .brand-mark {
    display: block;
    width: min(300px, 100%);
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}
.brand-mark {
    display: block;
    width: min(300px, 100%);
    height: auto;
    overflow: visible;
    user-select: none;
    pointer-events: none;
}

.brand-name {
    font-family: Syne, Outfit, sans-serif;
    font-size: clamp(36px, 4.4vw, 64px);
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 0.95;
    color: #ffb3b3;
    background: linear-gradient(180deg, #ffffff 0%, #ffb3b3 55%, #e10600 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.brand-copy {
    max-width: 420px;
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 36px;
}

.feat {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #d6d6d6;
}

.feat i {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--red-bright);
    background: rgba(225, 6, 0, 0.08);
    font-size: 12px;
}

.brand-sub {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    width: fit-content;
    background: rgba(0, 0, 0, 0.35);
}

.brand-sub i { color: var(--red-bright); }

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
}

.card {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: #101010;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 34px 30px 26px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), 0 0 32px rgba(225, 6, 0, 0.1);
}

.card::before,
.card::after,
.card-corner-tr,
.card-corner-bl {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--red);
    pointer-events: none;
}

.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; content: ""; }
.card-corner-tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.card-corner-bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }

.card-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 12px;
}

.card-title {
    font-family: Syne, Outfit, sans-serif;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.card-title span { color: var(--red-bright); }

.card-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--red-bright);
    border: 1px solid var(--border);
    padding: 4px 8px;
    white-space: nowrap;
}

.mobile-brand {
    display: none;
    width: 100%;
    justify-content: center;
    align-items: center;
    margin: 12px 0 16px;
    overflow: visible;
}

.mobile-brand .wordmark {
    display: flex;
    margin: 0 auto;
    width: min(280px, 92%);
    justify-content: center;
}
.mobile-brand .wordmark img,
.mobile-brand .wordmark .brand-mark {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}
.mobile-brand .brand-name { font-size: 22px; margin: 0; }

.form-group { margin-bottom: 0; }

.card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.form-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--red-bright);
    text-transform: uppercase;
    letter-spacing: 1.4px;
    margin-bottom: 7px;
}

.input-wrap { position: relative; }

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

.form-input {
    width: 100%;
    background: #0b0b0b;
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 12px 42px 12px 40px;
    color: var(--text);
    font-size: 16px;
    font-family: Outfit, sans-serif;
    transition: border-color 0.2s;
}

.form-input::placeholder { color: #666; }

.form-input:focus {
    outline: none;
    border-color: var(--red);
}

.pw-mask {
    -webkit-text-security: disc;
}

.input-wrap:focus-within .input-icon { color: var(--red-bright); }

.pw-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
}

.pw-toggle:hover { color: var(--red-bright); }

.captcha-box {
    background: #0b0b0b;
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 12px;
    margin: 0;
}

.captcha-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.captcha-header i { color: var(--red-bright); font-size: 12px; }

.captcha-header span {
    font-size: 10px;
    font-weight: 700;
    color: var(--red-bright);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.captcha-img-wrap {
    flex: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #050505;
    height: 64px;
    min-width: 0;
}

.captcha-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    image-rendering: auto;
}

.captcha-refresh {
    width: 48px;
    height: 64px;
    border-radius: 2px;
    background: var(--red);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.captcha-refresh:hover { background: var(--red-bright); }

.captcha-input {
    width: 100%;
    background: #050505;
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 12px 14px;
    color: var(--red-bright);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 10px;
    font-family: Outfit, monospace;
}

.captcha-input::placeholder {
    color: rgba(225, 6, 0, 0.35);
    letter-spacing: 6px;
    font-size: 13px;
}

.captcha-input:focus {
    outline: none;
    border-color: var(--red);
}

.submit-btn {
    width: 100%;
    min-height: 48px;
    background: var(--red);
    border: none;
    border-radius: 2px;
    padding: 14px;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    font-family: Outfit, sans-serif;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.submit-btn:hover { background: var(--red-bright); }
.submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-link {
    text-align: center;
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-link a {
    color: var(--red-bright);
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover { color: #fff; text-decoration: underline; }

.footer-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.footer-btn {
    min-height: 44px;
    padding: 10px 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    font-family: Outfit, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.footer-btn:hover {
    background: rgba(225, 6, 0, 0.12);
    border-color: var(--border-hover);
    color: var(--red-bright);
}

.footer-btn.onion-btn {
    border-color: rgba(225, 6, 0, 0.5);
    color: var(--red-bright);
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-head-left svg { width: 28px; height: 28px; }

.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-subtitle { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.modal-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.modal-body { padding: 20px 22px 24px; }

.onion-link-box {
    background: #050505;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px 14px;
    margin-bottom: 20px;
}

.onion-link-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--red-bright);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.onion-link-row { display: flex; flex-direction: column; gap: 8px; }

.onion-link-text {
    font-size: 10.5px;
    color: #ffb3b3;
    font-family: ui-monospace, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.copy-btn {
    align-self: flex-start;
    background: var(--red);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    font-family: Outfit, sans-serif;
    padding: 10px 14px;
    min-height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    z-index: 2;
    pointer-events: auto;
}
.copy-btn i, .copy-btn span { pointer-events: none; }

.copy-btn:hover { background: var(--red-bright); }
.copy-btn.copied { background: #16a34a; }

.tutorial-section { margin-bottom: 18px; }

.tutorial-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--red-bright);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.step {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.step-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.step-text { font-size: 12px; color: var(--text); line-height: 1.5; }
.step-text a { color: var(--red-bright); text-decoration: none; font-weight: 600; }
.step-text a:hover { color: #fff; text-decoration: underline; }
.step-text strong { color: #ffb3b3; }

.platform-tabs { display: flex; gap: 6px; margin-bottom: 14px; }

.ptab {
    flex: 1;
    min-height: 40px;
    padding: 8px 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    font-family: Outfit, sans-serif;
    cursor: pointer;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ptab.active {
    background: rgba(225, 6, 0, 0.18);
    border-color: var(--red);
    color: var(--red-bright);
}

.platform-content { display: none; }
.platform-content.active { display: block; }

.info-note {
    background: rgba(225, 6, 0, 0.08);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 14px;
}

.info-note i { color: var(--red-bright); margin-right: 5px; }

.toast {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 300px;
    max-width: 90vw;
    animation: toast-in 0.28s ease;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-16px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast-inner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.success .toast-inner { border-color: rgba(74, 222, 128, 0.5); }
.toast.error .toast-inner { border-color: rgba(248, 113, 113, 0.5); }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--error); }
.toast-inner span { flex: 1; font-size: 13px; font-weight: 500; }

.toast-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 6px;
    font-size: 12px;
}

button,
a,
input {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(225, 6, 0, 0.18);
}

@media (max-width: 980px) {
    .bg-grid,
    .bg-slash { display: none; }

    .shell {
        grid-template-columns: 1fr;
        min-height: 100dvh;
    }

    .brand-panel { display: none; }
    .mobile-brand { display: flex; }

    .auth-panel {
        min-height: 100dvh;
        height: 100%;
        padding: calc(10px + env(safe-area-inset-top)) 12px calc(10px + env(safe-area-inset-bottom));
        align-items: stretch;
        justify-content: stretch;
    }

    .card {
        max-width: none;
        width: 100%;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        padding: 18px 14px 14px;
        box-shadow: none;
    }

    .form-row { grid-template-columns: 1fr; }

    .card form { flex: 0 0 auto; display: flex; flex-direction: column; gap: 12px; }

    .footer-btns {
        margin-top: 16px;
        padding-top: 14px;
        gap: 8px;
    }

    .card-title { font-size: 24px; }
}

@media (max-width: 480px) {
    .card-title { font-size: 22px; }
    .footer-btn { font-size: 9px; padding: 9px 4px; }
    .modal-head { padding: 16px 16px 12px; }
    .modal-body { padding: 16px 16px 20px; }
    .toast { min-width: 0; width: calc(100% - 24px); }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
