/* ==========================================================================
   std::cpp — authentication (login / register)
   ========================================================================== */

.auth-page {
    min-height: 100vh;
    padding: 22px;
    background:
        radial-gradient(ellipse 46% 44% at 12% 10%, rgba(37, 99, 235, 0.11), transparent 70%),
        radial-gradient(ellipse 40% 40% at 88% 6%, rgba(6, 182, 212, 0.1), transparent 72%),
        radial-gradient(ellipse 46% 40% at 58% 100%, rgba(124, 58, 237, 0.07), transparent 72%);
}

.auth-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
    width: min(1180px, 100%);
    min-height: calc(100vh - 44px);
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.52);
    box-shadow: 0 50px 110px -58px rgba(30, 64, 175, 0.45), inset 0 0 0 1px rgba(37, 99, 235, 0.035);
    overflow: hidden;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

/* -------------------------------------------------------------- brand side */

.auth-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 42px 52px 30px;
    background:
        radial-gradient(ellipse 60% 50% at 18% 8%, rgba(37, 99, 235, 0.14), transparent 68%),
        radial-gradient(ellipse 50% 42% at 88% 88%, rgba(6, 182, 212, 0.13), transparent 70%),
        linear-gradient(150deg, #f2f7ff 0%, #e9f2ff 48%, #eefaff 100%);
    border-right: 1px solid rgba(37, 99, 235, 0.09);
    overflow: hidden;
}

.auth-brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.06) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse 100% 80% at 20% 0%, #000 20%, transparent 100%);
    mask-image: radial-gradient(ellipse 100% 80% at 20% 0%, #000 20%, transparent 100%);
    pointer-events: none;
}

.auth-brand-panel::after {
    content: "std::";
    position: absolute;
    right: -24px;
    bottom: -38px;
    color: rgba(37, 99, 235, 0.045);
    font-family: var(--mono);
    font-size: 190px;
    font-weight: 700;
    letter-spacing: -0.08em;
    line-height: 1;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

.auth-brand-panel .brand {
    position: relative;
    z-index: 1;
    align-self: flex-start;
    animation: auth-in 0.7s var(--ease) both;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    max-width: 470px;
    padding: 40px 0;
}

.auth-brand-content .eyebrow {
    animation: auth-in 0.7s 0.06s var(--ease) both;
}

.auth-brand-content h1 {
    margin: 18px 0 16px;
    color: var(--ink);
    font-size: clamp(34px, 3.5vw, 46px);
    font-weight: 760;
    line-height: 1.2;
    letter-spacing: -0.045em;
    animation: auth-in 0.75s 0.12s var(--ease) both;
}

.auth-brand-content h1 .grad-text {
    background: linear-gradient(100deg, #2563eb 10%, #06b6d4 52%, #7c3aed 94%);
    background-size: 180% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: auth-gradient 7s ease-in-out infinite;
}

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

.auth-brand-content > p {
    max-width: 410px;
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.85;
    animation: auth-in 0.75s 0.18s var(--ease) both;
}

.auth-brand-content > p code {
    padding: 2px 6px;
    border-radius: 5px;
    color: var(--blue);
    background: rgba(37, 99, 235, 0.07);
    font-family: var(--mono);
    font-size: 0.9em;
}

.auth-terminal {
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    background: linear-gradient(150deg, #0b162b, #0a1427);
    box-shadow: 0 30px 60px -34px rgba(8, 20, 40, 0.6), inset 0 0 60px rgba(37, 99, 235, 0.05);
    overflow: hidden;
    animation: auth-in 0.85s 0.24s var(--ease) both;
}

.auth-term-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 13px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(255, 255, 255, 0.025);
}

.auth-term-bar .code-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #334155;
}

.auth-term-bar .code-dot:nth-child(1) { background: #f87171; }
.auth-term-bar .code-dot:nth-child(2) { background: #fbbf24; }
.auth-term-bar .code-dot:nth-child(3) { background: #34d399; }

.auth-term-bar span:last-child {
    margin-left: auto;
    color: #526580;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.06em;
}

.auth-terminal pre {
    margin: 0;
    padding: 16px 18px 18px;
    color: #9fb2ca;
    font-family: var(--mono);
    font-size: 10.8px;
    line-height: 2;
    white-space: pre-wrap;
}

.auth-terminal .prompt {
    color: #34d399;
}

.auth-terminal .dim {
    color: #526580;
}

.auth-terminal .ok {
    color: #34d399;
}

.auth-terminal .str {
    color: #fcd34d;
}

.auth-terminal .cursor {
    display: inline-block;
    width: 6px;
    height: 12px;
    margin-left: 2px;
    vertical-align: -1px;
    background: #34d399;
    animation: caret-blink 1.05s steps(1) infinite;
}

.auth-features {
    display: flex;
    flex-wrap: wrap;
    gap: 9px 20px;
    margin-top: 22px;
    animation: auth-in 0.9s 0.3s var(--ease) both;
}

.auth-features span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.03em;
}

.auth-features span::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 2px;
    background: var(--cyan);
    transform: rotate(45deg);
}

.auth-copyright {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--muted-2);
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.04em;
}

@keyframes auth-in {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- form side */

.auth-form-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px 46px;
    background:
        radial-gradient(ellipse 70% 50% at 90% 0%, rgba(37, 99, 235, 0.04), transparent 70%),
        rgba(255, 255, 255, 0.62);
}

.auth-card {
    width: min(100%, 392px);
    animation: auth-card-in 0.75s 0.1s var(--ease) both;
}

@keyframes auth-card-in {
    from { opacity: 0; transform: translateY(22px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

.auth-mobile-brand {
    display: none;
    margin-bottom: 30px;
}

.auth-head {
    margin-bottom: 26px;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    color: var(--muted-2);
    font-family: var(--mono);
    font-size: 10px;
}

.auth-back:hover {
    color: var(--blue);
}

.auth-head h2 {
    margin: 12px 0 8px;
    color: var(--ink);
    font-size: 30px;
    font-weight: 730;
    line-height: 1.2;
    letter-spacing: -0.04em;
}

.auth-head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.field {
    display: block;
    margin-bottom: 16px;
}

.field-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 7px;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 600;
}

.field-label em {
    color: var(--muted-2);
    font-family: var(--mono);
    font-size: 9px;
    font-style: normal;
    font-weight: 400;
    letter-spacing: 0.05em;
}

.field-control {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(248, 250, 255, 0.85);
    transition: border-color 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}

.field-control:focus-within {
    border-color: rgba(37, 99, 235, 0.45);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.07);
}

.field-control > svg {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--muted-2);
    pointer-events: none;
    transition: color 0.2s ease;
}

.field-control:focus-within > svg {
    color: var(--blue);
}

.field-control input {
    width: 100%;
    height: 46px;
    padding: 0 44px 0 42px;
    border: 0;
    outline: none;
    color: var(--ink-2);
    background: transparent;
    font-size: 13.5px;
}

.field-control input::placeholder {
    color: var(--muted-2);
}

.field-control input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: var(--ink-2);
}

.pwd-toggle {
    position: absolute;
    right: 7px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--muted-2);
    background: transparent;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.pwd-toggle:hover {
    color: var(--blue);
    background: rgba(37, 99, 235, 0.06);
}

.pwd-toggle svg {
    width: 16px;
    height: 16px;
}

.pwd-toggle .icon-eye-off {
    display: none;
}

.pwd-toggle.is-revealed {
    color: var(--blue);
    background: rgba(37, 99, 235, 0.06);
}

.pwd-toggle.is-revealed .icon-eye {
    display: none;
}

.pwd-toggle.is-revealed .icon-eye-off {
    display: block;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: -1px 0 17px;
}

.form-aside {
    color: var(--muted-2);
    font-size: 9.5px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.check {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.check input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.check .box {
    display: grid;
    place-items: center;
    width: 15px;
    height: 15px;
    flex: none;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.check .box svg {
    width: 9px;
    height: 9px;
    color: #fff;
    opacity: 0;
    transform: scale(0.55);
    transition: opacity 0.18s ease, transform 0.18s var(--ease);
}

.check:hover .box {
    border-color: rgba(37, 99, 235, 0.5);
}

.check input:checked + .box {
    border-color: transparent;
    background: var(--grad);
    box-shadow: 0 4px 10px -5px rgba(37, 99, 235, 0.7);
}

.check input:checked + .box svg {
    opacity: 1;
    transform: none;
}

.check input:focus-visible + .box {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.captcha-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.captcha-row .field-control {
    flex: 1;
    min-width: 0;
}

.captcha-row .field-control input {
    padding-right: 14px;
}

.captcha-image {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 128px;
    min-height: 48px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    flex: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.captcha-image:hover {
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 6px 18px -10px rgba(37, 99, 235, 0.45);
}

.captcha-image img {
    display: block;
    width: 100%;
    height: 46px;
    object-fit: cover;
}

.captcha-image::after {
    content: "↻";
    position: absolute;
    right: 5px;
    bottom: 3px;
    color: rgba(37, 99, 235, 0.65);
    font-family: var(--mono);
    font-size: 10px;
    pointer-events: none;
}

.field-hint {
    margin-top: 6px;
    color: var(--muted-2);
    font-size: 10.5px;
    line-height: 1.6;
}

.field-hint .ok {
    color: var(--success);
}

.field-hint.is-ok {
    color: var(--success);
}

.field-hint.is-bad {
    color: var(--danger);
}

.pwd-meter {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.pwd-meter span {
    height: 3px;
    flex: 1;
    border-radius: 2px;
    background: rgba(37, 99, 235, 0.11);
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.pwd-meter.is-1 span:nth-child(1) {
    background: var(--danger);
    box-shadow: 0 0 8px -1px rgba(239, 68, 68, 0.55);
}

.pwd-meter.is-2 span:nth-child(-n + 2) {
    background: #f59e0b;
    box-shadow: 0 0 8px -1px rgba(245, 158, 11, 0.5);
}

.pwd-meter.is-3 span {
    background: var(--success);
    box-shadow: 0 0 8px -1px rgba(16, 185, 129, 0.55);
}

.form-msg {
    min-height: 20px;
    margin: 4px 0 10px;
    color: var(--danger);
    font-size: 11.5px;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.form-msg.is-visible {
    opacity: 1;
    transform: none;
}

.form-msg.is-success {
    color: var(--success);
}

.auth-submit {
    width: 100%;
    min-height: 50px;
    margin-top: 2px;
    font-size: 14.5px;
}

.auth-submit[disabled] {
    cursor: wait;
    opacity: 0.82;
}

.auth-submit .spinner {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.auth-submit.is-loading .spinner {
    display: inline-block;
}

.auth-submit.is-loading svg {
    display: none;
}

.auth-switch {
    margin-top: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
}

.auth-switch a {
    color: var(--blue);
    font-weight: 600;
}

.auth-switch a:hover {
    color: var(--cyan);
}

.auth-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px dashed rgba(37, 99, 235, 0.12);
    color: var(--muted-2);
    font-size: 10px;
}

.auth-note .mono {
    color: rgba(37, 99, 235, 0.5);
    font-size: 9px;
}

.auth-note .lock {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.auth-note svg {
    width: 11px;
    height: 11px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}

.shake {
    animation: shake 0.4s ease;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1000px) {
    .auth-brand-panel {
        padding: 36px 36px 26px;
    }

    .auth-form-panel {
        padding: 38px 30px;
    }

    .auth-brand-panel::after {
        font-size: 150px;
    }
}

@media (max-width: 860px) {
    .auth-page {
        padding: 14px;
    }

    .auth-shell {
        grid-template-columns: minmax(0, 1fr);
        min-height: calc(100vh - 28px);
        border-radius: 22px;
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-form-panel {
        min-height: calc(100vh - 28px);
        padding: 34px 22px;
    }

    .auth-mobile-brand {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .auth-mobile-brand .back-home {
        color: var(--muted-2);
        font-family: var(--mono);
        font-size: 10px;
    }

    .auth-mobile-brand .back-home:hover {
        color: var(--blue);
    }
}

@media (max-width: 480px) {
    .auth-page {
        padding: 0;
        background: #f8fbff;
    }

    .auth-shell {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .auth-form-panel {
        min-height: 100vh;
        padding: 26px 18px;
        align-items: flex-start;
    }

    .auth-card {
        margin-top: 8vh;
    }

    .auth-head h2 {
        font-size: 27px;
    }

    .captcha-image {
        width: 112px;
    }

    .auth-head .auth-back {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand-content h1 .grad-text {
        animation: none;
    }
}
